如何确定通话活动的通道?

Den*_*son 3 java business-process-management bpmn camunda

我有一个Call Activity,用于我的BPMN图的不同通道."呼叫活动"中有一项任务.是否可以从任务中确定呼叫活动的通道?

在这里的图片看起来像这样:

流程图

通话活动

我想从任务"Get parent Lane"中分别确定"MyLane1""MyLane2".

小智 5

您可以使用BPMN Model API来确定引用活动的通道:

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
}
Run Code Online (Sandbox Code Playgroud)