Activiti 部署流程定义及相关的表(classpath部署、zip部署)

Activiti 部署流程定义及相关的表(classpath部署、zip部署)_第1张图片

 

package com.mycom.processDefinition;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.repository.Deployment;
import org.junit.Test;

public class ProcessDefinitionTest {

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    
    /*
     *部署流程定义 (从classpath)
     */
    @Test
    public void deploymentProcessDefinition(){
        Deployment deployment = processEngine.getRepositoryService()//与流程定义和部署对象相关的Service
                        .createDeployment()//创建一个部署对象
                        .name("流程定义")//添加部署名称
                        .addClasspathResource("diagrams/HelloWorld.bpmn")//从classpath的资源中加载,一次只能加载一个文件
                        .addClasspathResource("diagrams/HelloWorld.png")
                        .deploy();//完成部署
        System.out.println("部署ID:"+deployment.getId());
        System.out.println("部署名称:"+deployment.getName());
        
    }
    
    
}

 SELECT * FROM activiti.act_re_deployment a; #部署对象表

Activiti 部署流程定义及相关的表(classpath部署、zip部署)_第2张图片

 SELECT * FROM activiti.act_re_procdef a; #流程定义表

Activiti 部署流程定义及相关的表(classpath部署、zip部署)_第3张图片

 SELECT * FROM activiti.act_ge_bytearray a;# 资源文件表

Activiti 部署流程定义及相关的表(classpath部署、zip部署)_第4张图片

 

SELECT * FROM activiti.act_ge_property a; #主键生成策略表

Activiti 部署流程定义及相关的表(classpath部署、zip部署)_第5张图片

 

 

上面是classpath部署,下面是zip部署

Activiti 部署流程定义及相关的表(classpath部署、zip部署)_第6张图片

 

Activiti 部署流程定义及相关的表(classpath部署、zip部署)_第7张图片

 

package com.mycom.processDefinition;

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;

public class ProcessDefinitionTest {

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    
    /*
     *部署流程定义 (从classpath)
     */
    @Test
    public void deploymentProcessDefinition_classpath(){
        Deployment deployment = processEngine.getRepositoryService()//与流程定义和部署对象相关的Service
                        .createDeployment()//创建一个部署对象
                        .name("流程定义")//添加部署名称
                        .addClasspathResource("diagrams/HelloWorld.bpmn")//从classpath的资源中加载,一次只能加载一个文件
                        .addClasspathResource("diagrams/HelloWorld.png")
                        .deploy();//完成部署
        System.out.println("部署ID:"+deployment.getId());
        System.out.println("部署名称:"+deployment.getName());
        
    }
    
    /*
     *部署流程定义 (从zip)
     */
    @Test
    public void deploymentProcessDefinition_zip(){
        InputStream in = this.getClass().getClassLoader().getResourceAsStream("diagrams/HelloWorld.zip");
        ZipInputStream zipInputStream = new ZipInputStream(in);
        Deployment deployment = processEngine.getRepositoryService()//与流程定义和部署对象相关的Service
                        .createDeployment()//创建一个部署对象
                        .name("流程定义")//添加部署名称
                        .addZipInputStream(zipInputStream)//完成zip文件的部署
                        .deploy();//完成部署
        System.out.println("部署ID:"+deployment.getId());
        System.out.println("部署名称:"+deployment.getName());
        
    }
}

 

你可能感兴趣的:(Activiti 部署流程定义及相关的表(classpath部署、zip部署))