流程部署的几种方式

来源:互联网 发布:甩手掌柜软件 编辑:程序博客网 时间:2024/06/05 08:53

1. 项目结构





2. 指定zip格式的文件完成部署


/** * 部署流程定义(从zip) */@Testpublic void deploymentProcessDefinition_zip(){InputStream in = this.getClass().getClassLoader().getResourceAsStream("diagrams/helloworld.zip");ZipInputStream zipInputStream = new ZipInputStream(in);//与流程定义和部署相关的serviceRepositoryService repositoryService = processEngine.getRepositoryService();//创建一个部署对象DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();//添加部署的名称deploymentBuilder.name("流程定义");//指定zip格式的文件完成部署deploymentBuilder.addZipInputStream(zipInputStream);//完成部署Deployment deployment = deploymentBuilder.deploy();System.out.println("部署id:"+deployment.getId());System.out.println("部署名称:"+deployment.getName());}

3. 部署流程定义(从classpath)


/**     * 部署流程定义(从classpath)     */    @Test    public void deploymentProcessDefinition_classpath(){        //与流程定义和部署相关的service        RepositoryService repositoryService = processEngine.getRepositoryService();                //创建一个部署对象        DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();                //添加部署的名称        deploymentBuilder.name("流程定义");                //从classpath资源中加载,一次只能加载一个        deploymentBuilder.addClasspathResource("diagrams/helloworld.bpmn");        deploymentBuilder.addClasspathResource("diagrams/helloworld.png");                //完成部署        Deployment deployment = deploymentBuilder.deploy();                System.out.println("部署id:"+deployment.getId());//501        System.out.println("部署名称:"+deployment.getName());//流程定义    }


0 0
原创粉丝点击