[jBPM Users] - Re: how to get all tokens from processinstance
by peterbasutkar@gmail.com
i dont want only running task............i am using following this code for getting completed and pending token(task node) as well as running token information but this is keeping track of token data(means previously completed and currenrently running task) if an only if we are performing any signaling,but i want all completed and pending token information irrespective of signaling,means it should give me information when task is started,when it is ended for that processInstance
ProcessInstance processInstance = getProcessInstance();
LoggingInstance loggingInstance = processInstance.getLoggingInstance();
List logs = loggingInstance.getLogs(SignalLog.class);
for (SignalLog signalLog : logs) {
List children = signalLog.getChildren();
if(children.get(0) != null){
if(children.get(0) instanceof TransitionLog){
TransitionLog transitionLog = (TransitionLog)children.get(0);
System.out.println("Node Name:::"+transitionLog.getSourceNode().getName());
System.out.println("Node Start Time:::");
System.out.println("Node End Time:::"+transitionLog.getDate());
System.out.println("=====================================================");
}
if(children.get(0) instanceof NodeLog){
NodeLog nodeLog = (NodeLog)children.get(0);
System.out.println("Node Name:::"+nodeLog.getNode().getName());
System.out.println("Node Start Time:::"+nodeLog.getEnter());
System.out.println("Node End Time:::"+nodeLog.getLeave());
System.out.println("=====================================================");
}
}
}
return "success";
}
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264443#4264443
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264443
16 years, 5 months
[jBPM Users] - Re: how to get all tokens from processinstance
by saraswati.santanu
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
16 years, 5 months