activiti获取流程图实例

本文实例讲述了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.如果想流程发布的时候不生成流程图,需要进行如下配置:

 

你可能感兴趣的:(activiti获取流程图实例)