activiti7 读取bpmn文件部署流程

try {
//获取文件流
File fileBpmn = new File('bpmn文件绝对地址');
InputStream BpmnInputStream = null;
try {
BpmnInputStream = new FileInputStream(fileBpmn);
} catch (IOException e) {

}
File fileSvg = new File('png/svg 文件绝对地址');
InputStream SvgInputStream = null;
try {
SvgInputStream = new FileInputStream(fileSvg);
} catch (IOException e) {

}
//1.创建ProcessEngine对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

//2.得到RepositoryService实例
RepositoryService repositoryService = processEngine.getRepositoryService();


//3.进行部署
Deployment deployment = repositoryService.createDeployment()//创建Deployment对象
.name('name')
.key('')
.category('')
.tenantId("000000")
.addInputStream(fileBpmn.getName(), BpmnInputStream)//添加bpmn文件
.addInputStream(fileSvg.getName(), SvgInputStream)//添加png/svg文件
.deploy();//部署
log.info("name---" + deployment.getName());
} catch (Exception e) {
e.printStackTrace();
}

猜你喜欢

转载自www.cnblogs.com/ggdxx/p/13400014.html