工作流-解析bpmn

旧街凉风 提交于 2020-02-29 00:26:36
@SneakyThrows
public void add(FlowModelAdd param, MultipartFile file){
	byte[] bytes = file.getBytes();
	String xml = new String(bytes, StandardCharsets.UTF_8);

	//创建转换对象
	BpmnXMLConverter converter = new BpmnXMLConverter();
	XMLInputFactory factory = XMLInputFactory.newInstance();
	// 字节方式
	XMLStreamReader reader = factory.createXMLStreamReader(new ByteArrayInputStream(xml.getBytes()));
	// 流方式
	XMLStreamReader reader = factory.createXMLStreamReader(file.getInputStream());

	//将xml文件转换成BpmnModel
	BpmnModel bpmnModel = converter.convertToBpmnModel(reader);
	System.out.println(bpmnModel);
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!