activiti 并行网关(八)

1. 流程图

activiti 并行网关(八)_第1张图片


2. 代码实现

package com.hxzq.workflow.parallelgateway;

import java.io.InputStream;
import java.util.List;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.junit.Test;

/**
 * 并行网关
* select * from act_re_deployment;
* select * from act_hi_procinst;
* select * from act_re_procdef;
* * select * from act_ru_execution;
* select * from act_ru_task;
* select * from act_ru_variable;
* * select * from act_hi_procinst;
* select * from act_hi_actinst;
* select * from act_hi_taskinst;
* select * from act_hi_varinst;
* * @author ZHEN.L * */ public class ParallelGateWay { ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); /** * 部署流程定义 */ @Test public void deploymentProcessDefinition() { InputStream bpmn = this.getClass().getResourceAsStream( "Parallel.bpmn"); InputStream png = this.getClass().getResourceAsStream( "Parallel.png"); Deployment deployment = processEngine.getRepositoryService() .createDeployment() .addInputStream("Parallel.bpmn", bpmn) .addInputStream("Parallel.png", png).name("并行网关") .deploy(); System.out.println(deployment.getId()); System.out.println(deployment.getDeploymentTime()); } /** * 启动流程实例 */ @Test public void startProcessInstance() { String processIntanceKey = "parallel"; ProcessInstance processInstance = processEngine.getRuntimeService() .startProcessInstanceByKey(processIntanceKey); System.out.println(processInstance.getId()); System.out.println(processInstance.getActivityId()); } /** * 查询个人任务 */ @Test public void findTask() { String assignee = "王六"; List tasks = processEngine.getTaskService().createTaskQuery() .taskAssignee(assignee).list(); if (tasks != null && tasks.size() > 0) { for (Task t : tasks) { System.out.println(t.getId() + ", " + t.getName() + ", " + ", " + t.getOwner() + ", " + t.getCreateTime()); } } } /** * 完成个人任务 */ @Test public void completeTask() { String taskId = "2503"; processEngine.getTaskService().complete(taskId); } /** * 执行汇总 */ @Test public void execute(){ String executeId = "2103"; processEngine.getRuntimeService().signal(executeId); } }




你可能感兴趣的:(activiti)