[jboss-user] [JBoss jBPM] - Re: Passing objects through the workflow

mmusaji do-not-reply at jboss.com
Tue Aug 18 06:10:39 EDT 2009


I am creating a variable and starting the process by providing these variables on startup.


  | MyObject myObject = new MyObject();
  | myObject.setName("a name to set");
  | 
  | variables.put("myObj", myObject);
  | 
  | ProcessInstance processInstance = executionService.startProcessInstanceByKey("process", variables);
  | 

The workflow calls the class which implements the ActivityBehaviour interface.


  | <custom name="validate" class="org.tlg.workflow.AlterObject" exp="#{anObj}">         
  |     <transition g="-27,-18" name="" to="end"/>
  |    </custom>
  | 

Now unfortunately this is where I become stuck. In AlterObject class I cast the object back and amend details.


  | MyObject myObject= (MyObject )execution.getVariable("anObj");
  | myObject.setName("A different name"); //name should change
  | execution.setVariable("myObj", myObject);
  | 

Going back to my Junit I want to ensure them changes have taken effect. If I use the processInstanceId that kicked off the workflow the process has ended already, and if I use the existing hashmap to get the variable I have just set, I get the old value set in the object.

Is my workflow implementation correct for what I am trying to do?

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250116#4250116

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250116



More information about the jboss-user mailing list