Search in sources :

Example 1 with PostUpdateOrderExtensionHandler

use of org.broadleafcommerce.core.order.extension.PostUpdateOrderExtensionHandler in project BroadleafCommerce by BroadleafCommerce.

the class MergeOrdersByEmailPostRegistrationObserver method processRegistrationEvent.

@Override
public void processRegistrationEvent(Customer customer) {
    List<Order> orders = orderService.findOrdersByEmail(customer.getEmailAddress());
    List<Order> updOrders = new ArrayList<>();
    for (Order o : orders) {
        if (!o.getCustomer().isRegistered()) {
            o.setCustomer(customer);
            updOrders.add(o);
        }
    }
    List<PostUpdateOrderExtensionHandler> handlers = extensionManager.getHandlers();
    for (PostUpdateOrderExtensionHandler h : handlers) {
        ExtensionResultStatusType status = h.postUpdateAll(updOrders);
        if (!extensionManager.shouldContinue(status, null, null, null)) {
            break;
        }
    }
}
Also used : Order(org.broadleafcommerce.core.order.domain.Order) ArrayList(java.util.ArrayList) ExtensionResultStatusType(org.broadleafcommerce.common.extension.ExtensionResultStatusType) PostUpdateOrderExtensionHandler(org.broadleafcommerce.core.order.extension.PostUpdateOrderExtensionHandler)

Aggregations

ArrayList (java.util.ArrayList)1 ExtensionResultStatusType (org.broadleafcommerce.common.extension.ExtensionResultStatusType)1 Order (org.broadleafcommerce.core.order.domain.Order)1 PostUpdateOrderExtensionHandler (org.broadleafcommerce.core.order.extension.PostUpdateOrderExtensionHandler)1