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

Figure 1.1. JBoss 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 Red Hat JBoss 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 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.
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. Perspectives
- group:
- Project Authoring perspective contains the Project Explorer view (by default on the left) with the overview of available repository structure, and information on available resources, such as, business process definitions, form definitions, etc.; the editor area on the right, where the respective editor appears when a resource is opened; and the Messages view with validation messages.
- Artifact Repository perspective contains a list of jars which can be added as dependencies. The available operations in this perspective are upload/download artifact and open (view) the
pom.xmlfile. - Administration perspective (available only for users with the
ADMINrole) contains the File Explorer view (by default on the left) with available asset repositories; the editor area on the right, where the respective editor appears when a resource is opened. The perspective allows an administrator to connect Knowledge Store to a repository with assets and to create a new repository (refer to Administration and Configuration Guide).
- group:
- Deployments perspective contains a list of the deployed resources and allows you to build and deploy an undeploy new units.
- group:
- Process Definitions perspective contains a list of the deployed Process definitions. It allows you to instantiate and manage the deployed Processes.
- Process Instances perspective contains a list of the instantiated Processes. It allows you to view their execution worklow and its history.
- group:
- Task List perspective contains a list of Tasks produced by Human Task of the Process instances or produced manually. Only Tasks assigned to the logged-in user are visible. It allows you to claim Tasks assigned to a group you are a member of.
- group (the BAM component):
- Process & Task Dashboard perspective contains a prepared dashboard with statistics on runtime data of the Execution Server
- Business Dashboards perspective contains the full BAM component, the Dashbuilder, including administration features available for users with the
ADMINrole.
2.2. 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.3. 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.4. Embedding Business Central
Table 2.1. HTTP Query Parameters for Standalone Mode
| Parameter Name | Explanation | Allow Multiple Values | Example |
|---|---|---|---|
| standalone | This parameter switches Business Central to standalone mode. | no | (none) |
| path | Path to the asset to be edited. Note that asset should already exists. | no | git://master@uf-playground/todo.md |
| perspective | Reference to an existing perspective name. | no | org.guvnor.m2repo.client.perspectives.GuvnorM2RepoPerspective |
| header | Defines the name of the header that should be displayed (useful for context menu headers). | yes | ComplementNavArea |
===test.html===
<html>
<head>
<title>Test</title>
</head>
<body>
<iframe id="ifrm" width="1920" height="1080" src='http://localhost:8080/business-central?standalone=&perspective=AuthoringPerspective&header=AppNavBar'></iframe>
</body>
</html>web.xml of business-central. The default value for x-frame-options is as follows:
<param-name>x-frame-options</param-name> <param-value>SAMEORIGIN</param-value>
2.5. 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.5.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.5.2. Creating new assets

Figure 2.3. Creating new Asset screen

Figure 2.4. Create new pop-up dialog
2.5.3. Asset Metadata and Versioning
Metadata Management

Categories, Subject, Type, External Link and Source metadata for that asset. However, the most interesting metadata is the description of the asset that you can view/edit in the description field and the comments that you and other people with access to this asset can enter and view.
Important
Version Management
- Click the button in the asset toolbar and select the version that you are interested in. Business Central will load this version of the asset.

- Alternatively, open up the Overview section. The Version history section shows you all the available versions. the version that you want to restore.
2.6. Asset Locking Support
Procedure 2.1. Unlocking assets
- Open the asset.
- Click on the Overview tab and open up the Metadata screen.If the asset is already being edited by another user, the following will be displayed in the Lock status field:Locked by <user_name>
- To edit the asset locked by another user, click button.The following confirmation popup message is displayed:Are you sure you want to release the lock of this asset? This might cause <user_name> to lose unsaved changes!
- Click to confirm.The asset goes back to unlocked state.
2.7. Project Editor
2.7.1. The Project Editor
2.7.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.
Subject, Type, External Link and Source options for the asset.
2.7.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.7. 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.7.2, “Project Settings” for more information about Metadata.

Figure 2.8. Knowledge Base Settings - Metadata
2.7.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.9. 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.7.2, “Project Settings” for more information about Metadata.

Figure 2.10. Imports - Metadata
2.9. Rename, Copy, Delete assets
2.9.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.9.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.9.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.10. Deployment Menu: The Artifact Repository

Figure 2.12. 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 Finish
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.The repository will be indexed. Some workbench features may be unavailable until indexing has completed.
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 Project text box, enter the project name.

- The explorer refreshes to show a New Project Wizard pop-up window.

- 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
MortgageProject - 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. Avoid using a space or any special character that might lead to an invalid name. - 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. - Click on the
button to open the project view.
- 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.
Warning
3.7. Defining Kie Bases and Sessions
kmodule.xml project descriptor file of your project. You can do so through Business Central or by editing kmodule.xml in the src/main/resources/META-INF/ folder by navigating through the Repository view.
Defining Kie Bases and Sessions in the Project Editor
- Click → and navigate to your project.
- In the Project Explorer window, click .
- Click → . This view provides a user interface for changing
kmodule.xml. - Click Add to define and add your bases.
- After you enter a name for your Knowledge Base, add Packages. For including all packages, click below Packages and enter asterisk
*.
- Below Knowledge Sessions, click and enter the name of your session.
- Mark it
Defaultand select appropriate state.For Red Hat JBoss BRMS, you can choose betweenstatefulandstatelesssessions. Usestatelessif you do not need iterative invocations of the facts. Otherwise, usestatefulsession. - Click Save in the top right corner once you are done.
Defining Kie Bases and Sessions in kmodule.xml
kmodule.xml, do the following:
- Open the repository view for your project.

Figure 3.4. Changing to Repository View
- Navigate to
/src/main/resources/META-INF. Click onkmodule.xmlto edit the file directly. - Define your
kbasesandksessions. For example:<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <kbase name="myBase" default="true" eventProcessingMode="stream" equalsBehavior="identity" packages="*"> <ksession name="mySession" type="stateless" default="true" clockType="realtime"/> </kbase> </kmodule> - Click save in the top right corner.
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.
3.9. System Properties
Table 3.1. System Properties
| Property | Description |
|---|---|
| org.uberfire.nio.git.dir | Location of the directory .niogit. Default: working directory |
| org.uberfire.nio.git.daemon.enabled | Enables/disables git daemon. Default: true |
| org.uberfire.nio.git.daemon.host | If git daemon enabled, uses this property as local host identifier. Default: localhost |
| org.uberfire.nio.git.daemon.port | If git daemon enabled, uses this property as port number. Default: 9418 |
| org.uberfire.nio.git.ssh.enabled | Enables/disables ssh daemon. Default: true |
| org.uberfire.nio.git.ssh.host | If ssh daemon enabled, uses this property as local host identifier. Default: localhost |
| org.uberfire.nio.git.ssh.port | If ssh daemon enabled, uses this property as port number. Default: 8001 |
| org.uberfire.nio.git.ssh.cert.dir | Location of the directory .security where local certtificates will be stored. Default: working directory |
| org.uberfire.metadata.index.dir | Place where Lucene .index folder will be stored. Default: working directory |
| org.uberfire.cluster.id | Name of the helix cluster, for example: kie-cluster |
| org.uberfire.cluster.zk | Connection string to zookeeper. This is of the form host1:port1,host2:port2,host3:port3, for example: localhost:2188 |
| org.uberfire.cluster.vfs.lock | Name of the resource defined on helix cluster, for example: kie-vfs |
| org.uberfire.cluster.autostart | Delays VFS clustering until the application is fully initialized to avoid conflicts when all cluster members create local clones. Default: false |
| org.uberfire.sys.repo.monitor.disabled | Disable configuration monitor (do not disable unless you know what you're doing). Default: false |
| org.uberfire.secure.key | Secret password used by password encryption. Default: org.uberfire.admin |
| org.uberfire.secure.alg | Crypto algorithm used by password encryption. Default: PBEWithMD5AndDES |
| org.uberfire.domain | Security-domain name used by uberfire. Default: ApplicationRealm |
| org.guvnor.m2repo.dir | Place where Maven repository folder will be stored. Default: working-directory/repositories/kie |
| org.kie.example.repositories | Folder from where demo repositories will be cloned. The demo repositories need to have been obtained and placed in this folder. Demo repositories can be obtained from the kie-wb-6.2.0-SNAPSHOT-example-repositories.zip artifact. This System Property takes precedence over org.kie.demo and org.kie.example. Default: Not used. |
| org.kie.demo | Enables external clone of a demo application from GitHub. This System Property takes precedence over org.kie.example. Default: true |
| org.kie.example | Enables example structure composed by Repository, Organization Unit and Project. Default: false |
- Edit the file $
JBOSS_HOME/domain/configuration/host.xml. - Locate the XML elements server that belong to the
main-server-groupand add a system property, for example:<system-properties> <property name="org.uberfire.nio.git.dir" value="..." boot-time="false"/> ... </system-properties>
Chapter 4. Social Events
Follow User
Activity Timeline
Chapter 5. Data models
5.1. Data Modeler
Editor and Source tabs, along with source code preservation. This allows you to make changes to your model in external tools, like JBDS, and the Data Modeler updates the necessary code blocks automatically.
- Add/delete fields
- Select a given field. When a field is selected then the field information will be loaded in all the domain editors.

- Select the data object class. For example, by clicking on the data object name (on the main window) instead of loading the field properties, the domain editors will load the class properties.

5.2. Annotations in Data Modeler
Note
.jar file that has the annotation. The Data Modeler will run a validation check to confirm that the annotation is on the classpath, and the project will not build if the annotation is not present.
5.3. Creating a Data Object (Not Persistable)
- In the Project Authoring perspective, click → on the perspective menu. Enter the name and the location (the name has to be unique across the package, but it is possible to have two data object with the same name in two different packages). Uncheck the box to prevent the Data Object from being made persistable. Press the button.
- Create fields of the data object:
- By clicking button in the main editor window, you can add a field to the object with the attributes Id, Label and Type. Required attributes are marked with *.
- Id: field ID unique within the data object
- Label: label to be used in the Fields panel (optional)
- Type: data type of the field

- Click the button (the new field is created and the New field window closes) or the button (the new field is created and the New field window remains open, so it is possible to continue adding more fields).
Attributes can be edited selecting the attribute and editing the fields using the general properties screen to the right.
Important
5.4. Persistable Data Objects
Procedure 5.1. Creating a Persistable Data Object
- When creating a persistable Data Object, the Identifier field
idwill be generated automatically, along with the@Entityannotation.
Selecting the option changes a property to have multiple values. For example, it can enable an attributeName, to have a list of strings with multiple names. - Create fields of the data object:
- By clicking button in the main editor window, you can add a field to the object with the attributes Id, Label and Type. Required attributes are marked with *.
- Id: field ID unique within the data object
- Label: label to be used in the Fields panel (optional)
- Type: data type of the field

- Click the button (the new field is created and the New field window closes) or the button (the new field is created and the New field window remains open, so it is possible to continue adding more fields).
Attributes can be edited selecting the attribute and editing the fields using the general properties screen to the right.
5.5. Data Object Domain Screens
Drools & jBPM
- TypeSafe
- Role
- Timestamp
- Duration
- Expires


Persistence


Table 5.1. Type Annotations
| Annotation | Automatically Generated when Data Object is Persistable |
|---|---|
| javax.persistence.Entity | Yes |
| javax.persistence.Table | No |
Table 5.2. Field Annotations
| Annotation | Automatically Generated when Data Object is Persistable |
|---|---|
| javax.persistence.Id | Yes |
| javax.persistence.GeneratedValue | Yes |
| javax.persistence.SequenceGenerator | Yes |
| javax.persistence.Column | No |
| javax.persistence.OneToOne | No |
| javax.persistence.OneToMany | Yes - when a field has one or multiple values |
| javax.persistence.ManyToOne | Yes - when a field has multiple values |
| javax.persistence.ManyToMany | No |
| javax.persistence.ElementCollection | Yes - generated by the UI when a new field has one or multiple of a base java type, such as Integer, Boolean, String. This annotation cannot be edited with the Persistence screen tool (use the Advanced screen tool instead). |
Advanced




5.6. Configuring Relationships Between Data Objects

Usage Detected screen. It is still possible to delete the object from here, however this will stop your project from building successfully until the resulting errors are resolved.
5.7. Persistence Descriptor
persistence.xml file is created by default when the user opens the project editor and selects . It can then be configured via the Persistence Descriptor. The Persistence Descriptor is accessible by opening the Project Editor, and clicking → .


- enables the user to add arbitrary classes to the
persistence.xmlfile to be declared as entities. - will automatically load all the persisteable data objects in the current project.

Chapter 6. Writing rules
6.1. Creating a rule
Procedure 6.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.
6.2. The asset editor
6.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 6.1. The asset editor - Edit tab
Source tab shows the DRL source for a selected asset.

Figure 6.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 6.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 6.4. The asset editor - Metadata tab
6.2.2. Business rules with the guided editor
Example 6.1. The guided editor

6.2.3. Narrowing Facts Using Package White List
package-names-white-list.
pom.xml and project.imports project files. For existing projects, you may create this file manually.
Rules for Defining Packages
package-names-white-list file is a text file that accepts single package names on each line. Packages can contain wildcards as defined below:
com.redhat.finance: allows facts from only the com.redhat.finance package. Thus, com.redhat.finance.Person and com.redhat.finance.Salary are allowed, but com.redhat.finance.senior.Management are not allowed. |
com.redhat.finance.*: allows facts from the sub-packages of the com.redhat.finance package only. Thus, com.redhat.finance.senior.Management and com.redhat.finance.junior.Management are allowed, but not com.redhat.finance.Person. |
com.redhat.finance.**: this is a combination of the above two rules. Allows com.redhat.finance.Person and com.redhat.finance.senior.Management and even, com.redhat.finance.really.senior.Management classes. |
6.2.4. 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.
6.2.5. Salience
6.2.6. Adding Conditions or Actions to Rules
Procedure 6.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.
6.2.7. Adding a Field to a Fact Type
Procedure 6.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.
6.2.8. Technical Rules (DRL)

Figure 6.5. Technical Rule (DRL)
6.3. Decision Tables
6.3.1. Spreadsheet Decision Tables
6.3.2. Uploading Spreadsheet Decision Tables
Procedure 6.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.
6.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 6.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 6.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 6.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
| |
6.4. Web Based Guided Decision Tables
6.4.1. Web Based Guided Decision Tables



6.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.
6.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 6.6. Column Configuration
6.4.4. Adding Columns
icon.

Figure 6.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
6.4.5. Column Types
6.4.5.1. Attribute Columns
when $c : Cheese( name == "Cheddar" ) then ... end
when not Cheese( name == "Cheddar" ) then ... end
6.4.5.2. Metadata Columns

Figure 6.8. Attribute and MetaData Option
6.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 6.9. Simple Condition Column
6.4.5.4. Field Value Columns

Figure 6.10. Set the value of a field
6.4.5.5. New Fact Field Value Columns

Figure 6.11. Set the value of a field on a new fact
6.4.5.6. Delete Existing Fact Columns

Figure 6.12. Delete an existing fact
6.4.6. Advanced Column Types
6.4.6.1. Condition BRL Fragment Columns

Figure 6.13. Add a Condition BRL fragment
6.4.6.2. Execute Work Item Columns

Figure 6.14. Execute a Work Item

Figure 6.15. WS Work Item

Figure 6.16. REST Work Item

Figure 6.17. Log Work Item

Figure 6.18. Email Work Item
6.4.6.3. Field Value with Work Item Parameter Columns

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

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

Figure 6.21. Simple layout for Adding an Action BRL fragment
6.4.7. Rule Definition

Figure 6.22. Rule Definition
6.4.8. Cell Merging

Figure 6.23. Cell Merging
6.4.9. Cell Grouping

Figure 6.24. Cell Grouping
6.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
...
end6.5. Rule Templates
6.5.1. The Guided Rule Template
Procedure 6.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 6.25. Guided Template Editor
Note
6.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 6.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 5.3, “Creating a Data Object (Not Persistable)”), 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 6.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 6.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 6.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 6.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 6.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 6.31. Setting a variable name
- Continue to add
WHENconditions as appropriate for the project. The example below demonstrates "servicelength" and "rating" constraints.
Figure 6.32. WHEN Constraints
6.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 6.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 6.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 6.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 6.35. Field Value Options
6.5.4. Data Tables in the Guided Rule Template
Procedure 6.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 6.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 6.37. Source Code for Nurse Example
- Save the template when you are finished working in the Guided Template Editor.
6.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 6.38. DSL Editor
6.7. Data Enumerations
6.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 6.2. An Example Enumeration Configuration
'Board.type' : [ 'Short', 'Long', 'M=Mini', 'Boogie'] 'Person.age' : [ '20', '25', '30', '35' ]
6.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']
6.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.
6.8. Scorecards
6.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 6.39. Scorecard Example
6.8.2. Creating a Scorecard
Procedure 6.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.
6.9. Verification and Validation of Guided Decision Tables
6.9.1. Introduction
- RedundancyRedundancy happens when two rows in a decision table execute the same consequences for the same set of facts. For example, two rows checking a client's birthday and providing a birthday discount may result in double discount.
- SubsumptionSubsumption is similar to redundancy and exists when two rules execute the same consequences, but one executes on a subset of facts of the other. For example, these two rules:
- when Person age > 10 then Increase Counter
- when Person age > 20 then Increase Counter
In this case, if a person is 15 years old, only one rule fires and if a person is 20 years old, both rules fire. Such cases cause similar trouble during runtime as redundancy. - ConflictsA conflicting situation occurs when two similar conditions have different consequences. Sometimes, there may be conflicts between two rows (rules) or two cells in a decision table.The example below illustrates conflict between two rows in a decision table:
- when Deposit > 20000 then Approve Loan
- when Deposit > 20000 then Refuse Loan
In this case, there is no way to know if the loan will be approved or not.The example below illustrates conflict between two cells in a decision table:- When Age > 25
- When Age < 25
A row with conflicting cells never execute. - DefiencyDefiency is similar to a conflict and occurs due to incompleteness in the logic of a rule in a decision table. For example, consider the following two deficient rules:
- when Age > 20 then Approve Loan
- when Deposit < 20000 then Refuse Loan
These two rules may lead to confusion for a person who is over 20 years old and have deposited less than 20000. You may add more constraints to avoid the conflict after noticing the warning to make your rule logic complete. - Missing ColumnsIn some cases, usually by accident, the user can delete all the condition or action columns. When the conditions are removed all the actions are executed and when the actions columns are missing the rows do nothing. Both may or may not be by design, usually though this is a mistake.
6.9.2. Reporting
Error: This means a serious fault, which may lead to the guided decision table failing to work as designed at run time. Conflicts, for example, are reported as errors.
Warning: This is most likely a serious fault, however they may not prevent the guided decision table from working but need to be double checked. Warnings are used e.g. for subsumption.
Information: This kind of issues might be a design decision of the author of the guided decision table as well as a simple accident. This is used e.g. for a row missing any condition.
Note
Chapter 7. Building and deploying assets

Figure 7.1. Build & Deploy Option
Chapter 8. Managing Assets
8.1. Versions and storage
Project Explorer from the unified environment of Red Hat JBoss BRMS.
Chapter 9. Testing
9.1. Test Scenarios

Figure 9.1. Test Scenario Screen
9.2. Creating a Test Scenario
Procedure 9.1. Creating a new Test Scenario
- Open the Projects view from the menu.
- Select the project where the test scenario is to be created.
- From the New Item 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 9.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.
- 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 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 import the data objects that are required for your Scenario, click 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 9.3. Providing Test Scenario Facts
- After you have imported the data 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 9.4. Providing Given Facts
- To add a new fact, 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 data models that you have imported in the Config screen.
You can select a particular data object from the model and 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 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 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. See Section 9.3, “Additional Test Scenario Features” for more information.
Procedure 9.5. Providing Expected Rules
- Once you are satisfied with the Given rule conditions, you can expect that rules that will be fired if the Given rule 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 a fact model to match your Given facts by selecting it from the Any fact that matches drop down. Instances of data objects are in the working memory, rather than matching what has been set up in the Given section. Rules may change the contents of working memory for example, some facts may be retracted, others inserted, and some will have their properties changed.In the figure shown above, you can mandate that instances of the Product's one or more properties match the Given rule conditions.
Procedure 9.6. Reviewing, Saving, and Running a Scenario
- Once you are satisfied with your Test Scenario's facts, you can save it by clicking the button in the upper right corner. Ensure you 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.
9.3. Additional Test Scenario Features
Procedure 9.7. Calling Methods
Call Method- allows you to call a method on an existing fact in the beginning of the rule execution. This feature is accessed by clicking on the green plus sign
next to the feature. This opens up a new input box like the following:

Figure 9.2. Call Method
- After selecting an existing fact from the drop-down list, click the Add button. The green arrow button
allows you to call a method on the fact.

Figure 9.3. Invoke a Method
Procedure 9.8. Adding Globals
globals- validate the global field values. Globals are named objects that are visible to the rule engine but are different from the objects for facts. Accordingly, the changes in the object of a global do not trigger the reevaluation of rules. This feature is accessed by clicking on the green plus sign
next to the feature.

Figure 9.4. New Global
- After selecting an existing global from the drop-down list, click the Add button. Clicking on the newly selected global allows you to assign values to fields of the global variable.

Figure 9.5. Apply Field
- After selecting an existing field from the drop-down list, click the OK button. Once you have selected the field, you will be able to set its value.
By clicking on this icon, you will be able to edit the field values.

Figure 9.6. Field Values
Procedure 9.9. Configuring Rules
Configuring rules- allows the user to determine additional constraints on the firing of rules by providing the following options:Allow these rules to fire:- allows you to select which rules are allowed to fire.Prevent these rules from firing:- allows you to prevent certain rules from firing for the test scenario.All rules may fire- will allow all the rules to fire for the given test.

Figure 9.7. Configuration
- If you select
Allow these rules to fire:orPrevent these rules from firing:, you will be supplied with an empty field where you can select the rules which pertain to the configuration by clicking the green plus sign
next to the empty field. This will open a dialog to select which rules are affected by the condition.

Figure 9.8. Selecting rules
- Choose a rule from the drop-down list and click the OK button. The selected rules will appear in the field next to the rules configuration option. You can add as many rules as you like to this field.
Procedure 9.10. Date and Time Configuration
Use real date and time- the real time is used when running the test scenario.
Figure 9.9. Real Date and Time
Use a simulated date and time- this option allows you to specify the year, month, day, hour, and minute associated with the test scenario run.
Figure 9.10. Title
Procedure 9.11. Advanced Fact Data
- After providing values to editable properties as part of your created fact, the Field value dialog box will appear where you can edit literal values or provide advanced fact data.

Figure 9.11. Advanced Options
- Within the Advanced Options section, you will be provided with various choices depending on the type of fact created and the model objects used for the particular Test Scenario.
Bound variable- sets the value of the field to the fact bout to the selected variable. The field must be of the right type.
Figure 9.12. Bound Variable
Create new fact- allows you to create a new fact. By clicking on the button, a new fact will appear as the value of the field. By clicking on that fact, you will be supplied with a drop down of various field values, and these values may be given further field values.
Figure 9.13. Create New Fact
Procedure 9.12. Adding More Sections
- The Test Scenario edit screen allows you to add Given, Call Method, and Expect sections to the scenario by clicking the More
button below the EXPECT section. This will open a block encompassing all three sections that can be removed by clicking the delete item
button.
Procedure 9.13. Modifying or Deleting an Existing Fact
Modifying an existing fact- allows the editing of a fact between knowledge base executions.Delete an existing fact- allows the removing of facts between executions.

Figure 9.14. Modifying and Deleting Existing Facts
Chapter 10. The Realtime Decision Server
10.1. Deploying the Realtime Decision Server
kie-server.war. When you install JBoss BRMS, this WAR file is installed and deployed in your web container by default. Consequently, this gives you automatic access to this web application with the URL of http://SERVER:PORT/kie-server/.
- Once you have deployed the WAR file (or if you have it deployed on the same web container where JBoss BRMS is deployed), create a user with the role of kie-server in this web container.
- Test that you can access the decision engine by navigating to the endpoint in a browser window:
http://SERVER:PORT/kie-server/services/rest/server/with the web container running. You will be prompted for your username/password that you created in the previous step. - Once authenticated, you will see an XML response in the form of engine status, similar to this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <response type="SUCCESS" msg="Kie Server info"> <kie-server-info> <capabilities>BPM</capabilities> <capabilities>KieServer</capabilities> <capabilities>BRM</capabilities> <location>http://localhost:8230/kie-server/services/rest/server</location> <name>KieServer@/kie-server</name> <id>15ad5bfa-7532-3eea-940a-abbbbc89f1e8</id> <version>6.3.0.Final-redhat-5</version> </kie-server-info> </response>
10.2. Installing the Realtime Decision Server in Other Containers
10.2.1. JBoss Web Server 2.x/3.x, Tomcat 7.x/8.x
Procedure 10.1.
- Download and unzip the Tomcat distribution.
- Download
kie-server-6.3.0.Final-webc.warand place it intoTOMCAT_HOME/webapps. - Configure user(s) and role(s). Make sure that
TOMCAT_HOME/conf/tomcat-users.xmlcontains the following username and role definition. The username and password should be unique, however ensure that the user has the rolekie-server:<role rolename="kie-server"/> <user username="serveruser" password="my.s3cr3t.pass" roles="kie-server"/>
- Start the server by running
TOMCAT_HOME/bin/startup.[sh|bat]. You can check out the Tomcat logs inTOMCAT_HOME/logsto see if the application deployed successfully. See Section 10.3.1, “Bootstrap Switches” for the bootstrap switches that can be used to properly configure the instance. For instance:$ ./startup.sh -Dorg.kie.server.id=first-kie-server -Dorg.kie.server.location=http://localhost:8080/kie-server/services/rest/server - Verify the server is running. Access
http://SERVER:PORT/kie-server/services/rest/server/and type the specified username and password. You should see simple XML message with basic information about the server.
Important
10.3. Realtime Decision Server Setup
10.3.1. Bootstrap Switches
Table 10.1. Realtime Decision Server Bootstrap Switches
| Property | Value | Description | Required |
|---|---|---|---|
| org.drools.server.ext.disabled | boolean (default is "false") | If true, disables the BRM support (i.e. rules support). | No |
| org.jbpm.server.ext.disabled | boolean (default is "false") | If true, disables the BPM support (i.e. processes support) | No |
| org.kie.server.id | string | An arbitrary ID to be assigned to this server. If a remote controller is configured, this is the ID under which the server will connect to the controller to fetch the kie container configurations. | No. If not provided, an ID is automatically generated. |
| org.kie.server.user | string (default is "kieserver") | User name used to connect with the kieserver from the controller, required when running in managed mode | Yes when using a controller. This property needs to be set in Business Central system properties. |
| org.kie.server.pwd | string (default is "kieserver1!") | Password used to connect with the kieserver from the controller, required when running in managed mode | Yes when using a controller. This property needs to be set in Business Central system properties. |
| org.kie.server.controller | comma separated list of urls | List of urls to controller REST endpoint. E.g.: http://localhost:8080/kie-wb/rest/controller | Yes when using a controller |
| org.kie.server.controller.user | string (default is "kieserver") | Username used to connect to the controller REST api | Yes when using a controller |
| org.kie.server.controller.pwd | string (default is "kieserver1!") | Password used to connect to the controller REST api | Yes when using a controller |
| org.kie.server.location | URL location of Realtime Decision Server instance | The URL used by the controller to call back on this server. E.g.: http://localhost:8230/kie-server/services/rest/server | Yes when using a controller |
| org.kie.server.domain | string | JAAS LoginContext domain that shall be used to authenticate users when using JMS | No |
| org.kie.server.bypass.auth.user | boolean (default is "false") | Allows to bypass the authenticated user for task related operations e.g. queries | No |
| org.kie.server.repo | valid file system path (default is ".") | Location on local file system where Realtime Decision Server state files will be stored | No |
| org.kie.server.persistence.ds | string | DataSource JNDI name | Yes when BPM support enabled |
| org.kie.server.persistence.tm | string | Transaction manager platform for Hibernate properties set | Yes when BPM support enabled |
| org.kie.server.persistence.dialect | string | Hibernate dialect to be used | Yes when BPM support enabled |
| org.jbpm.ht.callback | string | One of supported callbacks for Task Service (default jaas) | No |
| org.jbpm.ht.custom.callback | string | Custom implementation of UserGroupCallback in case org.jbpm.ht.callback was set to ‘custom’ | No |
| kie.maven.settings.custom | valid file system path | Location of custom settings.xml for maven configuration | No |
| org.kie.executor.interval | integer (default is 3) | Number of time units between polls by executor | No |
| org.kie.executor.pool.size | integer (default is 1) | Number of threads in the pool for async work | No |
| org.kie.executor.retry.count | integer (default is 3) | Number of retries to handle errors | No |
| org.kie.executor.timeunit | TimeUnit (default is "SECONDS") | TimeUnit representing interval | No |
| org.kie.executor.disabled | boolean (default is "false") | Disables executor completely | No |
| kie.server.jms.queues.response | string (default is "queue/KIE.SERVER.RESPONSE") | JNDI name of response queue for JMS | No |
| org.kie.server.controller.connect | long (default is 10000) | Waiting time in milliseconds between repeated attempts to connect Realtime Decision Server to controller when Realtime Decision Server starts up | No |
| org.drools.server.filter.classes | boolean (default is "false") | If set to true then Drools Realtime Decision Server extension accepts custom classes being annotated by XmlRootElement or Remotable annotations only. | No |
Important
org.kie.server.persistence.ds property), in order to avoid conflicts.
10.3.2. Managed Realtime Decision Server
Important
Note
10.3.3. Registering a Realtime Decision Server
standalone.xml:
<property name="org.kie.server.user" value="anton"></property> <property name="org.kie.server.pwd" value="password1!"></property> <property name="org.kie.server.location" value="http://localhost:8080/kie-server/services/rest/server"></property> <property name="org.kie.server.controller" value="http://localhost:8080/business-central/rest/controller"></property> <property name="org.kie.server.controller.user" value="kieserver"></property> <property name="org.kie.server.controller.pwd" value="kieserver1!"></property> <property name="org.kie.server.id" value="local-server-123"></property>
standalone.xml file is located in the $SERVER_HOME/standalone/configuration/ directory.
org.kie.server.user must have the kie-server role assigned.
Note
org.kie.server.controller.user and org.kie.server.controller.pwd must be set to kieserver and kieserver1! respectively due to a known issue in the 6.2.0 release.
Warning
org.kie.server.location points to the same host as org.kie.server.controller. This is not suitable for production.
kieserver user:
- Change into
$SERVER_HOME/bin/. - Execute the following command:
$ ./add-user.sh -a --user kieserver --password kieserver1! --role kie-server
http://SERVER:PORT/kie-server/services/rest/server/. Once authenticated, you will see the following XML response:
<response type="SUCCESS" msg="Kie Server info"> <kie-server-info> <capabilities>KieServer</capabilities> <capabilities>BRM</capabilities> <capabilities>BPM</capabilities> <location> http://localhost:8080/kie-server/services/rest/server </location> <name>local-server-123</name> <id>local-server-123</id> <version>6.3.0.Final-redhat-5</version> </kie-server-info> </response>
10.3.4. Unmanaged Realtime Decision Server
- Deploy KIE Container
- Undeploy KIE Container
- Start KIE Container
- Stop KIE Container
Note
10.4. Creating a Container
icon next to the Realtime Decision Server. This will bring up the Create Container... dialogue.

10.5. Managing Containers
Starting a Container
to select the Container, then click . You can select multiple Containers and start them all at the same time.
appears next to it.
appears next to Container(s) and the Realtime Decision Server that they are deployed on. For troubleshooting, check the logs of both the Realtime Decision Server and the Business Central before redeploying the Containers.
Stopping and Deleting a Container
to select the running Container(s) and or .
Updating Container Deployments
next to the Container. This opens up the Container Info screen:

- Manual Update: To manually update a provision, enter the new Version number in the Version box and click . You can update the Group Id or the Artifact Id, if these have changed as well.
- Automatic Update: If you want a deployed Container to always have the latest version of your deployment without manually editing it, you need to set the Version property to the value of
LATESTand start a Scanner. This will ensure that the deployed provision always contains the latest version. The Scanner can be started on demand by clicking or you can start it in the background with scans happening at a specified interval (in seconds).You can also set this value toLATESTwhen you are first creating this deployment.The Resolved Release Id will show you the actual, latest version number. Note that if the Resolved Release Id is empty, this is an issue not influencing the functionality of the upgrade feature.
10.6. The REST API for Realtime Decision Server Execution
- The base URL for sending requests is the endpoint defined earlier (http://SERVER:PORT/kie-server/services/rest/server/).
- All requests require basic HTTP Authentication for the role kie-server.
- Accept: application/json or application/xml
- Content-Type: application/json or application/xml
X-KIE-ContentType: has three possible values - JSON, JAXB, or XSTREAM. Set it according to the format of your request to the server.
-u: specifies username:password for the Realtime Decision Server authentication.-H: specifies HTTP headers.-X: specifies the HTTP method of the request, that is [GET], [POST], [PUT], or [DELETE].
Note
10.6.1. BRMS Commands
Table 10.2. BRMS Commands Endpoints
| URI | Method | Request Type | Response Type | Description |
|---|---|---|---|---|
| /containers/instances/{containerID} | POST | A single org.drools.core.command.impl.GenericCommand command or multiples commands in BatchExecutionCommand wrapper. | org.kie.server.api.model.ServiceResponse<String> | Executes the commands sent to the specified containerId and returns the commands execution results. For more information, See supported commands below. |
AgendaGroupSetFocusCommandClearActivationGroupCommandClearAgendaCommandClearAgendaGroupCommandClearRuleFlowGroupCommandDeleteCommandInsertObjectCommandModifyCommandGetObjectCommandInsertElementsCommandFireAllRulesCommandQueryCommandSetGlobalCommandGetGlobalCommandGetObjectsCommandBatchExecutionCommand
org.drools.core.command.runtime package. Alternatively, see Supported JBoss BRMS Commands from the Red Hat JBoss Develompent Guide.
Example 10.1. [POST] Drools Commands Execution
- Change into a directory of your choice and create
commandsRequest.json:{ "lookup" : null, "commands" : [ { "insert" : { "object" : "testing", "disconnected" : false, "out-identifier" : null, "return-object" : true, "entry-point" : "DEFAULT" } }, { "fire-all-rules" : { } } ] } - Execute the following command:
$ curl -X POST -H 'X-KIE-ContentType: JSON' -H 'Content-type: application/json' -u 'kieserver:kieserver1!' --data @commandsRequest.json http://localhost:8080/kie-server/services/rest/server/containers/instances/myContainer
The command generates a request that sends the Insert Object and Fire All Rules commands to the server.Lookupspecifies a ksession configured in your kjar. If you use a null lookup value, the default KIE session will be used.
{
"type" : "SUCCESS",
"msg" : "Container hello successfully called.",
"result" : "{\n \"results\" : [ ],\n \"facts\" : [ ]\n}"
}
10.6.2. Managing Processes
Table 10.3. Process Management Endpoints
| URI | Method | Request Type | Response Type | Description |
|---|---|---|---|---|
| /instances | DELETE | N/A | N/A | Aborts multiple process instances specified by the query parameter instanceId. |
| /instances/{processInstanceId}/signals | GET | N/A | A list of Strings | Returns all the available signal names for processInstanceId as a list of Strings |
| /instances/{processInstanceId}/variable/{varName} | PUT | The variable marshalled value | N/A | Sets the value of variable varName for process instance processInstanceId. If successful, the return value is HTTP code 201. |
| /instances/{processInstanceId}/variable/{varName} | GET | N/A | The variable value | Returns the marshalled value of varName for processInstanceId. |
| /instances/{processInstanceId}/variables | POST | A map with variable names and values | N/A | Sets multiple processInstanceId variables. The request is a map, in which the key is the name of the variable and the value is the new value of the variable. |
| /instances/{processInstanceId}/variables | GET | N/A | A map with the variable names and values | Gets all variables for processInstanceId as a map, in which the key is the name of the variable and the value is the value of the variable |
| /instances/{processInstanceId}/workitems/ | GET | N/A | A list of WorkItemInstance objects | Gets all the work items of the given processInstanceId. |
| /instances/{processInstanceId}/workitems/{workItemId} | GET | N/A | A WorkItemInstance object | Gets the workItemId work item of the given processInstanceId. |
| /instances/{processInstanceId}/workitems/{workItemId}/aborted | PUT | N/A | N/A | Aborts the workItemId work item of the given processInstanceId. If successful, the return value is HTTP code 201. |
| /instances/{processInstanceId}/workitems/{workItemId}/completed | PUT | N/A | N/A | Completes the workItemId work item of the given processInstanceId. If successful, the return value is HTTP code 201. |
| /{processId}/instances | POST | A map with variables used to start the process. | Plain text with the process instance id. | Creates a business process instance specified by processId. Accepted input is a map with the process variables and its values. |
| instances/signal/{signalName} | POST | A marshalled object | N/A | Signals multiple process instances of a query parameter instanceId with signal signalName. You can provide the signal payload marshalled in the request body. |
| instances/{processInstanceId} | DELETE | N/A | N/A | Aborts a process specified by processInstanceId. If successful, the return value is HTTP code 204. |
| instances/{processInstanceId} | GET | N/A | A ProcessInstance object | Returns the details of processInstanceId. You can request variable information by setting the withVars parameter as true. |
| instances/{processInstanceId}/signal/{signalName} | POST | A marshalled object | N/A | Signals the process instance processInstanceId with signal signalName. You can provide the signal payload marshalled in the request body. |
| {processId}/instances/correlation/{correlationKey} | POST | A map with variables used to start the process. | Plain text with the process instance id. | Creates a business process instance specified by the processId with the correlation key correlationKey. Accepted input is a map with the process variables and its values. |
Example 10.2. Managing Processes
- Create
person.js:{ "p" : { "org.kieserver.test.Person": { "id" : 13, "name": "William" } }Start a process using a custom object (Person) as a parameter:$ curl -X POST -u 'kieserver:kieserver1!' -H 'Content-type: application/json' -H 'X-KIE-ContentType: JSON' --data @person.js 'http://localhost:8080/kie-server/services/rest/server/containers/person/processes/proc-with-pojo.p-proc/instances'
- Create a new process instance of process definition
com.sample.rewards-basicwith parameters:$ curl -X POST -u 'kieserver:kieserver1!' -H 'Content-type: application/json' -H 'X-KIE-ContentType: JSON' --data '{"employeeName": "William"}' 'http://localhost:8080/kie-server/services/rest/server/containers/rewards/processes/com.sample.rewards-basic/instances'Returns process instance ID. - Get the variables of process instance
3$ curl -u 'kieserver:kieserver1!' -H 'Accept: application/json' 'http://localhost:8080/kie-server/services/rest/server/containers/rewards/processes/instances/3/variables'
Example response:{ "employeeName" : "William" } - Send a TEST signal to the process instance with ID
5$ curl -X POST -u 'kieserver:kieserver1!' -H 'Content-type: application/json' -H 'X-KIE-ContentType: JSON' --data '"SIGNAL DATA"' 'http://localhost:8080/kie-server/services/rest/server/containers/test/processes/instances/signal/TEST?instanceId=5'
10.6.3. Managing Process Definitions
page and pageSize parameters.
Table 10.4. Process Queries Endpoints
| URI | Method | Request Type | Response Type | Description |
|---|---|---|---|---|
| / | GET | N/A | A list of ProcessDefinition objects | Returns a list of process definitions available for the container containerId |
| /{processId}/variables | GET | N/A | A VariablesDefinition object | Returns a map of the variable definitions for processId. The map contains the name of the variable and its type. |
| /{processId}/tasks/service | GET | N/A | A ServiceTaskDefinition object | Returns all service tasks for processId. The return value is a map with the names and types of the service tasks. If no tasks are found, the return value is an empty list. |
| /{processId}/tasks/users | GET | N/A | A list of UserTaskDefinition objects | Returns all the user tasks for processId. The response also contains maps of the input and output parameters. The key is the name and the value is the type of a parameter. |
| /{processId}/subprocesses | GET | N/A | A SubProcessDefinition object | Returns a list of reusable sub-process IDs for processId. |
| /{processId}/entities | GET | N/A | An AssociatedEntitiesDefinition object | Returns a map with the entities associated with processId. |
| /{processId}/tasks/users/{taskName}/inputs | GET | N/A | A TaskInputsDefinition object | Returns a map with all the task input parameter definitions for taskName of processId. The key is the name of the input and the value is its type. |
| /{processId}/tasks/users/{taskName}/outputs | GET | N/A | A TaskOutputsDefinition object | Returns a map with all the task output parameter definitions for taskName of processId. The key is the name of the input and the value is its type. |
Example 10.3. [GET] Process Definitions for a Specified Container
rewards container and uses pagination:
$ curl -u 'kieserver:kieserver1!' -H 'accept: application/json' 'http://localhost:8080/kie-server/services/rest/server/queries/containers/instances/rewards/processes/definitions?page=0&pageSize=1000'
{
"processes" : [ {
"process-id" : "com.sample.rewards-basic",
"process-name" : "Rewards Basic",
"process-version" : "1",
"package" : "com.sample",
"container-id" : "rewards"
} ]
}
Example 10.4. [GET] User Tasks for a Specified Process
com.sample.rewards-basic process in the rewards container:
$ curl -u 'kieserver:kieserver1!' -H 'accept: application/json' 'http://localhost:8080/kie-server/services/rest/server/containers/instances/rewards/processes/definitions/com.sample.rewards-basic/tasks/users'
{
"task" : [ {
"task-name" : "Approval by PM",
"task-priority" : 0,
"task-skippable" : false,
"associated-entities" : [ "PM" ],
"task-inputs" : {
"Skippable" : "Object",
"TaskName" : "java.lang.String",
"GroupId" : "Object"
},
"task-outputs" : {
"_approval" : "Boolean"
}
}, {
"task-name" : "Approval by HR",
"task-priority" : 0,
"task-skippable" : false,
"associated-entities" : [ "HR" ],
"task-inputs" : {
"Skippable" : "Object",
"TaskName" : "java.lang.String",
"GroupId" : "Object"
},
"task-outputs" : {
"_approval" : "Boolean"
}
} ]
}
Example 10.5. [GET] Variable Definitions for Specified Process
com.sample.rewards-basic process in the rewards container:
$ curl -u 'kieserver:kieserver1!' -H 'accept: application/json' 'http://localhost:8080/kie-server/services/rest/server/containers/instances/rewards/processes/definitions/com.sample.rewards-basic/variables'
{
"variables" : {
"result" : "String",
"hrApproval" : "Boolean",
"pmApproval" : "Boolean",
"employeeName" : "String"
}
}
10.6.4. Managing User Tasks
10.6.4.1. Managing Task Instances
Table 10.5. Task Instance Endpoints
| URI | Method | Request Type | Response Type | Description |
|---|---|---|---|---|
| activated | PUT | N/A | N/A | Activates the taskId task. |
| claimed | PUT | N/A | N/A | Claims the taskId task. |
| started | PUT | N/A | N/A | Starts the taskId task. |
| stopped | PUT | N/A | N/A | Stops the taskId task. |
| completed | PUT | A map with the output parameters name/value | N/A | Completes the taskId task. You can provide the output parameters in form of a map, where the key is the parameter name and the value is the value of the output parameter. |
| delegated | PUT | N/A | N/A | Delegates the taskId task to a user provided by the targetUser query parameter. |
| exited | PUT | N/A | N/A | Exits the taskId task. |
| failed | PUT | N/A | N/A | Fails the taskId task. |
| forwarded | PUT | N/A | N/A | Forwards the taskId task to the user provided by the targetUser query parameter. |
| released | PUT | N/A | N/A | Releases the taskId task. |
| resumed | PUT | N/A | N/A | Resumes the taskId task. |
| skipped | PUT | N/A | N/A | Skips the taskId task. |
| suspended | PUT | N/A | N/A | Suspends the taskId task. |
| nominated | PUT | N/A | N/A | Nominates the taskId task to the potential owners by the potOwner query parameter. You can use the parameter multiple times (for example: potOwner=usr1&potOwner=usr2). |
Example 10.6. Task Instances
- Start task with
taskId4 in the containertest$ curl -X PUT -u 'kieserver:kieserver1!' http://localhost:8080/kie-server/services/rest/server/containers/test/tasks/4/states/started
- Complete the task 1 by passing an output parameter
$ curl -X PUT -u 'kieserver:kieserver1!' -H 'Content-type: application/json' -H 'X-KIE-ContentType: JSON' --data '{ "_approval" : true }' 'http://localhost:8080/kie-server/services/rest/server/containers/test/tasks/1/states/completed'
Note
Unexpected error during processing User '[UserImpl:'{USER ID}']' does not have permissions to execute operation OPERATION on task id {TASK ID}
Unexpected error during processing: User '[UserImpl:'{USER ID}']' was unable to execute operation OPERATION on task id {TASK ID} due to a no 'current status' match
-Dorg.kie.server.bypass.auth.user=true, you also must provide a user using the query parameter user, who has the permission to execute the operation. If you do not use the parameter, the logged user will be used to perform the action.
10.6.4.2. Managing Task Instance Data
Table 10.6. Task Instance Data Management Endpoints
| URI | Method | Request Type | Response Type | Description |
|---|---|---|---|---|
| / | GET | N/A | A TaskInstance object | Gets task instance details of a taskId task. |
| attachments | POST | The content of the attachment | N/A | Adds a new attachment for the task. The ID of the created content is returned in the response, which is HTTP code 201. The name of the attachment is set using the query parameter name. It is not an idempotent method, thus if you make multiples request, it will create multiple attachements. |
| attachments | GET | N/A | A list of TaskAttachment objects | Gets all task attachments for the task. |
| attachments/{attachmentId} | GET | N/A | A TaskAttachment object | Gets the attachmentId task attachment. |
| attachments/{attachmentId} | DELETE | N/A | N/A | Removes the attachmentId attachment. |
| attachments/{attachmentId}/content | GET | N/A | An attachment type object | Gets the attachmentId task attachment content. |
| comments | POST | A TaskComment object | Long | Adds a new comment for the task. The ID of the created content is returned in the response, which HTTP code is 201. It is not an idempotent method, thus if you make multiples request, it will create multiple comments. |
| comments | GET | N/A | A list of TaskComment objects | Gets all task comments for the task. |
| comments/{commentId} | GET | N/A | A TaskComment object | Gets a task comment identified by commentId. |
| comments/{commentId} | DELETE | N/A | N/A | Removes the commentId comment for the task. |
| contents/input | GET | N/A | A map with the input parameters name/value | Gets the task input content in form of a map, where the key is the parameter name and the value is the value of the output parameter. |
| contents/output | PUT | A map with the output parameters name/value | N/A | Updates the task output parameters and returns HTTP 201 if successful. You must provide the output parameters in form of a map, where the key is the parameter name and the value is the value of the output parameter. |
| contents/output | GET | N/A | A map with the output parameters name/value | Gets the task output content in form of a map, where the key is the parameter name and the value is the value of the output parameter. |
| contents/{contentId} | DELETE | N/A | N/A | Deletes the task contentId content and returns HTTP code 204. |
| description | PUT | Marshalled String value | N/A | Updates the task description and returns HTTP code 201 if successful. You must provide the new value for description in the request body. |
| expiration | PUT | Marshalled Date value | N/A | Updates the task expiration date and returns HTTP 201 if successful. You must provide the new value for the expiration date in the request body. |
| name | PUT | Marshalled String value | N/A | Updates the task name and returns HTTP code 201 if successful. You must provide the new value for name in the request body. |
| priority | PUT | Marshalled int value | N/A | Updates the task priority and returns HTTP code 201 if successful. You must provide the new value for priority in the request body. |
| skipable | PUT | Marshalled boolean value | N/A | Updates the task property skipable and returns HTTP 201 if successful. You must provide the new value for the skipable property in the request body. |
Example 10.7. User Task Instance Data
- Get a user task instance for container
test:$ curl -X GET -u 'kieserver:kieserver1!' 'http://localhost:8080/kie-server/services/rest/server/containers/test/tasks/1'
Example response:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <task-instance> <task-id>1</task-id> <task-priority>0</task-priority> <task-name>Approval by PM</task-name> <task-subject></task-subject> <task-description></task-description> <task-form>ApprovalbyPM</task-form> <task-status>Ready</task-status> <task-actual-owner></task-actual-owner> <task-created-by></task-created-by> <task-created-on>2016-02-15T13:31:10.624-02:00</task-created-on> <task-activation-time>2016-02-15T13:31:10.624-02:00</task-activation-time> <task-skippable>false</task-skippable> <task-workitem-id>1</task-workitem-id> <task-process-instance-id>1</task-process-instance-id> <task-parent-id>-1</task-parent-id> <task-process-id>com.sample.rewards-basic</task-process-id> <task-container-id>rewards</task-container-id> </task-instance> - Set priority to 3 for task 1:
$ curl -X PUT -u 'kieserver:kieserver1!' -H 'Content-type: application/json' -H 'X-KIE-ContentType: JSON' --data '3' 'http://localhost:8080/kie-server/services/rest/server/containers/test/tasks/1/priority'
- Add a comment to a task 2:
$ curl -X POST -u 'kieserver:kieserver1!' -H 'Content-type: application/json' -H 'X-KIE-ContentType: JSON' --data '{ "comment" : "One last comment", "comment-added-by": "kieserver"}' 'http://localhost:8080/kie-server/services/rest/server/containers/test/tasks/2/comments' - Get all task comments:
$ curl -u 'kieserver:kieserver1!' -H 'Accept: application/json' 'http://localhost:8080/kie-server/services/rest/server/containers/test/tasks/2/comments'
Example response:{ "task-comment" : [ { "comment-id" : 1, "comment" : "Some task comment", "comment-added-by" : "kieserver" }, { "comment-id" : 3, "comment" : "One last comment", "comment-added-by" : "kieserver" } ] }
10.7. The REST API for Realtime Decision Server Administration
10.7.1. Managed Realtime Decision Server Environment
- The controller base URL is provided by kie-wb war deployment, which is the same as
org.kie.server.controllerproperty (for example http://localhost:8080/kie-wb/rest/controller). - All requests require basic HTTP Authentication for the role kie-server.
- [GET] /admin/servers
- Returns a list of Realtime Decision Server instances.
Example 10.8. Example Server Response
<kie-server-instance-list> <kie-server-instance> <server-id>local-server-123</server-id> <server-setup> <server-containers> <containers container-id="MyContainer" status="STARTED"> <release-id> <artifact-id>project1</artifact-id> <group-id>com.sample</group-id> <version>1.0.0</version> </release-id> </containers> </server-containers> </server-setup> <server-managed-instances> <managedInstances> <location>http://localhost:8080/kie-server/services/rest/server</location> <status>UP</status> <capabilities> <capabilities>KieServer</capabilities> <capabilities>BRM</capabilities> <capabilities>BPM</capabilities> </capabilities> </managedInstances> </server-managed-instances> <server-name>local-server-123</server-name> <server-status>UP</server-status> <server-version>6.3.0.Final</server-version> </kie-server-instance> </kie-server-instance-list> - [GET] /admin/server/{id}
- Returns a Realtime Decision Server instance.
Example 10.9. Server Response
<kie-server-instance> <server-id>local-server-123</server-id> <server-setup> <server-containers> <containers container-id="MyContainer" status="STARTED"> <release-id> <artifact-id>project1</artifact-id> <group-id>com.sample</group-id> <version>1.0.0</version> </release-id> </containers> </server-containers> </server-setup> <server-managed-instances> <managedInstances> <location>http://localhost:8080/kie-server/services/rest/server</location> <status>UP</status> <capabilities> <capabilities>KieServer</capabilities> <capabilities>BRM</capabilities> <capabilities>BPM</capabilities> </capabilities> </managedInstances> </server-managed-instances> <server-name>local-server-123</server-name> <server-status>UP</server-status> <server-version>6.3.0.Final</server-version> </kie-server-instance> - [PUT] /admin/server/{id}
- Creates a new Realtime Decision Server instance with the specified id.
Example 10.10. Example Request to Create a New Realtime Decision Server Instance
<kie-server-info> <capabilities>KieServer</capabilities> <capabilities>BRM</capabilities> <location>http://localhost:8080/kie-server/services/rest/server</location> <name>local-server-456</name> <id>local-server-456</id> <version>6.3.0.Final</version> </kie-server-info>
- [DELETE] /admin/server/{id}
- Deletes a Realtime Decision Server instance with the specified id.
- [GET] /admin/server/{id}/containers/{containerId}
- Returns the container information including its release id.
Example 10.11. Server Response
<kie-container container-id="MyContainer" status="STARTED"> <release-id> <artifact-id>project1</artifact-id> <group-id>com.sample</group-id> <version>1.0.0</version> </release-id> </kie-container> - [PUT] /admin/server/{id}/containers/{containerId}
- Creates a new container with the specified containerId and the given release id.
Example 10.12. Server Request
<kie-container container-id="MyContainer"> <release-id> <artifact-id>project1</artifact-id> <group-id>com.sample</group-id> <version>1.0.0</version> </release-id> </kie-container> - [DELETE] /admin/server/{id}/containers/{containerId}
- Disposes a container with the specified containerId.
- [POST] /admin/server/{id}/containers/{containerId}/status/started
- Starts the container. No request body required.
- [POST] /admin/server/{id}/containers/{containerId}/status/stopped
- Stops the Container. No request body required.
10.7.2. Unmanaged Realtime Decision Server Environment
- The base URL for these will remain as the endpoint defined earlier (http://SERVER:PORT/kie-server/services/rest/server/).
- All requests require basic HTTP Authentication for the role kie-server.
- [GET] /
- Returns the execution server information.
Example 10.13. Server Response
<response type="SUCCESS" msg="KIE Server info"> <kie-server-info> <version>6.2.0.redhat-1</version> </kie-server-info> </response> - [POST] /config
- Using POST HTTP method, you can execute various commands on the execution server, for example: create-container, list-containers, dispose-container and call-container. Following is the list of supported commands:
CreateContainerCommandGetServerInfoCommandListContainersCommandCallContainerCommandDisposeContainerCommandGetContainerInfoCommandGetScannerInfoCommandUpdateScannerCommandUpdateReleaseIdCommand
For more information about the commands, see theorg.kie.server.api.commandspackage.Example 10.14. Request to Create a Container
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <script> <create-container> <container container-id="command-script-container"> <release-id> <artifact-id>baz</artifact-id> <group-id>foo.bar</group-id> <version>2.1.0.GA</version> </release-id> </container> </create-container> <call-container container-id="command-script-container"> <payload><?xml version="1.0" encoding="UTF-8" standalone="yes"?> <batch-execution lookup="defaultKieSession"> <insert out-identifier="message" return-object="true" entry-point="DEFAULT" disconnected="false"> <object xsi:type="message" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <text>HelloWorld</text> </object> </insert> <fire-all-rules max="-1"/> </batch-execution> </payload> </call-container> <dispose-container container-id="command-script-container"/> </script>
- [GET] /containers
- Returns a list of containers on the server.
Example 10.15. Server Response
<response type="SUCCESS" msg="List of created containers"> <kie-containers> <kie-container container-id="MyProjectContainer" status="STARTED"> <release-id> <artifact-id>Project1</artifact-id> <group-id>com.redhat</group-id> <version>1.0</version> </release-id> <resolved-release-id> <artifact-id>Project1</artifact-id> <group-id>com.redhat</group-id> <version>1.0</version> </resolved-release-id> </kie-container> </kie-containers> </response> - [GET] /containers/{id}
- Returns the status and information about the specified container.
Example 10.16. Server Response
<response type="SUCCESS" msg="Info for container MyProjectContainer"> <kie-container container-id="MyProjectContainer" status="STARTED"> <release-id> <artifact-id>Project1</artifact-id> <group-id>com.redhat</group-id> <version>1.0</version> </release-id> <resolved-release-id> <artifact-id>Project1</artifact-id> <group-id>com.redhat</group-id> <version>1.0</version> </resolved-release-id> </kie-container> </response> - [PUT] /containers/{id}
- Allows you to create a new container in the execution server.
Example 10.17. Request to create a container
<kie-container container-id="MyRESTContainer"> <release-id> <artifact-id>Project1</artifact-id> <group-id>com.redhat</group-id> <version>1.0</version> </release-id> </kie-container>Example 10.18. Example Server Response When Creating a Container
<response type="SUCCESS" msg="Container MyRESTContainer successfully deployed with module com.redhat:Project1:1.0"> <kie-container container-id="MyProjectContainer" status="STARTED"> <release-id> <artifact-id>Project1</artifact-id> <group-id>com.redhat</group-id> <version>1.0</version> </release-id> <resolved-release-id> <artifact-id>Project1</artifact-id> <group-id>com.redhat</group-id> <version>1.0</version> </resolved-release-id> </kie-container> </response> - [DELETE] /containers/{id}
- Disposes a container specified by the id.
Example 10.19. Server Response disposing a container
<response type="SUCCESS" msg="Container MyProjectContainer successfully disposed."/>
- [GET] /containers/{id}/release-id
- Returns the full release id for the specified container.
Example 10.20. Server Response
<response type="SUCCESS" msg="ReleaseId for container MyProjectContainer"> <release-id> <artifact-id>Project1</artifact-id> <group-id>com.redhat</group-id> <version>1.0</version> </release-id> </response>The server will respond with a success or error message, such as:Example 10.21. Server Response
<response type="SUCCESS" msg="Release id successfully updated."> <release-id> <artifact-id>Project1</artifact-id> <group-id>com.redhat</group-id> <version>1.0</version> </release-id> </response> - [GET] /containers/{id}/scanner
- Returns information about the scanner for container's automatic updates.
Example 10.22. Server Response
<response type="SUCCESS" msg="Scanner info successfully retrieved"> <kie-scanner status="DISPOSED"/> </response>
- [POST] /containers/{id}/scanner
- Allows you to start or stop a scanner that controls polling for updated container deployments.
Example 10.23. Example Server Request to Start the Scanner
<kie-scanner status="STARTED" poll-interval="20"/>
Example 10.24. Server Response
<response type="SUCCESS" msg="Kie scanner successfully created."> <kie-scanner status="STARTED"/> </response>
To stop the Scanner, replace the status withDISPOSEDand remove the poll-interval attribute.
10.8. Realtime Decision Server Java Client API Overview
10.8.1. Maven Dependencies
Example 10.25. Maven Dependency using BOM
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.bom.brms</groupId>
<artifactId>jboss-brms-bpmsuite-bom</artifactId>
<version>${version.org.jboss.bom.brms}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-client</artifactId>
</dependency>
</dependencies>6.2.1.GA-redhat-2 in version.org.jboss.bom.brms for Red Hat JBoss BRMS 6.2.0. Follow Maven BOM page to see all the available versions.
Example 10.26. Hello World Maven Dependency
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-client</artifactId>
<version>6.3.0.Final-redhat-7</version>
</dependency>10.8.2. Client Configuration
Example 10.27. Client Configuration
import org.kie.server.api.marshalling.MarshallingFormat;
import org.kie.server.client.KieServicesClient;
import org.kie.server.client.KieServicesConfiguration;
import org.kie.server.client.KieServicesFactory;
public class DecisionServerTest {
private static final String URL = "http://localhost:8080/kie-server/services/rest/server";
private static final String USER = "kieserver";
private static final String PASSWORD = "kieserver1!";
private static final MarshallingFormat FORMAT = MarshallingFormat.JSON;
private KieServicesConfiguration conf;
private KieServicesClient kieServicesClient;
@Before
public void initialize() {
conf = KieServicesFactory.newRestConfiguration(URL, USER, PASSWORD);
conf.setMarshallingFormat(FORMAT);
kieServicesClient = KieServicesFactory.newKieServicesClient(conf);
}
}Example 10.28. JMS Client Configuration
import java.util.Properties;
import javax.jms.ConnectionFactory;
import javax.jms.Queue;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.junit.Test;
import org.kie.server.client.KieServicesClient;
import org.kie.server.client.KieServicesConfiguration;
import org.kie.server.client.KieServicesFactory;
public class DecisionServerTest {
private static final String REMOTING_URL = new String("remote://localhost:4447");
private static final String USER = "kieserver";
private static final String PASSWORD = "kieserver1!";
private static final String INITIAL_CONTEXT_FACTORY = new String("org.jboss.naming.remote.client.InitialContextFactory");
private static final String CONNECTION_FACTORY = new String("jms/RemoteConnectionFactory");
private static final String REQUEST_QUEUE_JNDI = new String("jms/queue/KIE.SERVER.REQUEST");
private static final String RESPONSE_QUEUE_JNDI = new String("jms/queue/KIE.SERVER.RESPONSE");
private KieServicesConfiguration conf;
private KieServicesClient kieServicesClient;
@Test
public void testJms() throws Exception {
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
env.put(Context.PROVIDER_URL, REMOTING_URL);
env.put(Context.SECURITY_PRINCIPAL, USER);
env.put(Context.SECURITY_CREDENTIALS, PASSWORD);
InitialContext context = new InitialContext(env);
Queue requestQueue = (Queue) context.lookup(REQUEST_QUEUE_JNDI);
Queue responseQueue = (Queue) context.lookup(RESPONSE_QUEUE_JNDI);
ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup(CONNECTION_FACTORY);
conf = KieServicesFactory.newJMSConfiguration(connectionFactory, requestQueue, responseQueue, USER, PASSWORD);
kieServicesClient = KieServicesFactory.newKieServicesClient(conf);
}
}
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-jms-client-bom</artifactId>
<version>7.5.6.Final-redhat-2</version>
<type>pom</type>
</dependency>
10.8.3. Server Response
org.kie.server.api.model.ServiceResponse<T> object, where T represents the payload type. It has following attributes:
String msg: returns the response message.ResponseType type: returns SUCCESS or FAILURE.T result: returns the requested object.
Example 10.29. Hello World Server Response
import org.kie.server.api.model.ServiceResponse; import org.kie.server.client.RuleServicesClient; RuleServicesClient ruleClient = client.getServicesClient(RuleServicesClient.class); ServiceResponse<String> response = ruleClient.executeCommands(container, batchCommand); System.out.println(response.getResult());
10.8.4. Inserting and Executing Commands
org.kie.api.command.KieCommands class to insert commands. Use org.kie.api.KieServices.get().getCommands() to instantiate the KieCommands class. If you want to add multiple commands, you must use the BatchExecutionCommand wrapper. For additional example, follow the Hello World project.
Example 10.30. Inserting and Executing Commands
public void executeCommands() {
String containerId = "hello";
System.out.println("== Sending commands to the server ==");
RuleServicesClient rulesClient = kieServicesClient.getServicesClient(RuleServicesClient.class);
KieCommands commandsFactory = KieServices.Factory.get().getCommands();
Command<?> insert = commandsFactory.newInsert("Some String OBJ");
Command<?> fireAllRules = commandsFactory.newFireAllRules();
Command<?> batchCommand = commandsFactory.newBatchExecution(Arrays.asList(insert, fireAllRules));
ServiceResponse<String> executeResponse = rulesClient.executeCommands(containerId, batchCommand);
if(executeResponse.getType() == ResponseType.SUCCESS) {
System.out.println("Commands executed with success! Response: ");
System.out.println(executeResponse.getResult());
}
else {
System.out.println("Error executing rules. Message: ");
System.out.println(executeResponse.getMsg());
}
}
org.drools:drools-compiler Maven dependency:
<!-- Valid for version 6.2.0 --> <dependency> <groupId>org.drools</groupId> <artifactId>drools-compiler</artifactId> <version>6.3.0.Final</version> </dependency>
10.8.5. Server Capabilities
Note
org.kie.server.api.model.KieServerInfo object.
Example 10.31. Server Capabilities
public void listCapabilities() {
KieServerInfo serverInfo = kieServicesClient.getServerInfo().getResult();
System.out.print("Server capabilities:");
for(String capability: serverInfo.getCapabilities()) {
System.out.print(" " + capability);
}
System.out.println();
}10.8.6. Containers
org.kie.server.api.model.KieContainerResource object. List of resources is represented by the org.kie.server.api.model.KieContainerResourceList object.
Example 10.32. Print a List of Containers
public void listContainers() {
KieContainerResourceList containersList = kieServicesClient.listContainers().getResult();
List<KieContainerResource> kieContainers = containersList.getContainers();
System.out.println("Available containers: ");
for (KieContainerResource container : kieContainers) {
System.out.println("\t" + container.getContainerId() + " (" + container.getReleaseId() + ")");
}
}10.8.7. Handling Containers
ServiceResponse will be returned with void payload. If you create a container, KieContainerResource object will be returned.
Example 10.33. Dispose and Create a Container
public void disposeAndCreateContainer() {
System.out.println("== Disposing and creating containers ==");
List<KieContainerResource> kieContainers = kieServicesClient.listContainers().getResult().getContainers();
if (kieContainers.size() == 0) {
System.out.println("No containers available...");
return;
}
KieContainerResource container = kieContainers.get(0);
String containerId = container.getContainerId();
ServiceResponse<Void> responseDispose = kieServicesClient.disposeContainer(containerId);
if (responseDispose.getType() == ResponseType.FAILURE) {
System.out.println("Error disposing " + containerId + ". Message: ");
System.out.println(responseDispose.getMsg());
return;
}
System.out.println("Success Disposing container " + containerId);
System.out.println("Trying to recreate the container...");
ServiceResponse<KieContainerResource> createResponse = kieServicesClient.createContainer(containerId, container);
if(createResponse.getType() == ResponseType.FAILURE) {
System.out.println("Error creating " + containerId + ". Message: ");
System.out.println(responseDispose.getMsg());
return;
}
System.out.println("Container recreated with success!");
}10.8.8. Available Realtime Decision Server Clients
KieServicesClient serves also as an entry point for other clients with the ability to perform various operations, such as JBoss BRMS commands and manage processes. Following services are available in the org.kie.server.client package:
- JobServicesClient is used to schedule, cancel, requeue, and get job requests.
- ProcessServicesClient is used to start, signal, and abort processes or work items.
- QueryServicesClient is used to query processes, process nodes, and process variables.
- RuleServicesClient is used to send commands to the server to perform rule-related operations (for example insert objects into the working memory, fire rules, ...).
- UserTaskServicesClient is used to perform all user-task operations (start, claim, cancel a task) and query tasks by specified field (process instances id, user, ...)
getServicesClient method provides access to any of these clients:
RuleServicesClient rulesClient = kieServicesClient.getServicesClient(RuleServicesClient.class);
10.8.9. List of Available Business Processes
QueryClient to list available process definitions. QueryClient methods use pagination, therefore in addition to the query you make, you must provide the current page and the number of results per page. In the provided example, the query starts on page 0 and lists the first 1000 results.
Example 10.34. List Processes
public void listProcesses() {
System.out.println("== Listing Business Processes ==");
QueryServicesClient queryClient = kieServicesClient.getServicesClient(QueryServicesClient.class);
List<ProcessDefinition> findProcessesByContainerId = queryClient.findProcessesByContainerId("rewards", 0, 1000);
for (ProcessDefinition def : findProcessesByContainerId) {
System.out.println(def.getName() + " - " + def.getId() + " v" + def.getVersion());
}
}Chapter 11. 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.The following two API's are only available in Red Hat JBoss BPM Suite.
- Deployment REST API calls are asynchronous or synchronous, depending on the operation performed. These calls perform actions on the deployments or retrieve information about one ore more deployments.
- Runtime REST API calls are calls to the Execution Server and to the Process Execution Engine, Task Execution Engine, and Business Rule Engine. They are synchronous and return the requested data as JAXB objects.
http://SERVER_ADDRESS:PORT/business-central/rest/REQUEST_BODY
Note
11.1. Knowledge Store REST API
POST and DELETE return details of the request as a well as a job id that can be used to request the job status and verify whether the job finished successfully. The GET operations return information about repositories, projects and organizational units.
11.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 11.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]
11.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 11.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"}] - [GET] /repositories/{repositoryName}
- This returns information on a specific repository - [GET]
- [DELETE] /repositories/{repositoryName}
- This deletes the repository - [DELETE]
- [POST] /repositories/
- This creates or clones the repository defined by the JSON entity - [POST]
Example 11.3. JSON entity with repository details of a repository to be cloned
{"name":"myClonedRepository", "description":"", "userName":"", "password":"", "requestType":"clone", "gitURL":"git://localhost/example-repository"} - [GET] /repositories/{repositoryName}/projects/
- This returns a list of the projects in a specific repository as a JSON entity - [POST]
Example 11.4. JSON entity with details of existing projects
[ { "name" : "my-project-name", "description" : "Project to illustrate REST output", "groupId" : "com.acme", "version" : "1.0" }, { "name" : "yet-another-project-name", "description" : "Yet Another Project to illustrate REST output", "groupId" : "com.acme", "version" : "2.2.1" } ] - [POST] /repositories/{repositoryName}/projects/
- This creates a project in the repository - [POST]
Example 11.5. 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 11.6. Request body that defines the project to be deleted
"{"name":"myProject","description": "my project"}"
11.1.3. Organizational unit calls
organizationalUnits calls are provided:
- [GET] /organizationalunits/
- This returns a list of all the organizational units - [GET].
Example 11.7. Organizational unit list in JSON
[ { "name" : "EmployeeWage", "description" : null, "owner" : "Employee", "defaultGroupId" : "org.bpms", "repositories" : [ "EmployeeRepo", "OtherRepo" ] }, { "name" : "OrgUnitName", "description" : null, "owner" : "OrgUnitOwner", "defaultGroupId" : "org.group.id", "repositories" : [ "repository-name-1", "repository-name-2" ] } ] - [GET] /organizationalunits/{organizationalUnitName}
- This returns a JSON entity with info about a specific organizational unit - [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 11.8. Organizational unit in JSON
{ "name":"testgroup", "description":"", "owner":"tester", "repositories":["testGroupRepository"] } - [POST] /organizationalunits/{organizationalUnitName}
- This updates the details of an existing organizational unit - [POST].Both the
nameandownerfields in the consumedUpdateOrganizationalUnitinstance can be left empty. Both thedescriptionfield and the repository association can not be updated via this operation.Example 11.9. Update organizational unit input in JSON
{ "owner" : "NewOwner", "defaultGroupId" : "org.new.default.group.id" } - [DELETE] /organizationalunits/{organizationalUnitName}
- This deletes an organizational unit - [GET].
- [POST] /organizationalunits/{organizationalUnitName}/repositories/{repositoryName}
- This adds the repository to the organizational unit - [POST].
- [DELETE] /organizationalunits/{organizationalUnitName}/repositories/{repositoryName}
- This removes a repository from the organizational unit - [POST].
11.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.
11.2. REST summary
http://server:port/business-central/rest
Table 11.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 6.2.0-4 | Thu Apr 28 2016 | ||
| |||
| Revision 6.2.0-3 | Tue Mar 29 2016 | ||
| |||
| Revision 6.2.0-2 | Mon Nov 30 2015 | ||
| |||
| Revision 6.2.0-1 | Mon Nov 30 2015 | ||
| |||

