[jboss-user] [jBPM] - Re: obsolete id
Francesco Pietrobelli
do-not-reply at jboss.com
Wed Sep 7 08:56:25 EDT 2011
Francesco Pietrobelli [http://community.jboss.org/people/francesco.pietrobelli] created the discussion
"Re: obsolete id"
To view the discussion, visit: http://community.jboss.org/message/625274#625274
--------------------------------------------------------------
You can use this method:
/**
* Get the node instance corresponding to a work item identified with
* <code>workItemId</code>
*
* @param workItemId
* identification of work item id
* @param container
* the container that contains the node instance, in most case
* the process instance
* @return null if no node instance is found, the correspond node instance
* otherwise
*/
public static WorkItemNodeInstance findNodeInstance(long workItemId,
NodeInstanceContainer container) {
for (NodeInstance nodeInstance : container.getNodeInstances()) {
if (nodeInstance instanceof WorkItemNodeInstance) {
WorkItemNodeInstance workItemNodeInstance = (WorkItemNodeInstance) nodeInstance;
if (workItemNodeInstance.getWorkItem().getId() == workItemId) {
return workItemNodeInstance;
}
}
if (nodeInstance instanceof NodeInstanceContainer) {
WorkItemNodeInstance result = findNodeInstance(workItemId,
((NodeInstanceContainer) nodeInstance));
if (result != null) {
return result;
}
}
}
return null;
}
and then invoke the method getNodeId() on returned object.
Of course your WorkItemHandler needs a reference to StatefulKnowledgeSession, but you can pass it when you register your WorkItemHandler on your session.
I hope this is useful.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/625274#625274]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110907/8d99f140/attachment-0001.html
More information about the jboss-user
mailing list