<bpmndi:bpmnshape>尝试从java源创建池和通道时,缺少xml中的参与者和lane元素

时间:2017-05-15 17:57:16

标签: java jaxb alfresco activiti bpmn

以下是我编写的代码片段,用于生成简单的 .bpmn 文件

public void testDynamicDeploy() throws Exception {
      BpmnModel model = new BpmnModel();
      Process process = new Process();

      model.addProcess(process);
      process.setId("process");

      process.addFlowElement(createStartEvent());
      process.addFlowElement(createUserTask("task1", "First task", "fred"));
      process.addFlowElement(createUserTask("task2", "Second task", "john"));
      process.addFlowElement(createEndEvent());

      process.addFlowElement(createSequenceFlow("start", "task1"));
      process.addFlowElement(createSequenceFlow("task1", "task2"));
      process.addFlowElement(createSequenceFlow("task2", "end"));

      Pool newPool = ActivitiElements.createPool("LMS", "LMS1");
      newPool.setProcessRef(process.getId());

    Lane lane = ActivitiElements.createLane("Booking1", "Booking");
    lane.getFlowReferences().add("start");
    lane.getFlowReferences().add("task1");
    lane.getFlowReferences().add("task3");
    lane.getFlowReferences().add("end");
    lane.setParentProcess(process);

     process.getLanes().add(lane);

    model.getPools().add(newPool);

   new BpmnAutoLayout(model).execute();

   byte[] xml = new BpmnXMLConverter().convertToXML(model);
   FileUtils.writeByteArrayToFile(targetFile, xml);
}

生成的targetFile文件缺少&#34; bpmndi:BPMNShape&#34; 元素

<participant id="LMS" name="LMS1" processRef="process"></participant>

<lane id="Booking1" name="Booking">

我检查了 model.getLocationMap()它包含除参与者和泳道之外的所有 FlowElement GraphicInfo

请帮助解决此问题

非常感谢