|
Rule Execution Server API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IlrSessionRequest
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 MapinputParameters = 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; }
Method Summary | |
---|---|
String |
getExecutionId()
Returns the assigned execution ID. |
Object |
getInputParameter(String name)
Returns the value of an input parameter. |
Map<String,Object> |
getInputParameters()
Returns the input parameters. |
IlrPath |
getRulesetPath()
Returns the ruleset path. |
String |
getTaskName()
Returns the name of the task to be executed. |
IlrTraceFilter |
getTraceFilter()
Returns the trace filter. |
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(String name)
Removes an input parameter from the parameters map. |
void |
setBOMAccess(boolean bomAccess)
Sets the BOM access flag. |
void |
setExecutionId(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(String name,
Object value)
Sets an input parameter. |
void |
setInputParameters(Map<String,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(String taskName)
Sets the name of the task to be executed. |
void |
setTraceEnabled(boolean traceEnabled)
Enables or disables XU traces. |
void |
setUserData(Serializable userData)
Set the user data that is passed to the interceptor and the XU. |
Method Detail |
---|
void setRulesetPath(IlrPath rulesetPath)
rulesetPath
- The ruleset path.IlrPath getRulesetPath()
void setInputParameter(String name, 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.Object getInputParameter(String name)
getInputParameters().get(name)
).
name
- The parameter name. This value must not
be null
.
name
has been set, null
is returned.void removeInputParameter(String name)
getInputParameters().remove(name)
.
name
- The name of the parameter to remove. This value must not
be null
.Map<String,Object> getInputParameters()
void setInputParameters(Map<String,Object> inputParameters)
inputParameters
- A map containing <name,value>
input parameters. This value must not be null
.IlrTraceFilter getTraceFilter()
void setUserData(Serializable userData)
userData
- The user data.Serializable getUserData()
boolean isBOMAccess()
void setBOMAccess(boolean bomAccess)
bomAccess
- The BOM access flag.String getTaskName()
void setTaskName(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.String getExecutionId()
null
is returned.void setExecutionId(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.
|
Rule Execution Server API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |