3 Replies Latest reply on Jan 7, 2008 1:50 PM by koen.aers

    Finding all tokens in ProcessDefinition?

    jruud

      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