@Service(value="blItemOfferProcessor") public class ItemOfferProcessorImpl extends OrderOfferProcessorImpl implements ItemOfferProcessor
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
LOG |
offerDao, orderItemDao, promotableItemFactoryofferTimeZoneProcessor| Constructor and Description |
|---|
ItemOfferProcessorImpl() |
| Modifier and Type | Method and Description |
|---|---|
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) |
applyAllOrderOffers, applyOrderOffer, buildItemDetailAdjustmentMap, buildItemPriceDetailKey, buildOrderItemList, buildPromFulfillmentAdjMap, buildPromotableDetailsMap, buildPromotableFulfillmentGroupMap, buildPromotableItemMap, buildPromotableOrderAdjustmentsMap, buildPromotableQualifiersMap, compareAndAdjustOrderAndItemOffers, couldOfferApplyToOrder, couldOfferApplyToOrder, couldOfferApplyToOrder, couldOfferApplyToOrder, createCandidateOrderOffer, filterOrderLevelOffer, getPromotableItemFactory, processMatchingDetails, removeTrailingNotCombinableOrderOffers, setOfferDao, setOrderItemDao, setPromotableItemFactory, synchronizeAdjustmentsAndPrices, synchronizeFulfillmentGroupAdjustments, synchronizeFulfillmentGroups, synchronizeItemPriceDetails, synchronizeItemQualifiers, synchronizeOrderAdjustments, synchronizeOrderItems, updateItemAdjustment, updatePriceDetailcheckForItemRequirements, clearAllNonFinalizedQuantities, couldOfferApplyToCustomer, couldOfferApplyToOrderItems, couldOfferApplyToRequestDTO, couldOfferApplyToTimePeriod, couldOrderItemMeetOfferRequirement, executeExpression, filterOffers, finalizeQuantities, getOfferTimeZoneProcessor, meetsItemQualifierSubtotal, removeInvalidCustomerOffers, removeInvalidRequestOffers, removeOutOfDateOffers, removeTimePeriodOffers, setOfferTimeZoneProcessor, splitDetailsIfNecessaryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplyAllOrderOffers, couldOfferApplyToOrder, executeExpression, filterOrderLevelOffer, getPromotableItemFactory, removeTrailingNotCombinableOrderOffers, setOfferDao, setOrderItemDao, setPromotableItemFactory, synchronizeAdjustmentsAndPricesfilterOfferspublic void filterItemLevelOffer(PromotableOrder order, List<PromotableCandidateItemOffer> qualifiedItemOffers, Offer offer)
ItemOfferProcessorfilterItemLevelOffer in interface ItemOfferProcessororder - the BLC orderqualifiedItemOffers - the container list for any qualified offersoffer - the offer in questionprotected PromotableCandidateItemOffer createCandidateItemOffer(List<PromotableCandidateItemOffer> qualifiedItemOffers, Offer offer, PromotableOrder promotableOrder)
qualifiedItemOffers - the container list for candidate item offersoffer - the offer in questionpublic void applyAllItemOffers(List<PromotableCandidateItemOffer> itemOffers, PromotableOrder order)
ItemOfferProcessorapplyAllItemOffers in interface ItemOfferProcessoritemOffers - a sorted list of CandidateItemOfferprotected 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 Orderprotected 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 comparisonprotected 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 comparisonpublic void filterOffers(PromotableOrder order, List<Offer> filteredOffers, List<PromotableCandidateOrderOffer> qualifiedOrderOffers, List<PromotableCandidateItemOffer> qualifiedItemOffers)
filterOffers in interface ItemOfferProcessorprotected 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 ItemOfferProcessorCopyright © 2014. All Rights Reserved.