zoukankan      html  css  js  c++  java
  • camunda流程实例启动的一些简单操作

    public class ZccRuntimeService {
    RuntimeService runtimeService;
    RepositoryService repositoryService;

    @Before
    public void init(){
    ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("camunda.cfg.xml");
    ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
    runtimeService = processEngine.getRuntimeService();
    repositoryService=processEngine.getRepositoryService();
    System.out.println(runtimeService);
    }

    /**
    * 部署流程
    */
    @Test
    public void deploymentBPMN(){
    DeploymentBuilder deploymentBuilder=repositoryService.createDeployment();
    Deployment deploy = deploymentBuilder.name("审批").tenantId("a").source("本地测试").addClasspathResource("my3.bpmn").deploy();

    }

    /**
    * 启动流程实例
    * insert into ACT_HI_TASKINST ( ID_, PROC_DEF_KEY_, PROC_DEF_ID_, ROOT_PROC_INST_ID_, PROC_INST_ID_, EXECUTION_ID_, CASE_DEF_KEY_, CASE_DEF_ID_, CASE_INST_ID_, CASE_EXECUTION_ID_, ACT_INST_ID_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, OWNER_, ASSIGNEE_, START_TIME_, END_TIME_, DURATION_, DELETE_REASON_, TASK_DEF_KEY_, PRIORITY_, DUE_DATE_, FOLLOW_UP_DATE_, TENANT_ID_, REMOVAL_TIME_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) Update counts: [1]
    * Result 1: insert into ACT_HI_PROCINST ( ID_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_KEY_, PROC_DEF_ID_, START_TIME_, END_TIME_, REMOVAL_TIME_, DURATION_, START_USER_ID_, START_ACT_ID_, END_ACT_ID_, SUPER_PROCESS_INSTANCE_ID_, ROOT_PROC_INST_ID_, SUPER_CASE_INSTANCE_ID_, CASE_INST_ID_, DELETE_REASON_, TENANT_ID_, STATE_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) Update counts: [1]
    * Result 2: insert into ACT_HI_IDENTITYLINK ( ID_, TIMESTAMP_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, ROOT_PROC_INST_ID_, PROC_DEF_ID_, OPERATION_TYPE_, ASSIGNER_ID_, PROC_DEF_KEY_, TENANT_ID_, REMOVAL_TIME_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) Update counts: [1]
    * Result 3: insert into ACT_HI_ACTINST ( ID_, PARENT_ACT_INST_ID_, PROC_DEF_KEY_, PROC_DEF_ID_, ROOT_PROC_INST_ID_, PROC_INST_ID_, EXECUTION_ID_, ACT_ID_, TASK_ID_, CALL_PROC_INST_ID_, CALL_CASE_INST_ID_, ACT_NAME_, ACT_TYPE_, ASSIGNEE_, START_TIME_, END_TIME_, DURATION_, ACT_INST_STATE_, SEQUENCE_COUNTER_, TENANT_ID_, REMOVAL_TIME_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) Update counts: [1, 1]
    * Result 4: insert into ACT_RU_EXECUTION ( ID_, ROOT_PROC_INST_ID_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, ACT_INST_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_, IS_EVENT_SCOPE_, PARENT_ID_, SUPER_EXEC_, SUPER_CASE_EXEC_, CASE_INST_ID_, SUSPENSION_STATE_, CACHED_ENT_STATE_, SEQUENCE_COUNTER_, TENANT_ID_, REV_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1 ) Update counts: [1]
    * Result 5: insert into ACT_RU_TASK ( ID_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_, ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, CASE_EXECUTION_ID_, CASE_INST_ID_, CASE_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, FOLLOW_UP_DATE_, SUSPENSION_STATE_, TENANT_ID_, REV_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1 ) Update counts: [1]
    */
    @Test
    public void startProcessInstanceBykey(){
    //ProcessInstance startProcessInstanceByKey(String processDefinitionKey);
    String processDefinitionKey="Process_0plj3di";
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinitionKey);
    System.out.println(processInstance.getId()+processInstance.getBusinessKey()+processInstance.getProcessInstanceId()+processInstance.getTenantId());
    }

    /**
    * 从任意节点启动流程实例
    */
    @Test
    public void startProcessInstanceBykey2(){
    //ProcessInstance startProcessInstanceByKey(String processDefinitionKey);
    String processDefinitionKey="Process_0plj3di";
    ProcessInstantiationBuilder processInstantiationBuilder = runtimeService.createProcessInstanceByKey(processDefinitionKey);
    //startBeforeActivity(String activityId);
    //String activityId="Task_0c5po9a";部门经理
    String activityId="Task_15ymjc7";//总经理
    ProcessInstance processInstance = processInstantiationBuilder.businessKey("001").startBeforeActivity(activityId).execute();
    System.out.println(processInstance);
    }
    }
  • 相关阅读:
    java之获取变量的类型
    java中的++和--
    java(三)基础类型之间的转换
    golang数据结构之总结
    golang数据结构之树的三种遍历方式
    golang数据结构之散哈希表(Hash)
    golang数据结构之递归解决迷宫问题
    golang数据结构之利用栈求计算表达式(加减乘除)
    golang数据结构之栈
    golang数据结构之快速排序
  • 原文地址:https://www.cnblogs.com/yscec/p/11657923.html
Copyright © 2011-2022 走看看