Class PromotionOrderResults
java.lang.Object
de.hybris.platform.promotions.result.PromotionOrderResults
An object representing the results of evaluating promotions on an AbstractOrder. This object holds details of each
promotion that fired, and the OrderEntry objects that it fired on, and details of all other OrderEntry objects,
indicating if they could be part of a potential promotion. A
PromotionResult object represents the state of
any promotion that fired or potentially fired.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumprotected static enum -
Constructor Summary
ConstructorsConstructorDescriptionPromotionOrderResults(SessionContext ctx, AbstractOrder order, List<PromotionResult> promotionResults, double changeFromLastResults) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected static List<WrappedOrderEntry>cleanWrappedEntryList(SessionContext ctx, List<WrappedOrderEntry> wrappedEntries) protected static Collection<WrappedOrderEntry>findAllMatchingEntries(SessionContext ctx, List<WrappedOrderEntry> wrappedEntries, Collection<PromotionOrderEntryConsumed> consumedEntries) Return a list of results for promotions that did not consume products.Return a list of results for promotions that consumed products.Returns allPromotionResultobjects.Return a list of results for promotions that fired and did not consume products and have been applied.Return a list of results for promotions that fired and consumed products and have been applied.protected static longgetConsumedQuantityForEntry(SessionContext ctx, PromotionResult result, AbstractOrderEntry orderEntry) Return a list of WrappedOrderEntry objects that were not part of any any promotion that fired.Return a list of WrappedOrderEntry objects that were not part of any any promotion that fired or could fire.Return a list of WrappedOrderEntry objects that were part of any any promotion that could fire.Return a list of results for promotions that fired and did not consume products.Return a list of results for promotions that fired and consumed products.protected static longgetMaxConsumedQuantityForEntry(SessionContext ctx, List<PromotionResult> promotionResults, AbstractOrderEntry orderEntry) Return a list of results for promotions that fired and did not consume products and have been applied.Return a list of results for promotions that fired and consumed products and have been applied.protected List<PromotionResult>getPromotionResults(PromotionOrderResults.PromotionResultStatus statusFlag, PromotionOrderResults.PromotionResultProducts productsFlag) Return a list of results for promotions that meet the specified criteria.doubleReturn the total change since the last evaluation of results.voidInvalidate all cached data held in this PromotionOrderResults instance.protected static voidremoveConsumedEntries(SessionContext ctx, List<WrappedOrderEntry> wrappedEntries, Collection<PromotionOrderEntryConsumed> consumedEntries) protected static List<WrappedOrderEntry>wrapEntries(SessionContext ctx, AbstractOrder order)
-
Constructor Details
-
PromotionOrderResults
public PromotionOrderResults(SessionContext ctx, AbstractOrder order, List<PromotionResult> promotionResults, double changeFromLastResults) Constructor.- Parameters:
ctx- The hybris contextorder- The orderpromotionResults- The promotion resultschangeFromLastResults- The change from last results
-
-
Method Details
-
invalidateCache
public void invalidateCache()Invalidate all cached data held in this PromotionOrderResults instance. This method should be called if any of the PromotionResults are applied or unapplied. -
getTotalChangeFromLastResults
public double getTotalChangeFromLastResults()Return the total change since the last evaluation of results.- Returns:
- A double representing the calculation newTotalValueOfDiscounts - oldTotalValueOfDiscounts
-
getAllResults
Returns allPromotionResultobjects. This list will include all promotions that either fired or identified themselves as potentially firing.- Returns:
- The list of promotion results
-
getAllProductPromotions
Return a list of results for promotions that consumed products. This list will include all promotions that consumed products regardless of their firing status.- Returns:
- The list of promotion results
-
getFiredProductPromotions
Return a list of results for promotions that fired and consumed products.- Returns:
- A list of the results of product promotions that fired
-
getAppliedProductPromotions
Return a list of results for promotions that fired and consumed products and have been applied.- Returns:
- A list of the results of product promotions that fired and applied
-
getPotentialProductPromotions
Return a list of results for promotions that fired and consumed products and have been applied.- Returns:
- A list of the results of product promotions that fired and applied
-
getAllOrderPromotions
Return a list of results for promotions that did not consume products. This list will include all promotions that did not consume products regardless of their firing status- Returns:
- The list of promotion results
-
getFiredOrderPromotions
Return a list of results for promotions that fired and did not consume products.- Returns:
- A list of the results of promotions that fired
-
getAppliedOrderPromotions
Return a list of results for promotions that fired and did not consume products and have been applied.- Returns:
- A list of the results of promotions that fired and applied
-
getPotentialOrderPromotions
Return a list of results for promotions that fired and did not consume products and have been applied.- Returns:
- A list of the results of order promotions that fired and applied
-
getPromotionResults
protected List<PromotionResult> getPromotionResults(PromotionOrderResults.PromotionResultStatus statusFlag, PromotionOrderResults.PromotionResultProducts productsFlag) Return a list of results for promotions that meet the specified criteria.- Parameters:
statusFlag- status criteriaproductsFlag- consumed products criteria- Returns:
- a list of promotion results
-
getEntriesNotInPromotions
Return a list of WrappedOrderEntry objects that were not part of any any promotion that fired or could fire.- Returns:
- a list of WrappedOrderEntry objects
-
getEntriesWithPotentialPromotions
Return a list of WrappedOrderEntry objects that were part of any any promotion that could fire.- Returns:
- a list of WrappedOrderEntry objects
-
getEntriesNotInFiredPromotions
Return a list of WrappedOrderEntry objects that were not part of any any promotion that fired. The WrappedOrderEntry holds the promotions that could fire for the specified products. Note that the results returned from this method are the same as those from combining the results from methodsgetEntriesWithPotentialPromotions()andgetEntriesNotInPromotions()but the WrappedOrderEntry objects may be consolidated together. In general it is preferable to callgetEntriesWithPotentialPromotions()andgetEntriesNotInPromotions()that than calling this method directly.- Returns:
- a list of WrappedOrderEntry objects
-
getMaxConsumedQuantityForEntry
protected static long getMaxConsumedQuantityForEntry(SessionContext ctx, List<PromotionResult> promotionResults, AbstractOrderEntry orderEntry) -
getConsumedQuantityForEntry
protected static long getConsumedQuantityForEntry(SessionContext ctx, PromotionResult result, AbstractOrderEntry orderEntry) -
findAllMatchingEntries
protected static Collection<WrappedOrderEntry> findAllMatchingEntries(SessionContext ctx, List<WrappedOrderEntry> wrappedEntries, Collection<PromotionOrderEntryConsumed> consumedEntries) -
wrapEntries
-
removeConsumedEntries
protected static void removeConsumedEntries(SessionContext ctx, List<WrappedOrderEntry> wrappedEntries, Collection<PromotionOrderEntryConsumed> consumedEntries) -
cleanWrappedEntryList
protected static List<WrappedOrderEntry> cleanWrappedEntryList(SessionContext ctx, List<WrappedOrderEntry> wrappedEntries)
-