java.lang.Object
de.hybris.platform.promotionengineservices.action.impl.AbstractRuleActionStrategy<A>
All Implemented Interfaces:
RuleActionStrategy, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware
Direct Known Subclasses:
DefaultAddCouponActionStrategy, DefaultAddProductToCartActionStrategy, DefaultOrderAdjustTotalActionStrategy, DefaultOrderEntryAdjustActionStrategy, DefaultPotentialPromotionMessageActionStrategy, DefaultShippingActionStrategy

public abstract class AbstractRuleActionStrategy<A extends AbstractRuleBasedPromotionActionModel> extends Object implements RuleActionStrategy, org.springframework.beans.factory.BeanNameAware
Abstract base class for Rule Action Strategy.
  • Constructor Details

    • AbstractRuleActionStrategy

      public AbstractRuleActionStrategy()
  • Method Details

    • createPromotionAction

      protected A createPromotionAction(PromotionResultModel promotionResult, AbstractRuleActionRAO action)
      Creates an instance of the configured promotionAction (which is a subtype of RuleBasedPromotionActionModel, sets a new unique UUID, sets this strategy's id, marks the action as applied, attaches the given promotionResult and tries to lookup the rule which created the given AbstractRuleActionRAO. Note: the action is created through the modelService, but it is not saved.
      Parameters:
      promotionResult - the promotionResult that the to-be-created promotion action belongs to
      action - the action rao
      Returns:
      the newly created instance
    • handleActionMetadata

      protected void handleActionMetadata(AbstractRuleActionRAO action, AbstractRuleBasedPromotionActionModel actionModel)
    • handleUndoActionMetadata

      protected void handleUndoActionMetadata(AbstractRuleBasedPromotionActionModel action)
    • getMetadataHandlers

      protected List<RuleActionMetadataHandler> getMetadataHandlers(String mdKey)
    • undoInternal

      protected AbstractOrderModel undoInternal(A action)
      removes the given action (if it is not already removed), its associated DiscountValues and its PromotionResult (if the PromotionResult has no other actions associated with it).
      Parameters:
      action - the action to undo
      Returns:
      the action's associated order (or null if the action is already removed)
    • recalculateIfNeeded

      protected boolean recalculateIfNeeded(AbstractOrderModel order)
      recalculates the given order if the #forceImmediateRecalculation flag is set to true.
      Parameters:
      order - the order to recalculate
      Returns:
      false if the recalculation failed, otherwise true
    • getExtendedOrderDao

      protected ExtendedOrderDao getExtendedOrderDao()
    • setExtendedOrderDao

      public void setExtendedOrderDao(ExtendedOrderDao extendedOrderDao)
    • getModelService

      protected ModelService getModelService()
    • setModelService

      public void setModelService(ModelService modelService)
    • getPromotionAction

      protected Class<A> getPromotionAction()
    • setPromotionAction

      public void setPromotionAction(Class<A> promotionAction)
    • getPromotionActionService

      protected PromotionActionService getPromotionActionService()
    • setPromotionActionService

      public void setPromotionActionService(PromotionActionService promotionActionService)
    • getForceImmediateRecalculation

      protected Boolean getForceImmediateRecalculation()
    • setForceImmediateRecalculation

      public void setForceImmediateRecalculation(Boolean forceImmediateRecalculation)
    • getCalculationService

      protected CalculationService getCalculationService()
    • setCalculationService

      public void setCalculationService(CalculationService calculationService)
    • setBeanName

      public void setBeanName(String beanName)
      Specified by:
      setBeanName in interface org.springframework.beans.factory.BeanNameAware
    • getStrategyId

      public String getStrategyId()
      Description copied from interface: RuleActionStrategy
      Returns this strategy's unique Id
      Specified by:
      getStrategyId in interface RuleActionStrategy<A extends AbstractRuleBasedPromotionActionModel>
      Returns:
      the strategy's Id
    • getRuleActionMetadataHandlers

      protected Map<String,List<RuleActionMetadataHandler>> getRuleActionMetadataHandlers()
    • setRuleActionMetadataHandlers

      public void setRuleActionMetadataHandlers(Map<String,List<RuleActionMetadataHandler>> ruleActionMetadataHandlers)
    • getPromotionResultUtils

      protected PromotionResultUtils getPromotionResultUtils()
    • setPromotionResultUtils

      public void setPromotionResultUtils(PromotionResultUtils promotionResultUtils)
    • getActionUtils

      protected ActionUtils getActionUtils()
    • setActionUtils

      public void setActionUtils(ActionUtils actionUtils)
    • getDefaultRuleMetadataKeys

      protected Collection<String> getDefaultRuleMetadataKeys()
    • setDefaultRuleMetadataKeys

      public void setDefaultRuleMetadataKeys(Collection<String> defaultRuleMetadataKeys)