Open Your Business Rules!
Rules-based
Operational Decision Services
Release Notes 7.0.1
Decision Microservices with Spring Framework
OpenRules Release 7.0.1 provides a sampling and detailed tutorial of
how to add an OpenRules-based service to the popular
Spring
framework. The new
tutorial "Developing Decision Microservices with Spring Boot
and OpenRules"
Additional OpenRules API
Direct Access To Excel Data Tables from Java
In previous releases
you needed to manually created an Excel table of
the type Method to get an access to the Data table. For
example, to get an access from Java to this Data table
you needed to create in Excel special access
method such this one:
Then in your Java launcher you
needed to write
Customer[] customers = (Customer[]) decision.execute("getCustomers");
The enhanced Decision's API includes the method
"Object getData(String name)" that
can directly access arrays described in the Excel's Data
tables. So, you don't need anymore to create the Method
"getCustomers" in Excel, and may simply write:
Customer[] customers = (Customer[]) decision.getData("customers");
Similarly, if you have an Excel table of teh type
Variable, e.g.
you may get a customer from this table by using the
method "getVariable":
Customer customer = (Customer) decision.getVariable("customer");
Spliting Decision
into DecisionData
and DecisionModel
You may use the new API "DecisionData"
to separate an access to your
Excel data from your decision model. For example, in the
sample decision project "HelloJava" the Java class
MainDecisionData gets an array of customers from the file
"Test.xls":
DecisionData data = new DecisionData("file:rules/Test.xls");
Customer[] customers = (Customer[]) data.get("customers");
or
Customer customer =
(Customer) data.get("customer");
Now instead of creating one
decision based on the main Excel file, you may create an
instance of the new class "DecisionModel" for the same Excel
file. Then you may use this decision model to create
multiple decisions that share the same rules repository. The
same sample
decision project "HelloJava" demonstrates this API:
DecisionModel
model = new DecisionModel("file:rules/Goals.xls");
Decision decision = model.createDecision("DecisionHelloStatement");
When you create an instance of the
DecisionModel, on the background an
instanse of OpenRulesEngine is created as well: so
it could be a relatively expensive operation.
But the method "createDecision(String goal) is quick and
highly efficent.
We modified some
exemples in the workspace "openrules.models" to demonstrate
the new API.
Download the latest complete OpenRules release 7.0.1 from here.
If you have any questions, comments or suggestions, please post them at the Google Discussion Group or send them directly to support@openrules.com.