[jboss-user] [JBoss jBPM] - setting and accessing process variables in jpdl

shea.phillips do-not-reply at jboss.com
Mon Mar 26 16:22:44 EDT 2007


I am wondering how/if it is possible to set and access process variables from JPDL.   I am most interested at the moment in being able to assign the return value from  an action expression to a process variable for use elsewhere in my process definition.  

Here is a snippet from my process definition (not necessarily working) that invokes a Seam service/component and accepts a parameter and returns a String value or null, which I will test against in a transition element, and then use as a parameter in another action expression.  Ultimately, the result of the latter service invocation will also be passed as a parameter  to another service, although not shown here:

  | <process-definition xmlns="http://jbpm.org/jpdl-3.1.xsd"
  |         name="interpretationProcess">
  | 	<start-state name="start">
  |       <transition name="begin" to="determineInterpretationProcess"></transition>
  | 	</start-state>
  |    <node name="determineInterpretationProcess">
  |        <action expression="#{interpretationLookup.getIntepretationName($recordID)}"/>
  |        <transition condition="#{empty interpretationName}" to="completed"/>
  |         <transition condition="#{not empty interpretationName}" to="doInterpretation"/>
  |    </node>
  |     <node name="doInterpretation">
  |         <action expression="#{interpretationService.doInterpretation($interpretationName)}"/>
  |     </node>
  |     <end-state name="completed" />
  | </process-definition>
There are two issue I have here:

1. $myVar is a process instance variable created when my process instance is created - can it be referenced as shown above in an expression?

2. How would I assign the return value of my expression to a variable with some scope that is accessible within my process?  My sense so far is that I may need to use the  element...

Note that I would like to avoid having a "stateful" service (in which I invoke a method that does not return a value, but has a separate method for retrieving the result of the method).  I have seen this in at least one example, but I would prefer not to do this.



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

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

More information about the jboss-user mailing list