public class DefaultPlatformRuleEngineService extends Object implements RuleEngineService
| Constructor and Description |
|---|
DefaultPlatformRuleEngineService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addKieBaseModel(KieModuleModel module,
KieFileSystem kfs,
DroolsKIEBaseModel base)
Creates a new kie base from the given
module based on the given base. |
protected void |
addKieSessionModel(KieBaseModel base,
DroolsKIESessionModel session)
Creates a new kie session from the given
base based on the given session. |
protected void |
addRules(KieBaseModel kieBaseModel,
KieFileSystem kfs,
DroolsKIEBaseModel base)
Adds the given
base's rules to the given kfs. |
RuleEngineActionResult |
archiveRule(AbstractRuleEngineRuleModel ruleEngineRule)
Archives the given rule if it already exists.
|
RuleEngineActionResult |
archiveRule(AbstractRuleEngineRuleModel ruleEngineRule,
AbstractRulesModuleModel rulesModule)
Archives the given rule if it already exists.
|
protected MessageLevel |
convertLevel(Level level)
converts a drools message
Level to a MessageLevel. |
protected KieModule |
createKieModule(DroolsKIEModuleModel module,
RuleEngineActionResult result)
Creates a
KieModule based on the given DroolsKIEModuleModel object. |
protected RuleEngineActionResult |
createRuleEngineActionResult(String message,
String moduleName,
boolean success,
MessageLevel level)
creates a RuleEngineActionResult object with the given parameters.
|
protected RuleExecutionCountListener |
createRuleExecutionCounterListener() |
RuleEvaluationResult |
evaluate(RuleEvaluationContext context)
Executes rule evaluation for given RuleEvaluationContext.
|
protected ConfigurationService |
getConfigurationService() |
protected DroolsKIEBaseFinderStrategy |
getDroolsKIEBaseFinderStrategy() |
protected EngineRuleDao |
getEngineRuleDao() |
protected EqualityBehaviorOption |
getEqualityBehaviorOption(DroolsEqualityBehavior behavior)
converts between hybris and drools equality behavior
|
protected EventProcessingOption |
getEventProcessingOption(DroolsEventProcessingMode eventProcessingMode)
converts between hybris and drools event processing mode
|
protected EventService |
getEventService() |
protected KieServices |
getKieServices() |
protected ModelService |
getModelService() |
protected Lock |
getReadLock() |
protected ReadWriteLock |
getReadWriteLock() |
protected ReleaseId |
getReleaseId(DroolsKIEModuleModel module)
creates a ReleaseId based on the given module
|
Class<? extends RuleExecutionCountListener> |
getRuleExecutionCounterClass() |
AbstractRuleEngineRuleModel |
getRuleForCode(String code)
Finds AbstractRuleEngineRuleModel for given code.
|
AbstractRuleEngineRuleModel |
getRuleForUuid(String uuid)
Finds AbstractRuleEngineRuleModel for given uuid.
|
protected RuleModuleFinderStrategy |
getRuleModuleFinderStrategy() |
AbstractRulesModuleModel |
getRuleModuleForRule(AbstractRuleEngineRuleModel rule)
Finds AbstractRulesModuleModel by corresponding AbstractRuleEngineRuleModel.
|
protected RulesModuleDao |
getRulesModuleDao() |
protected KieSessionType |
getSessionType(DroolsSessionType sessionType)
converts between hybris and drools session type
|
protected Lock |
getWriteLock() |
RuleEngineActionResult |
initialize(AbstractRulesModuleModel module)
Initializes the given rules module and propagates a
RuleEngineInitializedEvent to other nodes. |
RuleEngineActionResult |
initialize(AbstractRulesModuleModel abstractModule,
boolean propagateToOtherNodes)
Initializes the given rules module (and if
propagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes). |
List<RuleEngineActionResult> |
initializeAllRulesModules()
Initializes all
AbstractRulesModuleModels that are marked as active (in case of cluster mode - on all the
nodes). |
List<RuleEngineActionResult> |
initializeAllRulesModules(boolean propagateToOtherNodes)
Initializes all
AbstractRulesModuleModels that are marked as active. |
protected boolean |
isRuleEngineActive() |
protected boolean |
isSessionStateless(DroolsRuleEngineContextModel ruleEngineContext)
Determine if the current RuleEngineContext's KieSession is Stateless.
|
void |
setConfigurationService(ConfigurationService configurationService) |
void |
setDroolsKIEBaseFinderStrategy(DroolsKIEBaseFinderStrategy droolsKIEBaseFinderStrategy) |
void |
setEngineRuleDao(EngineRuleDao engineRuleDao) |
void |
setEventService(EventService eventService) |
protected void |
setKieServices(KieServices kieServices) |
void |
setModelService(ModelService modelService) |
void |
setRuleExecutionCounterClass(Class<? extends RuleExecutionCountListener> ruleExecutionCounterClass) |
void |
setRuleModuleFinderStrategy(RuleModuleFinderStrategy ruleModuleFinderStrategy) |
void |
setRulesModuleDao(RulesModuleDao rulesModuleDao) |
void |
setup()
The method is used to set the date format and KIEServices before the class is put into service(dependency
injection).
|
void |
setUpKieServices()
The method is used to set KIEServices.
|
protected ExecutionResultImpl |
tryExecution(StatelessKieSession session,
Command command,
int currentAttempt)
Deprecated.
do not use, this method is subject to change without further notice.
|
RuleEngineActionResult |
updateEngineRule(AbstractRuleEngineRuleModel ruleEngineRule)
Updates the given rule if it already exists and returns true if update was successful.
|
RuleEngineActionResult |
updateEngineRule(AbstractRuleEngineRuleModel ruleEngineRule,
AbstractRulesModuleModel rulesModule)
Updates the given rule if it already exists.
|
protected void |
writeKModuleXML(KieModuleModel module,
KieFileSystem kfs)
writes the given
module to the given kfs file system. |
protected void |
writePomXML(DroolsKIEModuleModel module,
KieFileSystem kfs)
writes the given
module's pom file to the given kfs file system. |
public RuleEvaluationResult evaluate(RuleEvaluationContext context)
RuleEngineServiceevaluate in interface RuleEngineServicecontext - the rule engine context containing data about rule engine execution@Deprecated protected ExecutionResultImpl tryExecution(StatelessKieSession session, Command command, int currentAttempt)
protected boolean isSessionStateless(DroolsRuleEngineContextModel ruleEngineContext)
ruleEngineContext - public RuleEngineActionResult initialize(AbstractRulesModuleModel abstractModule, boolean propagateToOtherNodes)
RuleEngineServicepropagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes).initialize in interface RuleEngineServiceabstractModule - the module to be initializedpropagateToOtherNodes - if true propagates a RuleEngineInitializedEvent to other nodes.RuleEngineActionResult.isActionFailed() to check if the
action succeeded)protected boolean isRuleEngineActive()
public RuleEngineActionResult initialize(AbstractRulesModuleModel module)
RuleEngineServiceRuleEngineInitializedEvent to other nodes.initialize in interface RuleEngineServicemodule - the module to be initializedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public List<RuleEngineActionResult> initializeAllRulesModules(boolean propagateToOtherNodes)
RuleEngineServiceAbstractRulesModuleModels that are marked as active.initializeAllRulesModules in interface RuleEngineServicepropagateToOtherNodes - if true on all the nodes of clusterpublic List<RuleEngineActionResult> initializeAllRulesModules()
RuleEngineServiceAbstractRulesModuleModels that are marked as active (in case of cluster mode - on all the
nodes).initializeAllRulesModules in interface RuleEngineServiceRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public RuleEngineActionResult updateEngineRule(AbstractRuleEngineRuleModel ruleEngineRule)
RuleEngineServiceupdateEngineRule in interface RuleEngineServiceruleEngineRule - Rule to be updatedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public RuleEngineActionResult updateEngineRule(AbstractRuleEngineRuleModel ruleEngineRule, AbstractRulesModuleModel rulesModule)
RuleEngineServiceupdateEngineRule in interface RuleEngineServiceruleEngineRule - Rule to be updatedrulesModule - AbstractRulesModuleModel where the Rule be updatedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public RuleEngineActionResult archiveRule(AbstractRuleEngineRuleModel ruleEngineRule)
RuleEngineServicearchiveRule in interface RuleEngineServiceruleEngineRule - Rule to be archivedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public RuleEngineActionResult archiveRule(AbstractRuleEngineRuleModel ruleEngineRule, AbstractRulesModuleModel rulesModule)
RuleEngineServicearchiveRule in interface RuleEngineServiceruleEngineRule - Rule to be archivedrulesModule - AbstractRulesModuleModel where the Rule is archivedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public AbstractRuleEngineRuleModel getRuleForCode(String code)
RuleEngineServicegetRuleForCode in interface RuleEngineServicecode - the rule codepublic AbstractRuleEngineRuleModel getRuleForUuid(String uuid)
RuleEngineServicegetRuleForUuid in interface RuleEngineServiceuuid - the rule uuidpublic AbstractRulesModuleModel getRuleModuleForRule(AbstractRuleEngineRuleModel rule)
RuleEngineServicegetRuleModuleForRule in interface RuleEngineServicerule - the AbstractRuleEngineRuleModelprotected KieModule createKieModule(DroolsKIEModuleModel module, RuleEngineActionResult result) throws de.hybris.platform.ruleengine.impl.DefaultPlatformRuleEngineService.DroolsInitializationException
KieModule based on the given DroolsKIEModuleModel object. This makes use of the
following methods:
module - the module to create the KieModule fromDroolsInitializationException - if any errors are encountered during the creationde.hybris.platform.ruleengine.impl.DefaultPlatformRuleEngineService.DroolsInitializationExceptionprotected void writeKModuleXML(KieModuleModel module,
KieFileSystem kfs)
module to the given kfs file system.module - the kie modulekfs - the file systemprotected void writePomXML(DroolsKIEModuleModel module, KieFileSystem kfs)
module's pom file to the given kfs file system.module - the kie modulekfs - the file systemprotected void addKieBaseModel(KieModuleModel module,
KieFileSystem kfs,
DroolsKIEBaseModel base)
module based on the given base. This method internally calls
addRules(KieBaseModel, KieFileSystem, DroolsKIEBaseModel) and
addKieSessionModel(KieBaseModel, DroolsKIESessionModel)module - the kie modulekfs - the file systembase - the hybris KIE base objectprotected void addRules(KieBaseModel kieBaseModel,
KieFileSystem kfs,
DroolsKIEBaseModel base)
base's rules to the given kfs.kieBaseModel - the kieBaseModelkfs - the file systembase - the hybris KIE base objectprotected void addKieSessionModel(KieBaseModel base,
DroolsKIESessionModel session)
base based on the given session.base - the kie basesession - the hybris KIE session objectprotected MessageLevel convertLevel(Level level)
Level to a MessageLevel.protected KieSessionType getSessionType(DroolsSessionType sessionType)
protected EventProcessingOption getEventProcessingOption(DroolsEventProcessingMode eventProcessingMode)
protected EqualityBehaviorOption getEqualityBehaviorOption(DroolsEqualityBehavior behavior)
protected RuleExecutionCountListener createRuleExecutionCounterListener()
protected ReleaseId getReleaseId(DroolsKIEModuleModel module)
module - the module to create the ReleaseId forpublic Class<? extends RuleExecutionCountListener> getRuleExecutionCounterClass()
public void setRuleExecutionCounterClass(Class<? extends RuleExecutionCountListener> ruleExecutionCounterClass)
protected EventService getEventService()
public void setEventService(EventService eventService)
protected ConfigurationService getConfigurationService()
public void setConfigurationService(ConfigurationService configurationService)
protected RuleEngineActionResult createRuleEngineActionResult(String message, String moduleName, boolean success, MessageLevel level)
message and level.message - the messagemoduleName - the module's namesuccess - whether the operation of this result was successful or not (sets
RuleEngineActionResult.setActionFailed(boolean) with the negated value of successlevel - the message level of the ResultItem@PostConstruct public void setup()
protected EngineRuleDao getEngineRuleDao()
public void setEngineRuleDao(EngineRuleDao engineRuleDao)
protected RulesModuleDao getRulesModuleDao()
public void setRulesModuleDao(RulesModuleDao rulesModuleDao)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected RuleModuleFinderStrategy getRuleModuleFinderStrategy()
public void setRuleModuleFinderStrategy(RuleModuleFinderStrategy ruleModuleFinderStrategy)
protected DroolsKIEBaseFinderStrategy getDroolsKIEBaseFinderStrategy()
public void setDroolsKIEBaseFinderStrategy(DroolsKIEBaseFinderStrategy droolsKIEBaseFinderStrategy)
protected ReadWriteLock getReadWriteLock()
protected Lock getReadLock()
protected Lock getWriteLock()
protected KieServices getKieServices()
protected void setKieServices(KieServices kieServices)
public void setUpKieServices()
Copyright © 2000-2016 SAP SE. All Rights Reserved.