Class AbstractRuleActionStrategy<A extends AbstractRuleBasedPromotionActionModel>

    • Constructor Detail

      • AbstractRuleActionStrategy

        public AbstractRuleActionStrategy()
    • Method Detail

      • 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
      • 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
      • setExtendedOrderDao

        public void setExtendedOrderDao​(ExtendedOrderDao extendedOrderDao)
      • getModelService

        protected ModelService getModelService()
      • setModelService

        public void setModelService​(ModelService modelService)
      • getPromotionAction

        protected java.lang.Class<A> getPromotionAction()
      • setPromotionAction

        public void setPromotionAction​(java.lang.Class<A> promotionAction)
      • setPromotionActionService

        public void setPromotionActionService​(PromotionActionService promotionActionService)
      • getForceImmediateRecalculation

        protected java.lang.Boolean getForceImmediateRecalculation()
      • setForceImmediateRecalculation

        public void setForceImmediateRecalculation​(java.lang.Boolean forceImmediateRecalculation)
      • setCalculationService

        public void setCalculationService​(CalculationService calculationService)
      • setBeanName

        public void setBeanName​(java.lang.String beanName)
        Specified by:
        setBeanName in interface org.springframework.beans.factory.BeanNameAware
      • getRuleActionMetadataHandlers

        protected java.util.Map<java.lang.String,​java.util.List<RuleActionMetadataHandler>> getRuleActionMetadataHandlers()
      • setRuleActionMetadataHandlers

        public void setRuleActionMetadataHandlers​(java.util.Map<java.lang.String,​java.util.List<RuleActionMetadataHandler>> ruleActionMetadataHandlers)
      • setPromotionResultUtils

        public void setPromotionResultUtils​(PromotionResultUtils promotionResultUtils)
      • getActionUtils

        protected ActionUtils getActionUtils()
      • setActionUtils

        public void setActionUtils​(ActionUtils actionUtils)