1. 发布流程图
2.发布的代码
package com.java1234.activiti.procdef;
import java.io.InputStream;
import java.util.zip.ZipInputStream;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.repository.Deployment;
import org.junit.Test;
/**
* 部署流程, 使用zip方式!
* @author Administrator
*
*/
public class DeployProcdef {
/**
* 获取默认流程引擎实例,默认读取配置文件activiti.cfg.xml
*/
private ProcessEngine processEngine=ProcessEngines.getDefaultProcessEngine();
/**
* 部署流程定义.
*/
@Test
public void deployWidthClassPath(){
Deployment deployment= processEngine.getRepositoryService()// 部署相关service
.createDeployment()//创建部署对象
.addClasspathResource("diagrams/HelloWorld2.bpmn")//加载资源文件
.addClasspathResource("diagrams/HelloWorld2.png") //加载资源图片
.name("HelloWorld2流程java代码添加进去的第二次部署")//设置名称
.deploy();//部署
System.out.println("流程部署Id:"+deployment.getId());
System.out.println("流程部署Name:"+deployment.getName());
}
/**
* 部署流程定义. zip 部署流程
*/
@Test
public void deployWidthZip(){
InputStream inputStream= this.getClass().getClassLoader().getResourceAsStream("diagrams/HelloWorld.zip");//返回一个流
ZipInputStream zipInputStream= new ZipInputStream(inputStream);// 实例化zip 输入流
Deployment deployment= processEngine.getRepositoryService()// 部署相关service
.createDeployment()//创建部署对象
.addZipInputStream(zipInputStream) // 添加zip输入流;
.name("zip方式摄入的流程名称name")// 设置名称!
.deploy();//部署
System.out.println("流程部署Id:"+deployment.getId());
System.out.println("流程部署Name:"+deployment.getName());
/* 输出结果:
流程部署Id:5001
流程部署Name:zip方式摄入的流程名称name
*/
}
}
3.数据的影响:
select * from act_re_deployment; | ![]() |
select * from act_re_procdef; | ![]() |
select * from act_ge_bytearray; | ![]() |
select * from act_ge_property; | ![]() |
## 流程部署表
select * from act_re_deployment;
## 流程定义表
select * from act_re_procdef;
## 资源文件表
select * from act_ge_bytearray;
## 系统配置表
select * from act_ge_property;