Created
September 25, 2012 03:56
-
-
Save tangrui/3779888 to your computer and use it in GitHub Desktop.
Find node instance by work item id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fg