Chinaunix首页 | 论坛 | 博客
  • 博客访问: 604361
  • 博文数量: 298
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3077
  • 用 户 组: 普通用户
  • 注册时间: 2019-06-17 10:57
文章分类

全部博文(298)

文章存档

2022年(96)

2021年(201)

2019年(1)

我的朋友

分类: Java

2022-01-14 15:40:39


点击(此处)折叠或打开


  1.     /**部署流程定义(根据ui.modeler的 modelId部署)
  2.      * @param modelId 模型ID
  3.      * @from fhadmin.cn
  4.      */
  5.     protected String deploymentProcessDefinitionFromUIModelId(String modelId) throws Exception{
  6.         Model model = modelService.getModel(modelId);
  7.         BpmnModel bpmnModel = modelService.getBpmnModel(model);
  8.         Deployment deployment = repositoryService.createDeployment()
  9.         .name(model.getName())
  10.         .addBpmnModel(model.getKey() + ".bpmn", bpmnModel).deploy();
  11.         return deployment.getId();    //部署ID
  12.     }
  13.     
  14.     /**部署流程定义(从Classpath)
  15.      * @param name        //部署名称
  16.      * @param xmlpath    //xml文件路径
  17.      * @param pngpath    //png文件路径
  18.      * @from fhadmin.cn
  19.      */
  20.     protected String deploymentProcessDefinitionFromClasspath(String name, String xmlpath, String pngpath){
  21.         DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();        //创建部署对象
  22.         deploymentBuilder.name(name);                        //部署名称
  23.         deploymentBuilder.addClasspathResource(xmlpath);    //从文件中读取xml资源
  24.         deploymentBuilder.addClasspathResource(pngpath);    //从文件中读取png资源
  25.         Deployment deployment = deploymentBuilder.deploy();    //完成部署
  26.         return deployment.getId();                            //部署ID
  27.     }
  28.     
  29.     /**部署流程定义(从zip压缩包)
  30.      * @param name        //部署名称
  31.      * @param zippath    //zip文件路径
  32.      * @from fhadmin.cn
  33.      * @throws FileNotFoundException
  34.      */
  35.     protected String deploymentProcessDefinitionFromZip(String name, String zippath) throws Exception{
  36.         File outfile = new File(zippath);
  37.         FileInputStream inputStream = new FileInputStream(outfile);
  38.         ZipInputStream ipInputStream = new ZipInputStream(inputStream);
  39.         DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();        //创建部署对象
  40.         deploymentBuilder.name(name);                        //部署名称
  41.         deploymentBuilder.addZipInputStream(ipInputStream);
  42.         Deployment deployment = deploymentBuilder.deploy();    //完成部署
  43.         ipInputStream.close();
  44.         inputStream.close();
  45.         return deployment.getId();                            //部署ID
  46.     }


阅读(540) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~