flowable resource deployment

Tables involved in resource deployment

act_re_deployment (deployment object table) stores the display name and deployment time of the process definition, adding a record for each deployment

act_re_procdef (process definition table) stores the attribute information of the process definition. Deploying each new process definition will add a record to this table. When the key of the process definition is the same, the version upgrade +1 is used

The targetNamespace field in the process file corresponds to the CATEGORY in the table

The id in the process file corresponds to the key in the table

The process file name corresponds to the name in the table

The primary key id rule is key:virsion:generatedid

act_ge_bytearray (resource file table) stores deployment information related to process definitions. That is, the storage location of the process definition document. If you don't lose it, two records will be added, one is about the bpmn rule file and the other is the picture (if only one file is specified for bpmn during deployment, flowable will parse the content of the bpmn file during deployment and automatically generate a flowchart). The two files are not very large, they are stored in the database in binary

Resource deployment method

1.classpath way

2. Text mode

3. Model way

4. Byte mode

5. Streaming method

DeploymentBuilder addInputStream(String resourceName, InputStream inputStream);

DeploymentBuilder addClasspathResource(String resource);

DeploymentBuilder addString(String resourceName, String text);

DeploymentBuilder addBytes(String resourceName, byte[] bytes);

DeploymentBuilder addZipInputStream(ZipInputStream zipInputStream);

DeploymentBuilder addBpmnModel(String resourceName, BpmnModel bpmnModel);

Process deployment DeploymentBuilder classpath method

@Test
public void DeploymentBuild1() {
    DeploymentBuilder deploymentBuilder = repositoryService.createDeployment()
            .category("测试分类")
            .name("名称")
            .addClasspathResource("Complex_compensation.manualmodif.importInFlowable_NOSHAPE.bpmn20.xml");
    //流程部署
    Deployment deploy = deploymentBuilder.deploy();

    System.out.println(deploy.getId());
}
/**
*字符串方式
*资源名称限制 结尾必须是bpmn20.xml or bpmn 才可以部署到流程定义表
*/
 @Test
    public void deploy1() {
        String text = IoUtil.readFileAsString("Complex_compensation.manualmodif.importInFlowable_NOSHAPE.bpmn20.xml");
        DeploymentBuilder deploymentBuilder = repositoryService.createDeployment()
                .category("测试分类")
                .name("名称")
                .key("测试的key")
                .addString("testStr.bpmn20.xml", text);
        //流程部署
        Deployment deploy = deploymentBuilder.deploy();
        System.out.println(deploy.getId());
    }
  /**
     * 输入流方式
     */
    @Test
    public void deploy2() {
        InputStream inputStream = SpringTest.class.getClassLoader().getResourceAsStream("Complex_compensation.manualmodif.importInFlowable_NOSHAPE.bpmn20.xml");
        DeploymentBuilder deploymentBuilder = repositoryService.createDeployment()
                .category("测试分类")
                .name("名称")
                .key("测试的key")
                .addInputStream("inputStream.bpmn20.xml", inputStream);
        //流程部署
        Deployment deploy = deploymentBuilder.deploy();
        System.out.println(deploy.getId());
    }

 

Guess you like

Origin blog.csdn.net/qq_37790902/article/details/108659507