Class DefaultRuleEngineSystemSetup
- java.lang.Object
-
- de.hybris.platform.servicelayer.event.impl.AbstractEventListener<AfterInitializationEndEvent>
-
- de.hybris.platform.ruleengineservices.maintenance.systemsetup.impl.DefaultRuleEngineSystemSetup
-
- All Implemented Interfaces:
RuleEngineSystemSetup,java.util.EventListener,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener<AfterInitializationEndEvent>
public class DefaultRuleEngineSystemSetup extends AbstractEventListener<AfterInitializationEndEvent> implements RuleEngineSystemSetup
The default implementation for RuleEngineSystemSetupService. This setup class allows to register source rules for deployment after system initialization.
-
-
Constructor Summary
Constructors Constructor Description DefaultRuleEngineSystemSetup()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T extends ItemModel>
java.util.List<T>convert(java.util.Set<PK> pks)converts the given set of PKs to source rule model objects.protected voiddoRuleDeployment(java.lang.String moduleName, java.util.List<SourceRuleModel> rules)protected booleanfailOnError()whether to fail on any error or ignore them (set viaruleengineservices.system.setup.failOnErrorsystem property, defaults to true.protected ConfigurationServicegetConfigurationService()protected java.lang.StringgetInitializationEventType(AfterInitializationEndEvent event)protected java.util.Map<java.lang.String,java.util.Set<PK>>getInitializationMap()protected ModelServicegetModelService()protected RuleEngineServicegetRuleEngineService()protected RuleMaintenanceServicegetRuleMaintenanceService()protected java.util.function.Predicate<SourceRuleModel>getSourceRuleModelValidator()<T extends AbstractRulesModule>
voidinitializeModule(T module)Performs initialization of the provided (jalo) rules module.protected voidonEvent(AfterInitializationEndEvent event)This method is called byApplicationListener.onApplicationEvent(ApplicationEvent)and processes the given event.voidregisterSourceRuleForDeployment(SourceRule sourceRule, java.lang.String... moduleNames)registers a (jalo) SourceRule to be compiled and deployed for the given moduleNames after the next initialization.voidregisterSourceRulesForDeployment(java.util.Collection<SourceRuleModel> sourceRules, java.util.Collection<java.lang.String> moduleNames)registers a collection of SourceRules to be compiled and deployed for the given moduleNames after the next initialization.voidsetConfigurationService(ConfigurationService configurationService)voidsetModelService(ModelService modelService)voidsetRuleEngineService(RuleEngineService ruleEngineService)voidsetRuleMaintenanceService(RuleMaintenanceService ruleMaintenanceService)voidsetSourceRuleModelValidator(java.util.function.Predicate<SourceRuleModel> sourceRuleModelValidator)protected <T extends ItemModel>
java.util.Optional<T>validateAndConvertFromJalo(PK pk)protected <T extends AbstractRulesModuleModel>
java.util.Optional<T>validateAndConvertFromJalo(AbstractRulesModule rulesModule)protected <T extends SourceRuleModel>
java.util.Optional<T>validateAndConvertFromJalo(SourceRule sourceRule)-
Methods inherited from class de.hybris.platform.servicelayer.event.impl.AbstractEventListener
afterPropertiesSet, onApplicationEvent, setApplicationContext, setClusterService, setTenantService
-
-
-
-
Method Detail
-
initializeModule
public <T extends AbstractRulesModule> void initializeModule(T module)
Description copied from interface:RuleEngineSystemSetupPerforms initialization of the provided (jalo) rules module. This method is intended to be used from within impex scripts.- Specified by:
initializeModulein interfaceRuleEngineSystemSetup- Parameters:
module- Jalo representation of rules module to be initialized
-
registerSourceRuleForDeployment
public void registerSourceRuleForDeployment(SourceRule sourceRule, java.lang.String... moduleNames)
Description copied from interface:RuleEngineSystemSetupregisters a (jalo) SourceRule to be compiled and deployed for the given moduleNames after the next initialization. This method is intended to be used from within impex scripts.- Specified by:
registerSourceRuleForDeploymentin interfaceRuleEngineSystemSetup- Parameters:
sourceRule- the source rule to be registered for deploymentmoduleNames- the target module(s) by name
-
registerSourceRulesForDeployment
public void registerSourceRulesForDeployment(java.util.Collection<SourceRuleModel> sourceRules, java.util.Collection<java.lang.String> moduleNames)
Description copied from interface:RuleEngineSystemSetupregisters a collection of SourceRules to be compiled and deployed for the given moduleNames after the next initialization. This call will register all given source rules for all given module names.- Specified by:
registerSourceRulesForDeploymentin interfaceRuleEngineSystemSetup- Parameters:
sourceRules- the source rules to be registered for deploymentmoduleNames- the target modules by name
-
onEvent
protected void onEvent(AfterInitializationEndEvent event)
Description copied from class:AbstractEventListenerThis method is called byApplicationListener.onApplicationEvent(ApplicationEvent)and processes the given event.- Specified by:
onEventin classAbstractEventListener<AfterInitializationEndEvent>- Parameters:
event- the event to be processed- See Also:
ApplicationListener.onApplicationEvent(ApplicationEvent)
-
doRuleDeployment
protected void doRuleDeployment(java.lang.String moduleName, java.util.List<SourceRuleModel> rules)
-
getInitializationEventType
protected java.lang.String getInitializationEventType(AfterInitializationEndEvent event)
-
validateAndConvertFromJalo
protected <T extends SourceRuleModel> java.util.Optional<T> validateAndConvertFromJalo(SourceRule sourceRule)
-
validateAndConvertFromJalo
protected <T extends AbstractRulesModuleModel> java.util.Optional<T> validateAndConvertFromJalo(AbstractRulesModule rulesModule)
-
validateAndConvertFromJalo
protected <T extends ItemModel> java.util.Optional<T> validateAndConvertFromJalo(PK pk)
-
failOnError
protected boolean failOnError()
whether to fail on any error or ignore them (set viaruleengineservices.system.setup.failOnErrorsystem property, defaults to true.- Returns:
- whether to fail on any error or not
-
convert
protected <T extends ItemModel> java.util.List<T> convert(java.util.Set<PK> pks)
converts the given set of PKs to source rule model objects.- Parameters:
pks- the set of pks- Returns:
- the list of source rule models
-
getInitializationMap
protected java.util.Map<java.lang.String,java.util.Set<PK>> getInitializationMap()
-
getRuleMaintenanceService
protected RuleMaintenanceService getRuleMaintenanceService()
-
setRuleMaintenanceService
public void setRuleMaintenanceService(RuleMaintenanceService ruleMaintenanceService)
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getConfigurationService
protected ConfigurationService getConfigurationService()
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
getSourceRuleModelValidator
protected java.util.function.Predicate<SourceRuleModel> getSourceRuleModelValidator()
-
setSourceRuleModelValidator
public void setSourceRuleModelValidator(java.util.function.Predicate<SourceRuleModel> sourceRuleModelValidator)
-
getRuleEngineService
protected RuleEngineService getRuleEngineService()
-
setRuleEngineService
public void setRuleEngineService(RuleEngineService ruleEngineService)
-
-