2 Replies Latest reply on Mar 19, 2007 5:29 PM by kukeltje

    How to find out current node/state in process instance?

    yamert

      Hello!

      I'm actively investigating jBPM, therefore I'm writing appropriate tests.
      I've defined one test, that starts a new process instance (creates one via JbpmContext, saves into DB).

      Second test should get the newest process instance from DB, and continue it.
      I do it by calling GraphSession.findProcessInstances(aProcessDefinitionFromDB);

      The question is: how second test can detect, which is the current wait state?
      Alas, jBPM API description is rather poor (I mean jbpm-3.1.4, and API docs that are attached to the distributive), and the only thing I could find was ProcessInstance.getRootToken() --but it seems to return a reference to the start state...

      How can I decide, for example, which node transition to activate, if I don't know at which node the process instance is currently?
      Why there's no a method like ProcessInstance.getCurrentToken() or ProcessInstance.getCurrentNode()?

        • 1. Re: How to find out current node/state in process instance?

          Most of the time u don't need to know which transition to activate (unless in special cases of forks, decisions etc..)

          ProcessInstance.signal()

          will find the default leaving transition from the current node where the root token is parked and signal it to the next node.

          If u really want to know which node the process-instance is in use this

          ProcessInstance.getRootToken().getNode()

          • 2. Re: How to find out current node/state in process instance?
            kukeltje

            Often my real-life boss is not happy when I say the source is the best documentation, but often, in combination with good testcases it is. jBPM has numerous testcases and you'll see that by looking at them, that they will answer many of your future questions