Class PromotionOrderView


  • public class PromotionOrderView
    extends java.lang.Object
    A filtered view of the OrderEntries for a given order.
    • 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 context
        product - 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 context
        quantity - 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 context
        comparator - the comparator
        quantity - 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 context
        comparator - the comparator
        quantity - the quantity to consume
        Returns:
        a list of consumed order entries
      • consume

        public java.util.List<PromotionOrderEntryConsumed> consume​(SessionContext ctx,
                                                                   Product product,
                                                                   long quantity)
        Consume products from this view.
        Parameters:
        ctx - the hybris context
        product - the product type
        quantity - 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 context
        comparator - 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 context
        comparator - the comparator
        Returns:
        the next order entry