org.broadleafcommerce.core.offer.service.processor
Class OrderOfferProcessorImpl

java.lang.Object
  extended by org.broadleafcommerce.core.offer.service.processor.AbstractBaseProcessor
      extended by org.broadleafcommerce.core.offer.service.processor.OrderOfferProcessorImpl
All Implemented Interfaces:
BaseProcessor, OrderOfferProcessor
Direct Known Subclasses:
FulfillmentGroupOfferProcessorImpl, ItemOfferProcessorImpl

@Service(value="blOrderOfferProcessor")
public class OrderOfferProcessorImpl
extends AbstractBaseProcessor
implements OrderOfferProcessor

Author:
jfischer

Field Summary
protected  CartService cartService
           
protected  FulfillmentGroupItemDao fulfillmentGroupItemDao
           
protected  OfferDao offerDao
           
protected  OrderItemService orderItemService
           
protected  PromotableItemFactory promotableItemFactory
           
 
Constructor Summary
OrderOfferProcessorImpl()
           
 
Method Summary
 boolean applyAllOrderOffers(java.util.List<PromotableCandidateOrderOffer> orderOffers, PromotableOrder order)
          Private method that takes a list of sorted CandidateOrderOffers and determines if each offer can be applied based on the restrictions (stackable and/or combinable) on that offer.
protected  void applyOrderOffer(PromotableOrder order, PromotableCandidateOrderOffer orderOffer)
          Private method used by applyAllOrderOffers to create an OrderAdjustment from a CandidateOrderOffer and associates the OrderAdjustment to the Order.
protected  boolean compareAndAdjustOrderAndItemOffers(PromotableOrder order, boolean orderOffersApplied)
           
 void compileOrderTotal(PromotableOrder order)
           
 boolean couldOfferApplyToOrder(Offer offer, PromotableOrder order)
          Private method which executes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.
protected  boolean couldOfferApplyToOrder(Offer offer, PromotableOrder order, PromotableFulfillmentGroup fulfillmentGroup)
          Private method which executes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.
protected  boolean couldOfferApplyToOrder(Offer offer, PromotableOrder order, PromotableOrderItem discreteOrderItem)
          Private method which executes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.
protected  boolean couldOfferApplyToOrder(Offer offer, PromotableOrder order, PromotableOrderItem discreteOrderItem, PromotableFulfillmentGroup fulfillmentGroup)
          Private method which executes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.
protected  PromotableCandidateOrderOffer createCandidateOrderOffer(PromotableOrder order, java.util.List<PromotableCandidateOrderOffer> qualifiedOrderOffers, Offer offer)
           
 void filterOrderLevelOffer(PromotableOrder order, java.util.List<PromotableCandidateOrderOffer> qualifiedOrderOffers, Offer offer)
           
 void gatherCart(PromotableOrder promotableOrder)
           
 CartService getCartService()
           
 FulfillmentGroupItemDao getFulfillmentGroupItemDao()
           
 OfferDao getOfferDao()
           
 OrderItemService getOrderItemService()
           
 PromotableItemFactory getPromotableItemFactory()
           
 void initializeSplitItems(PromotableOrder order, java.util.List<PromotableOrderItem> items)
           
protected  void mergeSplitItems(PromotableOrder order)
           
 java.util.List<PromotableCandidateOrderOffer> removeTrailingNotCombinableOrderOffers(java.util.List<PromotableCandidateOrderOffer> candidateOffers)
           
 void setCartService(CartService cartService)
           
 void setFulfillmentGroupItemDao(FulfillmentGroupItemDao fulfillmentGroupItemDao)
           
 void setOfferDao(OfferDao offerDao)
           
 void setOrderItemService(OrderItemService orderItemService)
           
 void setPromotableItemFactory(PromotableItemFactory promotableItemFactory)
           
 
Methods inherited from class org.broadleafcommerce.core.offer.service.processor.AbstractBaseProcessor
checkForItemRequirements, clearAllNonFinalizedQuantities, clearOffersandAdjustments, couldOfferApplyToCustomer, couldOfferApplyToOrderItems, couldOrderItemMeetOfferRequirement, executeExpression, filterOffers, finalizeQuantities, removeInvalidCustomerOffers, removeOutOfDateOffers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.broadleafcommerce.core.offer.service.processor.OrderOfferProcessor
executeExpression
 
Methods inherited from interface org.broadleafcommerce.core.offer.service.processor.BaseProcessor
clearOffersandAdjustments, filterOffers
 

Field Detail

offerDao

protected OfferDao offerDao

cartService

protected CartService cartService

orderItemService

protected OrderItemService orderItemService

fulfillmentGroupItemDao

protected FulfillmentGroupItemDao fulfillmentGroupItemDao

promotableItemFactory

protected PromotableItemFactory promotableItemFactory
Constructor Detail

OrderOfferProcessorImpl

public OrderOfferProcessorImpl()
Method Detail

filterOrderLevelOffer

public void filterOrderLevelOffer(PromotableOrder order,
                                  java.util.List<PromotableCandidateOrderOffer> qualifiedOrderOffers,
                                  Offer offer)
Specified by:
filterOrderLevelOffer in interface OrderOfferProcessor

couldOfferApplyToOrder

public boolean couldOfferApplyToOrder(Offer offer,
                                      PromotableOrder order)
Private method which executes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.

Specified by:
couldOfferApplyToOrder in interface OrderOfferProcessor
Parameters:
offer -
order -
Returns:
true if offer can be applied, otherwise false

couldOfferApplyToOrder

protected boolean couldOfferApplyToOrder(Offer offer,
                                         PromotableOrder order,
                                         PromotableOrderItem discreteOrderItem)
Private method which executes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.

Parameters:
offer -
order -
discreteOrderItem -
Returns:
true if offer can be applied, otherwise false

couldOfferApplyToOrder

protected boolean couldOfferApplyToOrder(Offer offer,
                                         PromotableOrder order,
                                         PromotableFulfillmentGroup fulfillmentGroup)
Private method which executes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.

Parameters:
offer -
order -
fulfillmentGroup -
Returns:
true if offer can be applied, otherwise false

couldOfferApplyToOrder

protected boolean couldOfferApplyToOrder(Offer offer,
                                         PromotableOrder order,
                                         PromotableOrderItem discreteOrderItem,
                                         PromotableFulfillmentGroup fulfillmentGroup)
Private method which executes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.

Parameters:
offer -
order -
discreteOrderItem -
fulfillmentGroup -
Returns:
true if offer can be applied, otherwise false

createCandidateOrderOffer

protected PromotableCandidateOrderOffer createCandidateOrderOffer(PromotableOrder order,
                                                                  java.util.List<PromotableCandidateOrderOffer> qualifiedOrderOffers,
                                                                  Offer offer)

removeTrailingNotCombinableOrderOffers

public java.util.List<PromotableCandidateOrderOffer> removeTrailingNotCombinableOrderOffers(java.util.List<PromotableCandidateOrderOffer> candidateOffers)
Specified by:
removeTrailingNotCombinableOrderOffers in interface OrderOfferProcessor

applyAllOrderOffers

public boolean applyAllOrderOffers(java.util.List<PromotableCandidateOrderOffer> orderOffers,
                                   PromotableOrder order)
Private method that takes a list of sorted CandidateOrderOffers and determines if each offer can be applied based on the restrictions (stackable and/or combinable) on that offer. OrderAdjustments are create on the Order for each applied CandidateOrderOffer. An offer with stackable equals false cannot be applied to an Order that already contains an OrderAdjustment. An offer with combinable equals false cannot be applied to the Order if the Order already contains an OrderAdjustment.

Specified by:
applyAllOrderOffers in interface OrderOfferProcessor
Parameters:
orderOffers - a sorted list of CandidateOrderOffer
order - the Order to apply the CandidateOrderOffers
Returns:
true if order offer applied; otherwise false

initializeSplitItems

public void initializeSplitItems(PromotableOrder order,
                                 java.util.List<PromotableOrderItem> items)
Specified by:
initializeSplitItems in interface OrderOfferProcessor

compareAndAdjustOrderAndItemOffers

protected boolean compareAndAdjustOrderAndItemOffers(PromotableOrder order,
                                                     boolean orderOffersApplied)

gatherCart

public void gatherCart(PromotableOrder promotableOrder)
Specified by:
gatherCart in interface OrderOfferProcessor

applyOrderOffer

protected void applyOrderOffer(PromotableOrder order,
                               PromotableCandidateOrderOffer orderOffer)
Private method used by applyAllOrderOffers to create an OrderAdjustment from a CandidateOrderOffer and associates the OrderAdjustment to the Order.

Parameters:
orderOffer - a CandidateOrderOffer to apply to an Order

mergeSplitItems

protected void mergeSplitItems(PromotableOrder order)

compileOrderTotal

public void compileOrderTotal(PromotableOrder order)
Specified by:
compileOrderTotal in interface OrderOfferProcessor

getOfferDao

public OfferDao getOfferDao()
Specified by:
getOfferDao in interface OrderOfferProcessor

setOfferDao

public void setOfferDao(OfferDao offerDao)
Specified by:
setOfferDao in interface OrderOfferProcessor

getCartService

public CartService getCartService()
Specified by:
getCartService in interface OrderOfferProcessor

setCartService

public void setCartService(CartService cartService)
Specified by:
setCartService in interface OrderOfferProcessor

getOrderItemService

public OrderItemService getOrderItemService()
Specified by:
getOrderItemService in interface OrderOfferProcessor

setOrderItemService

public void setOrderItemService(OrderItemService orderItemService)
Specified by:
setOrderItemService in interface OrderOfferProcessor

getFulfillmentGroupItemDao

public FulfillmentGroupItemDao getFulfillmentGroupItemDao()
Specified by:
getFulfillmentGroupItemDao in interface OrderOfferProcessor

setFulfillmentGroupItemDao

public void setFulfillmentGroupItemDao(FulfillmentGroupItemDao fulfillmentGroupItemDao)
Specified by:
setFulfillmentGroupItemDao in interface OrderOfferProcessor

getPromotableItemFactory

public PromotableItemFactory getPromotableItemFactory()
Specified by:
getPromotableItemFactory in interface OrderOfferProcessor

setPromotableItemFactory

public void setPromotableItemFactory(PromotableItemFactory promotableItemFactory)
Specified by:
setPromotableItemFactory in interface OrderOfferProcessor


Copyright © 2012. All Rights Reserved.