This sample shows how to extend the default properties of the rule packages and business rules, and how to customize web pages to display these properties.
Key Features
Key features of this sample include:
-
Extension model
-
Automatic update of database schema
-
UI customization for extended properties
Installing this Sample
To install this sample through the Samples Console:
-
Go to the Samples Console and locate the
teamserver > serverextendedbrm sample.
-
Check that the Samples Server is started. For information on how to start and stop the Samples Server, see Stopping and Restarting the Samples Server from the Samples Console.
-
Execute the
repack command to compile and repackage the application into a new deployable file.
-
Execute the
run command to set the extensions and deploy the new application.
The database schema is automatically updated by the Ant tasks.
-
Wait for the Java EE application to start before continuing. (The server trace displays the message:
[EARDeployer] Started J2EE application.)
Running this Sample
This sample can only be opened and run in the Samples Console.
To open and run the sample:
-
Open a web browser and enter the following URL to access Rule Team Server:
The
datasource parameter on the URL instructs Rule Team Server to use a specific datasource which supports the extended database schema and provides access to an extended rule type,
Extended Rule.
-
Sign in to Rule Team Server using the following details:
-
To create a rule of type Extended Rule:
-
Click the Compose tab.
-
Click Extended Rule in the Start from a type list, then click OK in the Type Information page.
-
The Extended Rule properties are defined in 8 steps.
Custom properties are defined in
Step 1: Properties,
Step 5: Edit Additional Properties, and
Step 6: Edit Target Release, as follows:
-
In Step1: Properties, the custom field Customer Names allows you to enter a comma-separated list of values (in this case, customer names).
-
Click Step 5: Edit Additional Properties > New. This step includes four customized fields:
- In the
Requestor Mail field, enter an invalid e-mail, such as "
john doe", and then click
Apply. An error message is displayed asking you to enter a valid e-mail address.
- Click a state on the
Territory map to select a territory. The name of the state you clicked appears in the text field just above the territory map.
- Select one of the options listed in the
Requirement list.
- Click the folder icon to the right of the
Authority text box, expand the hierarchy of options, and select the authority
loanvalidation-rules > Corporate > WS-ASE Department > Service 1.
- Click
Apply. The options are applied and the newly created property is listed in the
Edit Additional Properties page.
-
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). Each text field is associated with a custom validator to ensure that values entered are between a specified minimum and maximum value, and a custom
Production Level field that offers a list of numbered options.
-
Click Apply.
An error message is displayed indicating that the value of the property
majorVersion should be between 1 and 20.
-
Click Finish.
-
Return to the Samples Console and execute the
feed command.
This updates the custom properties, such as the options in the hierarchical list of department authorities for the
Authority property in
Step 5: Edit Additional Properties.
Source Files
This sample is located in <InstallDir>/teamserver/samples/serverextendedbrm.
The source files for the new extension model are located in:
<InstallDir>/teamserver/samples/serverextendedbrm/resources
-
serverextendedbrm.brmx is the extension model.
-
serverextendedbrm.brdx is the extension data.
-
serverextendedbrm_en_US.properties is the messages file.
The source file for the configuration is located in:
<InstallDir>/teamserver/samples/serverextendedbrm/config
-
extended-faces-config.xml is the JSF configuration file for extended features.
The source files for the customization are located in:
<InstallDir>/teamserver/samples/serverextendedbrm/src/serverextendedbrm
Highlights
Highlights of this sample include:
-
Extending the business rule model. In this sample, we show how to use the Ant tasks to set the extensions. This feature helps you to automatically:
-
Generate an SQL script that carries schema modifications according to the new model
-
Execute the SQL script against the database.
-
UI property customization. This sample shows different ways to customize the web user interface for extended properties such as:
-
Renderers, which are declared through the
extended-faces-config.xml and associated with the property in the extension model. Property renderers must extend IlrPropertyEditorRenderer. They mostly redefine the encodeValueField method to provide response code.
-
Validators, which can be customized (as shown in
CustomRequestorPropertyValidator.java) or standard. Custom validators must implement the IlrTypeValidator interface. Standard validators can be specified for range-min, range-max values as described in the extension model.
Rebuilding this Sample
To rebuild this sample.
-
Execute the
clean command.
-
Execute the
build command.
Related Concepts
Related Tasks
Related Reference