当前位置: 首页>>代码示例>>Java>>正文


Java BpmnXMLConverter.convertToXML方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:18,代码来源:ModelXmlResource.java

示例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;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:12,代码来源:DeploymentBuilderImpl.java

示例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;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:12,代码来源:DeploymentBuilderImpl.java

示例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());
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:38,代码来源:ProcessWithCompensationConverterTest.java


注:本文中的org.flowable.bpmn.converter.BpmnXMLConverter.convertToXML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。