|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.broadleafcommerce.core.offer.service.processor.AbstractBaseProcessor
org.broadleafcommerce.core.offer.service.processor.OrderOfferProcessorImpl
org.broadleafcommerce.core.offer.service.processor.ItemOfferProcessorImpl
@Service(value="blItemOfferProcessor") public class ItemOfferProcessorImpl
Filter and apply order item offers.
| Field Summary |
|---|
| Fields inherited from class org.broadleafcommerce.core.offer.service.processor.OrderOfferProcessorImpl |
|---|
offerDao, orderItemDao, promotableItemFactory |
| Fields inherited from class org.broadleafcommerce.core.offer.service.processor.AbstractBaseProcessor |
|---|
offerTimeZoneProcessor |
| Constructor Summary | |
|---|---|
ItemOfferProcessorImpl()
|
|
| Method Summary | |
|---|---|
protected boolean |
adjustmentIsNotGoodEnoughToBeApplied(PromotableCandidateItemOffer itemOffer,
PromotableOrderItemPriceDetail detail)
The adjustment might not be better than the sale price. |
protected void |
applyAdjustments(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
The itemOffer has been qualified and prior methods added PromotionDiscount objects onto the ItemPriceDetail. |
void |
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 |
applyItemOffer(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
|
protected void |
applyItemQualifiersAndTargets(PromotableCandidateItemOffer itemOffer,
PromotableOrder order)
|
protected void |
applyLegacyAdjustments(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
Legacy adjustments use the stackable flag instead of item qualifiers and targets |
protected void |
applyOrderItemAdjustment(PromotableCandidateItemOffer itemOffer,
PromotableOrderItemPriceDetail itemPriceDetail)
Private method used by applyAdjustments to create an OrderItemAdjustment from a CandidateOrderOffer and associates the OrderItemAdjustment to the OrderItem. |
protected List<List<PromotableCandidateItemOffer>> |
buildItemOfferPermutations(List<PromotableCandidateItemOffer> offers)
This method could be overridden to potentially run all permutations of offers. |
protected List<PromotableOrderItemPriceDetail> |
buildPriceDetailListFromOrderItems(List<PromotableOrderItem> items)
|
protected void |
calculatePotentialSavings(List<PromotableCandidateItemOffer> itemOffers,
PromotableOrder order)
This method determines the potential savings for each item offer as if it was the only item offer being applied. |
protected void |
chooseSaleOrRetailAdjustments(PromotableOrder order)
Some promotions can only apply to the retail price. |
protected PromotableCandidateItemOffer |
createCandidateItemOffer(List<PromotableCandidateItemOffer> qualifiedItemOffers,
Offer offer,
PromotableOrder promotableOrder)
Create a candidate item offer based on the offer in question and a specific order item |
protected void |
determineBestPermutation(List<PromotableCandidateItemOffer> itemOffers,
PromotableOrder order)
|
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)
|
protected Comparator<PromotableOrderItemPriceDetail> |
getQualifierItemComparator(boolean applyToSalePrice)
Used in applyItemQualifiersAndTargets(PromotableCandidateItemOffer, PromotableOrder) allow for customized
sorting for which qualifier items should be attempted to be used first for a promotion. |
protected Comparator<PromotableOrderItemPriceDetail> |
getTargetItemComparator(boolean applyToSalePrice)
Used in applyItemQualifiersAndTargets(PromotableCandidateItemOffer, PromotableOrder) allow for customized
sorting for which target items the promotion should be attempted to be applied to first. |
protected boolean |
isTotalitarianOfferAppliedToAnyItem(PromotableOrder order)
|
protected boolean |
itemOfferCanBeApplied(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
Return false if a totalitarian offer has already been applied and this order already has item adjustments. |
protected boolean |
markQualifiers(PromotableCandidateItemOffer itemOffer,
PromotableOrder order)
Loop through ItemCriteria and mark qualifiers required to give the promotion to 1 or more targets. |
protected void |
markQualifiersAndTargets(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
|
protected boolean |
markTargets(PromotableCandidateItemOffer itemOffer,
PromotableOrder order)
Loop through ItemCriteria and mark targets that can get this promotion to give the promotion to 1 or more targets. |
protected void |
mergePriceDetails(PromotableOrder order)
Checks to see if any priceDetails need to be combined and if so, combines them. |
protected boolean |
offerListStartsWithNonCombinable(List<PromotableCandidateItemOffer> offerList)
|
protected boolean |
offerMeetsSubtotalRequirements(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
|
| Methods inherited from class org.broadleafcommerce.core.offer.service.processor.AbstractBaseProcessor |
|---|
checkForItemRequirements, clearAllNonFinalizedQuantities, couldOfferApplyToCustomer, couldOfferApplyToOrderItems, couldOfferApplyToRequestDTO, couldOfferApplyToTimePeriod, couldOrderItemMeetOfferRequirement, executeExpression, filterOffers, finalizeQuantities, getOfferTimeZoneProcessor, meetsItemQualifierSubtotal, removeInvalidCustomerOffers, removeInvalidRequestOffers, removeOutOfDateOffers, removeTimePeriodOffers, setOfferTimeZoneProcessor, splitDetailsIfNecessary |
| 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, couldOfferApplyToOrder, executeExpression, filterOrderLevelOffer, getPromotableItemFactory, removeTrailingNotCombinableOrderOffers, setOfferDao, setOrderItemDao, setPromotableItemFactory, synchronizeAdjustmentsAndPrices |
| Methods inherited from interface org.broadleafcommerce.core.offer.service.processor.BaseProcessor |
|---|
filterOffers |
| Constructor Detail |
|---|
public ItemOfferProcessorImpl()
| Method Detail |
|---|
public void filterItemLevelOffer(PromotableOrder order,
List<PromotableCandidateItemOffer> qualifiedItemOffers,
Offer offer)
ItemOfferProcessor
filterItemLevelOffer in interface ItemOfferProcessororder - the BLC orderqualifiedItemOffers - the container list for any qualified offersoffer - the offer in question
protected PromotableCandidateItemOffer createCandidateItemOffer(List<PromotableCandidateItemOffer> qualifiedItemOffers,
Offer offer,
PromotableOrder promotableOrder)
qualifiedItemOffers - the container list for candidate item offersoffer - the offer in question
public void applyAllItemOffers(List<PromotableCandidateItemOffer> itemOffers,
PromotableOrder order)
ItemOfferProcessor
applyAllItemOffers in interface ItemOfferProcessoritemOffers - a sorted list of CandidateItemOffer
protected boolean offerMeetsSubtotalRequirements(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
protected boolean isTotalitarianOfferAppliedToAnyItem(PromotableOrder order)
protected void applyOrderItemAdjustment(PromotableCandidateItemOffer itemOffer,
PromotableOrderItemPriceDetail itemPriceDetail)
orderOffer - a CandidateOrderOffer to apply to an Order
protected void applyAdjustments(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
order - itemOffer -
protected void applyLegacyAdjustments(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
order - itemOffer -
protected boolean adjustmentIsNotGoodEnoughToBeApplied(PromotableCandidateItemOffer itemOffer,
PromotableOrderItemPriceDetail detail)
itemOffer - detail -
protected boolean itemOfferCanBeApplied(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
order - itemOffer -
protected void applyItemOffer(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
protected void chooseSaleOrRetailAdjustments(PromotableOrder order)
order - protected void mergePriceDetails(PromotableOrder order)
order -
protected void applyItemQualifiersAndTargets(PromotableCandidateItemOffer itemOffer,
PromotableOrder order)
protected List<PromotableOrderItemPriceDetail> buildPriceDetailListFromOrderItems(List<PromotableOrderItem> items)
protected boolean markQualifiers(PromotableCandidateItemOffer itemOffer,
PromotableOrder order)
itemOffer - order -
protected boolean markTargets(PromotableCandidateItemOffer itemOffer,
PromotableOrder order)
itemOffer - order -
protected Comparator<PromotableOrderItemPriceDetail> getQualifierItemComparator(boolean applyToSalePrice)
applyItemQualifiersAndTargets(PromotableCandidateItemOffer, PromotableOrder) allow for customized
sorting for which qualifier items should be attempted to be used first for a promotion. Default behavior
is to sort descending, so higher-value items are attempted to be qualified first.
applyToSalePrice - - whether or not the Comparator should use the sale price for comparison
protected Comparator<PromotableOrderItemPriceDetail> getTargetItemComparator(boolean applyToSalePrice)
Used in applyItemQualifiersAndTargets(PromotableCandidateItemOffer, PromotableOrder) allow for customized
sorting for which target items the promotion should be attempted to be applied to first. Default behavior is to
sort descending, so higher-value items get the promotion over lesser-valued items.
Note: By default, both the getQualifierItemComparator(boolean) and this target comparator are sorted
in descending order. This means that higher-valued items can be paired with higher-valued items and lower-valued
items can be paired with lower-valued items. This also ensures that you will not have the scenario where 2
lower-valued items can be used to qualify a higher-valued target.
applyToSalePrice - - whether or not the Comparator should use the sale price for comparison
public void filterOffers(PromotableOrder order,
List<Offer> filteredOffers,
List<PromotableCandidateOrderOffer> qualifiedOrderOffers,
List<PromotableCandidateItemOffer> qualifiedItemOffers)
filterOffers in interface ItemOfferProcessor
protected void calculatePotentialSavings(List<PromotableCandidateItemOffer> itemOffers,
PromotableOrder order)
itemOffers - order -
protected void markQualifiersAndTargets(PromotableOrder order,
PromotableCandidateItemOffer itemOffer)
protected boolean offerListStartsWithNonCombinable(List<PromotableCandidateItemOffer> offerList)
protected List<List<PromotableCandidateItemOffer>> buildItemOfferPermutations(List<PromotableCandidateItemOffer> offers)
offers -
protected void determineBestPermutation(List<PromotableCandidateItemOffer> itemOffers,
PromotableOrder order)
public void applyAndCompareOrderAndItemOffers(PromotableOrder order,
List<PromotableCandidateOrderOffer> qualifiedOrderOffers,
List<PromotableCandidateItemOffer> qualifiedItemOffers)
applyAndCompareOrderAndItemOffers in interface ItemOfferProcessor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||