i
SDK Programming Guide
To develop an advanced rule using an IDE, a series of steps must be followed.
Once the rule is created in the advanced rules modeler, it is downloaded to be included in the IDE project, it is developed and, once finished, it is imported from the context menu into the Deyel modeler.
Example of Use
This example describes the steps to develop the "getCostsWithTax" rule in the IDE.
A rule named "getCostsWithTax" is created. It receives a price list as an input parameter. The price list is added and the VAT cost is obtained. Returns the total VAT and the total amount of the sum as output parameter .
The “getCostsWithTax'' rule invokes the "taxCalculation" rule, which receives the sum of prices as an input parameter, in the "inputAmount" field. Returns the VAT value as an output parameter, in the "taxValue" field.
Note: For the example, the "taxCalculation" rule is assumed to be available within the environment.
Step 1: Create the "getCostsWithTax" rule
In the rule modeler, a rule is created with the "getCostsWithTax" descriptive name.
The previously created adapter is selected, enter a description and press "Create Rule".
An input parameter is defined:
Name |
Data Type |
---|---|
"priceList" |
Double[] |
An output parameter is defined:
Name |
Data Type |
---|---|
"totalAmount" |
Double |
"AmountOfTaxApplied" |
Double |
Once the parameters have been entered, select the "Save" option from the top toolbar.
Step 2: Download the "getCostsWithTax" rule
From the top toolbar of the rule modeler, select the “Download” option.
The rule download includes:
•Java sources to develop and test the rule.
•A class file with code that allows the rule to be executed.
Step 3: Setup the local environment
To develop the rule you need to have a local environment to work with Java.
Step 4: Include the "getCostsWithTax" rule in the Java IDE project
The rule download generates a zip file containing two folders, the classes folder and the src folder.
Once the file is unzipped, they are added to the corresponding folders previously defined in the Java IDE project.
The structure of the project already configured is shown:
Step 5: Rule development
When the "getCostsWithTax" rule is included in the Java IDE project, two classes are obtained:
Name |
Description |
---|---|
getCostsWithTax_1 |
Includes the rule logic |
TestRule |
Includes the values to test from the IDE |
The following code is defined in the getCostsWithTax_1 class:
|