工作流实战_10_flowable 流程实例的删除
项目地址 | https://gitee.com/lwj/flowable.git |
---|---|
代码分支 | flowable-base |
视频讲解地址 | https://space.bilibili.com/485524575/channel/detail?cid=94579 |
用户名 | 密码 |
---|---|
0000001 | test |
0000002 | test |
0000003 | test |
0000004 | test |
文章目录
- 1. 演示
- 2. 代码
- 2.1. 删除实例命令
- 2.2. 执行删除动作
1. 演示
2. 代码
2.1. 删除实例命令
public class DeleteFlowableProcessInstanceCmd implements Command<Void>, Serializable {private static final long serialVersionUID = 1L;protected String processInstanceId;protected String deleteReason;protected boolean cascade = false;public DeleteFlowableProcessInstanceCmd(String processInstanceId, String deleteReason) {this.processInstanceId = processInstanceId;this.deleteReason = deleteReason;}public DeleteFlowableProcessInstanceCmd(String processInstanceId, String deleteReason,boolean cascade) {this.processInstanceId = processInstanceId;this.deleteReason = deleteReason;this.cascade = cascade;}@Overridepublic Void execute(CommandContext commandContext) {if (processInstanceId == null) {throw new FlowableIllegalArgumentException("processInstanceId is null");}ExecutionEntity processInstanceEntity = CommandContextUtil.getExecutionEntityManager(commandContext).findById(processInstanceId);if (processInstanceEntity == null) {throw new FlowableObjectNotFoundException("No process instance found for id '" + processInstanceId + "'", ProcessInstance.class);}if (processInstanceEntity.isDeleted()) {return null;}if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, processInstanceEntity.getProcessDefinitionId())) {Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();compatibilityHandler.deleteProcessInstance(processInstanceId, deleteReason);} else {CommandContextUtil.getExecutionEntityManager(commandContext).deleteProcessInstance(processInstanceEntity.getProcessInstanceId(), deleteReason, cascade);}return null;}}
2.2. 执行删除动作
public ReturnVo<String> deleteProcessInstanceById(String processInstanceId) {ReturnVo<String> returnVo = null;long count = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).count();if (count > 0) {DeleteFlowableProcessInstanceCmd cmd = new DeleteFlowableProcessInstanceCmd(processInstanceId, "删除流程实例", true);managementService.executeCommand(cmd);returnVo = new ReturnVo<>(ReturnCode.SUCCESS, "删除成功");} else {historyService.deleteHistoricProcessInstance(processInstanceId);returnVo = new ReturnVo<>(ReturnCode.SUCCESS, "删除成功");}return returnVo;}
工作流实战_10_flowable 流程实例的删除相关推荐
- 工作流实战_17_flowable 流程实例撤回
由于群里有些朋友对这个flowable还不是很熟悉,师傅(小学生05101)制作一个开源的项目源码,一共大家学习和交流,希望对有帮助,少走弯路 如果有不懂的问题可以入群:633168411 里面都是一 ...
- 工作流实战_12_flowable 流程实例 终止流程
项目地址 https://gitee.com/lwj/flowable.git 代码分支 flowable-base 视频讲解地址 https://space.bilibili.com/4855245 ...
- 工作流实战_11_flowable 流程实例 跟踪流程
项目地址 https://gitee.com/lwj/flowable.git 代码分支 flowable-base 视频讲解地址 https://space.bilibili.com/4855245 ...
- 工作流实战_08_flowable 流程实例的启动
项目地址 https://gitee.com/lwj/flowable.git 代码分支 flowable-base 视频讲解地址 https://space.bilibili.com/4855245 ...
- 工作流实战_09_flowable 流程实例挂起与激活
由于群里有些朋友对这个flowable还不是 很熟悉,在群里的小伙伴的建议下,我师傅(小学生05101)制作一个开源的项目源码,一共大家学习和交流,希望对有帮助,少走弯路 如果有不懂的问题可以入群:6 ...
- 工作流实战_06_flowable 流程定义的删除
List item 由于群里有些朋友对这个flowable还不是 很熟悉,在群里的小伙伴的建议下,我师傅(小学生05101)制作一个开源的项目源码,一共大家学习和交流,希望对有帮助,少走弯路 如果有不 ...
- 工作流学习——Activiti流程实例、任务管理四步曲 (zhuan)
http://blog.csdn.net/zwk626542417/article/details/46646565 ***************************************** ...
- 工作流实战_25_flowable 流程中的自动跳过
项目地址:https://gitee.com/lwj/flowable.git 分支flowable-base 背景:在实际场景中,我们往往会有这样的需求,当流程到达某一个节点的时候,我们让其自动的跳 ...
- 工作流实战_18_flowable 流程任务的转办
项目地址 https://gitee.com/lwj/flowable.git 代码分支 flowable-base 视频讲解地址 https://www.bilibili.com/video/av7 ...
最新文章
- 请与计算机管理员联系,电脑的限制被取消,请与管理员联系 解决方案
- FastMaskRCNN算法TensorFlow配置,训练
- 如何学习linux设备驱动
- Ubuntu16.04 Xmind安装
- info.plist文件里面添加描述 - 配置定位,相册等
- java中8种数据类型和默认值所占字节数
- HDOJ 1002 A + B Problem II 解题报告
- DLNg第三周:序列模型和注意力机制
- 人体姿态识别研究综述(详细归纳!)
- MYSQL安装+Mysql-front 注册码
- 小众绿软|媒体:Soprano Audio Player v1.60
- URI中有关@符号的一些猥琐idea
- 计算机网络丢包排查,ping命令图文教程,电脑测试网络丢包延迟,检测网络故障通不通...
- 如何统计各个分发平台的下载数据
- Oracle 迁移至Mysql
- [转]PCB Layout中的走线策略
- 专业文学网站设计原则与趋势
- 中科院博士教你如何查找外文文献
- 小峰峰的pat甲级刷题记录1030
- 谷歌浏览器查看网页源代码
热门文章
- 学霸女神冯净冰:我是如何从复旦走到诺奖获得者经济学大会的
- c++ curl 超时_cc++写网络爬虫,curl+gumbo配合使用
- web通讯录常见问题解答以及增加个性功能
- 预处理指令 #pragma 的使用
- 「技术人生」第6篇:技术同学应该如何理解业务?
- 限免下载!揭秘你不知道的计算机“进化论”
- 使用Spark Streaming SQL基于时间窗口进行数据统计
- 第一个将Palette Mode引入VVC(H.266),阿里云在JVET会议上引起关注
- AI又破案!衢州城市大脑这回抓了一个抢劫犯
- AliOS Things v1.1.2新特性