当前位置:网站首页>Chapter 5: Activiti process shunting judgment, judging to go to different task nodes
Chapter 5: Activiti process shunting judgment, judging to go to different task nodes
2022-08-05 10:21:00 【Full stack programmer webmaster】
大家好,又见面了,我是你们的朋友全栈君.
Here we undertake the previous blog post of the column,
Ask for leave in the process we will have a judgment,Because the general leave monitor has the right to directly approve and approve,Without the approval of the class teacher,There needs to be a judgement here.;
Here we assist a leave process,如下:
流程图如下:
So how do you judge which antenna is going?,That is, whether to go or notleave003这个节点呢,Here we need to write built-in expressions,类似el表达式:
另外一条线:
Next we create a new class,如下,Need to modify the flow chart file name in the deployment process definition method:
对了,There is also a need to modify the startup processkey,The flow chart of the previous test casekey是StudentLeaveProcess00,现在改成StudentLeaveProcess02.如下:
代码如下:
package com.xiaoyexinxixn.ActivityLesson.flow;
import static org.junit.Assert.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.junit.Test;
import com.xiaoyexinxixn.ActivityLesson.model.Student;
public class StudentLeaveProcess2 {
//Get the default process engine instance,会自动读取activiti.cfg.xml ,So we have to strictly define the name of the configuration file
private ProcessEngine processEngine =ProcessEngines.getDefaultProcessEngine();
/**
* 部署流程定义
*/
@Test
public void deploy() {
//获取部署相关service,这些都是activiti封装好的api接口,还有很多,The following will also be used a lot
Deployment deployment=processEngine.getRepositoryService()
//创建部署
.createDeployment()
//Load flowchart resource file
.addClasspathResource("diagrams/StudentLeave2.bpmn")
//Load process image
.addClasspathResource("diagrams/StudentLeave2.png")
//流程名称
.name("leave02")
//部署流程
.deploy();
System.out.println("流程部署的ID: "+deployment.getId());
System.out.println("流程部署的Name: "+deployment.getName());
}
/*
* 启动流程实例
*/
@Test
public void start(){
//运行启动流程的servicee
ProcessInstance pi=processEngine.getRuntimeService()
//定义流程表的KEY字段值,key值是我们前面定义好的key,可在act_re_procdef表中的key_字段中找到,
.startProcessInstanceByKey("studentLeaveProcess02");
System.out.println(pi.getId());
System.out.println(pi.getProcessDefinitionId());
} }运行deploy()方法,部署流程,After success, look at the process deployment table:act_re_deployment:
是有leave02的;
Then start the process again,
然后完成任务,to test our judgment.
到leave02节点;
Then we use what we learned in the previous chapter,在节点leave02结束的时候设置msg变量的值,So as to determine which node to go.
代码:
/**
* 完成任务时设置流程变量
*/
@Test
public void completeTaskVariablesTest(){
Map<String, Object> variables=new HashMap<String,Object>();
variables.put("msg", "common");
processEngine.getTaskService().complete("72502",variables);
}运行后,Found that the data in the task table is gone,说明没有走leave03节点,说明是没有问题的.
Go to the settings in the same waymsg为“important”chance to goleave03节点.
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/106142.html原文链接:https://javaforall.cn
边栏推荐
- 2022 Huashu Cup Mathematical Modeling Ideas Analysis and Exchange
- FPGA:基础入门LED灯闪烁
- FPGA: Use of the development environment Vivado
- Technical dry goods | Hausdorff distance for image segmentation based on MindSpore
- 第六章:activiti流程分流判断之排它网关和并行网关
- 登录功能和退出功能(瑞吉外卖)
- 多线程(进阶) - 2.5w字总结
- 气象数据数据处理实例——matlab字符串切割匹配与R语言日期匹配(数据拼接)
- Still looking for a network backup resources?Hurry up to collect the following network backup resource search artifact it is worth collecting!
- 数据中台建设(十):数据安全管理
猜你喜欢

Our Web3 Entrepreneurship Project, Yellow

Complete image segmentation efficiently based on MindSpore and realize Dice!

告白数字化转型时代:麦聪软件以最简单的方式让企业把数据用起来

Meteorological data processing example - matlab string cutting matching and R language date matching (data splicing)

高质量 DeFi 应用构建指南,助力开发者玩转 DeFi Summer

如何选币与确定对应策略研究

【MindSpore Easy-Diantong Robot-01】You may have seen many knowledge quiz robots, but this one is a bit different

项目成本控制如何帮助项目成功?

电气工程的标准是什么

2022华数杯数学建模A题环形振荡器的优化设计思路思路代码分享
随机推荐
19. Server-side session technology Session
华为轻量级神经网络架构GhostNet再升级,GPU上大显身手的G-GhostNet(IJCV22)
What is SPL?
基于MindSpore高效完成图像分割,实现Dice!
【Unity】【UGUI】【在屏幕上显示文本】
入门 Polkadot 平行链开发,看这一篇就够了
19.3 restart the Oracle environment
Pycharm 常用外部工具
导火索:OAuth 2.0四种授权登录方式必读
MySQL事务
语音社交软件开发——充分发挥其价值
阿里顶级架构师多年总结的JVM宝典,哪里不会查哪里!
【 temperature warning program DE development 】 event driven model instance
Go compilation principle series 6 (type checking)
技术干货 | 基于 MindSpore 实现图像分割之豪斯多夫距离
In-depth understanding of timeout settings for Istio traffic management
MySQL之数据视图
Why are RELTABLESPACE values 0 for many tables displayed in sys_class?
RT - Thread record (a, RT, RT Thread version - Thread Studio development environment and cooperate CubeMX quick-and-dirty)
第九章:activit内置用户组设计与组任务分配和IdentityService接口的使用