以下是我编写的代码片段,用于生成简单的 .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文件缺少" bpmndi:BPMNShape" 元素
<participant id="LMS" name="LMS1" processRef="process"></participant>
和
<lane id="Booking1" name="Booking">
我检查了 model.getLocationMap()它包含除参与者和泳道之外的所有 FlowElement GraphicInfo 。
请帮助解决此问题
非常感谢
答案 0 :(得分:0)
目前无法使用 BpmnXMLConverter()。convertToXML(model);