Question

Wonder if anyone can give me a straight answer for this. It's mostly curiosity, though might be something important.

When using jBPM, I have 2 options to declare process variables:

1) passing parameters to BPMN through java code, using a Map, where string is the variable name and Object its value

2) directly on the BPMN properties

I noticed recently that it's sufficient to declare process variables in BPMN. Should I only declare it there or should I declare it in the java class as well? What are the differences here?

Cheers

Was it helpful?

Solution

The BPMN file must define all the process variables that are going to be used in the different nodes of the process. Process variables are mainly used for mapping input/output variables to/from tasks. If in TaskA you need a variable coming from the process, you must have a variable defined in your process and you have to define the correct mapping. In order to use a variable in your process you must define it first. The misconception here is that the BPMN only defines the name and type of its variables, but not their structures. If you want to set values to those variables when the process is started, you must provide the Map you have mentioned. jBPM will 'copy' the values of the Map to the variables in the process. The keys you use in the Map must correspond to the name of the variables you have defined in your process.

Hope it helps,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top