码迷,mamicode.com
首页 > 其他好文 > 详细

camunda流程实例启动的一些简单操作

时间:2019-10-12 01:38:09      阅读:807      评论:0      收藏:0      [点我收藏+]

标签:cache   star   type   ssi   builder   本地   process   部门   ant   

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);
}
}

camunda流程实例启动的一些简单操作

标签:cache   star   type   ssi   builder   本地   process   部门   ant   

原文地址:https://www.cnblogs.com/yscec/p/11657923.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!