[jboss-dev-forums] [jBPM Development] - Getting Node Name from Node Instance in jBPM 5.4

João Guerra do-not-reply at jboss.com
Mon Mar 25 07:06:32 EDT 2013


João Guerra [https://community.jboss.org/people/ciberg] created the discussion

"Getting Node Name from Node Instance in jBPM 5.4"

To view the discussion, visit: https://community.jboss.org/message/804567#804567

--------------------------------------------------------------
Hi,

I'm trying to get the node name for a process that at a given moment has a gateway making two tasks active simultaneasly.

The problem is that when I get the NodeInstance collection it seems that it is not iterating correctly, when I use a do/while with a hasNext I enter a infinite loop and only one NodeName is obtained.
Then I changed it for using size, and although the size is correct (in my case size is 2) the getNameName method always returns the same node name as if the iterator was always in the same place.

Can you help me on this?

Here is the code:
> ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId);
> WorkflowProcessInstance workflowProcessInstance = null;
> Collection<NodeInstance> nodes = ((org.jbpm.workflow.instance.WorkflowProcessInstance) processInstance).getNodeInstances();
> int nodeSize = nodes.size();
> System.out.println("Number of nodes - " + nodeSize);
> int count = 0;
> do {
>   processTasks = nodes.iterator().next().getNodeName();
>   System.out.println(processTasks + "  -  " + count);
>   count = count + 1;
> } while (count < nodes.size());
> 
The result of this code is:
Number of nodes - 2
Digitalize Document - 0
Digitalize Document - 1


Instead of:
Number of nodes - 2
Digitalize Document - 0
Insert data - 1

Thank you
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/804567#804567]

Start a new discussion in jBPM Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2035]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20130325/284f43e4/attachment.html 


More information about the jboss-dev-forums mailing list