Complex rule model extensions sample details
You can run and rebuild this sample, and you can also look at source files to understand how this sample works. This sample runs only in the Decision Center Enterprise console.
Running this sample
To run this sample:
Open a web browser and enter the following URL to access Decision Center:
http://localhost:<PORT>/teamserver?datasource=jdbc/serverextendedbrm
The datasource parameter on the URL instructs Decision Center to use a specific datasource which supports the extended database schema and provides access to an extended rule type, Extended Rule.
Sign in to Decision Center using the following details:
Username: rtsAdmin
Password: rtsAdmin
Click the Home tab and select the loanvalidation-rules project.
To create a rule of type Extended Rule:
Click the Compose tab.
Select Extended Rule and then click OK.
Step 1, Step 5, and Step 6 define the custom properties for rules of type Extended Rule as follows:
In Step1: Properties, use the custom field Customer Names to enter a comma-separated list of values. In this example, customer names.
Click . This step includes four customized fields:
In the Requestor Mail field, enter an invalid email, such as “john doe”, and then click Apply. An error message prompts you to enter a valid email address.
Click a state on the Territory map to select a territory. The name of the state you clicked displays in the text field above the territory map.
Select one of the options listed in the Requirement list.
Click the folder icon next to the Authority text box, expand the hierarchy of options, and select the authority .
Click Apply to apply the options. The Edit Additional Properties page displays the newly created property.
Click Next to go to Step 6: Edit Target Release, and then click New.
This step includes three text fields (Major Version, Minor Version, and Patch Level), and a custom Production Level field that offers a list of numbered options. Text fields are associated with a custom validator to ensure that values entered are between a specified minimum and maximum value.
Click Apply.
Decision Center displays error messages, for example, to indicate that the value of the property majorVersion must be between 1 and 20.
Click Finish.
Sign out of Decision Center.
Return to the Samples Console and execute the feed command.
The command updates the data model with its custom properties, such as the options in the hierarchical list of department authorities for the Authority property.
Sign back in to Decision Center.
Edit the rule you created. Notice that the Authority drop-down list in Step 5: Edit Additional Properties now displays more options in .
Rebuilding this sample
To rebuild this sample:
In the Samples Commands view, navigate to .
Execute the clean command.
Execute the build command.
How this sample works
In this sample, you use the Ant tasks to extend the business rule model. You use the extensions to perform the following tasks automatically:
Generate an SQL script that carries schema modifications according to the new model.
Execute the SQL script against the database.
This sample shows different ways to customize the web user interface for extended properties such as:
Renderers, which you declare through extended-faces-config.xml and associate with the property in the extension model. Property renderers must extend IlrPropertyEditorRenderer. They mostly redefine the encodeValueField method to provide response code.
Validators, which you can customize (as shown in CustomRequestorPropertyValidator.java) or standard. Custom validators must implement the IlrTypeValidator interface. You can specify standard validators for range-min, range-max values as described in the extension model.
Source files
The source files for this sample are in the following locations:
New extension model: <InstallDir>/teamserver/samples/serverextendedbrm/resources
Configuration: <InstallDir>/teamserver/samples/serverextendedbrm/config
Customization: <InstallDir>/teamserver/samples/serverextendedbrm/src/serverextendedbrm
You can also view and modify the sample source files in Rule Designer. To import the sample into your workspace, click the Import projects link in the Samples and Tutorials view, and switch to the Java™ perspective.