I have a Call Activity, which is used in different lanes of my BPMN diagram. There is a task inside the Call Activity. Is it possible to determine the Lane of the Call Activity from the Task?
It looks something like this in the pictures here:
I want to determine "MyLane1" respectively "MyLane2" from inside the Task "Get parent Lane".
You can use the BPMN Model API to determine the lane which references an activity:
ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().processDefinitionKey("idOfProcess").singleResult();
BpmnModelInstance bpmnModelInstance = repositoryService.getBpmnModelInstance(procDef.getId());
CallActivity callActivity = null;
Collection<Lane> lanes = bpmnModelInstance.getModelElementsByType(Lane.class);
// iterate the lanes
for (Lane lane : lanes) {
// iterate the flownodes referenced by the lane:
for (FlowNode flowNode : lane.getFlowNodeRefs()) {
if("idOfCallactivity".equals(flowNode.getId())) {
callActivity = (CallActivity) flowNode;
break;
}
}
}
if(callActivity != null) {
// work with callactivity
}