Class PromotionOrderView
- java.lang.Object
-
- de.hybris.platform.promotions.result.PromotionOrderView
-
public class PromotionOrderView extends java.lang.ObjectA filtered view of the OrderEntries for a given order.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPromotionOrderView(AbstractPromotion promotion, java.util.List<PromotionOrderEntry> orderEntries)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<PromotionOrderEntryConsumed>consume(SessionContext ctx, long quantity)Consume a specific quantity of products from this view.java.util.List<PromotionOrderEntryConsumed>consume(SessionContext ctx, Product product, long quantity)Consume products from this view.java.util.List<PromotionOrderEntryConsumed>consumeFromHead(SessionContext ctx, java.util.Comparator<PromotionOrderEntry> comparator, long quantity)Consume products from this view in the specified order.java.util.List<PromotionOrderEntryConsumed>consumeFromTail(SessionContext ctx, java.util.Comparator<PromotionOrderEntry> comparator, long quantity)Consume products from this view in the reverse of the specfied order.protected static java.util.List<PromotionOrderEntryConsumed>doConsume(SessionContext ctx, java.util.List<PromotionOrderEntry> workingEntries, AbstractPromotion promotion, long quantity)protected static PromotionOrderEntrydoPeek(SessionContext ctx, java.util.List<PromotionOrderEntry> workingEntries)java.util.List<PromotionOrderEntry>getAllEntries(SessionContext ctx)Get all the entries in this view.java.util.List<PromotionOrderEntry>getAllEntriesByPrice(SessionContext ctx)Get all the entries in this view sorted by price.protected java.util.List<PromotionOrderEntry>getOrderEntries()protected AbstractPromotiongetPromotion()longgetQuantity(SessionContext ctx, Product product)Get the number of a single product remaining.longgetTotalQuantity(SessionContext ctx)Get the total number of products remaining in this view.PromotionOrderEntrypeek(SessionContext ctx)Look at the next promotion order entry from this view.PromotionOrderEntrypeekFromHead(SessionContext ctx, java.util.Comparator<PromotionOrderEntry> comparator)Look at the next promotion order entry from this view in the order specified.PromotionOrderEntrypeekFromTail(SessionContext ctx, java.util.Comparator<PromotionOrderEntry> comparator)Look at the next promotion order entry from this view in the reverse of the order specified.
-
-
-
Constructor Detail
-
PromotionOrderView
protected PromotionOrderView(AbstractPromotion promotion, java.util.List<PromotionOrderEntry> orderEntries)
-
-
Method Detail
-
getTotalQuantity
public long getTotalQuantity(SessionContext ctx)
Get the total number of products remaining in this view.- Parameters:
ctx- the hybris context- Returns:
- the number of products remaining
-
getQuantity
public long getQuantity(SessionContext ctx, Product product)
Get the number of a single product remaining.- Parameters:
ctx- the hybris contextproduct- the product- Returns:
- the quantity of the specified product remaining
-
consume
public java.util.List<PromotionOrderEntryConsumed> consume(SessionContext ctx, long quantity)
Consume a specific quantity of products from this view. The type of product is not relevant.- Parameters:
ctx- the hybris contextquantity- the quantity to consume- Returns:
- a list of consumed order entries
-
consumeFromHead
public java.util.List<PromotionOrderEntryConsumed> consumeFromHead(SessionContext ctx, java.util.Comparator<PromotionOrderEntry> comparator, long quantity)
Consume products from this view in the specified order.- Parameters:
ctx- the hybris contextcomparator- the comparatorquantity- the quantity to consume- Returns:
- a list of consumed order entries
-
consumeFromTail
public java.util.List<PromotionOrderEntryConsumed> consumeFromTail(SessionContext ctx, java.util.Comparator<PromotionOrderEntry> comparator, long quantity)
Consume products from this view in the reverse of the specfied order.- Parameters:
ctx- the hybris contextcomparator- the comparatorquantity- the quantity to consume- Returns:
- a list of consumed order entries
-
doConsume
protected static java.util.List<PromotionOrderEntryConsumed> doConsume(SessionContext ctx, java.util.List<PromotionOrderEntry> workingEntries, AbstractPromotion promotion, long quantity)
-
consume
public java.util.List<PromotionOrderEntryConsumed> consume(SessionContext ctx, Product product, long quantity)
Consume products from this view.- Parameters:
ctx- the hybris contextproduct- the product typequantity- the quantity- Returns:
- a list of consumed order entries
-
getAllEntries
public java.util.List<PromotionOrderEntry> getAllEntries(SessionContext ctx)
Get all the entries in this view.- Parameters:
ctx- the hybris context- Returns:
- the order entries
-
getAllEntriesByPrice
public java.util.List<PromotionOrderEntry> getAllEntriesByPrice(SessionContext ctx)
Get all the entries in this view sorted by price.- Parameters:
ctx- the hybris context- Returns:
- the order entries
-
peekFromHead
public PromotionOrderEntry peekFromHead(SessionContext ctx, java.util.Comparator<PromotionOrderEntry> comparator)
Look at the next promotion order entry from this view in the order specified.- Parameters:
ctx- the hybris contextcomparator- the comparator- Returns:
- the next order entry
-
peek
public PromotionOrderEntry peek(SessionContext ctx)
Look at the next promotion order entry from this view.- Parameters:
ctx- the hybris context- Returns:
- the next order entry
-
peekFromTail
public PromotionOrderEntry peekFromTail(SessionContext ctx, java.util.Comparator<PromotionOrderEntry> comparator)
Look at the next promotion order entry from this view in the reverse of the order specified.- Parameters:
ctx- the hybris contextcomparator- the comparator- Returns:
- the next order entry
-
doPeek
protected static PromotionOrderEntry doPeek(SessionContext ctx, java.util.List<PromotionOrderEntry> workingEntries)
-
getOrderEntries
protected java.util.List<PromotionOrderEntry> getOrderEntries()
-
getPromotion
protected AbstractPromotion getPromotion()
-
-