3 Replies Latest reply on Jan 7, 2008 1:50 PM by Koen Aers

    Finding all tokens in ProcessDefinition?

    John Ruud Newbie

      I would like to iterate through all the tokens in a ProcessDefinition (in order to print out the token.getId() for each node). However, very likely because I don't understand how the jbpm engine code is supposed to work, I'm only getting the root token back, even when the diagram contains several forks etc. For example, I have tried running the code below on several known-to-be-good process definitions:

      ProcessDefinition pd = ProcessDefinition.parseXmlString(xml);
      ProcessInstance pi = new ProcessInstance(pd);

      ...but for example:
      pi.findAllTokens() only returns the root token, and:
      pi.getRootToken().getChildren() returns null

      Any ideas?

      Thanks, John