Class AbstractBaseProcessor
java.lang.Object
org.broadleafcommerce.core.offer.service.processor.AbstractBaseProcessor
- All Implemented Interfaces:
BaseProcessor
- Direct Known Subclasses:
OrderOfferProcessorImpl
- Author:
- jfischer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OfferServiceExtensionManagerprotected OfferTimeZoneProcessorprotected final PromotableOfferUtility -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractBaseProcessor(PromotableOfferUtility promotableOfferUtility) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddChildOrderItemsToCandidates(Offer offer, CandidatePromotionItems candidates, OfferItemCriteria criteria, List<PromotableOrderItem> promotableOrderItems, PromotableOrderItem item) protected voidcheckForItemRequirements(Offer offer, CandidatePromotionItems candidates, OfferItemCriteria criteria, List<PromotableOrderItem> promotableOrderItems, boolean isQualifier) protected voidclearAllNonFinalizedQuantities(List<PromotableOrderItemPriceDetail> priceDetails) We were not able to meet all of the ItemCriteria for a promotion, but some of the items were marked as qualifiers or targets.protected booleancouldOfferApplyToCustomer(Offer offer, Customer customer) Private method which executes the appliesToCustomerRules in the Offer to determine if this Offer can be applied to the Customer.protected CandidatePromotionItemscouldOfferApplyToOrderItems(Offer offer, List<PromotableOrderItem> promotableOrderItems) protected booleancouldOfferApplyToRequestDTO(Offer offer, RequestDTO requestDTO) protected booleancouldOfferApplyToTimePeriod(Offer offer) protected booleancouldOrderItemMeetOfferRequirement(OfferItemCriteria criteria, PromotableOrderItem orderItem) protected CalendardateToCalendar(Date date, TimeZone offerTimeZone) executeExpression(String expression, Map<String, Object> vars) Private method used by couldOfferApplyToOrder to execute the MVEL expression in the appliesToOrderRules to determine if this offer can be applied.filterOffers(List<Offer> offers, Customer customer) protected voidfinalizeQuantities(List<PromotableOrderItemPriceDetail> priceDetails) Updates the finalQuanties for the PromotionDiscounts and PromotionQualifiers.protected PromotableOrderItemfindQualifyingItemForPriceData(OfferPriceData offerPriceData, List<PromotableOrderItem> promotableOrderItems) protected booleanhasPositiveValue(Money money) protected booleanisEmpty(Collection<? extends Object> collection) protected booleanmeetsItemQualifierSubtotal(Offer offer, CandidatePromotionItems candidateItem) removeInvalidCustomerOffers(List<Offer> offers, Customer customer) Private method that takes in a list of Offers and removes all Offers from the list that does not apply to this customer.removeInvalidRequestOffers(List<Offer> offers) removeOutOfDateOffers(List<Offer> offers) Removes all out of date offers.removeTimePeriodOffers(List<Offer> offers) Removes all offers that are not within the timezone and timeperiod of the offer.voidsetOfferTimeZoneProcessor(OfferTimeZoneProcessor offerTimeZoneProcessor) protected voidsplitDetailsIfNecessary(List<PromotableOrderItemPriceDetail> priceDetails) Checks to see if the discountQty matches the detailQty.protected StringusePriceBeforeAdjustments(String expression)
-
Field Details
-
promotableOfferUtility
-
offerTimeZoneProcessor
-
extensionManager
-
-
Constructor Details
-
AbstractBaseProcessor
-
-
Method Details
-
couldOfferApplyToOrderItems
protected CandidatePromotionItems couldOfferApplyToOrderItems(Offer offer, List<PromotableOrderItem> promotableOrderItems) -
findQualifyingItemForPriceData
protected PromotableOrderItem findQualifyingItemForPriceData(OfferPriceData offerPriceData, List<PromotableOrderItem> promotableOrderItems) -
isEmpty
-
hasPositiveValue
-
meetsItemQualifierSubtotal
-
checkForItemRequirements
protected void checkForItemRequirements(Offer offer, CandidatePromotionItems candidates, OfferItemCriteria criteria, List<PromotableOrderItem> promotableOrderItems, boolean isQualifier) -
addChildOrderItemsToCandidates
protected void addChildOrderItemsToCandidates(Offer offer, CandidatePromotionItems candidates, OfferItemCriteria criteria, List<PromotableOrderItem> promotableOrderItems, PromotableOrderItem item) -
couldOrderItemMeetOfferRequirement
protected boolean couldOrderItemMeetOfferRequirement(OfferItemCriteria criteria, PromotableOrderItem orderItem) -
executeExpression
Private method used by couldOfferApplyToOrder to execute the MVEL expression in the appliesToOrderRules to determine if this offer can be applied.- Parameters:
expression-vars-- Returns:
- a Boolean object containing the result of executing the MVEL expression
-
usePriceBeforeAdjustments
-
clearAllNonFinalizedQuantities
We were not able to meet all of the ItemCriteria for a promotion, but some of the items were marked as qualifiers or targets. This method removes those items from being used as targets or qualifiers so they are eligible for other promotions.- Parameters:
priceDetails-
-
finalizeQuantities
Updates the finalQuanties for the PromotionDiscounts and PromotionQualifiers. Called after we have confirmed enough qualifiers and targets for the promotion.- Parameters:
priceDetails-
-
splitDetailsIfNecessary
Checks to see if the discountQty matches the detailQty. If not, splits the priceDetail.- Parameters:
priceDetails-
-
filterOffers
- Specified by:
filterOffersin interfaceBaseProcessor
-
removeInvalidRequestOffers
-
couldOfferApplyToRequestDTO
-
removeTimePeriodOffers
Removes all offers that are not within the timezone and timeperiod of the offer. If an offer does not fall within the timezone or timeperiod rule, that offer will be removed.- Parameters:
offers-- Returns:
- List of Offers within the timezone or timeperiod of the offer
-
couldOfferApplyToTimePeriod
-
removeOutOfDateOffers
Removes all out of date offers. If an offer does not have a start date, or the start date is a later date, that offer will be removed. Offers without a start date should not be processed. If the offer has a end date that has already passed, that offer will be removed. Offers without a end date will be processed if the start date is prior to the transaction date.- Parameters:
offers-- Returns:
- List of Offers with valid dates
-
dateToCalendar
-
removeInvalidCustomerOffers
Private method that takes in a list of Offers and removes all Offers from the list that does not apply to this customer.- Parameters:
offers-customer-- Returns:
- List of Offers that apply to this customer
-
couldOfferApplyToCustomer
Private method which executes the appliesToCustomerRules in the Offer to determine if this Offer can be applied to the Customer.- Parameters:
offer-customer-- Returns:
- true if offer can be applied, otherwise false
-
getOfferTimeZoneProcessor
-
setOfferTimeZoneProcessor
-