3 Replies Latest reply on May 9, 2006 11:40 AM by marco ferraz

    jBPM 3.1 Decision Node Example Code

    Ian Terrell Newbie

      Is there any example code for a decision node in version 3.1? I'm migrating my code from 3.0.2 and it sounds like that has to change to a JSP-like syntax. Unfortunately, I don't see any relevant code snippets in the user guide, the migration guide, or in src/process.examples.

      Here's my test process:

      <process-definition name="New Decision Node Test">
       <start-state name="start">
       <transition name="start" to="decide" />
       </start-state>
       <decision name="decide">
       <transition name="default" to="n1"/>
       <transition name="2" to="n2">
       <condition>
       <![CDATA[#{x == 2}]]>
       </condition>
       </transition>
       <transition name="3" to="n3">
       <condition>
       <![CDATA[#{x == 3}]]>
       </condition>
       </transition>
       </decision>
       <state name="n1">
       <transition name="finish" to="end" />
       </state>
       <state name="n2">
       <transition name="finish" to="end" />
       </state>
       <state name="n3">
       <transition name="finish" to="end" />
       </state>
       <end-state name="end"/>
      </process-definition>
      


      Executing the above code I always go to n1, even when I have set (the Integer) x to 2, or 3. Am I doing something incorrectly with the new expressions?

      Ian

        • 1. Re: jBPM 3.1 Decision Node Example Code
          Ian Terrell Newbie

          Haha. Further experimentation shows me what I can only assume must be a bug in the interpretation of whitespace.

          The following revision to the test process works as expected:

          <process-definition name="New Decision Node Test">
           <start-state name="start">
           <transition name="start" to="decide" />
           </start-state>
           <decision name="decide">
           <transition name="default" to="n1"/>
           <transition name="2" to="n2">
           <condition><![CDATA[#{x == 2}]]></condition>
           </transition>
           <transition name="3" to="n3">
           <condition><![CDATA[#{x == 3}]]></condition>
           </transition>
           </decision>
           <state name="n1">
           <transition name="finish" to="end" />
           </state>
           <state name="n2">
           <transition name="finish" to="end" />
           </state>
           <state name="n3">
           <transition name="finish" to="end" />
           </state>
           <end-state name="end"/>
          </process-definition>
          


          However, if you have even one space, it won't evaluate the conditions. For instance, the following process always goes to n1.
          <process-definition name="New Decision Node Test">
           <start-state name="start">
           <transition name="start" to="decide" />
           </start-state>
           <decision name="decide">
           <transition name="default" to="n1"/>
           <transition name="2" to="n2">
           <condition> <![CDATA[#{x == 2}]]></condition>
           </transition>
           <transition name="3" to="n3">
           <condition> <![CDATA[#{x == 3}]]></condition>
           </transition>
           </decision>
           <state name="n1">
           <transition name="finish" to="end" />
           </state>
           <state name="n2">
           <transition name="finish" to="end" />
           </state>
           <state name="n3">
           <transition name="finish" to="end" />
           </state>
           <end-state name="end"/>
          </process-definition>
          


          Uh oh. :)

          • 3. Re: jBPM 3.1 Decision Node Example Code
            marco ferraz Newbie

            HI iterrell!!

            I put the code that u submited on the source page of my process definition..
            I deployed it.. but on the JBPM administration page.. i don´t have a "start process link" to start it-..i only have the reference that he is there...!! Did u know what is the problem?? i put the code just like u submit it!!

            other question.. on your example u work with the variable "x".. where you did the definition of that variable? and.. how? and also..


            Thanks a lot!!
            marco