Skip to content

Instantly share code, notes, and snippets.

@tangrui
Created September 25, 2012 03:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tangrui/3779888 to your computer and use it in GitHub Desktop.
Save tangrui/3779888 to your computer and use it in GitHub Desktop.
Find node instance by work item id
private 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;
}
@hejie
Copy link

hejie commented Sep 25, 2012

fg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment