public class PromotionEvaluationContext
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
PromotionEvaluationContext.ConsumptionLogger
Consumptionlogger keeps track of all consumptions during an evaluation run.
|
| Constructor and Description |
|---|
PromotionEvaluationContext(AbstractOrder order,
boolean observeRestrictions,
java.util.Date date)
Create an context for evaluating promotions on the given order.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abandonLogging(AbstractPromotion promo)
Abandon the current logging operation and throw away all of the consumption objects.
|
static java.util.Comparator<PromotionOrderEntry> |
createPriceComparator(SessionContext ctx)
Create a comparator for the current context that orders by price in natural order (lowest to highest).
|
PromotionOrderView |
createView(SessionContext ctx,
AbstractPromotion promotion,
java.util.List<Product> validProducts)
Create a filtered view of the order containing only the products specified in validProducts.
|
java.util.List<PromotionOrderEntryConsumed> |
finishLoggingAndGetConsumed(AbstractPromotion promo,
boolean removeFromOrder)
Complete the logging operation and return a list of all order entry consumptions since logging began.
|
java.util.Date |
getDate()
Get the effective date from the evaluation context.
|
protected PromotionEvaluationContext.ConsumptionLogger |
getLogger()
Get the consumption logger for this context.
|
boolean |
getObserveRestrictions()
Should restrictions be observed when evaluating promotions.
|
AbstractOrder |
getOrder()
Get the order that this context is working on.
|
void |
startLoggingConsumed(AbstractPromotion promo)
Start recording all of the consumed items in any view.
|
public PromotionEvaluationContext(AbstractOrder order, boolean observeRestrictions, java.util.Date date)
order - The order the context is evaluatingobserveRestrictions - Whether restrictions should be observed during evaluationdate - The effective date to use when evaluating promotionspublic void startLoggingConsumed(AbstractPromotion promo)
promo - The promotion requesting the recordingpublic java.util.List<PromotionOrderEntryConsumed> finishLoggingAndGetConsumed(AbstractPromotion promo, boolean removeFromOrder)
promo - The promotion requesting to complete the logging operationremoveFromOrder - Consume all the entries marked such that they cannot be used in another promotionpublic void abandonLogging(AbstractPromotion promo)
promo - the promotionprotected PromotionEvaluationContext.ConsumptionLogger getLogger()
public AbstractOrder getOrder()
public boolean getObserveRestrictions()
true if restrictions should be observed, false otherwise.public PromotionOrderView createView(SessionContext ctx, AbstractPromotion promotion, java.util.List<Product> validProducts)
CompositeProduct interface.ctx - The hybris session contextpromotion - The promotion creating the viewvalidProducts - The products that should be included in the viewpublic java.util.Date getDate()
public static java.util.Comparator<PromotionOrderEntry> createPriceComparator(SessionContext ctx)
ctx - The current hybris session contextCopyright © 2018 SAP SE. All Rights Reserved.