本文实例讲述了activiti获取流程图的方法,具体操作步骤如下:
1.发布流程代码如下:
1
2
3
4
5
|
repositoryService.createDeployment()
.name( "expense-process.bar" )
.addClasspathResource( "org/activiti/expenseProcess.bpmn20.xml" )
.addClasspathResource( "org/activiti/expenseProcess.png" )
.deploy();
|
2.根据key获取流程图代码如下:
1
2
3
4
5
6
7
|
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionKey( "expense" )
.singleResult();
String diagramResourceName = processDefinition.getDiagramResourceName();
InputStream imageStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), diagramResourceName);
|
3.如果想流程发布的时候不生成流程图,需要进行如下配置:
1
|
< property name = "createDiagramOnDeploy" value = "false" />
|