Engine interface (for setting up the engine)
and RunningEngine interface(for the usage of the engine API within rules and ruleflow)public class IlrContext
extends java.lang.Object
implements java.io.Serializable
IlrContext is the base class of all the execution contexts.
Rules can be executed only within an execution context.
In IBM Decision server, the rule engine is an instance of IlrContext,
the rule engine is simply a Java object.
An IlrContext instance is always attached to an
IlrRuleset. If the context is created without a ruleset passed
as an argument, it creates its own ruleset.
An IlrContext instance contains all the methods required to
control the rule engine. IlrRuleset is responsible for rule
management, IlrContext is responsible for rule execution.
Since version 5.0, the derivation of IlrContext has been
deprecated. You should use ruleset variables to add new fields to the
execution context.
An execution context is serializable.
Warning: Serialized objects of this class will not be compatible with future releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of IBM Decision Server.
IlrRuleset,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
firedRulesCountConstant
Deprecated.
use instead
IlrPropertyNames.FIRED_RULES_COUNT |
java.io.PrintWriter |
out
Deprecated.
As of ODM 8.0.1, the method
note(String) should be used |
| Constructor and Description |
|---|
IlrContext()
Deprecated.
As of JRules 7.1, this way of constructing a context with an empty ruleset is deprecated.
See other constructors for replacement.
|
IlrContext(IlrRuleset ruleset)
Deprecated.
Constructs an
IlrContext with an IlrRuleset
object. |
IlrContext(IlrRuleset ruleset,
com.ibm.rules.engine.connector.DataConnectorFactory dcf)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activatePacket(java.lang.String packet)
Deprecated.
|
void |
activateRule(IlrRule rule)
Deprecated.
|
void |
activateRules(IlrRule[] rules)
Deprecated.
|
void |
addNoteHandler(IlrNoteHandler handler)
Deprecated.
Adds a note handler to the context.
|
java.lang.Object |
assertLogical(java.lang.Object object)
Deprecated.
As of IBM Decision Server 8.0.1, truth maintenance system is deprecated.
|
void |
cleanRulesetVariables()
Deprecated.
Resets the values of the ruleset variables: either the 'in' parameters,
or the 'out' or the local variables.
|
int |
connectTool(IlrTool tool)
Deprecated.
Connects an
IlrTool to the context. |
int |
connectTool(IlrToolFactory toolFactory)
Deprecated.
Connects an
IlrTool created by an IlrToolFactory
to the context. |
int |
connectTool(IlrToolFactory toolFactory,
java.lang.String name)
Deprecated.
Connects an
IlrTool created by an IlrToolFactory
to the context. |
void |
deactivatePacket(java.lang.String packet)
Deprecated.
|
void |
deactivateRule(IlrRule rule)
Deprecated.
|
void |
deactivateRules(IlrRule[] rules)
Deprecated.
|
void |
disconnectTool(int toolID)
Deprecated.
Disconnects a connected
IlrTool. |
void |
disconnectTools()
Deprecated.
Disconnects all connected
IlrTool. |
void |
end()
Deprecated.
Prepares this context for garbage collection.
|
void |
endCurrentTask()
Deprecated.
Ends the context's current task by executing its potential final actions
and declaring it as Completed.
|
java.util.Enumeration |
enumerateInstances()
Deprecated.
Enumerates all the rule instances currently in the agenda of the context,
without changing the contents of the agenda.
|
java.util.Enumeration |
enumerateObjects()
Deprecated.
Enumerates all the objects in working memory of the context without any
discrimination on their types.
|
IlrParameterMap |
execute()
Deprecated.
Executes the ruleflow defined in the context's ruleset.
|
IlrParameterMap |
execute(java.lang.String name)
Deprecated.
Executes the task passed as the argument.
|
void |
executeInitialRule()
Deprecated.
|
java.lang.Object |
executeMain(java.lang.Object arg)
Deprecated.
Invokes the
ilrmain function with an argument. |
java.lang.Object |
executeMain(java.lang.String pkgName,
java.lang.Object arg)
Deprecated.
Invokes the
ilrmain function of the specified package with
an argument. |
IlrParameterMap |
executeTask()
Deprecated.
Provides a step-by-step execution of the ruleflow.
|
int |
fireAllRules()
Deprecated.
Fires all the rules in the agenda.
|
int |
fireAllRules(IlrAgendaFilter filter)
Deprecated.
Fires all the rules in the agenda using an agenda filter.
|
IlrRuleInstance |
fireRule()
Deprecated.
Fires the rule in the agenda that has the highest priority.
|
IlrRuleInstance |
fireRule(IlrAgendaFilter filter)
Deprecated.
Fires the next rule instance in the agenda that passes the filter.
|
int |
fireRules(IlrRule[] rules)
Deprecated.
Adds the rules passed as its argument to the context, fires all the rules
in the agenda, and removes the rules that were passed as its argument.
|
IlrRule[] |
getActivatedRules()
Deprecated.
|
int |
getConnectedToolNumber()
Deprecated.
Gives the number of connected
IlrTool(s) to the context. |
IlrTask |
getCurrentTask()
Deprecated.
Returns the task that is currently executing or the task that is in
a suspended state in the ruleflow.
|
static IlrNoteHandler |
getDefaultNoteHandler()
Deprecated.
Returns the default note handler.
|
IlrExceptionHandler |
getExceptionHandler()
Deprecated.
Gets the exception handler of this execution context.
|
IlrRuleInstance |
getFirstInstance()
Deprecated.
Gets the first rule instance of the agenda.
|
IlrTask |
getMainTask()
Deprecated.
Returns the task defined as the main task in the context's ruleset
ruleflow.
|
java.lang.Object[] |
getObjects(IlrClass clazz)
Deprecated.
Gets all the objects in working memory that are instances of the passed
XOM class.
|
java.lang.Object |
getParameterValue(java.lang.String name)
Deprecated.
Gets the value of the ruleset parameter.
|
IlrParameterMap |
getReturnValues()
Deprecated.
Returns the values of the "out" ruleset variables (those
defined either with the "inout" or "out" modifier).
|
IlrRuleset |
getRuleset()
Deprecated.
Gets the ruleset to which the context is attached.
|
IlrTask |
getTask(java.lang.String name)
Deprecated.
Returns the task defined in the ruleflow and whose name is the one
passed as the parameter.
|
boolean |
hasInstances(IlrRule rule)
Deprecated.
Tests whether the agenda contains instances of a rule.
|
void |
insert(java.lang.Object object)
Deprecated.
Inserts the object passed as the argument.
|
java.lang.Object |
insertLogical(java.lang.Object object)
Deprecated.
As of IBM Decision Server 8.0.1, truth maintenance system is deprecated.
|
java.lang.Object |
invokeFunction(java.lang.String name,
java.lang.Object[] arguments)
Deprecated.
Invokes a function of the context giving its name and the argument
values.
|
boolean |
isAgendaNotEmpty()
Deprecated.
Tests whether the agenda contains at least one fireable rule instance.
|
boolean |
isCacheRuleflowData()
Deprecated.
Tests whether or not the ruleflow data is cached when
resetRuleflow() is called. |
boolean |
isRuleActivated(IlrRule rule)
Deprecated.
|
boolean |
isRuleflowCompleted()
Deprecated.
Tests whether the ruleflow execution is completed, which means that
the ruleflow execution is not interrupted because of either a suspended
task or a task by task execution.
|
boolean |
isRuleSelected(IlrRule rule)
Deprecated.
Tests whether the rule is selected to be part of the executable rules.
|
boolean |
isTaskCompleted(java.lang.String name)
Deprecated.
Tests whether the specified task is completed.
|
boolean |
isUsingFlow()
Deprecated.
Returns a boolean to indicate whether a ruleflow has been defined in
the context's ruleset.
|
long |
nextTime()
Deprecated.
As of IBM Decision Server 7.5, event processing is deprecated.
|
long |
nextTime(long increment)
Deprecated.
As of IBM Decision Server 7.5, event processing is deprecated.
|
void |
note(java.lang.String note)
Deprecated.
Sends a note to the context's note handlers.
|
void |
refreshAgenda()
Deprecated.
Adds in the agenda all the rule instances that have been refracted.
|
void |
removeAllInstances()
Deprecated.
Removes all the instances currently in the agenda without firing them.
|
void |
removeAllNoteHandlers()
Deprecated.
Removes all note handlers from the context.
|
void |
removeInstance(IlrRuleInstance instance)
Deprecated.
Removes a particular rule instance from the agenda.
|
void |
removeInstances(IlrRule rule)
Deprecated.
Removes all the instances of a rule currently in the agenda without
firing them.
|
void |
removeNoteHandler(IlrNoteHandler handler)
Deprecated.
Removes a note handler from the context.
|
void |
reset()
Deprecated.
Called by Rule Studio to prepare a context for another execution.
|
void |
resetRuleflow()
Deprecated.
Resets ruleflow execution in the context.
|
void |
retract(java.lang.Object object)
Deprecated.
Retracts an object from working memory, if the object has been asserted.
|
void |
retractAll()
Deprecated.
Retracts all the objects from working memory.
|
void |
send(java.lang.Object object)
Deprecated.
Throws an
IlrUserActionException exception. |
void |
send(java.lang.String message,
java.lang.Object object)
Deprecated.
Throws an
IlrUserActionException exception using a message and an
object. |
void |
setCacheRuleflowData(boolean cache)
Deprecated.
Sets whether or not to keep the cached ruleflow data when
resetRuleflow() is called. |
void |
setExceptionHandler(IlrExceptionHandler handler)
Deprecated.
Sets the exception handler of this execution context.
|
void |
setMainTask(java.lang.String name)
Deprecated.
Sets the ruleflow main task by giving its name.
|
void |
setParameters(IlrParameterMap parameters)
Deprecated.
Sets the values of the declared ruleset variables contained in the
passed
IlrParameterMap (defined either with the
"in" or "inout" modifier). |
void |
setParameterValue(java.lang.String name,
java.lang.Object value)
Deprecated.
Sets the value of the ruleset parameter.
|
void |
setRuleflowExceptionHandler(IlrExceptionHandler handler)
Deprecated.
Sets the exception handler responsible for catching runtime
exceptions thrown during the execution of a ruleflow.
|
void |
setTime(long time)
Deprecated.
As of IBM Decision Server 7.5, event processing is deprecated.
|
long |
time()
Deprecated.
As of IBM Decision Server 7.5, event processing is deprecated.
|
void |
update(java.lang.Object object)
Deprecated.
Updates an object in working memory, if the object has been asserted.
|
void |
update(java.lang.Object object,
boolean refresh)
Deprecated.
Updates an object in working memory if the object has been asserted.
|
void |
updateContext()
Deprecated.
Updates the references to the context object.
|
void |
updateContext(boolean refresh)
Deprecated.
Updates references to the context object to ensure that the agenda is in
a consistent state with the objects referenced by this context.
|
public transient java.io.PrintWriter out
note(String) should be usedPrintWriter which prints to
System.out. The destination, of course, can be changed.
This field provides an easy way to redirect the printing of
messages.public static java.lang.String firedRulesCountConstant
IlrPropertyNames.FIRED_RULES_COUNTexecute and getReturnValues methods to
store the number of rules fired during this execution. Its value is
ilog.rules.firedRulesCount.@Deprecated public IlrContext()
IlrContext with no argument. This method
creates an empty IlrRuleset attached to the context. The ruleset
can then be obtained using the getRuleset() method. The
creation of a context, ordinarily fires the Initial Actions. Since this
constructor creates its own ruleset, and the ruleset has no rules
initially, then there is no Initial Actions to fire.getRuleset()public IlrContext(IlrRuleset ruleset)
IlrContext with an IlrRuleset
object. The ruleset must have the same context class as the created
context. If not, an IlrBadContextException is thrown. If the
ruleset has an Initial Action, and if the instance being constructed is a
direct instance of IlrContext, the action is executed. In
the case that the context is derived, the user must call
executeInitialRule() explicitly in the body of the derived class
constructor, after all the fields have been initialized.ruleset - The ruleset to which the context is attached.IlrBadContextExceptionpublic IlrContext(IlrRuleset ruleset, com.ibm.rules.engine.connector.DataConnectorFactory dcf)
public int connectTool(IlrTool tool) throws IlrToolConnectionException
IlrTool to the context. An
IlrToolConnectionException is thrown if the connection
fails.IlrToolConnectionExceptiontool - The IlrTool to connect.IlrTool's identifier.IlrTool,
IlrToolConnectionExceptionpublic int connectTool(IlrToolFactory toolFactory) throws IlrToolConnectionException
IlrTool created by an IlrToolFactory
to the context. An IlrToolConnectionException is thrown if
the connection fails.IlrToolConnectionExceptiontoolFactory - The IlrToolFactory used to create a new
IlrTool.IlrTool's identifier.IlrTool,
IlrToolConnectionException,
IlrLocalTracerToolFactory,
ilog.rules.debug.IlrBuilderToolFactorypublic int connectTool(IlrToolFactory toolFactory, java.lang.String name) throws IlrToolConnectionException
IlrTool created by an IlrToolFactory
to the context. An IlrToolConnectionException is thrown if
the connection fails.IlrToolConnectionExceptiontoolFactory - The IlrToolFactory used to create a new
IlrTool.name - A user context name. This name can be used by each created
IlrTool to identify the context.IlrTool's identifier.IlrTool,
IlrToolConnectionException,
IlrLocalTracerToolFactory,
ilog.rules.debug.IlrBuilderToolFactorypublic int getConnectedToolNumber()
IlrTool(s) to the context.IlrTool(s).public void disconnectTool(int toolID)
IlrTool.toolID - The IlrTool's identifier.public void disconnectTools()
IlrTool.public void note(java.lang.String note)
When a context is created, a default note handler is set (see
getDefaultNoteHandler().
This default note handler may be removed by a call to
removeAllNoteHandlers().
Other note handlers may be added by calling
addNoteHandler(IlrNoteHandler).
This method is multi-thread safe at the context level, yet the note handlers that are called may not be multi-thread safe themselves.
note - The note.public void addNoteHandler(IlrNoteHandler handler)
handler - The note handler.note(String),
removeNoteHandler(IlrNoteHandler),
removeAllNoteHandlers()public void removeNoteHandler(IlrNoteHandler handler)
handler - The note handler.note(String),
addNoteHandler(IlrNoteHandler),
removeAllNoteHandlers()public void removeAllNoteHandlers()
note(String) has no effect.note(String),
addNoteHandler(IlrNoteHandler),
removeNoteHandler(IlrNoteHandler),
removeAllNoteHandlers()public static IlrNoteHandler getDefaultNoteHandler()
out.note(String)public final IlrRuleset getRuleset()
public final void end()
public void reset()
reset, Rule Studio calls this method to make the context
ready for another run. By default, this method is defined as:
public synchronized void reset() {
retractAll();
cleanRulesetVariables();
resetRuleflow();
executeInitialRule();
}
A derived context class may override this method to perform
additional preparations for the execution of the context.public void send(java.lang.Object object)
throws IlrUserActionException
IlrUserActionException exception. This method is
intended to be used in a rule action to exit from the firing loop. The
method can catch the exception and process the result. An object is
passed along with the exception. It may contain a result or the cause.IlrUserActionExceptionobject - The object used to construct the exception.send(java.lang.String,java.lang.Object)public void send(java.lang.String message,
java.lang.Object object)
throws IlrUserActionException
IlrUserActionException exception using a message and an
object.IlrUserActionExceptionmessage - The message used to construct the exception.object - The object used to construct the exception.send(Object)public final IlrExceptionHandler getExceptionHandler()
null if no exception
handler has been set.public void setExceptionHandler(IlrExceptionHandler handler)
java.io.Serializable.
Note that the exception handler mechanism is restricted to the tasks
running the Rete+ algorithm. Even if set, the exception handler will not
be called from a task running the Sequential algorithm or the Fastpath
algorithm.handler - The new exception handler for this context. If this parameter
is null, the context will be set without an
exception handler.@Deprecated public void executeInitialRule()
IlrContext, the action(s) is/are automatically executed.public java.lang.Object invokeFunction(java.lang.String name,
java.lang.Object[] arguments)
throws IlrNoSuchFunctionException
IlrNoSuchFunctionException - in case the function is not known.name - The function name.arguments - The argument array.null.public java.lang.Object executeMain(java.lang.Object arg)
throws IlrNoSuchFunctionException
ilrmain function with an argument.IlrNoSuchFunctionException - if the ilrmain is not defined.arg - The argument of the function.null.public java.lang.Object executeMain(java.lang.String pkgName,
java.lang.Object arg)
throws IlrNoSuchFunctionException
ilrmain function of the specified package with
an argument.IlrNoSuchFunctionException - if the ilrmain is not defined in this package.arg - The argument of the function.null.@Deprecated public final long time()
nextTime(),
nextTime(long),
setTime(long)@Deprecated public final long nextTime()
time(),
nextTime(long),
setTime(long)@Deprecated public final long nextTime(long increment)
increment - A positive time increment.time(),
nextTime(),
setTime(long)@Deprecated public final void setTime(long time)
time - The new time of the engine.time(),
nextTime(),
nextTime(long)public void insert(java.lang.Object object)
object - The object to insert.public java.lang.Object insertLogical(java.lang.Object object)
equals method. If such an object is
found, the passed object is not inserted and the object in working memory
is returned. If no such object is found, the provided object is inserted
and returned. In both cases, the object in working memory is stated: it
is not maintained by any rule.object - The logical object to be inserted.public java.lang.Object assertLogical(java.lang.Object object)
insertLogical(Object) method.object - The logical object to be inserted.public void retract(java.lang.Object object)
object - The object to retract.public final void update(java.lang.Object object)
Updates an object in working memory, if the object has been asserted.
This method is equivalent to calling update(Object,boolean) with
the second argument set to false.
object - The object to update.public void update(java.lang.Object object,
boolean refresh)
Updates an object in working memory if the object has been asserted. If
the Boolean argument is false, this method does the same
thing as the previous method. If the Boolean argument is
true, the update will cause the agenda to be refreshed:
if a rule that uses this object is true, a rule instance
is inserted into the agenda. In this case, the rule applies as long as it
can be fired.
object - The object to update.refresh - The update flag. It is false for a normal
update and true for a looping rule behavior.public final void updateContext()
Updates the references to the context object. Calling this method is
equivalent to calling updateContext(boolean) with
false as argument.
public void updateContext(boolean refresh)
?context
variable in the rules.refresh - Set to true if a rule instance must be created
for each combination of objects that satisfies a rule. This
flag has the same interpretation as
update(Object,boolean).public void retractAll()
Retracts all the objects from working memory. The context becomes empty as if it had just been created (without the execution of the Initial Actions). The agenda is also emptied. The rules are not affected by this method.
public final java.lang.Object[] getObjects(IlrClass clazz)
Gets all the objects in working memory that are instances of the passed XOM class. The returned objects can be direct instances of the XOM class, or instances of a sub-class of the XOM class.
clazz - The XOM class.public final java.util.Enumeration enumerateObjects()
Enumerates all the objects in working memory of the context without any discrimination on their types.
public final boolean isAgendaNotEmpty()
Tests whether the agenda contains at least one fireable rule instance.
Note: This method can be used in the following cases:true if the agenda is not empty,
false if the agenda is empty.public final IlrRuleInstance getFirstInstance()
Gets the first rule instance of the agenda. This rule instance is the one placed at the top of the agenda and is the next to be fired. The agenda is not modified.
Note: This method can be used in the following cases:null if
the agenda is empty.public final boolean hasInstances(IlrRule rule)
Tests whether the agenda contains instances of a rule.
Note: This method can be used in the following cases:rule - The rule for which existence of instances is to be checked.true if the agenda contains at least one instance
of the rule, otherwise it returns false.public final void removeInstances(IlrRule rule)
Removes all the instances of a rule currently in the agenda without firing them.
Note: This method can be used in the following cases:rule - The rule for which instances are to be removed.public final void removeAllInstances()
Removes all the instances currently in the agenda without firing them. The agenda will become empty.
Note: This method can be used in the following cases:public final void removeInstance(IlrRuleInstance instance)
Removes a particular rule instance from the agenda.
Note: This method can be used in the following cases:instance - The rule instance to remove from the agenda.public final java.util.Enumeration enumerateInstances()
Enumerates all the rule instances currently in the agenda of the context, without changing the contents of the agenda.
Note: This method can be used in the following cases:public final void refreshAgenda()
Adds in the agenda all the rule instances that have been refracted. A refracted rule instance is one which has been fired or filtered, and which still evaluates to true.
Note: This method can be used in the following cases:public IlrRuleInstance fireRule()
Fires the rule in the agenda that has the highest priority.
Note: This method can be used in the following cases:null if the
agenda is empty.public IlrRuleInstance fireRule(IlrAgendaFilter filter)
Fires the next rule instance in the agenda that passes the filter. If the
filter is null, then the next instance is fired.
Otherwise, a rule instance is popped from the agenda, if it passes the
filter, it is fired. If it does not pass the filter, it is discarded.
This process loops until a rule instance is found that passes the filter
or the agenda is empty.
null if
the agenda is empty or no rule instance in the agenda passes the
filter.public int fireAllRules()
Fires all the rules in the agenda.
Note: This method can be used in the following cases:public int fireAllRules(IlrAgendaFilter filter)
Fires all the rules in the agenda using an agenda filter. If the passed
filter is null, then all the rule instances are fired.
Otherwise, a rule instance is popped from the agenda, if it passes the
filter, it is fired. If it does not pass the filter, it is discarded.
This process loops until no rule instance is left in the agenda.
filter - The agenda filter.public void activateRule(IlrRule rule)
Adds a rule to the context. The rule must belong to the ruleset to which this context is attached. Otherwise, this method does nothing.
If the rule is added, only the current context is affected. The contents of this context is updated accordingly. Note: This method may not work within a ruleflow, as the rules in a ruleflow are controlled by their tasks.rule - The rule to be added.public void activateRules(IlrRule[] rules)
Adds rules to the context. If the context class of the added rules does not match this context or if the context already contains the specified rules, the rule are not added. If rules are added, only the current context is affected. The content of the context is updated.
Note: This method may not work within a ruleflow, as the rules in a ruleflow are controlled by their tasks.rules - The rules to be added.public void activatePacket(java.lang.String packet)
Activates a rule packet.
Note: This method may not work within a ruleflow, as the rules in a ruleflow are controlled by their tasks.packet - The packet to be activated.public void deactivatePacket(java.lang.String packet)
Deactivates a rule packet.
Note: This method may not work within a ruleflow, as the rules in a ruleflow are controlled by their tasks.packet - The packet to be deactivated.public void deactivateRule(IlrRule rule)
Removes a rule from the context. The rule must belong to the ruleset to which this context is attached. Otherwise, this method does nothing.
If the rule is removed, the contents of this context is updated. Note: This method may not work within a ruleflow, as the rules in a ruleflow are controlled by their tasks.rule - The rule to be removed.public void deactivateRules(IlrRule[] rules)
Removes rules from the context. If the context class of the rules to be removed does not match this context or if the context does not contain the specified rules, the rule are not removed. If rules are removed, only the current context is affected. The content of the context is updated.
Note: This method may not work within a ruleflow, as the rules in a ruleflow are controlled by their tasks.rules - The rules to be removed.public final boolean isRuleActivated(IlrRule rule)
Tests whether this context contains a rule.
Note: This method may not work within a ruleflow, as the rules in a ruleflow are controlled by their tasks.rule - A rule.true if the context contains the rule, otherwise
it returns false.public final boolean isRuleSelected(IlrRule rule)
Tests whether the rule is selected to be part of the executable rules. In
case there is no ruleflow, this method returns the same value as
isRuleActivated. If there is a ruleflow, this method
returns true if the rule is part of the current task, else
it returns false.
rule - A rule.true if the the rule is selected as executable
rule, otherwise it returns false.public final IlrRule[] getActivatedRules()
Returns all the rules in the context.
Note: This method may not work within a ruleflow, as the rules in a ruleflow are controlled by their tasks.IlrRule. The length of the array can
be 0.public int fireRules(IlrRule[] rules)
Adds the rules passed as its argument to the context, fires all the rules in the agenda, and removes the rules that were passed as its argument. It returns the number of fired rules. This method is particularly useful if you know the agenda is empty and you only want specific rules to be fired.
Note: This method may not work within a ruleflow, as the rules in a ruleflow are controlled by their tasks.rules - The rules to be fired.public IlrParameterMap execute()
This method calls fireAllRules if no ruleflow is defined
in the context's ruleset.
The number of fired rules is returned in the returned
IlrParameterMap (when a ruleflow is executed, the number
of rules corresponds to the total number of rules fired during the entire
ruleflow execution). The value can be get in the result with the name
IlrContext.firedRulesCountConstant. The method also
returns the values of the ruleset variables whose modifier is either
"out" or "inout".
IlrParameterMap containing the "out"
and "inout" ruleset variable values and the number of
rules fired.IlrParameterMappublic void setMainTask(java.lang.String name)
IlrUserRuntimeException, encapsulating an
IlrUndefinedTaskException is thrown. This exception can be
caught if a ruleflow exception handler has been set on the context. The
task set with this method takes precedence over any task named
"main" in the ruleflow.
If there is no ruleflow defined in the context's ruleset, this method will be ignored.
public IlrTask getMainTask()
true,
or - the task named "main", or - the task set as main by the
API call setMainTask.
public void setParameters(IlrParameterMap parameters)
IlrParameterMap (defined either with the
"in" or "inout" modifier). If one of the values does
not correspond to an "in" or "inout" variable in the
ruleset, an IllegalArgumentException exception is thrown.
parameters - The structure containing "in" and "inout"
ruleset variables with a given value.public void setParameterValue(java.lang.String name,
java.lang.Object value)
IllegalArgumentException is
thrown.name - The name of the parameter whose value is set.value - The value of the ruleset parameter.public java.lang.Object getParameterValue(java.lang.String name)
IllegalArgumentException is
thrown.name - The name of the parameter whose value is requestedpublic void cleanRulesetVariables()
public IlrParameterMap getReturnValues()
IlrContext.firedRulesCountConstant.
IlrParameterMap that contains all the
"out" ruleset variables with their values.IlrParameterMappublic final boolean isUsingFlow()
true if a ruleflow is defined in the context's
ruleset, else returns false.public void endCurrentTask()
Ends the context's current task by executing its potential final actions and declaring it as Completed. This task has been suspended during the flow execution because its completion flag returned false.
public IlrParameterMap execute(java.lang.String name)
Executes the task passed as the argument. This call is equivalent to call
setMainTask with the passed task and then
execute.
name - The task's name.IlrParameterMappublic IlrParameterMap executeTask()
fireRule.
Otherwise it executes one task and exits. The ruleflow retains the
current task, and the next call to execute or
executeTask starts from the current task.
IlrParameterMap containing the "out"
and "inout" ruleset variable values and the number of
rules fired.IlrParameterMappublic void setRuleflowExceptionHandler(IlrExceptionHandler handler)
setExceptionHandler(IlrExceptionHandler)
handler - The exception handler in charge of catching ruleflow execution
exceptions.public IlrTask getTask(java.lang.String name)
null if no such task
exists.
name - The name of a task to return.name.public IlrTask getCurrentTask()
null.
If there is a ruleflow that is neither executing nor suspended, the
returned value is null. When the ruleflow is suspended
because of a suspended task (a task is suspended because its completion
flag returned a value of false) the current task is this task. If this
suspended task has been completed by the endCurrentTask
method, it is no longer the current task. The ruleflow's current task is
the one that is suspended, that is, the task that models the ruleflow
itself. If the ruleflow is suspended because of a task by task execution,
the current task is the one that models the ruleflow itself.
public void resetRuleflow()
public final boolean isCacheRuleflowData()
Tests whether or not the ruleflow data is cached when
resetRuleflow() is called.
setCacheRuleflowData(boolean),
resetRuleflow()public final void setCacheRuleflowData(boolean cache)
Sets whether or not to keep the cached ruleflow data when
resetRuleflow() is called.
When the ruleflow data is cached, some internal ruleflow execution
objects are reused from one call to execute() to another.
Otherwise, all the ruleflow internal objects are re-created at each call
to execute(). You should try keeping the ruleflow data cached
when the ruleflow has few application objects to process at one time
during each individual call to execute(). Note that the
internal ruleflow objects related to purely dynamic tasks cannot be
reused even if the ruleflow data is cached, because they depend on
runtime values and have to be recomputed when required.
By default, the ruleflow data is not cached.
cache - The control flag.isCacheRuleflowData(),
resetRuleflow(),
execute()public boolean isTaskCompleted(java.lang.String name)
IlrUndefinedTaskException exception encapsulated into an
IlrUserRuntimeException exception.
name - The task's fully qualified name.true if the specified task is not executing, else
returns false.public boolean isRuleflowCompleted()
true if the ruleflow execution is completed, else
returns false.© Copyright IBM Corp. 1987, 2017