Class OrderOfferProcessorImpl
java.lang.Object
org.broadleafcommerce.core.offer.service.processor.AbstractBaseProcessor
org.broadleafcommerce.core.offer.service.processor.OrderOfferProcessorImpl
- All Implemented Interfaces:
BaseProcessor,OrderOfferProcessor
- Direct Known Subclasses:
FulfillmentGroupOfferProcessorImpl,ItemOfferProcessorImpl
@Service("blOrderOfferProcessor")
public class OrderOfferProcessorImpl
extends AbstractBaseProcessor
implements OrderOfferProcessor
- Author:
- jfischer, bpolster
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.broadleafcommerce.common.service.GenericEntityServiceprotected OfferDaoprotected OfferServiceUtilitiesprotected OrderItemDaoprotected PromotableItemFactoryFields inherited from class org.broadleafcommerce.core.offer.service.processor.AbstractBaseProcessor
extensionManager, offerTimeZoneProcessor, promotableOfferUtility -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyAllOrderOffers(List<PromotableCandidateOrderOffer> orderOffers, PromotableOrder promotableOrder) 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 voidapplyOrderOffer(PromotableOrder promotableOrder, PromotableCandidateOrderOffer orderOffer) Private method used by applyAllOrderOffers to create an OrderAdjustment from a CandidateOrderOffer and associates the OrderAdjustment to the Order.protected StringbuildItemPriceDetailKey(OrderItemPriceDetail itemDetail) protected Map<Long,PromotableFulfillmentGroupAdjustment> protected Map<String,PromotableOrderItemPriceDetail> protected Map<Long,PromotableFulfillmentGroup> protected Map<Long,PromotableOrderAdjustment> buildPromotableOrderAdjustmentsMap(PromotableOrder promotableOrder) protected Map<Long,PromotionQualifier> protected voidcompareAndAdjustOrderAndItemOffers(PromotableOrder promotableOrder) Called when the system must determine whether to apply order or item adjustments.booleancouldOfferApplyToOrder(Offer offer, PromotableOrder promotableOrder) Executes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.protected booleancouldOfferApplyToOrder(Offer offer, PromotableOrder promotableOrder, 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 booleancouldOfferApplyToOrder(Offer offer, PromotableOrder promotableOrder, PromotableOrderItem orderItem) Private method which executes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.protected booleancouldOfferApplyToOrder(Offer offer, PromotableOrder promotableOrder, PromotableOrderItem promotableOrderItem, PromotableFulfillmentGroup promotableFulfillmentGroup) Private method which executes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.protected PromotableCandidateOrderOffercreateCandidateOrderOffer(PromotableOrder promotableOrder, List<PromotableCandidateOrderOffer> qualifiedOrderOffers, Offer offer) protected booleanvoidfilterOrderLevelOffer(PromotableOrder promotableOrder, List<PromotableCandidateOrderOffer> qualifiedOrderOffers, Offer offer) protected booleanorderMeetsQualifyingSubtotalRequirements(PromotableOrder order, PromotableCandidateOrderOffer orderOffer) protected booleanorderMeetsSubtotalRequirements(PromotableOrder order, PromotableCandidateOrderOffer orderOffer) protected voidprocessMatchingDetails(OrderItemPriceDetail itemDetail, PromotableOrderItemPriceDetail promotableItemDetail) removeTrailingNotCombinableOrderOffers(List<PromotableCandidateOrderOffer> candidateOffers) voidsetOfferDao(OfferDao offerDao) Set the offerDao (primarily for unit testing)voidsetOfferServiceUtilities(OfferServiceUtilities offerServiceUtilities) voidsetOrderItemDao(OrderItemDao orderItemDao) Set the orderItemDao (primarily for unit testing)voidsetPromotableItemFactory(PromotableItemFactory promotableItemFactory) protected voidvoidsynchronizeAdjustmentsAndPrices(PromotableOrder promotableOrder) Takes the adjustments and PriceDetails from the passed in PromotableOrder and transfers them to the actual order first checking to see if they already exist.protected voidsynchronizeFulfillmentGroupAdjustments(FulfillmentGroup fg, PromotableFulfillmentGroup promotableFG) protected voidsynchronizeFulfillmentGroups(PromotableOrder promotableOrder) protected voidsynchronizeItemPriceDetails(OrderItem orderItem, PromotableOrderItem promotableOrderItem) protected voidsynchronizeItemQualifiers(OrderItem orderItem, PromotableOrderItem promotableOrderItem) protected voidsynchronizeOrderAdjustments(PromotableOrder promotableOrder) protected voidsynchronizeOrderItems(PromotableOrder promotableOrder) protected voidupdateAdjustmentIfChangesDetected(OrderAdjustment adjustment, PromotableOrderAdjustment promotableAdjustment) Methods inherited from class org.broadleafcommerce.core.offer.service.processor.AbstractBaseProcessor
addChildOrderItemsToCandidates, checkForItemRequirements, clearAllNonFinalizedQuantities, couldOfferApplyToCustomer, couldOfferApplyToOrderItems, couldOfferApplyToRequestDTO, couldOfferApplyToTimePeriod, couldOrderItemMeetOfferRequirement, dateToCalendar, executeExpression, filterOffers, finalizeQuantities, findQualifyingItemForPriceData, getOfferTimeZoneProcessor, hasPositiveValue, isEmpty, meetsItemQualifierSubtotal, removeInvalidCustomerOffers, removeInvalidRequestOffers, removeOutOfDateOffers, removeTimePeriodOffers, setOfferTimeZoneProcessor, splitDetailsIfNecessary, usePriceBeforeAdjustmentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.broadleafcommerce.core.offer.service.processor.BaseProcessor
filterOffersMethods inherited from interface org.broadleafcommerce.core.offer.service.processor.OrderOfferProcessor
executeExpression
-
Field Details
-
promotableItemFactory
-
orderItemDao
-
offerDao
-
offerServiceUtilities
-
entityService
protected org.broadleafcommerce.common.service.GenericEntityService entityService
-
-
Constructor Details
-
OrderOfferProcessorImpl
-
-
Method Details
-
filterOrderLevelOffer
public void filterOrderLevelOffer(PromotableOrder promotableOrder, List<PromotableCandidateOrderOffer> qualifiedOrderOffers, Offer offer) - Specified by:
filterOrderLevelOfferin interfaceOrderOfferProcessor
-
couldOfferApplyToOrder
Description copied from interface:OrderOfferProcessorExecutes the appliesToOrderRules in the Offer to determine if this offer can be applied to the Order, OrderItem, or FulfillmentGroup.- Specified by:
couldOfferApplyToOrderin interfaceOrderOfferProcessor- Returns:
- true if offer can be applied, otherwise false
-
couldOfferApplyToOrder
protected boolean couldOfferApplyToOrder(Offer offer, PromotableOrder promotableOrder, PromotableOrderItem orderItem) 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-promotableOrder-orderItem-- Returns:
- true if offer can be applied, otherwise false
-
couldOfferApplyToOrder
protected boolean couldOfferApplyToOrder(Offer offer, PromotableOrder promotableOrder, 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-promotableOrder-fulfillmentGroup-- Returns:
- true if offer can be applied, otherwise false
-
couldOfferApplyToOrder
protected boolean couldOfferApplyToOrder(Offer offer, PromotableOrder promotableOrder, PromotableOrderItem promotableOrderItem, PromotableFulfillmentGroup promotableFulfillmentGroup) 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-promotableOrder-promotableOrderItem-promotableFulfillmentGroup-- Returns:
- true if offer can be applied, otherwise false
-
createCandidateOrderOffer
protected PromotableCandidateOrderOffer createCandidateOrderOffer(PromotableOrder promotableOrder, List<PromotableCandidateOrderOffer> qualifiedOrderOffers, Offer offer) -
removeTrailingNotCombinableOrderOffers
public List<PromotableCandidateOrderOffer> removeTrailingNotCombinableOrderOffers(List<PromotableCandidateOrderOffer> candidateOffers) - Specified by:
removeTrailingNotCombinableOrderOffersin interfaceOrderOfferProcessor
-
applyAllOrderOffers
public void applyAllOrderOffers(List<PromotableCandidateOrderOffer> orderOffers, PromotableOrder promotableOrder) Description copied from interface:OrderOfferProcessorTakes 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:
applyAllOrderOffersin interfaceOrderOfferProcessor- Parameters:
orderOffers- a sorted list of CandidateOrderOfferpromotableOrder- the Order to apply the CandidateOrderOffers
-
orderMeetsQualifyingSubtotalRequirements
protected boolean orderMeetsQualifyingSubtotalRequirements(PromotableOrder order, PromotableCandidateOrderOffer orderOffer) -
orderMeetsSubtotalRequirements
protected boolean orderMeetsSubtotalRequirements(PromotableOrder order, PromotableCandidateOrderOffer orderOffer) -
compareAndAdjustOrderAndItemOffers
Called when the system must determine whether to apply order or item adjustments.- Parameters:
promotableOrder-
-
applyOrderOffer
protected void applyOrderOffer(PromotableOrder promotableOrder, 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
-
getPromotableItemFactory
- Specified by:
getPromotableItemFactoryin interfaceOrderOfferProcessor
-
setPromotableItemFactory
- Specified by:
setPromotableItemFactoryin interfaceOrderOfferProcessor
-
buildPromotableOrderAdjustmentsMap
protected Map<Long,PromotableOrderAdjustment> buildPromotableOrderAdjustmentsMap(PromotableOrder promotableOrder) -
synchronizeOrderAdjustments
-
updateAdjustmentIfChangesDetected
protected void updateAdjustmentIfChangesDetected(OrderAdjustment adjustment, PromotableOrderAdjustment promotableAdjustment) -
synchronizeOrderItems
-
synchronizeItemPriceDetails
protected void synchronizeItemPriceDetails(OrderItem orderItem, PromotableOrderItem promotableOrderItem) -
synchronizeItemQualifiers
protected void synchronizeItemQualifiers(OrderItem orderItem, PromotableOrderItem promotableOrderItem) -
processMatchingDetails
protected void processMatchingDetails(OrderItemPriceDetail itemDetail, PromotableOrderItemPriceDetail promotableItemDetail) -
buildItemPriceDetailKey
-
buildPromotableDetailsMap
protected Map<String,PromotableOrderItemPriceDetail> buildPromotableDetailsMap(PromotableOrderItem item) -
buildPromotableQualifiersMap
-
synchronizeFulfillmentGroups
-
fgContainsFutureCreditAdjustment
-
syncFulfillmentPrice
-
buildPromotableFulfillmentGroupMap
protected Map<Long,PromotableFulfillmentGroup> buildPromotableFulfillmentGroupMap(PromotableOrder order) -
buildPromFulfillmentAdjMap
protected Map<Long,PromotableFulfillmentGroupAdjustment> buildPromFulfillmentAdjMap(PromotableFulfillmentGroup fg) -
synchronizeFulfillmentGroupAdjustments
protected void synchronizeFulfillmentGroupAdjustments(FulfillmentGroup fg, PromotableFulfillmentGroup promotableFG) -
synchronizeAdjustmentsAndPrices
Description copied from interface:OrderOfferProcessorTakes the adjustments and PriceDetails from the passed in PromotableOrder and transfers them to the actual order first checking to see if they already exist.- Specified by:
synchronizeAdjustmentsAndPricesin interfaceOrderOfferProcessor
-
setOfferDao
Description copied from interface:OrderOfferProcessorSet the offerDao (primarily for unit testing)- Specified by:
setOfferDaoin interfaceOrderOfferProcessor
-
setOrderItemDao
Description copied from interface:OrderOfferProcessorSet the orderItemDao (primarily for unit testing)- Specified by:
setOrderItemDaoin interfaceOrderOfferProcessor
-
getOfferServiceUtilities
-
setOfferServiceUtilities
-