本文整理汇总了Java中org.flowable.bpmn.converter.BpmnXMLConverter.convertToXML方法的典型用法代码示例。如果您正苦于以下问题:Java BpmnXMLConverter.convertToXML方法的具体用法?Java BpmnXMLConverter.convertToXML怎么用?Java BpmnXMLConverter.convertToXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.flowable.bpmn.converter.BpmnXMLConverter
的用法示例。
在下文中一共展示了BpmnXMLConverter.convertToXML方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModelXml
import org.flowable.bpmn.converter.BpmnXMLConverter; //导入方法依赖的package包/类
@RequestMapping(value = "/model/{modelId}/xml", method = RequestMethod.GET, name="获取模型XML")
public ResponseEntity<byte[]> getModelXml(@PathVariable String modelId) {
Model model = getModelFromRequest(modelId);
try {
BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(model.getId()));
BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentType(MediaType.TEXT_XML);
return new ResponseEntity<byte[]>(IOUtils.toByteArray(in), responseHeaders,HttpStatus.OK);
} catch (Exception e) {
throw new FlowableException("Error converting resource stream", e);
}
}
示例2: addBpmnModel
import org.flowable.bpmn.converter.BpmnXMLConverter; //导入方法依赖的package包/类
@Override
public DeploymentBuilder addBpmnModel(String resourceName, BpmnModel bpmnModel) {
BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
try {
String bpmn20Xml = new String(bpmnXMLConverter.convertToXML(bpmnModel), "UTF-8");
addString(resourceName, bpmn20Xml);
} catch (UnsupportedEncodingException e) {
throw new FlowableException("Error while transforming BPMN model to xml: not UTF-8 encoded", e);
}
return this;
}
示例3: addBpmnModel
import org.flowable.bpmn.converter.BpmnXMLConverter; //导入方法依赖的package包/类
@Override
public DeploymentBuilder addBpmnModel(String resourceName, BpmnModel bpmnModel) {
BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
try {
String bpmn20Xml = new String(bpmnXMLConverter.convertToXML(bpmnModel), "UTF-8");
addString(resourceName, bpmn20Xml);
} catch (UnsupportedEncodingException e) {
throw new ActivitiException("Error while transforming BPMN model to xml: not UTF-8 encoded", e);
}
return this;
}
示例4: testConvertingAfterAutoLayout
import org.flowable.bpmn.converter.BpmnXMLConverter; //导入方法依赖的package包/类
@Test
public void testConvertingAfterAutoLayout() {
final InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ProcessWithCompensationAssociation.bpmn20.xml");
BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
BpmnModel bpmnModel1 = bpmnXMLConverter.convertToBpmnModel(new InputStreamProvider() {
@Override
public InputStream getInputStream() {
return inputStream;
}
}, false, false);
if (bpmnModel1.getLocationMap().size() == 0) {
BpmnAutoLayout bpmnLayout = new BpmnAutoLayout(bpmnModel1);
bpmnLayout.execute();
}
byte[] xmlByte = bpmnXMLConverter.convertToXML(bpmnModel1);
final InputStream byteArrayInputStream = new ByteArrayInputStream(xmlByte);
BpmnModel bpmnModel2 = bpmnXMLConverter.convertToBpmnModel(new InputStreamProvider() {
@Override
public InputStream getInputStream() {
return byteArrayInputStream;
}
}, false, false);
assertEquals(10, bpmnModel1.getLocationMap().size());
assertEquals(10, bpmnModel2.getLocationMap().size());
assertEquals(7, bpmnModel1.getFlowLocationMap().size());
assertEquals(7, bpmnModel2.getFlowLocationMap().size());
}