本文實例講述了activiti獲取流程圖的方法,具體操作步驟如下:
1.發布流程代碼如下:
repositoryService.createDeployment() .name("expense-process.bar") .addClasspathResource("org/activiti/expenseProcess.bpmn20.xml") .addClasspathResource("org/activiti/expenseProcess.png") .deploy();
2.根據key獲取流程圖代碼如下:
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() .processDefinitionKey("expense") .singleResult(); String diagramResourceName = processDefinition.getDiagramResourceName(); InputStream imageStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), diagramResourceName);
3.如果想流程發布的時候不生成流程圖,需要進行如下配置:
<property name="createDiagramOnDeploy" value="false" />