Class PromotionOrderEntry
- java.lang.Object
-
- de.hybris.platform.promotions.result.PromotionOrderEntry
-
- All Implemented Interfaces:
java.lang.Comparable
public class PromotionOrderEntry extends java.lang.Object implements java.lang.ComparableAn entry as viewed from the PromotionEvaluationContext. This entry always shows the current state of the promotions
-
-
Constructor Summary
Constructors Constructor Description PromotionOrderEntry(AbstractOrderEntry orderEntry, PromotionEvaluationContext.ConsumptionLogger logger)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Object o)Compare to another object.PromotionOrderEntryConsumedconsume(SessionContext ctx, AbstractPromotion promotion, long quantity)Inform the context that a promotion wishes to consume the specified property of.AbstractOrderEntrygetBaseOrderEntry()Get the base order entry.java.lang.DoublegetBasePrice(SessionContext ctx)Returns the unit price of the product in this order entry.java.util.List<Product>getBaseProducts(SessionContext ctx)Returns a collection of base products for this order entry.protected PromotionEvaluationContext.ConsumptionLoggergetLogger()ProductgetProduct(SessionContext ctx)Return the product for this order entry.longgetQuantity(SessionContext ctx)Find the quantity of this orderEntry remaining after other promotions have run.
-
-
-
Constructor Detail
-
PromotionOrderEntry
public PromotionOrderEntry(AbstractOrderEntry orderEntry, PromotionEvaluationContext.ConsumptionLogger logger)
Constructor.- Parameters:
orderEntry- The order entrylogger- The logger
-
-
Method Detail
-
consume
public PromotionOrderEntryConsumed consume(SessionContext ctx, AbstractPromotion promotion, long quantity)
Inform the context that a promotion wishes to consume the specified property of.- Parameters:
ctx- The currency context to usepromotion- The promotion wishing to consume some of an order entryquantity- The quantity of the order entry to consume- Returns:
- The remaining quantity of the order entry
-
getQuantity
public long getQuantity(SessionContext ctx)
Find the quantity of this orderEntry remaining after other promotions have run.- Parameters:
ctx- The context to use- Returns:
- The remaining quantity
-
getProduct
public Product getProduct(SessionContext ctx)
Return the product for this order entry. Returns the actual product associated with the underlying order entry, this may be aProductor aVariantProduct.- Parameters:
ctx- The hybris context- Returns:
- The
Productthat this entry is for - See Also:
getBaseProducts(de.hybris.platform.jalo.SessionContext)
-
getBaseProducts
public java.util.List<Product> getBaseProducts(SessionContext ctx)
Returns a collection of base products for this order entry. Returns the current product if the product is not an instance ofVariantProductorCompositeProductotherwise the relevant base product is returned.- Parameters:
ctx- The hybris context- Returns:
- The base
Productthat this entry is for
-
getBasePrice
public java.lang.Double getBasePrice(SessionContext ctx)
Returns the unit price of the product in this order entry.- Parameters:
ctx- The hybris context- Returns:
- The unit price of the product
-
compareTo
public int compareTo(java.lang.Object o)
Compare to another object.- Specified by:
compareToin interfacejava.lang.Comparable- Parameters:
o- The object to compare to- Returns:
- See
Comparable.compareTo(T)
-
getBaseOrderEntry
public AbstractOrderEntry getBaseOrderEntry()
Get the base order entry.- Returns:
- the base order entry
-
getLogger
protected PromotionEvaluationContext.ConsumptionLogger getLogger()
-
-