Class AbstractRuleActionStrategy<A extends AbstractRuleBasedPromotionActionModel>
- 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 java.lang.Object implements RuleActionStrategy, org.springframework.beans.factory.BeanNameAware
Abstract base class for Rule Action Strategy.
-
-
Constructor Summary
Constructors Constructor Description AbstractRuleActionStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AcreatePromotionAction(PromotionResultModel promotionResult, AbstractRuleActionRAO action)Creates an instance of the configuredpromotionAction(which is a subtype ofRuleBasedPromotionActionModel, sets a new unique UUID, sets this strategy's id, marks the action as applied, attaches the givenpromotionResultand tries to lookup the rule which created the givenAbstractRuleActionRAO.protected ActionUtilsgetActionUtils()protected CalculationServicegetCalculationService()protected ExtendedOrderDaogetExtendedOrderDao()protected java.lang.BooleangetForceImmediateRecalculation()protected java.util.List<RuleActionMetadataHandler>getMetadataHandlers(java.lang.String mdKey)protected ModelServicegetModelService()protected java.lang.Class<A>getPromotionAction()protected PromotionActionServicegetPromotionActionService()protected PromotionResultUtilsgetPromotionResultUtils()protected java.util.Map<java.lang.String,java.util.List<RuleActionMetadataHandler>>getRuleActionMetadataHandlers()java.lang.StringgetStrategyId()Returns this strategy's unique Idprotected voidhandleActionMetadata(AbstractRuleActionRAO action, AbstractRuleBasedPromotionActionModel actionModel)protected voidhandleUndoActionMetadata(AbstractRuleBasedPromotionActionModel action)protected booleanrecalculateIfNeeded(AbstractOrderModel order)recalculates the givenorderif the#forceImmediateRecalculationflag is set totrue.voidsetActionUtils(ActionUtils actionUtils)voidsetBeanName(java.lang.String beanName)voidsetCalculationService(CalculationService calculationService)voidsetExtendedOrderDao(ExtendedOrderDao extendedOrderDao)voidsetForceImmediateRecalculation(java.lang.Boolean forceImmediateRecalculation)voidsetModelService(ModelService modelService)voidsetPromotionAction(java.lang.Class<A> promotionAction)voidsetPromotionActionService(PromotionActionService promotionActionService)voidsetPromotionResultUtils(PromotionResultUtils promotionResultUtils)voidsetRuleActionMetadataHandlers(java.util.Map<java.lang.String,java.util.List<RuleActionMetadataHandler>> ruleActionMetadataHandlers)protected AbstractOrderModelundoInternal(A action)removes the givenaction(if it is not already removed), its associated DiscountValues and its PromotionResult (if the PromotionResult has no other actions associated with it).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.ruleengineservices.action.RuleActionStrategy
apply, undo
-
-
-
-
Method Detail
-
createPromotionAction
protected A createPromotionAction(PromotionResultModel promotionResult, AbstractRuleActionRAO action)
Creates an instance of the configuredpromotionAction(which is a subtype ofRuleBasedPromotionActionModel, sets a new unique UUID, sets this strategy's id, marks the action as applied, attaches the givenpromotionResultand tries to lookup the rule which created the givenAbstractRuleActionRAO. Note: the action is created through themodelService, but it is not saved.- Parameters:
promotionResult- the promotionResult that the to-be-created promotion action belongs toaction- the action rao- Returns:
- the newly created instance
-
handleActionMetadata
protected void handleActionMetadata(AbstractRuleActionRAO action, AbstractRuleBasedPromotionActionModel actionModel)
-
handleUndoActionMetadata
protected void handleUndoActionMetadata(AbstractRuleBasedPromotionActionModel action)
-
getMetadataHandlers
protected java.util.List<RuleActionMetadataHandler> getMetadataHandlers(java.lang.String mdKey)
-
undoInternal
protected AbstractOrderModel undoInternal(A action)
removes the givenaction(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 givenorderif the#forceImmediateRecalculationflag is set totrue.- 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 java.lang.Class<A> getPromotionAction()
-
setPromotionAction
public void setPromotionAction(java.lang.Class<A> promotionAction)
-
getPromotionActionService
protected PromotionActionService getPromotionActionService()
-
setPromotionActionService
public void setPromotionActionService(PromotionActionService promotionActionService)
-
getForceImmediateRecalculation
protected java.lang.Boolean getForceImmediateRecalculation()
-
setForceImmediateRecalculation
public void setForceImmediateRecalculation(java.lang.Boolean forceImmediateRecalculation)
-
getCalculationService
protected CalculationService getCalculationService()
-
setCalculationService
public void setCalculationService(CalculationService calculationService)
-
setBeanName
public void setBeanName(java.lang.String beanName)
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
getStrategyId
public java.lang.String getStrategyId()
Description copied from interface:RuleActionStrategyReturns this strategy's unique Id- Specified by:
getStrategyIdin interfaceRuleActionStrategy<A extends AbstractRuleBasedPromotionActionModel>- Returns:
- the strategy's Id
-
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)
-
getPromotionResultUtils
protected PromotionResultUtils getPromotionResultUtils()
-
setPromotionResultUtils
public void setPromotionResultUtils(PromotionResultUtils promotionResultUtils)
-
getActionUtils
protected ActionUtils getActionUtils()
-
setActionUtils
public void setActionUtils(ActionUtils actionUtils)
-
-