[jboss-user] [JBoss Seam] - can't access non-Seam variables from jPDL decision condition

shea.phillips do-not-reply at jboss.com
Fri Mar 30 20:44:36 EDT 2007


Hello,

After significant amount of troubleshooting, I have discovered that the  org.jboss.seam.jbpm.SeamVariableResolver is used when resolving variables in a expression inside jBPM jPDL when the process is started inside of Seam.

This is fine and very useful in many cases, however, in my scenario, I am doing the following:

- starting the process from Seam with a single BUSINESS_PROCESS scope String var
-  invoking Seam components from embedded jPDL scripts, which set process context variables (non-Seam), that are subsequently referenced in condition expressions
- the condition expression evaluation uses the SeamVariableResolver and, as a result does not see the variable I  exposed from my script, although other scripts do (apparently they use some different variable resolution strategy)

Here is my jPDL snippet:


  |  <node name="establishInterpretationProcess">
  |         <transition to="decideOnInterpretation">
  |             <script>
  |                 <expression>
  |                     import org.jboss.seam.Component;
  |                     import com.foo.ECGInterpretationProcessNameResolverService;
  |                     
  |                     System.out.println("ECG ID is '" + ecgId + "'");                    
  | 
  |                     lookup = Component.getInstance(ECGInterpretationProcessNameResolverService.NAME, true);
  | 
  |                     interpretationName = lookup.determineInterpretationProcessName(ecgId);
  | 
  |                     System.out.println("Interpretation name in establishInterpretationProcess is '" + interpretationName + "'");
  |                 </expression>
  |                 <variable name="ecgId" mapped-name="ecgId" access="read"/>
  |                 <variable name="interpretationName" mapped-name="interpretationName" access="read,write"/>                
  |             </script>
  |         </transition>
  |     </node>
  | 
  |     <decision name="decideOnInterpretation">        
  |         <transition name="interpret" to="doInterpretation"/>            
  |         <transition name="dontInterpret" to="assignForManualInterpretation">
  |             <condition>#{interpretationName == null}</condition>
  |             <script>System.out.println("interpretationName was null!");</script>
  |         </transition>
  |     </decision>
  | 

The specific behaviour here is that the expression #{interpretationName == null} always evaluates to null, so the associated transition is always taken, regardless of the value of the interpretationName process context variable (as set in the script)

I tried to outject a value with BUSINESS_PROCESS scope from my component invoked in the script, but this also was not visible by the expression.

My design goal is to keep the process and the components loosely coupled (the current bsh notwithstanding :P ) such that either can potentially be reused, which is  why I am wanting to hold some minimal state in the process context.

Does anyone have any suggestions about how I might work around this?  I have an idea how I might modify the SeamVariableResolver to look in the jBPM contexts as well as its own scopes, but this seems like a big hammer.

thanks,

shea.

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

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



More information about the jboss-user mailing list