Class WrappedOrderEntry
- java.lang.Object
-
- de.hybris.platform.promotions.result.WrappedOrderEntry
-
public class WrappedOrderEntry extends java.lang.ObjectWrappedOrderEntry. A decorated presentation of OrderEntry which attaches extra information about whether the entry was part of any promotions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classWrappedOrderEntry.PromotionResultComparatorComparator forPromotionResultthat compares by certainty and then by priority.
-
Constructor Summary
Constructors Modifier Constructor Description protectedWrappedOrderEntry(SessionContext ctx, AbstractOrderEntry orderEntry)protectedWrappedOrderEntry(SessionContext ctx, AbstractOrderEntry orderEntry, long quantity)protectedWrappedOrderEntry(SessionContext ctx, AbstractOrderEntry orderEntry, long quantity, java.util.Collection<PromotionResult> promotionResults)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddPromotionResult(SessionContext ctx, PromotionResult promotionResult)Add a promotion result to this wrapped order entry.protected voidaddPromotionResults(SessionContext ctx, java.util.Collection<PromotionResult> promotionResults)Add a multiple promotion results to this wrapped order entry.protected voidconsume(long quantity)Protected method to allow order entries to be adjusted by consuming quantities.protected booleanconsumePromotionOrderEntryConsumed(SessionContext ctx, PromotionOrderEntryConsumed poec)AbstractOrderEntrygetBaseOrderEntry()The product in this order entry.doublegetEntryPrice()Get the total price for this order entry (unit price * quantity).doublegetEntryPrice(SessionContext ctx)Get the total price for this order entry (unit price * quantity).ProductgetProduct()The product in this order entry.ProductgetProduct(SessionContext ctx)The product in this order entry.java.util.List<PromotionResult>getPromotionResults()The list ofPromotionResultobjects that applied to this order entry.longgetQuantity()The quantity of the order entry.longgetQuantity(SessionContext ctx)The quantity of the order entry.UnitgetUnit()Get the unit for this entry.UnitgetUnit(SessionContext ctx)Get the unit for this entry.doublegetUnitPrice()Get the price for one unit of the represented product.doublegetUnitPrice(SessionContext ctx)Returns the price for one unit of the represented product.protected booleanisLegacyPromotion(PromotionOrderEntryConsumed poec)Returns false if the Promotion of the Promotion Result is/extends one from promotionengineservices.
-
-
-
Constructor Detail
-
WrappedOrderEntry
protected WrappedOrderEntry(SessionContext ctx, AbstractOrderEntry orderEntry)
-
WrappedOrderEntry
protected WrappedOrderEntry(SessionContext ctx, AbstractOrderEntry orderEntry, long quantity)
-
WrappedOrderEntry
protected WrappedOrderEntry(SessionContext ctx, AbstractOrderEntry orderEntry, long quantity, java.util.Collection<PromotionResult> promotionResults)
-
-
Method Detail
-
getQuantity
public long getQuantity()
The quantity of the order entry.- Returns:
- The quantity
-
getQuantity
public long getQuantity(SessionContext ctx)
The quantity of the order entry.- Parameters:
ctx- The hybris session context- Returns:
- The quantity
-
getProduct
public Product getProduct()
The product in this order entry.- Returns:
- The product in this order entry
-
getProduct
public Product getProduct(SessionContext ctx)
The product in this order entry.- Parameters:
ctx- The hybris session context- Returns:
- The product in this order entry
-
getBaseOrderEntry
public AbstractOrderEntry getBaseOrderEntry()
The product in this order entry.- Returns:
- The product in this order entry
-
getPromotionResults
public java.util.List<PromotionResult> getPromotionResults()
The list ofPromotionResultobjects that applied to this order entry.- Returns:
- A list of
PromotionResultobjects
-
addPromotionResult
protected void addPromotionResult(SessionContext ctx, PromotionResult promotionResult)
Add a promotion result to this wrapped order entry.- Parameters:
ctx- The hybris session contextpromotionResult- The promotion result to add
-
addPromotionResults
protected void addPromotionResults(SessionContext ctx, java.util.Collection<PromotionResult> promotionResults)
Add a multiple promotion results to this wrapped order entry.- Parameters:
ctx- The hybris session contextpromotionResults- The promotion results to add
-
consume
protected void consume(long quantity)
Protected method to allow order entries to be adjusted by consuming quantities.- Parameters:
quantity- The quantity to consume
-
getEntryPrice
public double getEntryPrice()
Get the total price for this order entry (unit price * quantity).- Returns:
- The total price
-
getEntryPrice
public double getEntryPrice(SessionContext ctx)
Get the total price for this order entry (unit price * quantity).- Parameters:
ctx- The hybris session context- Returns:
- The total price
-
getUnitPrice
public double getUnitPrice()
Get the price for one unit of the represented product.- Returns:
- The unit price
-
getUnitPrice
public double getUnitPrice(SessionContext ctx)
Returns the price for one unit of the represented product.- Parameters:
ctx- The hybris session context- Returns:
- The unit price
-
getUnit
public Unit getUnit()
Get the unit for this entry.- Returns:
- The unit
-
getUnit
public Unit getUnit(SessionContext ctx)
Get the unit for this entry.- Parameters:
ctx- The hybris session context- Returns:
- The unit
-
consumePromotionOrderEntryConsumed
protected boolean consumePromotionOrderEntryConsumed(SessionContext ctx, PromotionOrderEntryConsumed poec)
-
isLegacyPromotion
protected boolean isLegacyPromotion(PromotionOrderEntryConsumed poec)
Returns false if the Promotion of the Promotion Result is/extends one from promotionengineservices. True otherwise.
-
-