您的位置:首页 > 其它

Activiti的流程定义文件解析(后续)

2013-09-26 00:00 537 查看
今天同事无意之间发现一种更简单的方法去实现对流程定义文件的解析:

即在 activiti-engine源码包下的test目录下:org.activiti.standalone.parsing.ChineseConverterTest该类下的方法:

protected BpmnModel readXMLFile() throws Exception {
InputStream xmlStream = this.getClass().getClassLoader().getResourceAsStream(getResource());
StreamSource xmlSource = new InputStreamSource(xmlStream);
BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xmlSource, false, false, processEngineConfiguration.getXmlEncoding());
return bpmnModel;
}
只需获取流程定义文件流,最后通过
BpmnXMLConverter进行转换即可获取BpmnModel。

有了这么简洁的方法,可以对之前的那种实现无视了...


同样也发现原来在test目录下会有这么好的东西,看来以后得好好看看了...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息