码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-04-03 17:28:05      阅读:1508      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

 

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());
        
    }
}

 

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

标签:

原文地址:http://www.cnblogs.com/mingforyou/p/5350001.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!