Interface RuleActionContext
- All Known Implementing Classes:
DefaultDroolsRuleActionContext
public interface RuleActionContext
This interface represents the context for actions applied during rule evaluation.
-
Method Summary
Modifier and TypeMethodDescriptionGet cart RAOReturns a rule engine specific context object.getMetaData(String key) Returns the rule's meta-data for the given key (ornull).getParameter(String parameterName) Returns parameter of the running rule by it name or null if not found.<T> TgetParameter(String parameterName, Class<T> type) Returns parameter of the running rule by it name and type or throwsIllegalArgumentExceptionotherwise.Returns parameters of the running rule.Get rule engine result RAOget rule metadataGet the name of the ruleGet the name of the rules module.<T> TReturns the value for a specific type from the default variables container.<T> TReturns the value for a specific type and variables container.<T> Set<T>Returns the values for a specific type from the default variables container.<T> Set<T>Returns the values for a specific type and variables container.voidhalt()Stops evaluation of following rulesvoidinsertFacts(Object... facts) Insert the facts in an array to a contextvoidinsertFacts(Collection facts) Insert the facts in a collection to a contextvoidscheduleForUpdate(Object... facts) schedules the given facts for an update.voidsetParameters(Map<String, Object> parameters) Sets parameters to the running rulevoidupdateFacts(Object... facts) Update the facts in a contextvoidupdates any previously scheduled facts (seescheduleForUpdate(Object...)
-
Method Details
-
getMetaData
Returns the rule's meta-data for the given key (ornull). CallstoString()on the meta-data object.- Parameters:
key-- Returns:
- the string representation of the meta-data (or null)
-
scheduleForUpdate
schedules the given facts for an update. Note: The actual fact update is invoked viaupdateScheduledFacts()- Parameters:
facts- the facts to schedule for update
-
updateScheduledFacts
void updateScheduledFacts()updates any previously scheduled facts (seescheduleForUpdate(Object...) -
getValue
Returns the value for a specific type from the default variables container. If more than one value is found, the first one is returned.- Parameters:
type- - the type- Returns:
- the value or null if no value is found for the given type
-
getValues
Returns the values for a specific type from the default variables container.- Parameters:
type- - the type- Returns:
- the values or an empty set if no value is found for the given type
-
getValue
Returns the value for a specific type and variables container. If more than one value is found, the first one is returned.- Parameters:
type- - the typepath- - the path for the variables container- Returns:
- the value or null if no value is found for the given type
-
getValues
Returns the values for a specific type and variables container.- Parameters:
type- - the typepath- - the path for the variables container- Returns:
- the values or an empty set if no value is found for the given type
-
insertFacts
Insert the facts in an array to a context- Parameters:
facts- - the array of facts
-
insertFacts
Insert the facts in a collection to a context- Parameters:
facts- - the collection of facts
-
updateFacts
Update the facts in a context- Parameters:
facts- - the array of facts
-
getCartRao
CartRAO getCartRao()Get cart RAO -
getRuleEngineResultRao
RuleEngineResultRAO getRuleEngineResultRao()Get rule engine result RAO -
getRuleName
String getRuleName()Get the name of the rule -
getRuleMetadata
get rule metadata -
getDelegate
Object getDelegate()Returns a rule engine specific context object. -
getRulesModuleName
Get the name of the rules module. -
getParameters
Returns parameters of the running rule. -
getParameter
Returns parameter of the running rule by it name or null if not found. -
getParameter
Returns parameter of the running rule by it name and type or throwsIllegalArgumentExceptionotherwise. -
setParameters
Sets parameters to the running rule- Parameters:
parameters- - map of named objects, creating the execution context for an action
-
halt
void halt()Stops evaluation of following rules
-