To execute a ruleset in Java™ SE,
you create a Java SE factory,
a rule session, and a request.
Procedure
To execute a ruleset in a Java SE environment:
- Create a Java SE
factory.
IlrJ2SESessionFactory factory = new IlrJ2SESessionFactory();
- Use the factory to create a rule session.
IlrStatelessSession rulesession = factory.createStatelessSession();
- Use the factory to create an execution request.
IlrSessionRequest sessionRequest = factory.createRequest();
- Pass the path of the ruleset to be executed and ensure
the correct version is used.
sessionRequest.setRulesetPath(new IlrPath("/MyruleApp/Myruleset");
Optionally, you can force the latest version of the
ruleset to be used.
sessionRequest.setForceUptodate(true);
- Pass the ruleset input parameters.
sessionRequest.setInputParameters(map);
- Optionally, set the execution trace.
sessionRequest.setTraceEnabled(true);
sessionRequest.getTraceFilter().setInfoAllFilters(true);
- Execute the session and get the response.
IlrSessionResponse sessionResponse = rulesession.execute(sessionRequest);
return sessionResponse;