AnsweredAssumed Answered

How to find next UserTask across two sub-processes

Question asked by xuemzhan on Jan 7, 2016
Latest reply on Jan 11, 2016 by xuemzhan
Hi Export(s),

I built a process with two sub-processes A and B. There is a ErrorEndEvent EE1 in A, and with a ErrorBoundaryEvent EB1 in pairs. The EB1 connect to sub-process B. I want to find the first UesrTask in B with path EE1 -> EB1 -> Sub-process B -> (UserTasks).

But the path is end with EE1, and no way is found to connect EB1. I don't know how to use error event signal to find EB1 through EE1's errorCode. And also have no idea to find the next UserTask across sub-processes A and B.

I build a method as follow:

public void iteratorNextNodes(Process process, FlowNode sourceFlowElement, Map<String, FlowNode> nodeMap) throws Exception {
       List<SequenceFlow> list = sourceFlowElement.getOutgogingFlows();
       for (SequenceFlow sf : list) {
             sourceFlowElement = (FlowNode) process.getFlowElementRecursive(sf.getTargetRef());
             if (sourceFlowElement instanceof UserTask) {
                   nodeMap.put(sourceFlowElement.getId(), sourceFlowElement);
                   continue;
             } else {
                   iteratorNextNodes(process, sourceFlowElement, nodeMap);
             }
       }
       if (sourceElement instanceof UserTask) {
             nodeMap.put(sourceFlowElement.getId(), sourceFlowElement);
             return;
        }
}

Outcomes