4 Replies Latest reply on Aug 22, 2007 7:29 AM by masipu

    Decision -> select path

    masipu Newbie

      I want to select a path depending on a value from database. All goes smooth until I have selected the path. I want to run the path I have selected but not the other path. If I simply make a transition to end node from both paths, it almost works. The problem is, the path I didn't select, didn't finish and the process is still in running state. If i use join node before end state, it runs the path i didn't want to go.

      I know this is pretty basics but I haven't figured it out yet. Two paths, I want to go other and after it ends, I want to end the whole process.

        • 1. Re: Decision -> select path
          masipu Newbie

          update to problem:

          If i don't use the join node (well, even if i do use this happens), both paths are still ran.

           <decision name="DecisionThing">
           <event type="node-enter">
           <action name="ResolveDecision" class="com.eventizer.actionhandlers.ResolveTransition">
           <nodeName>SomeName</nodeName>
           </action>
           </event>
           <transition name="0" to="Zero"></transition>
           <transition name="1" to="One"></transition>
           </decision>
           <state name="Zero">
           <event type="node-enter">
           <action name="DoSomething" class="com.eventizer.actionhandlers.Some">
           </action>
           </event>
           <transition name="" to="End process"></transition>
           </state>
           <state name="One">
           <event type="node-enter">
           <action name="DoSomethingElse" class="com.eventizer.actionhandlers.SomeElse">
           </action>
           </event>
           <transition name="" to="End process"></transition>
           </state>
          


          So here, I want to either run Zero or One, not both.

          • 2. Re: Decision -> select path
            masipu Newbie

            I made more research with this problem.

            It seems, that when the process ends, it executes the second node - the not selected path (the one I didn't go to from decision). The reason it executes the not selected is that it is the default transition from decision node.

            I made a test case that simplified this (decision node and two child nodes so that depending on selection and transition, it printed different string to console) and after I went to end state, it ran the default transition of decision node. If I chose the default transition, it was executed twice, if I chose the second transition, both were executed.

            decision
            / \
            node 1 node2
            \ /
            end state

            So the question remains, why it executes the default transition after i go to end state?

            • 3. Re: Decision -> select path
              Martin Ehrlich Newbie

              For me this seems to be rather a problem in the implemented handlers than in jBPM itself.

              I think there are some code lines where you signal the process:

              pInstance.signal()

              Are you sure that you don't call this twice?

              Martin

              • 4. Re: Decision -> select path
                masipu Newbie

                Thanks mate! The problem wasn't with signalin but using the handler. I had ACTIONhandler in action node-enter where I used leaveNode method rather than DecisionHandler. It's fixed now. Sorry for my stupidness :)