[jboss-user] [jBPM Users] - Re: how to get all tokens from processinstance

saraswati.santanu do-not-reply at jboss.com
Sun Nov 8 06:53:50 EST 2009


In JBPM 3.x Token of a process instance is like an iterator which is pointing to the current node of the process. So the node associated with the token is the currently active node, which is the TaskNode for your case. In JBPM 3.x "Task" is not a node.
If you need to get the current active tasks then you can use TaskManagementInstance.

  | ProcessInstance processInstance= getProcessInstance();
  | //get the task management instance of the process instance
  | TaskMgmtInstance taskManagementInstance = processInstance.getTaskMgmtInstance();
  | 	
  | //find the unfinished tasks
  | Collection taskInstances = taskManagementInstance.getUnfinishedTasks(processInstance.getRootToken());
  | 

You can also get a "Set" of tasks from the node obtained from the current token.

  | Token rootToken = processInstance.getRootToken();
  | Node node = rootToken.getNode();
  | if (node instanceof TaskNode) {
  |     Set<Task> tasks = ((TaskNode)node).getTasks();
  | }
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264439#4264439

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264439



More information about the jboss-user mailing list