User Guide
The user guide for Red Hat JBoss BRMS 6
Abstract
Chapter 1. Introduction
1.1. About Red Hat JBoss BRMS
1.2. Use Case: Business Decision Management in the Insurance Industry with JBoss BRMS

Figure 1.1. BRMS Use Case: Insurance Industry Decision Making
1.3. Assets
Rules provide the logic for the rule engine to execute against. A rule includes a name, attributes, a 'when' statement on the left hand side of the rule, and a 'then' statement on the right hand side of the rule.
Business Rules define a particular aspect of a business that is intended to assert business structure or influence the behaviour of a business. Business Rules often focus on access control issues, pertain to business calculations and policies of an organization.
Business Processes are flow charts that describe the steps necessary to achieve business goals (see the BRMS Business Process Management Guide for more details).
A project is a container for packages of assets (business processes, rules, work definitions, decision tables, fact models, data models, and DSLs) that lives in the Knowledge Repository. It is this container that defines the properties of the KIE Base and KIE Session that are applied to its content. In the GUI, you can edit these entities in the Project Editor.
Important
pom.xml) with information on how to build the output artifact. It also contains the Module Descriptor file, kmodule.xml, that contains the KIE Base and KIE Session configuration for the assets in the project.
Packages are deployable collections of assets. Rules and other assets must be collected into a package before they can be deployed. When a package is built, the assets contained in the package are validated and compiled into a deployable package.
A domain specific languages, or DSL, is a rule language that is dedicated to the problem domain.
Decision Tables are collections of rules stored in either a spreadsheet or in the JBoss Enterprise BRMS user interface as guided decision tables.
Data models are a collection of facts about the business domain. The rules interact with the data model in rules-based applications.
1.4. Integrated Maven Dependencies
pom.xml file and should be included like the following example:
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1-redhat-2</version>
<scope>compile</scope>
</dependency>
Note
Chapter 2. Business Central
- Users need to manage versions/deployment of rules.
- Multiple users of different skill levels need to access and edit rules.
- You need an infrastructure to manage rules.
- Multiple types of rule editors (GUI, text) including:-
- Guided Rule Editor
- Rule Templates
- Decision Tables
- Store multiple rule "assets" together as a package
- Domain Specific Language support
- Complex Event Processing support
- Version control (historical assets)
- Testing of rules
- Validation and verification of rules
- Categorization
- Build and deploy including:-
- Assembly of assets into a binary package for use with a ChangeSet or KnowledgeBuilder.
- REST API to manipulate assets.
2.1. Logging on to Business Central
- Navigate to http://localhost:8080/business-central in a web browser. If the user interface has been configured to run from a domain name, substitute
localhostfor the domain name. For example http://www.example.com:8080/business-central. - Log in with the user credentials that were created during installation. For example: User =
helloworlduserand password =Helloworld@123.
2.2. The Home Screen

Figure 2.1. Business central home screen
The Authoring menu with links to Project Authoring and Administration is used to create and maintain the Knowledge Projects (KProjects), rule assets and repositories.
The Deployment menu allows a user to upload, download and manage the kjar files by using the artifact repository.
2.3. Project Authoring

Figure 2.2. The Project Explorer screen
- Project Explorer: The left pane of the project authoring screen is the project explorer that allows you to navigate through projects and create the required packages and assets. Clicking on the (
) button allows you to set the view to Project view or Repository view. The contents of the project can be navigated in a tree view by clicking on the Show as Folders or in a single-line path by clicking on the Show as Links.
- Content area: The content area shows the assets which are opened for editing. It has a toolbar with buttons like Save, Delete, Rename, Copy and Validate that can be used to perform the required actions on the assets that are being worked upon.
- Problems: The problems area shows the validation errors of the project that occur while saving or validating a particular asset.
2.3.1. Changing the Layout
Resizing the layout
- To resize the width of the screen:
- Move the mouse pointer over the vertical panel splitter. The pointer changes to
.
- Adjust the width of the screen by dragging the splitter and setting it at the required position.
- To resize the height of the screen:
- Hover the cursor over the horizontal panel splitter. The pointer changes to
.
- Adjust the height of the screen by dragging the splitter and setting the required position.
Repositioning the layout
- Move the mouse pointer on the title of the panel. The pointer changes to
.
- Press and hold the left click of the mouse and drag the screen to the required location. A
symbol indicating the target position is displayed to set the position of the screen.
2.3.2. Creating new assets

Figure 2.3. Creating new Asset screen

Figure 2.4. Create new pop-up dialog
2.4. Project Editor
2.4.1. The Project Editor
2.4.2. Project Settings
The Project settings screen allows a user to set the Group, Artifact, and Version ID's for a project. It edits the pom.xml setting file since we use Maven to build our projects.

Figure 2.5. Project Editor - Project Settings
The Dependencies option allows you to set the dependencies for the current project. You access the dependencies by using → option. You can add dependencies from the Artifact repository by clicking the button or by entering the Group ID, Artifact ID and Version ID of a project directly by clicking on the button.

Figure 2.6. Project Editor - Project Dependencies
The Metadata screen displays the generic data and version history of a project. It allows a user to edit other metadata details, add descriptions, and participate in discussions which are specific to a selected asset. You can assign categories to assets by clicking the plus icon
next to the → option. By opening an asset, you will see a list of the categories it currently belongs to. If you edit the asset, you will need to save your changes for future execution. Within the section is a list of attributes:
by- Who made the last change.Note- Comment from the last asset update.Created on- The date and time the asset was created.Created by- The name of the original asset author.Format- Short format name of the asset type.URI- Unique identifier of the asset.

Figure 2.7. Project Editor - Metadata
button to see advanced modification notes. You can press the
button to reload older versions of the file.
button, you can contribute to the discussion and then click OK to display the comment. The
button removes all the discussion posts.
2.4.3. Knowledge Base Settings
The Knowledge Base Settings allows the user to create the KIE bases and sessions using the kmodule.xml project descriptor file of your project. Accordingly, it edits the kmodule.xml project setting file.

Figure 2.8. Project Editor - Knowledge Base Settings
Identity or Equality assertion modes.
Identityuses anIdentityHashMapto store all asserted objects.
Equalityuses aHashMapto store all asserted objects.
Note
Identity and Equality assertion modes.
Cloud and Stream processing modes.
Cloudprocessing mode is the default processing mode. It behaves in the same manner as any pure forward-chaining rules engine.Streamprocessing mode is ideal when the application needs to process streams of events.
Note
Cloud and Stream processing modes.
button, you are able to add a new knowledge session to the table.
- The
Namefield displays the name of the session. - The
Defaultoption can only be allocated to one of each type of session. - The
Statedrop-down allows either Stateless or Stateful types. - The
Clockdrop-down allows either Realtime or Pseudo choices. - Clicking the
opens a pop-up that displays more properties for the knowledge session.
Please refer to Section 2.4.2, “Project Settings” for more information about Metadata.

Figure 2.9. Knowledge Base Settings - Metadata
2.4.4. Imports
The Import suggestions specify a set of imports used in the project. Each asset in a project has its own imports. The imports are used as suggestions when using the guided editors the workbench offers; accordingly, this makes it easier to work with the workbench as there is no need to type each import in every file that uses it. By changing the Import settings, the project.imports setting files are edited.

Figure 2.10. Project Editor - Imports
button. This displays a pop-up dialog to Add Import information. Once the Import Type has been entered, press OK.
button.
Note
Please refer to Section 2.4.2, “Project Settings” for more information about Metadata.

Figure 2.11. Imports - Metadata
2.6. Rename, Copy, Delete assets
2.6.1. Renaming a file or folder
- To rename a file or a folder, open Project Explorer by selecting → .
- Click the Gear
icon in the upper right hand corner of the Project Explorer view and in the menu that opens, select Repository View. Click the gear icon again to select the option Show as Links (if not already selected).
- Click the Rename
icon to the right of the file or folder you want to rename. In the displayed Rename this item dialog box, enter the new name and click the Rename item button.
2.6.2. Deleting a file or folder
- To delete a file or a folder, open Project Explorer by selecting → .
- Click the Gear icon (
) in the upper right hand corner of the Project Explorer view and in the menu that opens, select Repository View. Click the gear icon again to select the option Show as Links (if not already selected).
- Click the Delete icon (
) to the right of the file or folder you want to rename. In the displayed Delete this item dialog box, click the Delete item button.
2.6.3. Copying a file or folder
- To copy a file or a folder, open Project Explorer by selecting → .
- Click the Gear
icon in the upper right hand corner of the Project Explorer view and in the menu that opens, select Repository View. Click the gear icon again to select the option Show as Links (if not already selected).
- Click the Copy
icon to the right of the file or folder you want to copy. In the displayed Copy this item dialog box, enter the new name and click the Create copy button.
2.7. Deployment Menu: The Artifact Repository

Figure 2.13. The Artifact Repository Screen
Chapter 3. Setting up a new project
3.1. Creating an organizational unit
Important
ADMIN role can create an organizational unit.
Procedure 3.1. Creating an organizational unit
- Open the Administration perspective: on the main menu, click → .
- On the perspective menu, click → .
- In the Organization Unit Manager view, click on the button. The Add New Organizational Unit pop-up window opens.

Figure 3.1. Add New Organizational Unit Pop-up
- Enter the mandatory details:
- Organizational unit name.
- Owner.
- Click OK to create the unit.
3.2. Creating a repository
Important
ADMIN role can create a repository.
Procedure 3.2. Creating a New Repository
- Open the Administration perspective: on the main menu, click → .
- On the perspective menu, click → .
- The Create Repository pop-up window is displayed.

Figure 3.2. Create Repository Pop-up
- Enter the mandatory details:
- Repository name.
Note
Note that the repository name should be a valid filename. Avoid using a space or any special character that might lead to an invalid folder name. - Select an organizational unit in which the repository is to be created from the Organizational Unit drop-down option.
- Click Create
- A confirmation prompt with an OK button is displayed which notifies the user that the repository is created successfully. Click OK.
3.3. Cloning a repository
Important
ADMIN role can clone a repository.
Procedure 3.3. Cloning a repository
- Open the Administration perspective.
- On the Repositories menu, select .
- The Clone Repository pop-up window is displayed.

Figure 3.3. Clone Repository Pop-up
- In the Clone Repository dialog window, enter the repository details:
- Enter the Repository Name to be used as the repository identifier in the Asset repository and select the Organizational Unit it should be added to.
- Enter the URL of the GIT repository:
- For a Local Repository:
file:///path-to-repository/reponame - For a Remote or preexisting Repository:
git://hostname/reponame
Note
The file protocol is only supported for 'READ' operations. 'WRITE' operations are not supported. - If applicable, enter the User Name and Password to be used for authentication when cloning the repository.
- Click Clone.
- A confirmation prompt with an OK button is displayed which notifies the user that the repository is created successfully. Click OK.
3.4. Creating a project
- Open the Project Authoring perspective: on the main menu, click → .
- In the Project Explorer, select the organizational unit and the repository where you want to create the project.
- In the perspective menu, go to → .
- In the Create new Project dialog window, define the project details:
- In the Resource Name text box, enter the project name.

Figure 3.4. New Project Screen
Note
Note that the project name should be a valid filename. Avoid using a space or any special character that might lead to an invalid folder name.
- The explorer refreshes to show a New Project Wizard pop-up window.

Figure 3.5. New Project Wizard Pop-up
- Define the Project General Settings and Group artifact version details for this new project. These parameters are stored inside the
pom.xmlmaven configuration file.- Project Name: The name for the project; for example
Mortgages - Project Description: The description of the project which may be useful for the project documentation purpose.
- Group ID: group ID of the project; for example
org.mycompany.commons - Artifact ID: artifact ID unique in the group; for example
myframework - Version ID: version of the project; for example
2.1.1
The Project Screen view is updated with the new project details as defined in the pom.xml file. Note, that you can switch between project descriptor files in the drop down-box with Project Settings and Knowledge Base Setting, and edit their contents.
3.5. Creating a new package
Procedure 3.4. Creating a new package
- Open the Project Authoring perspective: on the main menu, click → .
- In the Project Explorer view, do the following:
- If in the Project view of Project Explorer, select the organizational unit, repository and the project where you want to create the package.
- If in the Repository view of Project Explorer, navigate to the project root, where you want to create the package.
- In the perspective menu, go to → .
- In the Create new Package dialog window, define the package details:
- In the Resource Name text box, enter the package name and click .
- The new package is now created under the selected project.
3.6. Adding dependencies
- Open the Project Editor for the given project:
- In the Project Explorer view of the
Project Authoringperspective, open the project directory. - In the perspective menu, go to → .
- In the Project Screen view, select in the Project Settings drop-down box the Dependencies item.
- On the updated Project Screen, click the button to add a maven dependency or click the button to add a dependency from the Knowledge Store (Artifact repository):
- When adding a maven dependency, a user has to define the Group ID, Artifact ID and the Version ID in the new row which is created in the dependency table.
- When adding a dependency from the Knowledge Store, select the dependency in the displayed dialog box: the dependency will be added to the dependency table.
- To apply the various changes, the dependencies must be saved.
3.7. Defining KIE bases and sessions
kmodule.xml project descriptor file of your project. You can edit this file via the user interface provided in the Project Editor or by directly editing this file under the src/main/resources/META-INF/ folder by navigating through the Repository view.
Defining KIE bases and sessions in the Project Editor
kmodule.xml file, do the following:
- Open your project properties with the Project Editor: in the Project Explorer, locate your project root. In the top menu, go to → .
- In the Project Screen tab on the right, select "Knowledge Base Settings: Knowledge bases and sessions" option. This brings up a user interface for editing the kmodule.xml file.
- Click on Add button to define and add your bases. Scroll down in this screen to add your knowledge sessions.
- Click the save button in the top right once done.
Defining KIE bases and sessions in the kmodule.xml file directly.
kmodule.xml file directly, do the following:
- Open up the repository view for your project by clicking the gear icon.

Figure 3.6. Changing to repository view
- Click on
srcfolder, and then drill down to locate theMETA-INFfolder (/src/main/resources/META-INF). You will see thekmodule.xmlfile. Click on this file and its raw view will open up in a panel on the right hand side. - Define your bases and sessions in this file panel. An example of what you need to enter is shown below.
<kbase name="TestBase" default="false" eventProcessingMode="stream" equalsBehavior="equality"> <ksession name="TestSession" type="stateless" default="false" clockType="realtime"/> </kbase> - Click save button in the top right hand screen once done.
Note
3.8. Creating a resource
Note
- In the Repository view of the Project Explorer, navigate to the
REPOSITORY/PROJECT/src/main/resources/directory. - Go to → .
- In the New resource dialog, define the package name and check the location of the package in the repository.
Chapter 4. Data models
Important
4.1. Data Modeler

|
The Objects panel contains a list of data objects that constitute the data model in the given Project.
|
|
The Fields panel contains a list of fields of the data object selected in the Objects panel.
|
|
The Properties panel displays the properties of the data field selected in the Field panel.
|
Figure 4.1. Data Modeler environment
4.2. Creating a data object
- Open the Data Modeler: in the Project Authoring perspective, click → on the perspective menu.
- Create a data object:
- In the Objects panel, click the button and provide the data object details:
- Identifier: name of the data object unique within the project.
Warning
This identifier name must be unique within the whole project, and not just the package. - Label: name of the data object to be displayed in the Objects panel
- New package: a new package the object should be created in
- Existing package: an existing package the object should be created in
- Superclass: a data object to be used as the superclass for the data object (the data objects extends this class, that is, it inherits all its fields)
- Create fields of the data object:
- Select the object in the Objects panel.
- In the Create new field part of the Fields panel, define the field properties:
- Id: field ID unique within the data object
- Label: label to be used in the Fields panel
- Type: data type of the field
- Click .
Important
Warning
Chapter 5. Writing rules
5.1. Creating a rule
Procedure 5.1. Creating a new rule
- In the Project Explorer view, do the following:
- If in the Project view of Project Explorer, select the organizational unit, repository and the project where you want to create the rule.
- If in the Repository view of Project Explorer, navigate to src/main/resources/ and the SUBFOLDER/PACKAGE where you want to create the project folder for the rule template.
- In the perspective menu, go to → .
- In the Create new Guided Rule dialog window, define the package details:
- In the Resource Name text box, enter the Guided Rule name and click .
- The new Guided Rule is now created under the selected project.
5.2. The asset editor
5.2.1. The asset editor
The edit tab is where assets can be edited. The available options in the edit tab will depend on the type of asset being edited.

Figure 5.1. The asset editor - Edit tab
Source tab shows the DRL source for a selected asset.

Figure 5.2. The asset editor - Source tab
The config tab suggests the set of imports used in the project. Each asset has its own imports and suggest fact types that the user might want to use.

Figure 5.3. The asset editor - Config tab
The Metadata screen displays the generic data and version history of an asset. It allows a user to edit other metadata details, add descriptions and discussions which are specific to a selected asset.

Figure 5.4. The asset editor - Metadata tab
5.2.2. Business rules with the guided editor
Example 5.1. The guided editor

5.2.3. The Anatomy of a Rule
- WhenThe When part of the rule is the condition that must be met. For instance, a bank providing credit in the form of a loan may specify that customers must be over twenty-one years of age. This would be represented by using when to determine if the customer is over twenty-one years of age.
- ThenThe Then part of the rule is the action to be performed when the conditional part of the rule has been met. For instance, when the customer is under twenty-one years of age, then decline the loan because the applicant is under age.
- OptionalOptional attributes such as salience can be defined on rules.
5.2.4. Salience
5.2.5. Adding Conditions or Actions to Rules
Procedure 5.2. Adding Conditions or Actions to Rules
- Click the plus icon in the When section of the guided editor to add a condition, or click the plus icon in the Then section of the guided editor to add an action.
- Select the condition or action from the menu and click Ok. If the package the rule belongs to has been configured to include DSL (Domain Specific Language) sentences, DSL sentences can be chosen from the menu.
- If the condition or action requires input, i.e., a date, true or false, am integer, or other input type, enter the required value.
5.2.6. Adding a Field to a Fact Type
Procedure 5.3. Adding a Field to a Fact Type
Select the Model
From the Project Explorer, select the Project and expand the package that contains the model.Select and Open the model from the list by clicking over it.Add the Field
Expand the fact type by clicking the plus sign next to it and select Add Field.Enter the Field Details
Add the details to the pop up dialogue. In this case, enter the name guarantor in the Field name field and select True or False from the Type drop down menu.Save the changes made to the model by selecting File and Save changes.
5.2.7. Technical Rules (DRL)

Figure 5.5. Technical Rule (DRL)
5.3. Decision Tables
5.3.1. Spreadsheet Decision Tables
5.3.2. Uploading Spreadsheet Decision Tables
Procedure 5.4. Uploading a Spreadsheet Decision Table
- To upload an existing spreadsheet, select → .
- Enter a name for the spreadsheet and then click button to browse and select the spreadsheet. You can only select
.xlsfiles. Click the button when done.
- Validate the uploaded spreadsheet by clicking on the Validate button located on the project screen menu bar.
- Now click on the Other drop down menu on the project screen toolbar and select the Convert to Guided Decision Table option.
5.3.3. Spreadsheet Decision Table Examples
- If the number of items ordered is 4 or more and totaling $300 or over and
- If delivered at the standard shipping day from the day they were purchased which would be 4 to 5 working days.
Table 5.1. For orders less than $300
| Number of items | Delivery Day | Shipping Charge, N = Number of Items |
|---|---|---|
|
3 or less
|
Next Day
|
$35
|
|
2nd Day
|
$15
| |
|
Standard
|
$10
| |
|
4 or more
|
Next Day
|
N*$7.50
|
|
2nd Day
|
N*3.50
| |
|
Standard
|
N*2.50
|
Table 5.2. For orders more than $300
| Number of items | Delivery Day | Shipping Charge, N = Number of Items |
|---|---|---|
|
3 or less
|
Next Day
|
$25
|
|
2nd Day
|
$10
| |
|
Standard
|
N*$1.50
| |
|
4 or more
|
Next Day
|
N*$5
|
|
2nd Day
|
N*2
| |
|
Standard
|
FREE
|


- Send an email when Recipient address is present, subject is present and before 5:30pm
- If after 5:30pm, then put it in the pending folder
- If Recipient address is missing, give a warning message
- If all fields are present and before 5:30, send the email
Table 5.3. Decision Table Mapping
| Criteria | Mapped Entries | ||||
|---|---|---|---|---|---|
Conditions (IF)
|
Address Present
|
Y
|
Y
| |
Y
|
|
Subject Present
|
Y
| |
Y
|
Y
| |
|
Before 5:30
|
Y
|
Y
|
Y
| | |
Actions (THEN)
|
Send Mail
|
X
| | | |
|
Error Message
| |
X
|
X
| | |
|
Make Pending
| | | |
X
| |
5.4. Web Based Guided Decision Tables
5.4.1. Web Based Guided Decision Tables



5.4.2. Types of decision tables
- Extended Entry
- Limited Entry
An Extended Entry decision table is one for which the column definitions specify Pattern, Field and operator but not value. The values, or states, are themselves held in the body of the decision table. It is normal, but not essential, for the range of possible values to be restricted by limiting entry to values from a list. Business central supports use of Java enumerations or decision table "optional value lists" to restrict value entry.
A Limited Entry decision table is one for which the column definitions specify value in addition to Pattern, Field and operator. The decision table states, held in the body of the table, are boolean where a positive value (a checked tick-box) has the effect of meaning the column should apply, or be matched. A negative value (a cleared tick-box) means the column does not apply.
5.4.3. Column Configuration
- LiteralThe value in the cell will be compared with the field using the operator.
- FormulaThe expression in the cell will be evaluated and then compared with the field.
- PredicateNo field is needed, the expression will be evaluated to true or false.

Figure 5.6. Column Configuration
5.4.4. Adding Columns
icon.

Figure 5.7. Advanced Column Options
- Add a new Metadata\Attribute column
- Add a simple Condition
- Set the value of a field
- Set the value of a field on a new fact
- Delete an existing fact
- Add a Condition BRL fragment
- Execute a Work Item
- Set the value of a field with a Work Item parameter
- Set the value of a field on a new Fact with a Work Item parameter
- Add an Action BRL fragment
5.4.5. Column Types
5.4.5.1. Attribute Columns
when $c : Cheese( name == "Cheddar" ) then ... end
when not Cheese( name == "Cheddar" ) then ... end
5.4.5.2. Metadata Columns

Figure 5.8. Attribute and MetaData Option
5.4.5.3. Condition Columns
- Literal : The value in the cell will be compared with the field using the operator.
- Formula: The expression in the cell will be evaluated and then compared with the field.
- Predicate : No field is needed, the expression will be evaluated to true or false.

Figure 5.9. Simple Condition Column
5.4.5.4. Field Value Columns

Figure 5.10. Set the value of a field
5.4.5.5. New Fact Field Value Columns

Figure 5.11. Set the value of a field on a new fact
5.4.5.6. Delete Existing Fact Columns

Figure 5.12. Delete an existing fact
5.4.6. Advanced Column Types
5.4.6.1. Condition BRL Fragment Columns

Figure 5.13. Add a Condition BRL fragment
5.4.6.2. Execute Work Item Columns

Figure 5.14. Execute a Work Item

Figure 5.15. WS Work Item

Figure 5.16. REST Work Item

Figure 5.17. Log Work Item

Figure 5.18. Email Work Item
5.4.6.3. Field Value with Work Item Parameter Columns

Figure 5.19. Set the value of a field with a Work Item parameter
Note
5.4.6.4. New Fact Field Value with Work Item Parameter Columns

Figure 5.20. Set the value of a field on a new Fact with a Work Item parameter.
Note
5.4.6.5. Action BRL Fragment Columns

Figure 5.21. Simple layout for Adding an Action BRL fragment
5.4.7. Rule Definition

Figure 5.22. Rule Definition
5.4.8. Cell Merging

Figure 5.23. Cell Merging
5.4.9. Cell Grouping

Figure 5.24. Cell Grouping
5.4.10. Otherwise Operations
== or inequality != operators can take advantage of a special decision table cell value of otherwise. This special value allows a rule to be defined that matches on all values not explicitly defined in all other rules defined in the table. This is best illustrated with an example:
when
Cheese( name not in ("Cheddar", "Edam", "Brie") )
...
then
...
endwhen
Cheese( name in ("Cheddar", "Edam", "Brie") )
...
then
...
end5.5. Rule Templates
5.5.1. The Guided Rule Template
Procedure 5.5. Creating a new Guided Rule Template
- In the Project Explorer view, do one of the following:
- If you are in the Project view, select the organizational unit, repository, and the project where you want to create the template.
- If you are in the Repository view, navigate to
src/main/resources/and theSUBFOLDER/PACKAGEwhere you want to create the project folder for the rule template.
- In the perspective menu, go to → .
- In the Create new Guided Rule Template dialog window, specify the rule template name:
- In the Resource Name text box, enter the Guided Rule Template name and click .
- The new Guided Rule Template is now created and under the selected project.

Figure 5.25. Guided Template Editor
Note
5.5.2. WHEN conditions in the Guided Rule Template
Guided Template Editor within Business Central allows users to set rule templates where the data is completely separate from the rules.
WHEN constrains within the Edit tab.
Note
Procedure 5.6. Using the Guided Template Editor with WHEN constraints
- Assuming you have already set up a Data Model for your project (as described in Section 4.2, “Creating a data object”), select the plus icon
to the right of the WHENsection of the Guided Template Editor. - A dialog window will appear with available condition templates to choose from. In the example below, we select the
Nurse...condition from the list.
Figure 5.26. Nurse Roster WHEN Dialog Window
- Click
OKand the Guided Template Editor will display yourWHENcondition. - Click on the newly added
WHENcondition. In the example below, it is the "There is a Nurse" condition. A "Modify constraints for Nurse" dialog appears.
Figure 5.27. Modify Constraints Dialog
- From here you can add a restriction on a field, apply multiple field constraints, add a new formula style expression, apply an expression editor, or set a variable name.
- In the example below, we will add a restriction of
servicelengthto the condition.
Figure 5.28. Title
- Once selected, the dialog window closes automatically.
- Next to the newly selected restriction will be a drop down box to choose an operator. In the example below, we have chosen an operator of "less than."

Figure 5.29. Restriction drop-down menu
- By selecting the Edit Icon
within the restrictions field, you will be able to define the field value with a literal value, template key, a formula, or expression editor.

Figure 5.30. Field Value Options
- By clicking on the
WHENcondition again, we can supply a variable name to help define the restriction. In the example below, we name it "nurse" and click the Set button.
Figure 5.31. Setting a variable name
- Continue to add
WHENconditions as appropriate for the project. The example below demonstrates "servicelength" and "rating" constraints.
Figure 5.32. WHEN Constraints
5.5.3. THEN actions in the Guided Rule Template
THEN section of a rule holds the actions to be executed when it matches the WHEN section.This section explores how to alter the THEN actions within the Edit tab of the Guided Template Editor.
Procedure 5.7. Using the Guided Template Editor with THEN actions
- Select the plus icon
to the right of the THENsection of the Guided Template Editor to inputTHENactions. - A dialog window will appear with available action templates to choose from. In the example below, we select the
Modify nurse...action from the list.
Figure 5.33. Nurse Roster THEN Dialog Window
- Click
OKand the Guided Template Editor will display yourTHENaction. - Click on the newly added
THENaction. In the example below, it is the "Modify value of Nurse[nurse]"
action. An "Add a field" dialog appears.

Figure 5.34. Add a field Dialog
- Within this dialog, you can choose a field from the Add field drop-down menu.
- Once selected, the dialog window closes automatically.
- By selecting the Edit Icon
within the item field, you will be able to define the field value with a literal value, template key, or a formula.

Figure 5.35. Field Value Options
5.5.4. Data Tables in the Guided Rule Template
Procedure 5.8. Using the Guided Template Editor with Data Tables
- Click on the Data tab at the bottom of the Guided Template Editor in order to access the newly created data table.
- Click the Add row...
button to add more table rows.
- Input additional data into the table. In the example below, we see the ServiceLessThan, ServiceGreaterThan, EmployeeRating, and VacationTime column options and supply data to each field.

Figure 5.36. Data Table for Guided Template Editor
- To view the code source, click the Source tab at the bottom of the Guided Template Editor. Illustrated below is the source code for the Nurse example in the Veronica Template.

Figure 5.37. Source Code for Nurse Example
- Save the template when you are finished working in the Guided Template Editor.
5.6. The Domain Specific Language Editor
- {<varName>:<regular expression>}This will render a text field in place of the DSL variable when the DSL sentence is used in the guided editor. The content of the text field will be validated against the regular expression.
- {<varName>:ENUM:<factType.fieldName>}This will render an enumeration in place of the DSL variable when the DSL sentence is used in the guided editor. <factType.fieldName> binds the enumeration to the model fact and field enumeration definition. This could be either a Knowledge Base enumeration or a Java enumeration, i.e., defined in a model POJO JAR file.
- {<varName>:DATE:<dateFormat>}This will render a date selector in place of the DSL variable when the DSL sentence is used in the guided editor.
- {<varName>:BOOLEAN:<[checked | unchecked]>}This will render a dropdown selector in place of the DSL variable, providing boolean choices, when the DSL sentence is used in the guided editor.

Figure 5.38. DSL Editor
5.7. Data Enumerations
5.7.1. Data Enumerations Drop Down List Configuration
fact.field to a list of values. These values are used to populate the drop-down menu. The list can either be literal or use a utility class (which must be added to the classpath) to load the strings. The strings contain either a value to be shown in the drop-down menu or a mapping from the code value (which is what is used in the rule) and a display value, e.g., M=Mini.
Example 5.2. An Example Enumeration Configuration
'Board.type' : [ 'Short', 'Long', 'M=Mini', 'Boogie'] 'Person.age' : [ '20', '25', '30', '35' ]
5.7.2. Advanced Enumeration Concepts
policyType and coverage. The choices for policyType could be Home or Car. The type of insurance policy will determine the type of coverage that will be available. A home insurance policy could include property or liability. A car insurance policy could include collision or fullCoverage.
'Insurance.policyType' : ['Home', 'Car'] 'Insurance.coverage[policyType=Home]' : ['property', 'liability'] 'Insurance.coverage[policyType=Car]' : ['collision', 'fullCoverage']
5.7.3. Obtaining Data Lists from External Sources
java.util.List (of strings). Instead of specifying a list of values in the user interface, the code can return the list of strings. (As normal, you can use the "=" sign inside the strings if you want to use a different display value to the rule value.) For example, you could use the following:
'Person.age' : ['20','25', '30', '35']
'Person.age' : (new com.yourco.DataHelper()).getListOfAges()
DataHelper which has a method getListOfAges() which returns a list of strings. The data enumerations are loaded the first time the guided editor is used in a session. To check the enumeration has loaded, go to the package configuration screen. You can "save and validate" the package; this will check it and provide feedback about any errors.
5.8. Scorecards
5.8.1. Scorecards
- A statistical analysis is performed on the historical data which is usually collected from the existing customer database.
- A predictive or probable characteristics (attributes or pieces of information) are identified based on this analysis.
- Each characteristics are then broken down into ranges of possible values which are then given a score.

Figure 5.39. Scorecard Example
5.8.2. Creating a Scorecard
Procedure 5.9. Creating a new Score Card (Spreadsheet)
- Open the Project Authoring perspective: on the main menu, click → .
- In the Project Explorer view, do the following:
- If in the Project view of Project Explorer, select the organizational unit, repository and the project where you want to create the score card.
- If in the Repository view of Project Explorer, navigate to the project root, where you want to create the score card.
- In the perspective menu, go to → .
- In the Create new Score Card (Spreadsheet) dialog window, define the package details:
- In the Resource Name text box, enter the score card name.
- Click on Choose File and browse to the location to select the spreadsheet in which the score card is initially created.
- Click OK.
- The new score card spreadsheet is created under the selected project.
Chapter 6. Building and deploying assets

Figure 6.1. Build & Deploy Option
Chapter 7. Managing Assets
7.1. Categories
Draft and Review categories make it possible to tag a rule so that it is clear exactly where the rule is in its life-cycle.
7.2. Versions and storage
Project Explorer from the unified environment of Red Hat JBoss BRMS.
7.3. Discussion

Figure 7.1. Discussion
Chapter 8. Testing
8.1. Test Scenarios

Figure 8.1. Test Scenario Screen
8.2. Creating a Test Scenario
Procedure 8.1. Creating a new Test Scenario
- Open the Projects view from the Authoring menu.
- Select the project where the test scenario is to be created.
- From the New dropdown menu on the toolbar, select Test Scenario from the listed options.
- Enter the Test Scenario name in the pop-up dialog box and click OK.
- You will be presented with the Test Scenario edit screen.
Procedure 8.2. Importing a model for the Test Scenario
- Use the tabs at the bottom of the screen to move between the Test Scenario edit screen and the Config edit screen.
- The Config screen allows you to specify the model objects that you will be using in this Test Scenario.
- Facts/data objects from the same package are available by default. For example, if you have a package structure
org.company.project, and you have a fact/data object Fact1 in packageorg.companyand a Fact2 in packageorg.company.project, you will not have to import model objects for Fact1 if you want to create a Test Scenario in packageorg.company; however, you will need to import Fact2 if you want to use it. - To do this, you will need to import the model objects required for your Scenario by clicking on the New Item button in the Config screen.
- These imports can be specific to your project's data model or generic ones like
StringorDoubleobjects.
Procedure 8.3. Providing Test Scenario conditions
- After you have imported the model objects, come back to the Test Scenario screen and enter the variables for your Scenario.
- At the minimum, there are two sections that require input: GIVEN and EXPECT
- GIVEN: What are the input facts for this Test Scenario?
- EXPECT: What are the expected results given the input facts from the GIVEN section?
GIVENthese input parameters,EXPECTthese rules to be activated or fired. You can alsoEXPECTfacts to be present and to have specific field values orEXPECTrules not to fire at all.If the expectations are met, then the Test Scenario has passed and your rules have been created correctly. If the expectations are not met, then the Test Scenario has failed and you need to check your rules.
Procedure 8.4. Providing Given Facts
- To add a new condition, click on the green + button next to the GIVEN label. This will bring up the New Input dialog box. Provide your fact data in this window based on the project models that you have imported in the Config screen.
You can select a particular fact/data object from the model, give it a variable name (called Fact Name in the window) or choose to activate a rule flow group instead. If you choose to activate a rule flow group, you are allowing rules from a rule flow group to be tested by activating the group in advance. If you want to both add a given fact and activate a rule flow group, you have to add the given fact, click the green + button again, and then add the activation. - Depending upon the model object that you select, you will be able to provide values to its editable properties as part of your GIVEN fact. For example, if your model was a
Product, you might have properties likeitemID,productNameandprice. You get to these properties by clicking on the textInsert Product.
By clicking on the pencil icon next to the property, you can edit the property to provide either a literal value for that property that should form part of your GIVEN fact data or you can provide advanced fact data.
Procedure 8.5. Providing Expected Rules
- Once you are satisfied with the Given fact conditions, you can provide the expected rules that will be fired if the Given fact conditions are met when the Test Scenario is run.
- To do so, click on the green + button next to the Expect label. A New expectation dialog box will come up.
- You can provide one of three expectations given the set of data that was created in the Given section. You can:
- Either type in the name of a rule that is expected to be fired or select it from the list of rules and then click the button.
- Expect a particular instance of a model object (and one or more of its properties) to have a certain value by selecting that instance from the drop down in the Fact Value field. For example,
product1shown in the figure, which is an instance of the fictitiousProductmodel created in the Given section. You specify the property values by first adding that instance by clicking the button and then clicking a green arrow
to bring up the fields to add. Once you have selected the field to add, you can provide a literal value for that field.
- Expect instances of a fact model to match your Given conditions by selecing it from the Any fact that matches drop down. In the figure shown above, you can mandate that instances of Product's one or more properties match the Given conditions. For example, You have a fact 'A' with a String field 'fieldA'. In the test scenario, you set two given facts: 'A' bound to variable 'a1' and 'A' bound to variable 'a2'. Fact 'a1' will have 'fieldA' with value "something", fact 'a2' will have 'fieldA' with value "else". You will add an expectation - any fact that matches A. Add 'fieldA' with value "something" to this expectation. Save the test scenario and run it. It will pass (correctly), even though only 'a1' matches the expectation.
Procedure 8.6. Reviewing, Saving, and Running a Scenario
- Once you are satisfied with your Test Scenario's conditions, you can save it by clicking the button in the upper right corner. Make sure to regularly save and review your scenarios.
- You can now run your Test Scenario by clicking the button at the top of the Test Scenario screen. The results are displayed at the bottom of this screen in a new panel called Reporting.
- Once you have a bunch of Test Scenarios for a particular package, you can run all of them together by accessing the All Test Scenarios tab and then clicking the button.
Chapter 9. REST API
- Knowledge Store (Artifact Repository) REST API calls are calls to the static data (definitions) and are asynchronous, that is, they continue running after the call as a job. These calls return a job ID, which can be used after the REST API call was performed to request the job status and verify whether the job finished successfully. Parameters of these calls are provided in the form of JSON entities.
http://SERVER_ADDRESS:PORT/business-central/rest/REQUEST_BODY
Note
9.1. Knowledge Store REST API
9.1.1. Job calls
- ACCEPTED: the job was accepted and is being processed.
- BAD_REQUEST: the request was not accepted as it contained incorrect content.
- RESOURCE_NOT_EXIST: the requested resource (path) does not exist.
- DUPLICATE_RESOURCE: the resource already exists.
- SERVER_ERROR: an error on the server occurred.
- SUCCESS: the job finished successfully.
- FAIL: the job failed.
- APPROVED: the job was approved.
- DENIED: the job was denied.
- GONE: the job ID could not be found.A job can be GONE in the following cases:
- The job was explicitly removed.
- The job finished and has been deleted from the status cache (the job is removed from status cache after the cache has reached its maximum capacity).
- The job never existed.
job calls are provided:
- [GET] /jobs/{jobID}
- returns the job status - [GET]
Example 9.1. Response of the job call on a repository clone request
"{"status":"SUCCESS","jodId":"1377770574783-27","result":"Alias: testInstallAndDeployProject, Scheme: git, Uri: git://testInstallAndDeployProject","lastModified":1377770578194,"detailedResult":null}" - [DELETE] /jobs/{jobID}
- removes the job - [DELETE]
9.1.2. Repository calls
repositories calls are provided:
- [GET] /repositories
- This returns a list of the repositories in the Knowledge Store as a JSON entity - [GET]
Example 9.2. Response of the repositories call
[{"name":"brms-assets","description":"generic assets","userName":null,"password":null,"requestType":null,"gitURL":"git://brms-assets"},{"name":"loanProject","description":"Loan processes and rules","userName":null,"password":null,"requestType":null,"gitURL":"git://loansProject"}] - [DELETE] /repositories/{repositoryName}
- This removes the repository from the Knowledge Store - [DELETE]
- [POST] /repositories/
- This creates or clones the repository defined by the JSON entity - [POST]
Example 9.3. JSON entity with repository details of a repository to be cloned
{"name":"myClonedRepository", "description":"", "userName":"", "password":"", "requestType":"clone", "gitURL":"git://localhost/example-repository"} - [POST] /repositories/{repositoryName}/projects/
- This creates a project in the repository - [POST]
Example 9.4. Request body that defines the project to be created
"{"name":"myProject","description": "my project"}" - [DELETE] /repositories/{repositoryName}/projects/
- This deletes the project in the repository - [DELETE]
Example 9.5. Request body that defines the project to be deleted
"{"name":"myProject","description": "my project"}"
9.1.3. Organizational unit calls
organizationalUnits calls are provided:
- [GET] /organizationalunits/
- This returns a list of all the organizational units - [GET].
- [POST] /organizationalunits/
- This creates an organizational unit in the Knowledge Store - [POST]. The organizational unit is defined as a JSON entity. This consumes an
OrganizationalUnitinstance and returns aCreateOrganizationalUnitRequestinstance.Example 9.6. Organizational unit in JSON
{ "name":"testgroup", "description":"", "owner":"tester", "repositories":["testGroupRepository"] } - [POST] /organizationalunits/{organizationalUnitName}/repositories/{repositoryName}
- This adds the repository to the organizational unit - [POST]. It also returns a
AddRepositoryToOrganizationalUnitRequestinstance.
Note
9.1.4. Maven calls
maven calls are provided below:
- [POST] /repositories/{repositoryName}/projects/{projectName}/maven/compile/
- This compiles the project (equivalent to
mvn compile) - [POST]. It consumes aBuildConfiginstance, which must be supplied but is not needed for the operation and may be left blank. It also returns aCompileProjectRequestinstance. - [POST] /repositories/{repositoryName}/projects/{projectName}/maven/install/
- This installs the project (equivalent to
mvn install) - [POST]. It consumes aBuildConfiginstance, which must be supplied but is not needed for the operation and may be left blank. It also returns aInstallProjectRequestinstance. - [POST] /repositories/{repositoryName}/projects/{projectName}/maven/test/
- This compiles and runs the tests - [POST]. It consumes a
BuildConfiginstance and returns aTestProjectRequestinstance. - [POST] /repositories/{repositoryName}/projects/{projectName}/maven/deploy/
- This deploys the project (equivalent to mvn deploy) - [POST]. It consumes a
BuildConfiginstance, which must be supplied but is not needed for the operation and may be left blank. It also returns aDeployProjectRequestinstance.
9.2. REST summary
http://server:port/business-central/rest
Table 9.1. Knowledge Store REST calls
| URL Template | Type | Description |
|---|---|---|
| /jobs/{jobID} | GET | return the job status |
| /jobs/{jobID} | DELETE | remove the job |
| /organizationalunits | GET | return a list of organizational units |
| /organizationalunits | POST |
create an organizational unit in the Knowledge Store described by the JSON
OrganizationalUnit entity
|
| /organizationalunits/{organizationalUnitName}/repositories/{repositoryName} | POST | add a repository to an organizational unit |
| /repositories/ | POST |
add the repository to the organizational unit described by the JSON
RepositoryReqest entity
|
| /repositories | GET | return the repositories in the Knowledge Store |
| /repositories/{repositoryName} | DELETE | remove the repository from the Knowledge Store |
| /repositories/ | POST | create or clone the repository defined by the JSON RepositoryRequest entity |
| /repositories/{repositoryName}/projects/ | POST | create the project defined by the JSON entity in the repository |
| /repositories/{repositoryName}/projects/{projectName}/maven/compile/ | POST | compile the project |
| /repositories/{repositoryName}/projects/{projectName}/maven/install | POST | install the project |
| /repositories/{repositoryName}/projects/{projectName}/maven/test/ | POST |
compile the project and run tests as part of compilation
|
| /repositories/{repositoryName}/projects/{projectName}/maven/deploy/ | POST | deploy the project |
Appendix A. Revision History
| Revision History | |||
|---|---|---|---|
| Revision 1.0.0-21 | Fri Nov 21 2014 | ||
| |||




