3 Replies Latest reply on Mar 25, 2009 4:03 AM by toriton

    A question on Transitions

    toriton

      Hi all, i ahve a little question.

      This is a part of my Process definition

      <state name="stateA">
       <event type="node-enter">
       <action class="com.example.AnActionHandler"></action>
       </event>
       <event type="node-leave">
       <cancel-timer name="MailSender"/>
       </event>
       <timer duedate="30 seconds" name="MailSender" transition="to nodeMail"></timer>
       <transition to="stateB" name="to stateB"></transition>
       <transition to="nodeMail" name="to nodeMail"></transition>
       </state>
      




      In this case i have a stateA that have 2 transitions, one is related at normal workflow, the transition named to stateB, and the other that is invoked only from a timer.

      And it work properly if i invoke the signal() method from a webapp that i use to test the process workflow.

      But the question is: there is any chance to configure the transition nodeMail to be invoked only by the timer? and not from the signal() method?

      Because if configured as i described before, the signal() method is perfect anyway to call correctly the transition to stateB, but if the order of the transitions is changed in:

       <transition to="nodeMail" name="to nodeMail"></transition>
      <transition to="stateB" name="to stateB"></transition>
      


      the transition named to nodeMail is the only one transition available invoking the signal() method.

      I know that i can call transition by name too, but i was looking if there was a chance to lock some transition to be executed if who is calling is not the one i expect.


      Thank in advance for any :) reply.
      T.


        • 1. Re: A question on Transitions
          kukeltje

          I personally seldomly use the signal(), I use explicit signal(transitionname)

          • 2. Re: A question on Transitions
            bradsdavis

            I agree with Ronald. Using the explicit signal() is the better way to do it. It allows the code to be read and understood more easily. The problem with the default signal() is that it is completely order based.


            If anything, there should be an attribute to mark it default. But there isn't, so I suggest using the explicit signal.

            • 3. Re: A question on Transitions
              toriton

              you use the explicit signal in any case?
              or only where there are more then one transition as the example i posted?


              I was considering too, how much is important to use an event on a transition, and if is correct to handle something in the moment you are going from A to B. Is not more easy or correct to set an handler on the leaving node event or on the enter?.

              I was looking for some more info about which is better practice to navigate through the process. Or if not the best practice which is the most common idea about it. :)