JBoss Community

Re: passing data to nodes

created by Ryan Peterson in jBPM - View the full discussion

I'm going through this myself, so far I've found:

 

Put the variable into the map like you wrote:

 

Map<String, Object> params = new HashMap<String, Object>();

boolean examOK = false;

params.put("examOK", examOK);

 

ksession.startProcess("com.sample.bpmn.hello", params);

 

 

Then in the bpmn definition, you need to have the process variables (if you want a global process variable I think?):

<itemDefinition id="_examOK" structureRef="java.lang.Boolean" />

 

and within the process def itself (still in the .bpmn file):

<property id="examOK" itemSubjectRef="_examOK"/>

 

You also need the dataInput mapped to your task (within your task, that lies inside the process):

<dataInput id="_999_examOK" name="examOK" />

 

<inputSet>

<dataInputRefs>_999_examOK</dataInputRefs>

</inputSet>

 

<dataInputAssociation>

        <sourceRef>examOK</sourceRef>

        <targetRef>_999_examOK</targetRef>

</dataInputAssociation>

 

 

That will map it into your workItemHandler, so you can obtain it via:

Boolean examOk = (Boolean) workItem.getParameter("examOK");

 

 

I'm not 100% sure if this is the "correct" way to implement this.  I'm unsure if this variable is global for all processes, for instance: what if the process is started multiple times for multiple users?  Does each process implementation get its own global examOk boolean using this method?

Reply to this message by going to Community

Start a new discussion in jBPM at Community