How to install jBPM5

 

  • First we need install apache ant, if you don't know how can do it you can see this article
  • The you need download the jBPM5 files from here, the current version is 5.4 at the moment of write this article
  • If you have internet connection without proxy please skip this step , of the other way  you need download eclipse helios from here
  • Then unzip the jbpm files in some directory, for me /home/moe/Java/jbpm-installer
  • Now, if you downloaded eclipse please copy the zip or tar.gz file (eclipse-java-helios-SR2-linux-gtk.tar.gz) into the lib directory of jbpm-installer for me: /home/moe/Java/jbpm-installer/lib
  • Open a terminal and type cd /home/moe/Java/jbpm-installer (your directory of jbpm-installer), and type ant install.demo
  • And for test our installation please type in the terminal ant start.demo, now you can access to the jbpm-console from the browser at this link http://localhost:8080/jbpm-console/app.html
  • Use krisv as username and password and you should see the administrative console of jbpm

 

How to get Process Variables within WorkItemHandler

During the last days I've working with jBPM5 and the main problem that I found is "How to get Process Variables within WorkItemHandler", and the solution is the following.

 

In this tutorial we are going to create a customized WorkItemHandler and then we are going to access to process variables, First of all we'll create a new jBPM project in eclipse

 

Now, within the source folder src/main/resource we are going to create a customized WorkItemHandler

- Create META-INF folder with drools.rulebase.conf and MyDefinitions.conf files.

drools.rulebase.conf 

drools.workDefinitions = MyDefinitions.conf

MyDefinitions.conf

import org.drools.process.core.datatype.impl.type.StringDataType;

 

[

 

  [

    "name" : "CustomizedHandler",    

    "parameters" : [

     "ParameterOne" : new StringDataType(),

     "ParameterTwo" : new StringDataType(),          

    ],

    "displayName" : "CustomizedHandler",

    "customEditor" : "org.drools.eclipse.flow.common.editor.editpart.work.SampleCustomEditor",

    "icon" : "icons/img.gif"

  ]   

]

 

Now we are going to create icons package within the same source folder with an little icon (img.gif) for our work item handler

 

Now, let's create a new BPMN2 process and then use the work item handler

 

Then we have to add a new variable variableOne to our process 

 

For pass the value of variableOne to the work item handler, in the handler properties on ParameterOne  set the value #{variableOne} 

Now we need to implement our work item handler

and the test class and the ouptput are here: