2 Replies Latest reply on Oct 12, 2006 11:04 PM by youngliuus

    Why must we call executionContext.leaveNode() in Node's Acti

    youngliuus

      In my 'execute' function in ActionHandler, I must call "executionContext.leaveNode()" at the very end.

      Since there can only be one Action in a given Node, I think leaveNode should be the default action after execution of ActionHandler, if user didn't call leaveNode in the actionHandler.

      Even in script, we also must call leaveNode after other work. And, if you updated some process variables, you must call executionContext.setVariable to set the updated values back, or the code get executed in the next node can't get the updated values. The reason is the code in the next node will be executed before the script interperter set the updated process variable back to ContextInstance. I believe this is really unconvenient for users.

      Is there anyone can give me a good reason for this?

      Thanks

        • 1. Re: Why must we call executionContext.leaveNode() in Node's
          fatbeat

          from my point of view you can have more options after an action handler, since an action handler can be on a transition or a node.

          at the end of the action handler you can tell the instance which way you want to go after the action handler, since a node can have more than one transition.

          • 2. Re: Why must we call executionContext.leaveNode() in Node's
            youngliuus

            Thank you for your response. I agree with what you said. But we can add calling leaveNode in class Node, after calling ActionHandler.
            The case I feel really unconvenient is when the ActionHandler is used by a node, and there is only one leaving transition, or we just want to go after the default transition. And I believe this is true for many cases.
            Moreover, it's a good idea that let the end-user write script for a node's action. Currently, we must tell the end-user to call leaveNode after the very end, and setVariable to processVariable before leaveNode if she/he updated some of processsVariables; if she/he didn't do these, the process doesn't work.

            Of cause, I can add my node type to jBPM, and implement this in my node type.