Created
January 5, 2015 07:51
-
-
Save henryyan/0c807e7809257fac6f84 to your computer and use it in GitHub Desktop.
遍历流程文件的元素
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 从classpath中获取 | |
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("chapter6/dynamic-form/leave.bpmn"); | |
// 创建转换对象 | |
BpmnXMLConverter converter = new BpmnXMLConverter(); | |
// 创建XMLStreamReader读取XML资源 | |
XMLInputFactory factory = XMLInputFactory.newInstance(); | |
XMLStreamReader reader = factory.createXMLStreamReader(inputStream); | |
// 把XML转换成BpmnModel对象 | |
BpmnModel bpmnModel = converter.convertToBpmnModel(reader); | |
// 验证BpmnModel对象不为空 | |
assertNotNull(bpmnModel); | |
Process process = bpmnModel.getMainProcess(); | |
Collection<FlowElement> flowElements = process.getFlowElements(); | |
for (FlowElement flowElement : flowElements) { | |
System.out.println(flowElement); | |
} |
Author
henryyan
commented
Jan 5, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment