JBoss Community

Unclear on how to get a Process param into my WorkItem

created by olddave in jBPM - View the full discussion

Hi,

 

I am defining my workflows using the BPMN2 Eclipse tool. When I run my WorkItem I need to get access to a parameter defined in the Process. I use this, which is not good because many Process may be running witht this same parameter in thei Stateful session.

 

[code]



AClass myContext = null;


Iterator<ProcessInstance> it = ksession.getProcessInstances().iterator();


while(it.hasNext()) {



ProcessInstance procInst =it.next();



Map<String,Object> contxt =  procInst.getProcess().getMetaData();



if(contxt.containsValue("myContext")) {




myContext = (AClass) contxt.get("myContext");



}


}


if(myContext != null)



service.run(aGrp, myContext);


manager.completeWorkItem(workItem.getId(), null);

[/code]

 

salaboy pointed to his general examples for a similar question and I looked in all of them and could not see where theh recommended way of accessing a Process parameter is shown.

 

Thx.

 

David

Reply to this message by going to Community

Start a new discussion in jBPM at Community