package com.zcc.acvitivi;import org.activiti.engine.ProcessEngine;import org.activiti.engine.ProcessEngineConfiguration;import org.activiti.engine.RuntimeService;import org.activiti.engine.runtime.ProcessInstance;/** * 启动流程实例 * 相关表: * act_hi_actinst 已完成信息 * act_hi_identitylink 参与表 * act_hi_procinst 流程实例 * act_hi_taskinst 任务实例 * act_ru_execution 执行表 * act_ru_identitylink 参与表 * act_ru_task 任务表 */public class ActivitiStartInstance { public static void main(String[] args) { //创建流程引擎配置类 ProcessEngineConfiguration processEngineConfiguration= ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml"); //流程引擎对象 ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine(); //获取RuntimeService RuntimeService runtimeService = processEngine.getRuntimeService(); //根据key启动流程实例 ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess"); System.out.println("流程部署id"+processInstance.getDeploymentId()); System.out.println("流程实例id"+processInstance.getId()); System.out.println("活动id"+processInstance.getActivityId()); }}
来源:https://www.cnblogs.com/yscec/p/11802753.html