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.數據的影響: java
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;