How to find next UserTask across two sub-processes

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2016 09:14 PM
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;
}
}
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;
}
}
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2016 08:16 AM
The error end event and the error boundary event should reference the same error (defined on the root level) OR both use the same errorCode.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2016 08:22 PM
Many thanks for your help. I have got the "errorCode" value in EE1 in sub-process A. I traversed all activities in ROOT level trying to get BE1(ErrorBoudanryEvent) activityImpl with the same "errorCode". But I failed on it. I could get all ErrorBoundaryEvent activities through "type" property. But I couldn't make a decision which one is BE1. There is no property called "errorCode" in activityImpl. Or no ErrorBoundaryEventActivityBehavior like ErrorEndEventBehavior having getErrorCode method. I only got BoundaryEventActivityBehavior via activityImpl.getActivityBehavior() method, but there is no property or method for me to subscribe "errorCode". Seem there is no extend class inherited from BoundaryEventActivityBehavior to handle ErrorBoundaryEvent.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2016 05:52 AM
You can find error definitions in activity properties:
[java]
ActivityImpl subprocessA = processDefinition.findActivity("subprocessA");
List<ErrorEventDefinition> errorEventDefinitions = (List<ErrorEventDefinition>) subprocessA.getProperty("errorEventDefinitions");
ErrorEventDefinition firstErrorEventDefinition = errorEventDefinitions.get(0);
String errorCode = firstErrorEventDefinition.getErrorCode();
[/java]
[java]
ActivityImpl subprocessA = processDefinition.findActivity("subprocessA");
List<ErrorEventDefinition> errorEventDefinitions = (List<ErrorEventDefinition>) subprocessA.getProperty("errorEventDefinitions");
ErrorEventDefinition firstErrorEventDefinition = errorEventDefinitions.get(0);
String errorCode = firstErrorEventDefinition.getErrorCode();
[/java]

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2016 02:18 AM
It works, thank you very much.
