flowable 部署流程的三种方式

简介: flowable 部署流程的三种方式
/**部署流程定义(根据ui.modeler的 modelId部署)
   * @param modelId 模型ID
   * @from fhadmin.cn
   */
  protected String deploymentProcessDefinitionFromUIModelId(String modelId) throws Exception{
    Model model = modelService.getModel(modelId);
    BpmnModel bpmnModel = modelService.getBpmnModel(model);
    Deployment deployment = repositoryService.createDeployment()
    .name(model.getName())
    .addBpmnModel(model.getKey() + ".bpmn", bpmnModel).deploy();
        return deployment.getId();  //部署ID
  }
  /**部署流程定义(从Classpath)
   * @param name    //部署名称
   * @param xmlpath //xml文件路径
   * @param pngpath //png文件路径
   * @from fhadmin.cn
   */
  protected String deploymentProcessDefinitionFromClasspath(String name, String xmlpath, String pngpath){
    DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();   //创建部署对象
    deploymentBuilder.name(name);           //部署名称
    deploymentBuilder.addClasspathResource(xmlpath);  //从文件中读取xml资源
    deploymentBuilder.addClasspathResource(pngpath);  //从文件中读取png资源
    Deployment deployment = deploymentBuilder.deploy(); //完成部署
    return deployment.getId();              //部署ID
  }
  /**部署流程定义(从zip压缩包)
   * @param name    //部署名称
   * @param zippath //zip文件路径
   * @from fhadmin.cn
   * @throws FileNotFoundException 
   */
  protected String deploymentProcessDefinitionFromZip(String name, String zippath) throws Exception{
    File outfile = new File(zippath);
    FileInputStream inputStream = new FileInputStream(outfile);
    ZipInputStream ipInputStream = new ZipInputStream(inputStream);
    DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();   //创建部署对象
    deploymentBuilder.name(name);           //部署名称
    deploymentBuilder.addZipInputStream(ipInputStream);
    Deployment deployment = deploymentBuilder.deploy(); //完成部署
    ipInputStream.close();
    inputStream.close();
    return deployment.getId();              //部署ID
  }

 

目录
相关文章
|
SQL XML 存储
Flowable 流程部署与删除
Flowable 流程部署与删除
|
7月前
|
XML JavaScript 前端开发
基于jeecgboot的flowable流程支持服务任务的功能
基于jeecgboot的flowable流程支持服务任务的功能
189 0
|
7月前
基于jeecgboot的flowable流程综合会签功能演示平台已经发布
基于jeecgboot的flowable流程综合会签功能演示平台已经发布
50 0
|
7月前
基于jeecgboot的flowable流程增加节点表单的支持(二)
基于jeecgboot的flowable流程增加节点表单的支持(二)
89 0
|
7月前
Activiti 流程发布
Activiti 流程发布
57 0
|
存储 Java API
流程引擎Activiti流程实例讲解
流程引擎Activiti流程实例讲解
277 0
|
XML SQL Java
玩转 Flowable 流程实例
玩转 Flowable 流程实例
|
Java 数据库连接 API
Activiti-流程操作2
Activiti-流程操作2
Activiti-流程操作2
|
Java API 数据库
Activiti-流程操作
Activiti-流程操作
Activiti-流程操作
flowable 三种方式部署流程
flowable 三种方式部署流程
493 0
下一篇
DataWorks