Everything you need to get started.
In this tutorial, we explain how to use the Open Business Rules Management System with Intalio. The prerequisite files including the OpenLexicon WSDL, an export of the repository for import and a solution to the tutorial are included in this
OpenLexicon Sample.
You do not have to be completely familiar with Business Rules or OpenLexicon to complete this tutorial. To complete this tutorial you must download and install the latest version of the universal installer for OpenLexicon (http://www.openlexicon.org/).
This tutorial requires version 5.0.125 (or latter) of the Intalio designer and release 31 (or latter) of the server and the universal installer for OpenLexicon.
In an employee on-boarding system, the company has established policies for the assignment of the proper computer to employees based on a number of conditions. For instance:
This is a good candidate for a truth table approach. The truth table is presented here:
|
Position |
Department |
Field Tech |
Assignment |
Included |
|
ENGINEER |
ENGINEERING |
ENGINEERING WORK STATION |
x |
|
|
FIELD TECH |
FIELD SERVICES |
LOCATOR |
HAND HELD GPS |
x |
|
FIELD TECH |
FIELD SERVICES |
INSTALLER |
HAND HELP |
x |
|
FIELD TECH |
FIELD SERVICES |
INSPECTOR |
LAP TOP |
x |
|
ADMINISTRATIVE |
* |
WORK STATION |
x |
|
|
EXECUTIVE |
ENGINEERING |
ENGINEERING WORK STATION |
x |
|
|
SALES |
* |
LAP TOP |
x |
|
|
EXECUTIVE |
HUMAN RESOURCES |
WORK STATION |
NOT! |
The ‘Included' column defines the rules that are in the OpenLexicon project when you start this demonstration. At the end of this tutorial we will enter the logic in OpenLexicon and deploy it without changing the process or restarting any servers.
Obviously, you could put this data into an SQL table and develop queries with the JDBC connector. Yet, you can build many layers of logic into OpenLexicon.
We will develop a process that accepts an employee business object and invokes the business rules and returns the computer type.
In general OpenLexicon provides 3 basic capabilities:
In this simple scenario we are going to develop a process that can uses a transformation and assigns the type of computer according to the rules in the truth table.
The last scenario in the truth table was not implemented. We will use OpenLexicon to add this scenario and rerun the process. This will demonstrate the simplicity and agility of the Intalio/OpenLexicon solution.
The project entitled ‘CodeDemo' includes the metadata needed to run this tutorial on the universal installer. If you have not modified that project you only need to install the OpenLexicon software
If you need to import OpenLexicon Metadata, there is a metadata extract, IntalioTutorial.xml that includes the logic for the truth table. If you are using another database or wish to use this import method then do the following:
The LexiconService has many ways to operate. It can run business rules from a cache file, or a database. The source of the OpenLexicon metadata can be easily configured in an Intalio process or it can be located in external system variable. We are going to use the simplest: a database identified by environment variables. You will need two environment variables:
LEXICON_USE_FAKE: This is a variable that permits a test of the Lexicon Web Service without running any business rules. Set this to a value of N.
TORQUE_PATH: This is the directory that holds you torque properties file. A copy of the Torque.properties file is included in the project export. OpenLexicon uses the Torque Project for object-relational data mapping in Java. The project is described here. However, the only thing you need to know is that the torque properties file provides the connection to the database that is needed for this tutorial. You can place this in any directory and set the value of TORQUE_PATH to this directory (i.e. C:\Torque).
If you are in a windows environment enter these in the system setup, advanced, environment variables tab.
Put a copy of the Torque.properties into the directory defined in TORQUE_PATH. You do not need to change this unless you have a custom database environment.
Create an Intalio project, name this project: LexiconTutorial. From the zip (or from the imported project) Copy the files Employee.xsd, and LexiconConnectorService.wsdl into the project. The .wsdl defines the web service for the OpenLexicon rules engine. We will explain how to use this in the data mapping section. The .xsd is a data type for the message flows. It corresponds to the schema that the rules engine will evaluate.
Go to File > New > Business Process Diagram and create a new file "Transform.bpm" in your project. In this tutorial, we will assume that the project is called LexiconTutorial.
You may rename the first pool that is created. Here we will call the pool "Input". The Task shape should be named "Interface". Set the pool as non-executable by hovering over the pool and right-clicking on the pool.
Create another pool name it Transform. Create the activities.
Your diagram should look like this:
Create another pool name it LexiconWebService. Set the pool as non executable. Add the call to the web service.
Introspect the WSDL LexiconConnectorService.wsdl. Introspect LexiconConnectorService, then LexiconConnectorServicePortSoap11port0
DND the LexOperation onto the LexiconWebService pool. Accept the first option from the menu as shown here:
Connect the Invoke Activity to the LexOperation and LexOperation to the Invoke Activity.
Your Process diagram should now look like:
We will now connect the message flows to the web service and return the results to the Input activity.
Create Process Variable
DND schema element tns:Employee onto the $EmpVar. This will resolve the issue. Your data editor should look like:
The service has been designed to give you access to any ruleset defined in the OpenLexicon repository. We will now map the input to the web service and assign the constants necessary for the process to work properly.
Connect the output of the web service to the Variable. In the process diagram, select the results activity to open the data mapper for that activity. In the data mapper connect the $xsd1LexOperationResponseMsg.part1 POJOType to $EmpVar as follows
Mouse click the ‘End' message. In the output message connect the $thisStartRequestMsg.body to $thisStartReMsg.body, then connect $EmpVar ComputerType to the computer type in the response message. It should look like:
We are now ready to deploy and test this process. Select the deployment button and select only these files from the dialog:
If all is well, you should be ready to enter examples from the truth table.
Note: the OpenLexicon and Intalio server must be running for this test to work. If you are in a windows environment you should have a program group for OpenLexicon (LexiconEnterprise) in your start menu.
The program group has items for starting and stopping the server and launching the OpenLexicon wizard.
From the Intalio|Server console, start an instance of Transform: Enter values from the truth table at the beginning of this tutorial,
For instance the input:
Should result in the value of ENGINEERING_WORK_STATION.
If you test the process with the values Position= ‘EXECUTIVE', Department= ‘HUMAN RESOURCES' you will return no result.
You can add this rule by simply editing the rule ‘IsWorkStation'. Start the OpenLexicon wizard. The installer for OpenLexicon places a program group in your menu. Select the wizard program and it will start the wizard in your browser.
Select the project ‘CodeDemo' and click on the Tab Business Rules. Scroll down to the ‘Predicate' isWorkStartion and click the Edit Button and shown here:
By either typing or using the expression palette, add the expression or [isExecutive() and isHumanResources()] as shown here:
Please be certain to press the SAVE button to add the business rule to the truth table. Actually, we are manipulating a function in the truth table, so we do not need to do anything to the rule set associated with the business object.
Rerun an instance of the process with the values of EXECUTIVE and HUMAN RESOURCES in position and Department
note that there is no need to restart the Intalio Server when you do this. This change is a good demonstration of the power of externalizing rules.
Copyright © Intalio, 1999-2010.