Activiti流程文件部署

天大地大妈咪最大 提交于 2020-04-17 09:21:34

【推荐阅读】微服务还能火多久?>>>

一 代码

package com.syc.activiti;


import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;


import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.DeploymentBuilder;


public class AddInputStream {


   public static void main(String[] args) throws Exception {
      // 创建流程引擎
      ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
      // 得到流程存储服务实例
      RepositoryService repositoryService = engine.getRepositoryService();
      // 第一个资源输入流
      InputStream is1 = new FileInputStream(new File(
            "src\\main\\resources\\artifact\\flow_inputstream1.png"));
      // 第二个资源输入流
      InputStream is2 = new FileInputStream(new File(
            "src\\main\\resources\\artifact\\flow_inputstream1.png"));
      // 创建DeploymentBuilder实例
      DeploymentBuilder builder = repositoryService.createDeployment();
      // 为DeploymentBuilder添加资源输入流
      builder.addInputStream("inputA", is1);
      builder.addInputStream("inputB", is2);
      // 执行部署方法
      builder.deploy();
   }


}

二 数据库

mysql> select * from act_re_deployment;
+-------+-------+-----------+------+------------+-------------------------+-----------------+
| ID_   | NAME_ | CATEGORY_ | KEY_ | TENANT_ID_ | DEPLOY_TIME_            | ENGINE_VERSION_ |
+-------+-------+-----------+------+------------+-------------------------+-----------------+
| 17501 | NULL  | NULL      | NULL |            | 2020-04-16 20:50:07.505 | NULL            |
+-------+-------+-----------+------+------------+-------------------------+-----------------+
1 row in set (0.00 sec)

发布了4132 篇原创文章 · 获赞 670 · 访问量 347万+
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!