Class PromotionOrderView
java.lang.Object
de.hybris.platform.promotions.result.PromotionOrderView
A filtered view of the OrderEntries for a given order.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPromotionOrderView(AbstractPromotion promotion, List<PromotionOrderEntry> orderEntries) -
Method Summary
Modifier and TypeMethodDescriptionconsume(SessionContext ctx, long quantity) Consume a specific quantity of products from this view.consume(SessionContext ctx, Product product, long quantity) Consume products from this view.consumeFromHead(SessionContext ctx, Comparator<PromotionOrderEntry> comparator, long quantity) Consume products from this view in the specified order.consumeFromTail(SessionContext ctx, Comparator<PromotionOrderEntry> comparator, long quantity) Consume products from this view in the reverse of the specfied order.protected static List<PromotionOrderEntryConsumed>doConsume(SessionContext ctx, List<PromotionOrderEntry> workingEntries, AbstractPromotion promotion, long quantity) protected static PromotionOrderEntrydoPeek(SessionContext ctx, List<PromotionOrderEntry> workingEntries) Get all the entries in this view.Get all the entries in this view sorted by price.protected List<PromotionOrderEntry>protected AbstractPromotionlonggetQuantity(SessionContext ctx, Product product) Get the number of a single product remaining.longGet the total number of products remaining in this view.peek(SessionContext ctx) Look at the next promotion order entry from this view.peekFromHead(SessionContext ctx, Comparator<PromotionOrderEntry> comparator) Look at the next promotion order entry from this view in the order specified.peekFromTail(SessionContext ctx, Comparator<PromotionOrderEntry> comparator) Look at the next promotion order entry from this view in the reverse of the order specified.
-
Constructor Details
-
PromotionOrderView
-
-
Method Details
-
getTotalQuantity
Get the total number of products remaining in this view.- Parameters:
ctx- the hybris context- Returns:
- the number of products remaining
-
getQuantity
Get the number of a single product remaining.- Parameters:
ctx- the hybris contextproduct- the product- Returns:
- the quantity of the specified product remaining
-
consume
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 List<PromotionOrderEntryConsumed> consumeFromHead(SessionContext ctx, 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 List<PromotionOrderEntryConsumed> consumeFromTail(SessionContext ctx, 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 List<PromotionOrderEntryConsumed> doConsume(SessionContext ctx, List<PromotionOrderEntry> workingEntries, AbstractPromotion promotion, long quantity) -
consume
public 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
Get all the entries in this view.- Parameters:
ctx- the hybris context- Returns:
- the order entries
-
getAllEntriesByPrice
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, 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
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, 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, List<PromotionOrderEntry> workingEntries) -
getOrderEntries
-
getPromotion
-