1 Reply Latest reply on May 11, 2007 1:21 PM by Jon Lachelt

    troubles with decision conditions...

    Shea Phillips Newbie


      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">
       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 + "'");
       <variable name='ecgId' mapped-name="ecgId" access='read'/>
       <variable name='interpretationName' mapped-name="interpretationName" access='read,write'/>
       <decision name="decideOnInterpretation">
       <transition name="doIt" to="doInterpretation"/>
       <transition name="skip" to="assignForManualInterpretation">
       <condition expression="#{ contextInstance.variables.interpretationName == 'NONE' }"/>
       <task-node name="assignForManualInterpretation">
       <task name="uninterpretedECG" swimlane="manualInterpretation" description="ECG for Manual Interpretation"/>
       <transition to="completed"/>
       <node name="doInterpretation">
       <transition to="performTriage">
       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);
       <variable name='ecgId' mapped-name="ecgId" access='read'/>
       <variable name='interpretationName' mapped-name="interpretationName" access='read'/>

      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.



        • 1. Re: troubles with decision conditions...
          Jon Lachelt Newbie

          I am having a similar behavior. The first transition is always taken, regardless of what the condition is. I've tried numerous different syntaxes as per other discussions I found on the forums:


          I'm using jbpm 3.1.4, so this is not an issue of it working once in 3.1.4 but no longer in 3.2.

          Did you figure out why you are getting this behavior?

          Here is my current version of the decision node. The workflow always takes the rejected transtion, regardless of the value of approval. If I swap the order of the transition, then it takes the approved transition (again regardless of the value of approval).

          <decision name="decision1">
           <transition name="rejected" to="end_rej">
           <condition>approval != 'approved'</condition>
           <transition name="approved" to="Approve NCM Job">
           <condition>approval == 'approved'</condition>