Class PromotionRulePrepareInterceptor
- java.lang.Object
-
- de.hybris.platform.promotionengineservices.interceptors.PromotionRulePrepareInterceptor
-
- All Implemented Interfaces:
Interceptor,PrepareInterceptor<AbstractRuleEngineRuleModel>
public class PromotionRulePrepareInterceptor extends java.lang.Object implements PrepareInterceptor<AbstractRuleEngineRuleModel>
A prepare interceptor for AbstractRuleEngineRuleModel which creates a RuleBasedPromotion for the rule, if it doesn't already exist. For existingRuleBasedPromotions the interceptor also updates the theAbstractRuleEngineRuleModel.getMessageFired().
-
-
Constructor Summary
Constructors Constructor Description PromotionRulePrepareInterceptor()
-
Method Summary
-
-
-
Method Detail
-
onPrepare
public void onPrepare(AbstractRuleEngineRuleModel model, InterceptorContext context) throws InterceptorException
Description copied from interface:PrepareInterceptorCalled in themodelService.saveAll()method. Prepares the values of the given model.- Specified by:
onPreparein interfacePrepareInterceptor<AbstractRuleEngineRuleModel>- Parameters:
model- the model which values has to be preparedcontext- theInterceptorContext- Throws:
InterceptorException- if an error occured during the preparation
-
doOnPrepare
protected void doOnPrepare(AbstractRuleEngineRuleModel model, InterceptorContext context)
-
createNewPromotionAndAddToRuleModel
protected RuleBasedPromotionModel createNewPromotionAndAddToRuleModel(AbstractRuleEngineRuleModel ruleModel)
-
setLocalizedMessageFired
protected boolean setLocalizedMessageFired(AbstractRuleEngineRuleModel engineRule, RuleBasedPromotionModel promotion)
Copies attributemessageFiredfor all locales from given AbstractRuleEngineRuleModel to given RuleBasedPromotionModel.- Parameters:
engineRule- AbstractRuleEngineRuleModel to copy messageFired frompromotion- RuleBasedPromotionModel to update it's messageFired- Returns:
- true if the promotion has been modified (i.e. the messageFired attribute has been modified in at least one language), otherwise false
-
setLocalizedDescription
protected void setLocalizedDescription(AbstractRuleModel rule, RuleBasedPromotionModel promotion)
Copies attributenamefor all locals from given AbstractRuleModel to thepromotionDescriptionof given RuleBasedPromotionModel.- Parameters:
rule- AbstractRuleModel to copy name frompromotion- RuleBasedPromotionModel to update it's promotionDescription
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getCommonI18NService
protected CommonI18NService getCommonI18NService()
-
setCommonI18NService
public void setCommonI18NService(CommonI18NService commonI18NService)
-
getRuleCompilerContextFactory
protected RuleCompilerContextFactory<DefaultRuleCompilerContext> getRuleCompilerContextFactory()
-
setRuleCompilerContextFactory
public void setRuleCompilerContextFactory(RuleCompilerContextFactory<DefaultRuleCompilerContext> ruleCompilerContextFactory)
-
getRuleDao
protected RuleDao getRuleDao()
-
setRuleDao
public void setRuleDao(RuleDao ruleDao)
-
-