Package de.hybris.platform.ruleengine
Interface RuleEngineService
-
- All Known Implementing Classes:
DefaultCommerceRuleEngineService
,DefaultPlatformRuleEngineService
public interface RuleEngineService
The interface provides with method that allows initialization and evaluation of rules modules.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description RuleEngineActionResult
archiveRule(AbstractRuleEngineRuleModel ruleEngineRule)
Deprecated, for removal: This API element is subject to removal in a future version.since 1811RuleEngineActionResult
archiveRule(AbstractRuleEngineRuleModel ruleEngineRule, AbstractRulesModuleModel rulesModule)
Deprecated, for removal: This API element is subject to removal in a future version.since 1811<T extends DroolsRuleModel>
java.util.Optional<InitializationFuture>archiveRules(java.util.Collection<T> engineRules)
Archive a collection of rules<T extends AbstractRuleEngineRuleModel>
voiddeactivateRulesModuleEngineRules(java.lang.String moduleName, java.util.Collection<T> engineRules)
make the specified collection of engine rules belonging to a specified module inactive, so that the engine wouln't take them in consideration during initRuleEvaluationResult
evaluate(RuleEvaluationContext context)
Since 6.0 Executes rule evaluation for given RuleEvaluationContext.AbstractRuleEngineRuleModel
getRuleForCodeAndModule(java.lang.String code, java.lang.String moduleName)
Finds AbstractRuleEngineRuleModel for given code and module.AbstractRuleEngineRuleModel
getRuleForUuid(java.lang.String uuid)
Finds AbstractRuleEngineRuleModel for given uuid.void
initialize(AbstractRulesModuleModel module, java.lang.String deployedMvnVersion, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, RuleEngineActionResult result)
Since 6.4 Initializes the given rules module (and ifpropagateToOtherNodes
is set totrue
propagates aRuleEngineInitializedEvent
to other nodes).void
initialize(AbstractRulesModuleModel module, java.lang.String deployedMvnVersion, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, RuleEngineActionResult result, ExecutionContext executionContext)
Since 18.08 Initializes the given rules module (and ifpropagateToOtherNodes
is set totrue
propagates aRuleEngineInitializedEvent
to other nodes).InitializationFuture
initialize(java.util.List<AbstractRulesModuleModel> modules, boolean propagateToOtherNodes, boolean enableIncrementalUpdate)
Since 6.4 Initializes the given rules module in blocking/async mode (depending on blocking param) (and ifpropagateToOtherNodes
is set totrue
propagates aRuleEngineInitializedEvent
to other nodes).InitializationFuture
initialize(java.util.List<AbstractRulesModuleModel> modules, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, ExecutionContext executionContext)
Since 6.7 Initializes the given rules module in blocking/async mode (depending on blocking param) (and ifpropagateToOtherNodes
is set totrue
propagates aRuleEngineInitializedEvent
to other nodes).java.util.List<RuleEngineActionResult>
initializeAllRulesModules()
Initializes allAbstractRulesModuleModel
s that are marked as active (in case of cluster mode - on all the nodes).java.util.List<RuleEngineActionResult>
initializeAllRulesModules(boolean propagateToOtherNodes)
Initializes allAbstractRulesModuleModel
s that are marked as active.<M extends AbstractRulesModuleModel>
voidinitializeNonBlocking(M module, java.lang.String deployedMvnVersion, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, RuleEngineActionResult result)
Since 6.4 Asynchronously initializes the given rules module (and ifpropagateToOtherNodes
is set totrue
propagates aRuleEngineInitializedEvent
to other nodes).RuleEngineActionResult
updateEngineRule(AbstractRuleEngineRuleModel ruleEngineRule, AbstractRulesModuleModel rulesModule)
Updates the given rule if it already exists.
-
-
-
Method Detail
-
evaluate
RuleEvaluationResult evaluate(RuleEvaluationContext context)
Since 6.0 Executes rule evaluation for given RuleEvaluationContext. Executes all rules contained within the context- Parameters:
context
- the rule engine context containing data about rule engine execution- Returns:
- results of rule engine execution
-
initializeNonBlocking
<M extends AbstractRulesModuleModel> void initializeNonBlocking(M module, java.lang.String deployedMvnVersion, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, RuleEngineActionResult result)
Since 6.4 Asynchronously initializes the given rules module (and ifpropagateToOtherNodes
is set totrue
propagates aRuleEngineInitializedEvent
to other nodes).- Parameters:
module
- the module to be initializeddeployedMvnVersion
- currently deployed version of the Kie ModulepropagateToOtherNodes
- if true propagates aRuleEngineInitializedEvent
to other nodes.enableIncrementalUpdate
- flag, if true, enables for incremental updates of the rule engine kie moduleresult
- the instance ofRuleEngineActionResult
accumulating the results of initialization
-
initialize
InitializationFuture initialize(java.util.List<AbstractRulesModuleModel> modules, boolean propagateToOtherNodes, boolean enableIncrementalUpdate)
Since 6.4 Initializes the given rules module in blocking/async mode (depending on blocking param) (and ifpropagateToOtherNodes
is set totrue
propagates aRuleEngineInitializedEvent
to other nodes).- Parameters:
modules
- the modules to be initializedpropagateToOtherNodes
- if true propagates aRuleEngineInitializedEvent
to other nodes.enableIncrementalUpdate
- flag, if true, enables for incremental updates of the rule engine kie module- Returns:
- instance of
InitializationFuture
to be used for eventual blocking on multiple parallel swapping
-
initialize
InitializationFuture initialize(java.util.List<AbstractRulesModuleModel> modules, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, ExecutionContext executionContext)
Since 6.7 Initializes the given rules module in blocking/async mode (depending on blocking param) (and ifpropagateToOtherNodes
is set totrue
propagates aRuleEngineInitializedEvent
to other nodes).- Parameters:
modules
- the modules to be initializedpropagateToOtherNodes
- if true propagates aRuleEngineInitializedEvent
to other nodes.enableIncrementalUpdate
- flag, if true, enables for incremental updates of the rule engine kie moduleexecutionContext
- instance ofExecutionContext
that serves as a storage for initialization related data- Returns:
- instance of
InitializationFuture
to be used for eventual blocking on multiple parallel swapping
-
initialize
void initialize(AbstractRulesModuleModel module, java.lang.String deployedMvnVersion, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, RuleEngineActionResult result)
Since 6.4 Initializes the given rules module (and ifpropagateToOtherNodes
is set totrue
propagates aRuleEngineInitializedEvent
to other nodes).- Parameters:
module
- the module to be initializeddeployedMvnVersion
- currently deployed mvn version of the rule engine modulepropagateToOtherNodes
- if true propagates aRuleEngineInitializedEvent
to other nodes.enableIncrementalUpdate
- flag, if true, enables for incremental updates of the rule engine kie moduleresult
- the instance ofRuleEngineActionResult
accumulating the results of initialization
-
initialize
void initialize(AbstractRulesModuleModel module, java.lang.String deployedMvnVersion, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, RuleEngineActionResult result, ExecutionContext executionContext)
Since 18.08 Initializes the given rules module (and ifpropagateToOtherNodes
is set totrue
propagates aRuleEngineInitializedEvent
to other nodes).- Parameters:
module
- the module to be initializeddeployedMvnVersion
- currently deployed mvn version of the rule engine modulepropagateToOtherNodes
- if true propagates aRuleEngineInitializedEvent
to other nodes.enableIncrementalUpdate
- flag, if true, enables for incremental updates of the rule engine kie moduleresult
- the instance ofRuleEngineActionResult
accumulating the results of initializationexecutionContext
- the instance ofExecutionContext
to be set as executionContext ofRuleEngineActionResult
if not null
-
initializeAllRulesModules
java.util.List<RuleEngineActionResult> initializeAllRulesModules()
Initializes allAbstractRulesModuleModel
s that are marked as active (in case of cluster mode - on all the nodes).- Returns:
- the results of the initialize action (use
RuleEngineActionResult.isActionFailed()
to check if the action succeeded)
-
initializeAllRulesModules
java.util.List<RuleEngineActionResult> initializeAllRulesModules(boolean propagateToOtherNodes)
Initializes allAbstractRulesModuleModel
s that are marked as active.- Parameters:
propagateToOtherNodes
- if true on all the nodes of cluster- Returns:
- the activation results
-
updateEngineRule
RuleEngineActionResult updateEngineRule(AbstractRuleEngineRuleModel ruleEngineRule, AbstractRulesModuleModel rulesModule)
Updates the given rule if it already exists.- Parameters:
ruleEngineRule
- Rule to be updatedrulesModule
-AbstractRulesModuleModel
where the Rule be updated- Returns:
- the result of the update action (use
RuleEngineActionResult.isActionFailed()
to check if the action succeeded)
-
archiveRule
@Deprecated(since="1811", forRemoval=true) RuleEngineActionResult archiveRule(AbstractRuleEngineRuleModel ruleEngineRule)
Deprecated, for removal: This API element is subject to removal in a future version.since 1811Archives the given rule if it already exists.- Parameters:
ruleEngineRule
- Rule to be archived- Returns:
- the result of the archive action (use
RuleEngineActionResult.isActionFailed()
to check if the action succeeded)
-
archiveRule
@Deprecated(since="1811", forRemoval=true) RuleEngineActionResult archiveRule(AbstractRuleEngineRuleModel ruleEngineRule, AbstractRulesModuleModel rulesModule)
Deprecated, for removal: This API element is subject to removal in a future version.since 1811Archives the given rule if it already exists.- Parameters:
ruleEngineRule
- Rule to be archivedrulesModule
-AbstractRulesModuleModel
where the Rule is archived- Returns:
- the result of the archive action (use
RuleEngineActionResult.isActionFailed()
to check if the action succeeded)
-
archiveRules
<T extends DroolsRuleModel> java.util.Optional<InitializationFuture> archiveRules(java.util.Collection<T> engineRules)
Archive a collection of rules- Type Parameters:
T
- subtype ofDroolsRuleModel
- Parameters:
engineRules
- collection ofDroolsRuleModel
instances- Returns:
- optional of
InitializationFuture
keeping the status of initialization
-
getRuleForCodeAndModule
AbstractRuleEngineRuleModel getRuleForCodeAndModule(java.lang.String code, java.lang.String moduleName)
Finds AbstractRuleEngineRuleModel for given code and module.- Parameters:
code
- the rule codemoduleName
- the rules module name- Returns:
- AbstractRuleEngineRuleModel for given code.
-
getRuleForUuid
AbstractRuleEngineRuleModel getRuleForUuid(java.lang.String uuid)
Finds AbstractRuleEngineRuleModel for given uuid.- Parameters:
uuid
- the rule uuid- Returns:
- AbstractRuleEngineRuleModel for given uuid.
-
deactivateRulesModuleEngineRules
<T extends AbstractRuleEngineRuleModel> void deactivateRulesModuleEngineRules(java.lang.String moduleName, java.util.Collection<T> engineRules)
make the specified collection of engine rules belonging to a specified module inactive, so that the engine wouln't take them in consideration during init- Type Parameters:
T
- a type of engine rules- Parameters:
moduleName
- Name of the module the rules should refer to when applying changesengineRules
- A collection ofAbstractRuleEngineRuleModel
to be deactivated
-
-