[jboss-user] [JBoss jBPM] - troubles with decision conditions...

shea.phillips do-not-reply at jboss.com
Thu Mar 29 20:24:07 EDT 2007


Hello,

As somewhat of a continuation of my post from a couple of days ago, I am still fighting with decision conditions/expressions.

I have read a number of previous posts that seem pretty similar to this, but not found a working solution. 

I have a process definition that includes the following snippet:


  |     <node name="establishInterpretationProcess">
  |         <transition to="decideOnInterpretation">
  |             <script>
  |                 <expression>
  |                     import com.foo.ECGInterpretationProcessNameResolverService;
  |                     import org.jboss.seam.Component;
  | 
  |                     System.out.println("ECG ID is '" + ecgId + "'");
  | 
  |                     lookup = Component.getInstance(ECGInterpretationProcessNameResolverService.NAME, true);
  | 
  |                     interpretationName = lookup.determineInterpretationProcessName(ecgId);
  | 
  |                     interpretationName = ( interpretationName == null ) ? "NONE" : interpretationName; 
  | 
  |                     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="doIt" to="doInterpretation"/>
  |         <transition name="skip" to="assignForManualInterpretation">
  |             <condition expression="#{ contextInstance.variables.interpretationName == 'NONE' }"/>            
  |         </transition>
  | 
  |     </decision>
  | 
  |     <task-node name="assignForManualInterpretation">
  |         <task name="uninterpretedECG" swimlane="manualInterpretation" description="ECG for Manual Interpretation"/>
  |         <transition to="completed"/>
  |     </task-node>
  | 
  |     <node name="doInterpretation">
  |         <transition to="performTriage">
  |             <script>
  |                 <expression>
  |                     import com.foo.interpretation.ECGInterpretationGeneratorService;
  |                     import org.jboss.seam.Component;
  | 
  |                     System.out.println("Interpretation name in doInterpretation is '" + interpretationName + "'");
  | 
  |                     interpreter = Component.getInstance(ECGInterpretationGeneratorService.NAME, true);
  | 
  |                     interpreter.execute(ecgId, interpretationName);
  |                 </expression>
  |                 <variable name='ecgId' mapped-name="ecgId" access='read'/>
  |                 <variable name='interpretationName' mapped-name="interpretationName" access='read'/>
  |             </script>
  |         </transition>
  |     </node>
  | 

The script works fine, but the first transition in the 'decideOnInterpretation' node is always taken., regardless of whether 'interpretationName' resolves to 'NONE' or some other value.

I have also tried a variation on this theme where I do not assign the magic value 'NONE' when 'interpretationName' resolves to null in the script (ie. I let it be a null String), and I use the condition expression '#{ contextInstance.variables.interpretationName == null }' with the result that the SECOND transition is always taken. 

Note, also that 'interpretationName' is used in the script in 'doIntepretation' and has the correct value (whatever is assigned in 'establishInterpretationProcess' script).  I would think that this means the variable is being exposed as a process instance variable. (it is also showing up in the database)

These symptoms lead me to the conclusion that the variable 'interpretationName' is not visible / in scope/or something inside my transition condition expression, or there is something wrong with my expression.  I have tried using CDATA inside condition element tags rather than the expression attribute with no better results.

Anyone have any further thoughts?

I am on JBPM 3.1.4 in Seam 1.2.0.PATCH1.

Thanks,

Shea.

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

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



More information about the jboss-user mailing list