The new engine supports the use of custom Java classes as Actions in your Ruleset. As with other Actions created with Clarify objects (Business Process, Code Table, SQL Action, and Application Interface), these custom Actions reside in your Project and can be added directly to a rule.
The Formula and External API Java Program: Two objects no longer needed
In the old engine, you may have used the Formula object to create a custom statement in order to perform custom calculations and return values in the Ruleset. This supported simple formulas, however when trying to create more complex solutions, it exposed limitations in the editor as well as the need for advanced programming knowledge.
Or, perhaps you wanted to scan for and replace values in large sets of data; in this case you could create and configure the External API Java Program object for this purpose. However, this required you to define parameters as well as the properties required by whatever external program you were calling, such as classpath, class, and method.
The new engine allows you to create and use a Java class directly without relying on other object editors. In the example below, three Java classes have been created for a Project and are shown in the Studio Project Explorer.
And they are available to be used as Actions in the v2 Ruleset editor.
Converting regular java types
There are many methods to convert the Ruleset Types to and from the usual Java Types. Methods to convert Ruleset Types are defined in the superclass AbstractAction.
Example: asString, asNumber
To convert Java Types to the reactor Types, use the constructors found in these classes:
- ReactorNumber.java
- ReactorBinary.java
- ReactorBoolean.java
- ReactorDateTime.java
- ReactorDuration.java
- ReactorList.java
- ReactorObject.java
- ReactorString.java
- Must extend Abstract Action.
- Must have an “execute” method.
- Parameters must be of a type from the com.extol.ebi.ruleset.lang.core package: Boolean, DateTime, List, Number, Object, String, SourceNode, and Binary.
- Return type must be of a type from the com.extol.ebi.ruleset.lang.core package: Boolean, DateTime, List, Number, Object, String, SourceNode, and Binary.
Comments
0 comments
Please sign in to leave a comment.