Rule model property extensions sample details

The steps describe running the sample in the Business console.

Running the sample

To check the properties in existing artifacts:

You start by checking the properties in the existing classes. These properties were added to the artifacts in the rule project in the sample database. You look at properties in Loan Validation Service, but they are the same in all decision services.

  1. Log in to the Business console. Use Bea as the username and password (see Opening Decision Center on the sample server).
  2. Click the Loan Validation Service box, and not its name, and click main to open the main branch.
  3. Expand Loan Validation Scoring, and click the computation rule folder.
  4. Click initialCorporateScore > Show Details. You see a new property, Customer Names. This property is empty because you did not specify a default value.
  5. Close the Details dialog.
  6. Click computationFlow > Show Details. You see the new property RF Status. It contains the default value that you set.
  7. Close the Details dialog.
To check the properties in the new My Rule rule class:
  1. In the computation package preview pane, click the Plus button "" and select New instance of My Rule.
  2. Enter a name for your rule and click Create.
  3. On the rule editor page, click Details.
  4. On the Properties tab, scroll to the end of the page to see all the new properties. Use the drop-down menu to set the Keys value:
    Image shows the Keys values.
  5. On the Extended tab, use the arrow to set the Index value, and use the drop-down menu to set the Geography value:Image shows the Geography value.
  6. On the Truth Value tab, use the slider to set the value to 45:
    Image shows the truth value.
  7. Close the Details dialog. You do not need to save the rule.

Rebuilding this sample

To rebuild this sample:

  1. Open the Samples Console (see Running samples from the Samples Console).
  2. In the Samples Commands view, expand Samples Commands > Decision Center > Rule model property extensions.
  3. Double-click restore to reset the database to its original state.
CAUTION:
If you do not reset the database to its original state before you run other samples and tutorials, the extended properties are applied to all projects.

How this sample works

In this sample, you use the Ant tasks to extend the business rule model and add the new property editors. In the build.xml file, the deploy task calls three subtasks:

  • repack: Repackages the Decision Center application with the new editor description.

  • set-extensions: Extends the rule model.

  • upload-messages: Adds NL-enabled messages for the new property names. en_US.properties is provided in the sample.

The model extensions that are sent to the database are done automatically:

  • Generation of an SQL script that carries schema modifications according to the new model.

  • Execution of the SQL script with the database.

The new property editors are described in script files that define the custom code as Dojo classes, and use custom cascading style sheets (CSS). The deploy task deploys to the repackaged application to the sample server.

Source files

The source files for this sample are in the following directory:

  • <InstallDir>/teamserver/samples/dcextendedbrm

The model extension files are in the <InstallDir>/teamserver/samples/dcextendedbrm/src/resources/model directory:

  • customPropertiesExtension.brmx: Describes the model.
  • customPropertiesExtension.brdx: Describes the associated data.
  • customPropertiesExtensionMessages.properties: Describes the messages for the en_US locale.

The extensions to the GUI are declared in the <InstallDir>/teamserver/samples/dcextendedbrm/src/resources/com/ibm/rules/decisioncenter/web/preferences.properties. directory. They use the templates described in the HTML files in the <InstallDir>/teamserver/samples/dcextendedbrm/src/resources/extensions/templates directory.

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.