Class PromotionRulePrepareInterceptor
java.lang.Object
de.hybris.platform.promotionengineservices.interceptors.PromotionRulePrepareInterceptor
- All Implemented Interfaces:
Interceptor,PrepareInterceptor<AbstractRuleEngineRuleModel>
public class PromotionRulePrepareInterceptor
extends Object
implements PrepareInterceptor<AbstractRuleEngineRuleModel>
A prepare interceptor for AbstractRuleEngineRuleModel which creates a RuleBasedPromotion for the rule, if it doesn't
already exist. For existing
RuleBasedPromotions the interceptor also updates the the
AbstractRuleEngineRuleModel.getMessageFired().-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RuleBasedPromotionModelprotected voiddoOnPrepare(AbstractRuleEngineRuleModel model, InterceptorContext context) protected CommonI18NServiceprotected ModelServiceprotected RuleBasedPromotionModelprotected RuleDaovoidonPrepare(AbstractRuleEngineRuleModel model, InterceptorContext context) Called in themodelService.saveAll()method.voidsetCommonI18NService(CommonI18NService commonI18NService) protected booleansetLocalizedMessageFired(AbstractRuleEngineRuleModel engineRule, RuleBasedPromotionModel promotion) Copies attributemessageFiredfor all locales from given AbstractRuleEngineRuleModel to given RuleBasedPromotionModel.protected voidsetLocalizedValue(Consumer<Locale> consumer) voidsetModelService(ModelService modelService) voidsetRuleCompilerContextFactory(RuleCompilerContextFactory<DefaultRuleCompilerContext> ruleCompilerContextFactory) voidsetRuleDao(RuleDao ruleDao)
-
Constructor Details
-
PromotionRulePrepareInterceptor
public PromotionRulePrepareInterceptor()
-
-
Method Details
-
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
-
getRuleBasedPromotion
-
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
-
setLocalizedValue
-
getModelService
-
setModelService
-
getCommonI18NService
-
setCommonI18NService
-
getRuleCompilerContextFactory
-
setRuleCompilerContextFactory
public void setRuleCompilerContextFactory(RuleCompilerContextFactory<DefaultRuleCompilerContext> ruleCompilerContextFactory) -
getRuleDao
-
setRuleDao
-