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

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

@Service(value="blItemOfferProcessor")
public class ItemOfferProcessorImpl
extends OrderOfferProcessorImpl
implements ItemOfferProcessor

Filter and apply order item offers.

Author:
jfischer

Field Summary
 
Fields inherited from class org.broadleafcommerce.core.offer.service.processor.OrderOfferProcessorImpl
cartService, fulfillmentGroupItemDao, offerDao, orderItemService, promotableItemFactory
 
Constructor Summary
ItemOfferProcessorImpl()
           
 
Method Summary
protected  int applyAdjustments(PromotableOrder order, int appliedItemOffersCount, PromotableCandidateItemOffer itemOffer, int beforeCount)
           
 boolean applyAllItemOffers(List<PromotableCandidateItemOffer> itemOffers, PromotableOrder order)
          Private method that takes a list of sorted CandidateItemOffers and determines if each offer can be applied based on the restrictions (stackable and/or combinable) on that offer.
 void applyAndCompareOrderAndItemOffers(PromotableOrder order, List<PromotableCandidateOrderOffer> qualifiedOrderOffers, List<PromotableCandidateItemOffer> qualifiedItemOffers)
           
protected  void applyItemQualifiersAndTargets(PromotableCandidateItemOffer itemOffer, PromotableOrder order)
           
protected  int applyLegacyAdjustments(int appliedItemOffersCount, PromotableCandidateItemOffer itemOffer, int beforeCount, PromotableOrderItem orderItem)
           
protected  void applyOrderItemAdjustment(PromotableCandidateItemOffer itemOffer, PromotableOrderItem orderItem)
          Private method used by applyAllItemOffers to create an OrderItemAdjustment from a CandidateItemOffer and associates the OrderItemAdjustment to the OrderItem.
protected  int checkAdjustments(PromotableOrder order, int appliedItemOffersCount)
           
protected  int checkLegacyAdjustments(List<PromotableOrderItem> discreteOrderItems, int appliedItemOffersCount)
           
protected  PromotableCandidateItemOffer createCandidateItemOffer(List<PromotableCandidateItemOffer> qualifiedItemOffers, Offer offer, PromotableOrderItem promotableOrderItem)
          Create a candidate item offer based on the offer in question and a specific order item
 void filterItemLevelOffer(PromotableOrder order, List<PromotableCandidateItemOffer> qualifiedItemOffers, Offer offer)
          Review an item level offer against the list of discountable items from the order.
 void filterOffers(PromotableOrder order, List<Offer> filteredOffers, List<PromotableCandidateOrderOffer> qualifiedOrderOffers, List<PromotableCandidateItemOffer> qualifiedItemOffers)
           
 
Methods inherited from class org.broadleafcommerce.core.offer.service.processor.OrderOfferProcessorImpl
applyAllOrderOffers, applyOrderOffer, compareAndAdjustOrderAndItemOffers, compileOrderTotal, couldOfferApplyToOrder, couldOfferApplyToOrder, couldOfferApplyToOrder, couldOfferApplyToOrder, createCandidateOrderOffer, filterOrderLevelOffer, gatherCart, gatherFulfillmentGroupLinkedBundleOrderItems, gatherFulfillmentGroupLinkedDiscreteOrderItem, gatherFulfillmentGroupLinkedDiscreteOrderItems, gatherOrderLinkedBundleOrderItems, gatherOrderLinkedDiscreteOrderItem, gatherOrderLinkedDiscreteOrderItems, getBundleOrderItemIdentifier, getCartService, getFulfillmentGroupItemDao, getOfferDao, getOrderItemService, getPromotableItemFactory, getTargetFulfillmentGroup, initializeBundleSplitItems, initializeSplitItems, mergeSplitBundleOrderItems, mergeSplitDiscreteOrderItems, mergeSplitItems, removeTrailingNotCombinableOrderOffers, setCartService, setFulfillmentGroupItemDao, setOfferDao, setOrderItemService, setPromotableItemFactory
 
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
applyAllOrderOffers, compileOrderTotal, couldOfferApplyToOrder, executeExpression, filterOrderLevelOffer, gatherCart, getCartService, getFulfillmentGroupItemDao, getOfferDao, getOrderItemService, getPromotableItemFactory, initializeBundleSplitItems, initializeSplitItems, removeTrailingNotCombinableOrderOffers, setCartService, setFulfillmentGroupItemDao, setOfferDao, setOrderItemService, setPromotableItemFactory
 
Methods inherited from interface org.broadleafcommerce.core.offer.service.processor.BaseProcessor
clearOffersandAdjustments, filterOffers
 

Constructor Detail

ItemOfferProcessorImpl

public ItemOfferProcessorImpl()
Method Detail

filterItemLevelOffer

public void filterItemLevelOffer(PromotableOrder order,
                                 List<PromotableCandidateItemOffer> qualifiedItemOffers,
                                 Offer offer)
Description copied from interface: ItemOfferProcessor
Review an item level offer against the list of discountable items from the order. If the offer applies, add it to the qualifiedItemOffers list.

Specified by:
filterItemLevelOffer in interface ItemOfferProcessor
Parameters:
order - the BLC order
qualifiedItemOffers - the container list for any qualified offers
offer - the offer in question

createCandidateItemOffer

protected PromotableCandidateItemOffer createCandidateItemOffer(List<PromotableCandidateItemOffer> qualifiedItemOffers,
                                                                Offer offer,
                                                                PromotableOrderItem promotableOrderItem)
Create a candidate item offer based on the offer in question and a specific order item

Parameters:
qualifiedItemOffers - the container list for candidate item offers
offer - the offer in question
promotableOrderItem - the specific order item
Returns:
the candidate item offer

applyAllItemOffers

public boolean applyAllItemOffers(List<PromotableCandidateItemOffer> itemOffers,
                                  PromotableOrder order)
Description copied from interface: ItemOfferProcessor
Private method that takes a list of sorted CandidateItemOffers and determines if each offer can be applied based on the restrictions (stackable and/or combinable) on that offer. OrderItemAdjustments are create on the OrderItem for each applied CandidateItemOffer. An offer with stackable equals false cannot be applied to an OrderItem that already contains an OrderItemAdjustment. An offer with combinable equals false cannot be applied to an OrderItem if that OrderItem already contains an OrderItemAdjustment, unless the offer is the same offer as the OrderItemAdjustment offer.

Specified by:
applyAllItemOffers in interface ItemOfferProcessor
Parameters:
itemOffers - a sorted list of CandidateItemOffer
Returns:
true if an OrderItemOffer was applied, otherwise false

applyAdjustments

protected int applyAdjustments(PromotableOrder order,
                               int appliedItemOffersCount,
                               PromotableCandidateItemOffer itemOffer,
                               int beforeCount)

checkAdjustments

protected int checkAdjustments(PromotableOrder order,
                               int appliedItemOffersCount)

checkLegacyAdjustments

protected int checkLegacyAdjustments(List<PromotableOrderItem> discreteOrderItems,
                                     int appliedItemOffersCount)

applyLegacyAdjustments

protected int applyLegacyAdjustments(int appliedItemOffersCount,
                                     PromotableCandidateItemOffer itemOffer,
                                     int beforeCount,
                                     PromotableOrderItem orderItem)

applyItemQualifiersAndTargets

protected void applyItemQualifiersAndTargets(PromotableCandidateItemOffer itemOffer,
                                             PromotableOrder order)

applyOrderItemAdjustment

protected void applyOrderItemAdjustment(PromotableCandidateItemOffer itemOffer,
                                        PromotableOrderItem orderItem)
Private method used by applyAllItemOffers to create an OrderItemAdjustment from a CandidateItemOffer and associates the OrderItemAdjustment to the OrderItem.

Parameters:
itemOffer - a CandidateItemOffer to apply to an OrderItem

filterOffers

public void filterOffers(PromotableOrder order,
                         List<Offer> filteredOffers,
                         List<PromotableCandidateOrderOffer> qualifiedOrderOffers,
                         List<PromotableCandidateItemOffer> qualifiedItemOffers)
Specified by:
filterOffers in interface ItemOfferProcessor

applyAndCompareOrderAndItemOffers

public void applyAndCompareOrderAndItemOffers(PromotableOrder order,
                                              List<PromotableCandidateOrderOffer> qualifiedOrderOffers,
                                              List<PromotableCandidateItemOffer> qualifiedItemOffers)
Specified by:
applyAndCompareOrderAndItemOffers in interface ItemOfferProcessor


Copyright © 2012. All Rights Reserved.