Class PromotionOrderAddFreeGiftAction

All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
GeneratedCachedPromotionOrderAddFreeGiftAction

public class PromotionOrderAddFreeGiftAction extends GeneratedPromotionOrderAddFreeGiftAction
PromotionOrderAddFreeGiftAction. Action that adds a specified product to the order as a give away item. Applying this action creates a new order entry for the free product with the quantity set to 1. This order entry is marked as a give away. Undoing this action removes the free product from the order.
See Also:
  • Constructor Details

    • PromotionOrderAddFreeGiftAction

      public PromotionOrderAddFreeGiftAction()
  • Method Details

    • apply

      public boolean apply(SessionContext ctx)
      Description copied from class: AbstractPromotionAction
      Apply the action to the order. Do not call AbstractOrder.recalculate() to update the totals as this disposes of all applied discounts and the promotions engine is unable to intercept the recalculate call to reinstate these.
      Specified by:
      apply in class AbstractPromotionAction
      Parameters:
      ctx - The hybris context
      Returns:
      true if discounts have been applied and calculateTotals needs to be called, false otherwise.
    • undo

      public boolean undo(SessionContext ctx)
      Description copied from class: AbstractPromotionAction
      Unapply the action from the order.
      Specified by:
      undo in class AbstractPromotionAction
      Parameters:
      ctx - The hybris context
      Returns:
      true if discounts have been removed and calculateTotals needs to be called, false otherwise.
    • isAppliedToOrder

      public boolean isAppliedToOrder(SessionContext ctx)
      Description copied from class: AbstractPromotionAction
      Test if this action is applied to the order.
      Specified by:
      isAppliedToOrder in class AbstractPromotionAction
      Parameters:
      ctx - The hybris context
      Returns:
      true if the action is applied, false otherwise.
    • getValue

      public double getValue(SessionContext ctx)
      Description copied from class: AbstractPromotionAction
      Get the total value of this action. For actions providing a discount this should be a positive value.
      Specified by:
      getValue in class AbstractPromotionAction
      Parameters:
      ctx - The hybris context
      Returns:
      The double value that is the value of this action
    • deepCloneAttributes

      protected void deepCloneAttributes(SessionContext ctx, Map values)
      Called to deep clone attributes of this instance

      The values map contains all the attributes defined on this instance. The map will be used to initialize a new instance of the Action that is a clone of this instance. This method can remove, replace or add to the Map of attributes.

      Overrides:
      deepCloneAttributes in class AbstractPromotionAction
      Parameters:
      ctx - The hybris context
      values - The map to write into