public interface IlrSessionRequest
extends java.io.Serializable
IlrSessionRequest is the interface for session requests.
This class is used to execute rulesets in a stateless rule session.
The following code example shows how to execute rules in a J2SE session.
public IlrSessionResponse executeRulesOnJ2SESession(Customer user, ShoppingCart cart) throws IlrFormatException, IlrSessionException {
IlrSessionFactory factory = new IlrJ2SESessionFactory();
IlrStatelessSession session = factory.createStatelessSession();
IlrSessionRequest sessionRequest = factory.createRequest();
sessionRequest.setRulesetPath(IlrPath.parsePath(rulesetPath));
// Ensure correct version of the ruleset is taken in account
sessionRequest.setForceUptodate(true);
sessionRequest.setTraceEnabled(true);
sessionRequest.getTraceFilter().setInfoAllFilters(true);
// Set the input parameters for the execution of the rules
Map inputParameters = new HashMap ();
Announcement announcement = new Announcement();
inputParameters.put("announcement", announcement);
inputParameters.put("customer", user);
inputParameters.put("shoppingCart", cart);
sessionRequest.setInputParameters(inputParameters);
IlrSessionResponse sessionResponse = session.execute(sessionRequest);
return sessionResponse;
}
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getExecutionId()
Returns the assigned execution ID.
|
java.lang.Object |
getInputParameter(java.lang.String name)
Returns the value of an input parameter.
|
java.util.Map<java.lang.String,java.lang.Object> |
getInputParameters()
Returns the input parameters.
|
IlrPath |
getRulesetPath()
Returns the ruleset path.
|
java.lang.String |
getTaskName()
Returns the name of the task to be executed.
|
IlrTraceFilter |
getTraceFilter()
Returns the trace filter.
|
java.io.Serializable |
getUserData()
Return the user data.
|
boolean |
isBOMAccess()
Returns the BOM access flag.
|
boolean |
isForceUptodate()
Tests if the ruleset has to be up-to-date before execution starts.
|
boolean |
isInterceptorEnabled()
Checks if session or session factory interceptors are overridden.
|
boolean |
isTraceEnabled()
Checks if XU traces are enabled.
|
void |
removeInputParameter(java.lang.String name)
Removes an input parameter from the parameters map.
|
void |
setBOMAccess(boolean bomAccess)
Sets the BOM access flag.
|
void |
setExecutionId(java.lang.String executionId)
Sets the execution ID for this request.
|
void |
setForceUptodate(boolean forceUptodate)
Forces execution to wait until ruleset parsing has been completed.
|
void |
setInputParameter(java.lang.String name,
java.lang.Object value)
Sets an input parameter.
|
void |
setInputParameters(java.util.Map<java.lang.String,java.lang.Object> inputParameters)
Sets the input parameters.
|
void |
setInterceptorEnabled(boolean interceptorEnabled)
Overrides any session or session factory interceptors.
|
void |
setRulesetPath(IlrPath rulesetPath)
Sets the ruleset path.
|
void |
setTaskName(java.lang.String taskName)
Sets the name of the task to be executed.
|
void |
setTraceEnabled(boolean traceEnabled)
Enables or disables XU traces.
|
void |
setUserData(java.io.Serializable userData)
Set the user data that is passed to the interceptor and the XU.
|
void setRulesetPath(IlrPath rulesetPath)
rulesetPath - The ruleset path.IlrPath getRulesetPath()
void setInputParameter(java.lang.String name,
java.lang.Object value)
getInputParameters().put(name, value).
Neither parameter can be set to null.
name - The name of the input parameter.value - The value of the input parameter.java.lang.Object getInputParameter(java.lang.String name)
getInputParameters().get(name)).name - The parameter name. This value must not
be null.name has been set, null is returned.void removeInputParameter(java.lang.String name)
getInputParameters().remove(name).name - The name of the parameter to remove. This value must not
be null.java.util.Map<java.lang.String,java.lang.Object> getInputParameters()
void setInputParameters(java.util.Map<java.lang.String,java.lang.Object> inputParameters)
inputParameters - A map containing <name,value>
input parameters. This value must not be null.IlrTraceFilter getTraceFilter()
void setUserData(java.io.Serializable userData)
userData - The user data.java.io.Serializable getUserData()
boolean isBOMAccess()
void setBOMAccess(boolean bomAccess)
bomAccess - The BOM access flag.java.lang.String getTaskName()
void setTaskName(java.lang.String taskName)
taskName - The name of the task to be executedboolean isTraceEnabled()
true is returned.void setTraceEnabled(boolean traceEnabled)
traceEnabled - Set to true to activate XU traces.boolean isInterceptorEnabled()
true is returned.void setInterceptorEnabled(boolean interceptorEnabled)
interceptorEnabled - Set to true to override any
session or session factory interceptors.boolean isForceUptodate()
true is returned.void setForceUptodate(boolean forceUptodate)
forceUptodate - Set to true to ensure that the
ruleset us up-to-date before execution starts.java.lang.String getExecutionId()
null is returned.void setExecutionId(java.lang.String executionId)
executionId
is returned in the response. The uniqueness of executionId is
up to you. It is mandatory if the Decision Warehouse is used.executionId - The execution ID for this request.© Copyright IBM Corp. 1987, 2017