private Collection<Long> getSubFlows(ProcessInstance processInstance) {
Collection<Long> result = new HashSet<Long>();
if (processInstance == null) {
return result;
}
WorkflowProcessInstance wp = (WorkflowProcessInstance) processInstance;
for (NodeInstance n : wp.getNodeInstances()) {
if (n instanceof SubProcessNodeInstance) {
SubProcessNodeInstance spn = (SubProcessNodeInstance) n;
result.add(spn.getProcessInstanceId());
}
}