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
           
 
Constructor Summary
OrderOfferProcessorImpl()
           
 
Method Summary
 boolean applyAllOrderOffers(java.util.List<CandidateOrderOffer> orderOffers, Order 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(CandidateOrderOffer orderOffer)
          Private method used by applyAllOrderOffers to create an OrderAdjustment from a CandidateOrderOffer and associates the OrderAdjustment to the Order.
protected  boolean compareAndAdjustOrderAndItemOffers(Order order, boolean orderOffersApplied)
           
 void compileOrderTotal(Order order)
           
 boolean couldOfferApplyToOrder(Offer offer, Order 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, Order order, FulfillmentGroup 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, Order order, OrderItem 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, Order order, OrderItem discreteOrderItem, FulfillmentGroup 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  CandidateOrderOffer createCandidateOrderOffer(Order order, java.util.List<CandidateOrderOffer> qualifiedOrderOffers, Offer offer)
           
 void filterOrderLevelOffer(Order order, java.util.List<CandidateOrderOffer> qualifiedOrderOffers, java.util.List<DiscreteOrderItem> discreteOrderItems, Offer offer)
           
 void gatherCart(Order order)
           
 java.util.List<OrderItem> getAllSplitItems(Order order)
           
 CartService getCartService()
           
 FulfillmentGroupItemDao getFulfillmentGroupItemDao()
           
 OfferDao getOfferDao()
           
 OrderItemService getOrderItemService()
           
 void initializeSplitItems(Order order, java.util.List<OrderItem> items)
           
protected  void mergeSplitItems(Order order)
           
 java.util.List<CandidateOrderOffer> removeTrailingNotCombinableOrderOffers(java.util.List<CandidateOrderOffer> candidateOffers)
           
 void setCartService(CartService cartService)
           
 void setFulfillmentGroupItemDao(FulfillmentGroupItemDao fulfillmentGroupItemDao)
           
 void setOfferDao(OfferDao offerDao)
           
 void setOrderItemService(OrderItemService orderItemService)
           
 
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
Constructor Detail

OrderOfferProcessorImpl

public OrderOfferProcessorImpl()
Method Detail

filterOrderLevelOffer

public void filterOrderLevelOffer(Order order,
                                  java.util.List<CandidateOrderOffer> qualifiedOrderOffers,
                                  java.util.List<DiscreteOrderItem> discreteOrderItems,
                                  Offer offer)
Specified by:
filterOrderLevelOffer in interface OrderOfferProcessor

couldOfferApplyToOrder

public boolean couldOfferApplyToOrder(Offer offer,
                                      Order 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,
                                         Order order,
                                         OrderItem 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,
                                         Order order,
                                         FulfillmentGroup 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,
                                         Order order,
                                         OrderItem discreteOrderItem,
                                         FulfillmentGroup 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 CandidateOrderOffer createCandidateOrderOffer(Order order,
                                                        java.util.List<CandidateOrderOffer> qualifiedOrderOffers,
                                                        Offer offer)

removeTrailingNotCombinableOrderOffers

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

applyAllOrderOffers

public boolean applyAllOrderOffers(java.util.List<CandidateOrderOffer> orderOffers,
                                   Order 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

getAllSplitItems

public java.util.List<OrderItem> getAllSplitItems(Order order)
Specified by:
getAllSplitItems in interface OrderOfferProcessor

initializeSplitItems

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

compareAndAdjustOrderAndItemOffers

protected boolean compareAndAdjustOrderAndItemOffers(Order order,
                                                     boolean orderOffersApplied)

gatherCart

public void gatherCart(Order order)
Specified by:
gatherCart in interface OrderOfferProcessor

applyOrderOffer

protected void applyOrderOffer(CandidateOrderOffer 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(Order order)

compileOrderTotal

public void compileOrderTotal(Order 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


Copyright © 2011. All Rights Reserved.