Class DefaultRuleMaintenanceService
java.lang.Object
de.hybris.platform.ruleengineservices.maintenance.impl.DefaultRuleMaintenanceService
- All Implemented Interfaces:
RuleMaintenanceService
Default implementation of
RuleMaintenanceService-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends SourceRuleModel>
RuleCompilerPublisherResultcompileAndPublishRules(List<T> rules, String moduleName, boolean enableIncrementalUpdate) Compiles and publishes rulesprotected <T extends SourceRuleModel>
RuleCompilerPublisherResultcompileAndPublishRules(List<T> rules, String moduleName, boolean enableIncrementalUpdate, boolean blocking) protected <T extends SourceRuleModel>
RuleCompilerPublisherResultcompileAndPublishRules(List<T> rules, String moduleName, boolean enableIncrementalUpdate, CronJobProgressTracker cronJobProgressTracker, boolean blocking) <T extends SourceRuleModel>
RuleCompilerPublisherResultcompileAndPublishRulesWithBlocking(List<T> rules, String moduleName, boolean enableIncrementalUpdate) Compiles and publishes rules with blocking on initialization<T extends SourceRuleModel>
RuleCompilerPublisherResultcompileAndPublishRulesWithBlocking(List<T> rules, String moduleName, boolean enableIncrementalUpdate, CronJobProgressTracker cronJobProgressTracker) Compiles and publishes rules with blocking on initializationprotected <T extends SourceRuleModel>
RuleCompilerTaskResultcompileRules(List<T> rules, String moduleName) protected ExecutionContextcreateExecutionContext(RuleCompilerTaskResult ruleCompilerTaskResult) protected <S extends SourceRuleModel>
Map<S,DroolsRuleModel> getDeployedRules(DroolsKIEModuleModel module) Given the rule engine module get the map of source rules to deployed drools rulesprotected EngineRuleDaoprotected EngineRulesRepositoryprotected EventServiceprotected ModelServiceprotected RuleCompilationContextProviderprotected RuleEngineServiceprotected RulePublishRestrictionprotected GuardedSuspension<String>protected RuleServiceprotected DroolsKIEModuleModelgetRulesModuleByName(String moduleName) protected RulesModuleDaoprotected RulesModuleResolverprotected <S extends SourceRuleModel>
Map<String,S> getSourceRulesByName(Collection<S> sourceRules) Maps provided collection of source rules to their namesinitializeAllModules(boolean enableIncrementalUpdate) Publish/re-publish drools rules for a all available modulesinitializeModule(String moduleName, boolean enableIncrementalUpdate) Publish/re-publish drools rules for a specific moduleprotected <S extends SourceRuleModel>
booleanisSourceRuleDeployed(Map<String, S> deployedRulesMap, SourceRuleModel sourceRule) Given the map of deployed source rules, verify whether the provided rule instance makes part of itprotected voidlogCompilerErrors(RuleCompilerTaskResult ruleCompilerTaskResult) protected voidonCompileErrorCleanup(RuleCompilerTaskResult result, String moduleName) voidsetEngineRuleDao(EngineRuleDao engineRuleDao) voidsetEngineRulesRepository(EngineRulesRepository engineRulesRepository) voidsetEventService(EventService eventService) voidsetModelService(ModelService modelService) voidsetRuleCompilationContextProvider(RuleCompilationContextProvider ruleCompilationContextProvider) voidsetRuleEngineService(RuleEngineService ruleEngineService) voidsetRulePublishRestriction(RulePublishRestriction rulePublishRestriction) voidsetRulesCompilationGuardedSuspension(GuardedSuspension<String> rulesCompilationGuardedSuspension) voidsetRuleService(RuleService ruleService) voidsetRulesModuleDao(RulesModuleDao rulesModuleDao) voidsetRulesModuleResolver(RulesModuleResolver rulesModuleResolver) synchronizeModules(String sourceModuleName, String targetModuleName) Synchronize the deployed rules between two modules.<T extends SourceRuleModel>
Optional<RuleCompilerPublisherResult>undeployRules(List<T> rules, String moduleName) "Undeploy" (deactivate) the rules in the rule engineprotected voidupdateCronJobTracker(CronJobProgressTracker tracker, int itemsTotal, int itemsProcessed)
-
Constructor Details
-
DefaultRuleMaintenanceService
public DefaultRuleMaintenanceService()
-
-
Method Details
-
compileAndPublishRulesWithBlocking
public <T extends SourceRuleModel> RuleCompilerPublisherResult compileAndPublishRulesWithBlocking(List<T> rules, String moduleName, boolean enableIncrementalUpdate) Description copied from interface:RuleMaintenanceServiceCompiles and publishes rules with blocking on initialization- Specified by:
compileAndPublishRulesWithBlockingin interfaceRuleMaintenanceService- Parameters:
rules- - list of rules to compile and publishmoduleName- Rules module nameenableIncrementalUpdate- flag, if true, enables for incremental updates of the rule engine kie module- Returns:
- instance of
RuleCompilerPublisherResultcontaining the status of rules compilation and publication
-
compileAndPublishRulesWithBlocking
public <T extends SourceRuleModel> RuleCompilerPublisherResult compileAndPublishRulesWithBlocking(List<T> rules, String moduleName, boolean enableIncrementalUpdate, CronJobProgressTracker cronJobProgressTracker) Description copied from interface:RuleMaintenanceServiceCompiles and publishes rules with blocking on initialization- Specified by:
compileAndPublishRulesWithBlockingin interfaceRuleMaintenanceService- Parameters:
rules- - list of rules to compile and publishmoduleName- Rules module nameenableIncrementalUpdate- flag, if true, enables for incremental updates of the rule engine kie modulecronJobProgressTracker- instance ofCronJobProgressTrackerused by cron job framework to track the job execution- Returns:
- instance of
RuleCompilerPublisherResultcontaining the status of rules compilation and publication
-
compileAndPublishRules
public <T extends SourceRuleModel> RuleCompilerPublisherResult compileAndPublishRules(List<T> rules, String moduleName, boolean enableIncrementalUpdate) Description copied from interface:RuleMaintenanceServiceCompiles and publishes rules- Specified by:
compileAndPublishRulesin interfaceRuleMaintenanceService- Parameters:
rules- - list of rules to compile and publishmoduleName- Rules module nameenableIncrementalUpdate- flag, if true, enables for incremental updates of the rule engine kie module- Returns:
- instance of
RuleCompilerPublisherResultcontaining the status of rules compilation and publication
-
initializeModule
public RuleCompilerPublisherResult initializeModule(String moduleName, boolean enableIncrementalUpdate) Description copied from interface:RuleMaintenanceServicePublish/re-publish drools rules for a specific module- Specified by:
initializeModulein interfaceRuleMaintenanceService- Parameters:
moduleName- Rules module name to publish the rules forenableIncrementalUpdate- flag, if true, enables for incremental updates of the rule engine kie module- Returns:
- instance of
RuleCompilerPublisherResultcontaining the status of rules compilation and publication
-
initializeAllModules
Description copied from interface:RuleMaintenanceServicePublish/re-publish drools rules for a all available modules- Specified by:
initializeAllModulesin interfaceRuleMaintenanceService- Parameters:
enableIncrementalUpdate- flag, if true, enables for incremental updates of the rule engine kie module- Returns:
- instance of
RuleCompilerPublisherResultcontaining the status of rules compilation and publication
-
undeployRules
public <T extends SourceRuleModel> Optional<RuleCompilerPublisherResult> undeployRules(List<T> rules, String moduleName) Description copied from interface:RuleMaintenanceService"Undeploy" (deactivate) the rules in the rule engine- Specified by:
undeployRulesin interfaceRuleMaintenanceService- Type Parameters:
T- type of theSourceRuleModel- Parameters:
rules- instances ofSourceRuleModelto undeploy from module if they were deployedmoduleName- the name of the rules module to undeploy the rules from- Returns:
- Optional of
RuleCompilerPublisherResultcontaining the status of rules compilation and publication
-
synchronizeModules
public Optional<RuleCompilerPublisherResult> synchronizeModules(String sourceModuleName, String targetModuleName) Description copied from interface:RuleMaintenanceServiceSynchronize the deployed rules between two modules. The result after synchronisation should be a complete alignment of source rules (including their versions) deployed for target module with those deployed for source module- Specified by:
synchronizeModulesin interfaceRuleMaintenanceService- Parameters:
sourceModuleName- The name of the module to be used as a source for synchronisationtargetModuleName- The name of the module to be used as a target for synchronisation- Returns:
- Optional of
RuleCompilerPublisherResultcontaining the status of rules compilation and publication for target module
-
isSourceRuleDeployed
protected <S extends SourceRuleModel> boolean isSourceRuleDeployed(Map<String, S> deployedRulesMap, SourceRuleModel sourceRule) Given the map of deployed source rules, verify whether the provided rule instance makes part of it- Type Parameters:
S- type of the source rule- Parameters:
deployedRulesMap- map of deployed source rules (by name)sourceRule- source rule instance to check- Returns:
- true if the provided source rule instance makes part of deployed rules. False otherwise
-
getSourceRulesByName
Maps provided collection of source rules to their names- Type Parameters:
S- generic type of source rules- Parameters:
sourceRules- collection of source rules to map- Returns:
- map of source rules by code
-
getDeployedRules
protected <S extends SourceRuleModel> Map<S,DroolsRuleModel> getDeployedRules(DroolsKIEModuleModel module) Given the rule engine module get the map of source rules to deployed drools rules- Type Parameters:
S- generic type of source rules- Parameters:
module- instance ofDroolsKIEModuleModelto find a map for- Returns:
- map of deployed drools rule by corresponding source rule
-
compileAndPublishRules
protected <T extends SourceRuleModel> RuleCompilerPublisherResult compileAndPublishRules(List<T> rules, String moduleName, boolean enableIncrementalUpdate, boolean blocking) -
compileAndPublishRules
protected <T extends SourceRuleModel> RuleCompilerPublisherResult compileAndPublishRules(List<T> rules, String moduleName, boolean enableIncrementalUpdate, CronJobProgressTracker cronJobProgressTracker, boolean blocking) -
onCompileErrorCleanup
-
createExecutionContext
-
updateCronJobTracker
protected void updateCronJobTracker(CronJobProgressTracker tracker, int itemsTotal, int itemsProcessed) -
compileRules
protected <T extends SourceRuleModel> RuleCompilerTaskResult compileRules(List<T> rules, String moduleName) -
getRulesModuleByName
-
logCompilerErrors
-
getModelService
-
setModelService
-
getRuleEngineService
-
setRuleEngineService
-
getRulesModuleDao
-
setRulesModuleDao
-
getRuleService
-
setRuleService
-
getRuleCompilationContextProvider
-
setRuleCompilationContextProvider
public void setRuleCompilationContextProvider(RuleCompilationContextProvider ruleCompilationContextProvider) -
getRulesModuleResolver
-
setRulesModuleResolver
-
getRulesCompilationGuardedSuspension
-
setRulesCompilationGuardedSuspension
public void setRulesCompilationGuardedSuspension(GuardedSuspension<String> rulesCompilationGuardedSuspension) -
getEngineRulesRepository
-
setEngineRulesRepository
-
getEventService
-
setEventService
-
getEngineRuleDao
-
setEngineRuleDao
-
setRulePublishRestriction
-
getRulePublishRestriction
-