Class PromotionOrderResults

java.lang.Object
de.hybris.platform.promotions.result.PromotionOrderResults

public class PromotionOrderResults extends Object
An object representing the results of evaluating promotions on an AbstractOrder. This object holds details of each promotion that fired, and the OrderEntry objects that it fired on, and details of all other OrderEntry objects, indicating if they could be part of a potential promotion. A PromotionResult object represents the state of any promotion that fired or potentially fired.
  • Constructor Details

    • PromotionOrderResults

      public PromotionOrderResults(SessionContext ctx, AbstractOrder order, List<PromotionResult> promotionResults, double changeFromLastResults)
      Constructor.
      Parameters:
      ctx - The hybris context
      order - The order
      promotionResults - The promotion results
      changeFromLastResults - The change from last results
  • Method Details

    • invalidateCache

      public void invalidateCache()
      Invalidate all cached data held in this PromotionOrderResults instance. This method should be called if any of the PromotionResults are applied or unapplied.
    • getTotalChangeFromLastResults

      public double getTotalChangeFromLastResults()
      Return the total change since the last evaluation of results.
      Returns:
      A double representing the calculation newTotalValueOfDiscounts - oldTotalValueOfDiscounts
    • getAllResults

      public List<PromotionResult> getAllResults()
      Returns all PromotionResult objects. This list will include all promotions that either fired or identified themselves as potentially firing.
      Returns:
      The list of promotion results
    • getAllProductPromotions

      public List<PromotionResult> getAllProductPromotions()
      Return a list of results for promotions that consumed products. This list will include all promotions that consumed products regardless of their firing status.
      Returns:
      The list of promotion results
    • getFiredProductPromotions

      public List<PromotionResult> getFiredProductPromotions()
      Return a list of results for promotions that fired and consumed products.
      Returns:
      A list of the results of product promotions that fired
    • getAppliedProductPromotions

      public List<PromotionResult> getAppliedProductPromotions()
      Return a list of results for promotions that fired and consumed products and have been applied.
      Returns:
      A list of the results of product promotions that fired and applied
    • getPotentialProductPromotions

      public List<PromotionResult> getPotentialProductPromotions()
      Return a list of results for promotions that fired and consumed products and have been applied.
      Returns:
      A list of the results of product promotions that fired and applied
    • getAllOrderPromotions

      public List<PromotionResult> getAllOrderPromotions()
      Return a list of results for promotions that did not consume products. This list will include all promotions that did not consume products regardless of their firing status
      Returns:
      The list of promotion results
    • getFiredOrderPromotions

      public List<PromotionResult> getFiredOrderPromotions()
      Return a list of results for promotions that fired and did not consume products.
      Returns:
      A list of the results of promotions that fired
    • getAppliedOrderPromotions

      public List<PromotionResult> getAppliedOrderPromotions()
      Return a list of results for promotions that fired and did not consume products and have been applied.
      Returns:
      A list of the results of promotions that fired and applied
    • getPotentialOrderPromotions

      public List<PromotionResult> getPotentialOrderPromotions()
      Return a list of results for promotions that fired and did not consume products and have been applied.
      Returns:
      A list of the results of order promotions that fired and applied
    • getPromotionResults

      Return a list of results for promotions that meet the specified criteria.
      Parameters:
      statusFlag - status criteria
      productsFlag - consumed products criteria
      Returns:
      a list of promotion results
    • getEntriesNotInPromotions

      public List<WrappedOrderEntry> getEntriesNotInPromotions()
      Return a list of WrappedOrderEntry objects that were not part of any any promotion that fired or could fire.
      Returns:
      a list of WrappedOrderEntry objects
    • getEntriesWithPotentialPromotions

      public List<WrappedOrderEntry> getEntriesWithPotentialPromotions()
      Return a list of WrappedOrderEntry objects that were part of any any promotion that could fire.
      Returns:
      a list of WrappedOrderEntry objects
    • getEntriesNotInFiredPromotions

      public List<WrappedOrderEntry> getEntriesNotInFiredPromotions()
      Return a list of WrappedOrderEntry objects that were not part of any any promotion that fired. The WrappedOrderEntry holds the promotions that could fire for the specified products. Note that the results returned from this method are the same as those from combining the results from methods getEntriesWithPotentialPromotions() and getEntriesNotInPromotions() but the WrappedOrderEntry objects may be consolidated together. In general it is preferable to call getEntriesWithPotentialPromotions() and getEntriesNotInPromotions() that than calling this method directly.
      Returns:
      a list of WrappedOrderEntry objects
    • getMaxConsumedQuantityForEntry

      protected static long getMaxConsumedQuantityForEntry(SessionContext ctx, List<PromotionResult> promotionResults, AbstractOrderEntry orderEntry)
    • getConsumedQuantityForEntry

      protected static long getConsumedQuantityForEntry(SessionContext ctx, PromotionResult result, AbstractOrderEntry orderEntry)
    • findAllMatchingEntries

      protected static Collection<WrappedOrderEntry> findAllMatchingEntries(SessionContext ctx, List<WrappedOrderEntry> wrappedEntries, Collection<PromotionOrderEntryConsumed> consumedEntries)
    • wrapEntries

      protected static List<WrappedOrderEntry> wrapEntries(SessionContext ctx, AbstractOrder order)
    • removeConsumedEntries

      protected static void removeConsumedEntries(SessionContext ctx, List<WrappedOrderEntry> wrappedEntries, Collection<PromotionOrderEntryConsumed> consumedEntries)
    • cleanWrappedEntryList

      protected static List<WrappedOrderEntry> cleanWrappedEntryList(SessionContext ctx, List<WrappedOrderEntry> wrappedEntries)