Activiti之读取BPMN文件

private void getActivitiBPMN(String processDefinitionId) throws Exception{
         ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
                    .processDefinitionId(processDefinitionId).singleResult();
           String resourceName =processDefinition.getResourceName();
            InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),
                    resourceName);
            //创建转换对象
            BpmnXMLConverter converter = new BpmnXMLConverter();
            XMLInputFactory factory = XMLInputFactory.newInstance();
            XMLStreamReader reader = factory.createXMLStreamReader(resourceAsStream);//createXmlStreamReader
            //将xml文件转换成BpmnModel
            BpmnModel bpmnModel = converter.convertToBpmnModel(reader);
            System.out.println(bpmnModel);
            
    }

你可能感兴趣的:(Activiti之读取BPMN文件)