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


    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; #部署对象表

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

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

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

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

    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());
            
        }
    }
  • 相关阅读:
    SpringMVC【二、项目搭建】
    SpringMVC【一、概述】
    VUE【四、组件】
    VUE【三、指令】
    VUE【二、选项和生命周期】
    VUE【一、概述】
    BootStrap【四、插件】
    BootStrap【三、组件】
    BootStrap【二、样式】
    C#+ArcEngine创建企业数据库、连接及相关
  • 原文地址:https://www.cnblogs.com/mingforyou/p/5350001.html
走看看 - 开发者的网上家园