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:

Comments   

 
0 #1 Tarun 2013-07-04 08:29
For pass the value of variableOne to the work item handler, in the handler properties on ParameterOne set the value #{variableOne}

What do you mean by this? Can you elaborate?
Quote
 

Add comment


Security code
Refresh