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 Object
implements RuleActionStrategy, org.springframework.beans.factory.BeanNameAware
Abstract base class for Rule Action Strategy.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 ActionUtilsprotected CalculationServiceprotected Collection<String>protected ExtendedOrderDaoprotected Booleanprotected List<RuleActionMetadataHandler>getMetadataHandlers(String mdKey) protected ModelServiceprotected PromotionActionServiceprotected PromotionResultUtilsprotected Map<String,List<RuleActionMetadataHandler>> Returns this strategy's unique Idprotected voidhandleActionMetadata(AbstractRuleActionRAO action, AbstractRuleBasedPromotionActionModel actionModel) protected voidprotected booleanrecalculates the givenorderif the#forceImmediateRecalculationflag is set totrue.voidsetActionUtils(ActionUtils actionUtils) voidsetBeanName(String beanName) voidsetCalculationService(CalculationService calculationService) voidsetDefaultRuleMetadataKeys(Collection<String> defaultRuleMetadataKeys) voidsetExtendedOrderDao(ExtendedOrderDao extendedOrderDao) voidsetForceImmediateRecalculation(Boolean forceImmediateRecalculation) voidsetModelService(ModelService modelService) voidsetPromotionAction(Class<A> promotionAction) voidsetPromotionActionService(PromotionActionService promotionActionService) voidsetPromotionResultUtils(PromotionResultUtils promotionResultUtils) voidsetRuleActionMetadataHandlers(Map<String, 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, waitMethods inherited from interface de.hybris.platform.ruleengineservices.action.RuleActionStrategy
apply, undo
-
Constructor Details
-
AbstractRuleActionStrategy
public AbstractRuleActionStrategy()
-
-
Method Details
-
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
-
getMetadataHandlers
-
undoInternal
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
recalculates the givenorderif the#forceImmediateRecalculationflag is set totrue.- Parameters:
order- the order to recalculate- Returns:
- false if the recalculation failed, otherwise true
-
getExtendedOrderDao
-
setExtendedOrderDao
-
getModelService
-
setModelService
-
getPromotionAction
-
setPromotionAction
-
getPromotionActionService
-
setPromotionActionService
-
getForceImmediateRecalculation
-
setForceImmediateRecalculation
-
getCalculationService
-
setCalculationService
-
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
getStrategyId
Description copied from interface:RuleActionStrategyReturns this strategy's unique Id- Specified by:
getStrategyIdin interfaceRuleActionStrategy<A extends AbstractRuleBasedPromotionActionModel>- Returns:
- the strategy's Id
-
getRuleActionMetadataHandlers
-
setRuleActionMetadataHandlers
public void setRuleActionMetadataHandlers(Map<String, List<RuleActionMetadataHandler>> ruleActionMetadataHandlers) -
getPromotionResultUtils
-
setPromotionResultUtils
-
getActionUtils
-
setActionUtils
-
getDefaultRuleMetadataKeys
-
setDefaultRuleMetadataKeys
-