activiti参考5-任务TASK
一、概要
1,设计TASK的表主要是:ACT_RU_TASK,ACT_HI_TASKINST(见参考-activiti表);
2,任务主要有:人工任务(usertask),服务任务(servicetask)等;
3,候选人/候选组(candidate):可以执行任务的一类人或者多个组,候选人/候选组中都可以去签收任务,一旦某人签收,就成为受理人,其他人就不能再签收受理此任务;usertask流程图中,candidate标示候选;候选人涉及的表ACT_RU_IDENTITYLINK;
4,受理人(assignee):有两种情况,一种是候选人/组中有人签收任务后成为受理人,另外一种是流程图中直接指定受理人,但是可以指定一个动态受理人;受理人涉及的表ACT_RU_TASK;
5,持有人(owner):持有人设置主要是存入历史表中,用于历史任务的查询,涉及的表ACT_HI_TASKINST;
二、任务操作
1,创建TASK任务与设置权限:可以使用代码创建任务,但是实际操作中都是绘制流程图。绘制TASK后,在属性可以设置候选人和受理人,一般都是设置候选人,因为固定受理人不太符合程序变动;
候选人设置了deptleader,该值将部署在表ACT_RU_IDENTITYLINK中,查看xml看见:
1
2
3
|
//设置了候选组 < userTask id = "deptLeaderAudit" name = "部门领导审批" activiti:candidateGroups = "deptLeader" > </ userTask > |
完整的XML(无图形位置信息)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
< process id = "leave" name = "请假流程" isExecutable = "true" > < documentation >请假流程演示</ documentation > < startEvent id = "startevent1" name = "Start" activiti:initiator = "applyUserId" ></ startEvent > < userTask id = "deptLeaderAudit" name = "部门领导审批" activiti:candidateGroups = "deptLeader" ></ userTask > < exclusiveGateway id = "exclusivegateway5" name = "Exclusive Gateway" ></ exclusiveGateway > < userTask id = "modifyApply" name = "调整申请" activiti:assignee = "${applyUserId}" > < extensionElements > < activiti:taskListener event = "complete" delegateExpression = "${afterModifyApplyContentProcessor}" ></ activiti:taskListener > </ extensionElements > </ userTask > < userTask id = "hrAudit" name = "人事审批" activiti:candidateGroups = "hr" ></ userTask > < exclusiveGateway id = "exclusivegateway6" name = "Exclusive Gateway" ></ exclusiveGateway > < userTask id = "reportBack" name = "销假" activiti:assignee = "${applyUserId}" > < extensionElements > < activiti:taskListener event = "complete" delegateExpression = "${reportBackEndProcessor}" ></ activiti:taskListener > </ extensionElements > </ userTask > < endEvent id = "endevent1" name = "End" ></ endEvent > < exclusiveGateway id = "exclusivegateway7" name = "Exclusive Gateway" ></ exclusiveGateway > < sequenceFlow id = "flow2" sourceRef = "startevent1" targetRef = "deptLeaderAudit" ></ sequenceFlow > < sequenceFlow id = "flow3" sourceRef = "deptLeaderAudit" targetRef = "exclusivegateway5" ></ sequenceFlow > < sequenceFlow id = "flow4" name = "不同意" sourceRef = "exclusivegateway5" targetRef = "modifyApply" > < conditionExpression xsi:type = "tFormalExpression" > <![CDATA[${!deptLeaderPass}]]> </ conditionExpression > </ sequenceFlow > < sequenceFlow id = "flow5" name = "同意" sourceRef = "exclusivegateway5" targetRef = "hrAudit" > < conditionExpression xsi:type = "tFormalExpression" > <![CDATA[${deptLeaderPass}]]> </ conditionExpression > </ sequenceFlow > < sequenceFlow id = "flow6" sourceRef = "hrAudit" targetRef = "exclusivegateway6" ></ sequenceFlow > < sequenceFlow id = "flow7" name = "同意" sourceRef = "exclusivegateway6" targetRef = "reportBack" > < conditionExpression xsi:type = "tFormalExpression" > <![CDATA[${hrPass}]]> </ conditionExpression > </ sequenceFlow > < sequenceFlow id = "flow8" sourceRef = "reportBack" targetRef = "endevent1" ></ sequenceFlow > < sequenceFlow id = "flow9" name = "不同意" sourceRef = "exclusivegateway6" targetRef = "modifyApply" > < conditionExpression xsi:type = "tFormalExpression" > <![CDATA[${!hrPass}]]> </ conditionExpression > </ sequenceFlow > < sequenceFlow id = "flow10" name = "重新申请" sourceRef = "exclusivegateway7" targetRef = "deptLeaderAudit" > < conditionExpression xsi:type = "tFormalExpression" > <![CDATA[${reApply}]]> </ conditionExpression > </ sequenceFlow > < sequenceFlow id = "flow11" sourceRef = "modifyApply" targetRef = "exclusivegateway7" ></ sequenceFlow > < sequenceFlow id = "flow12" name = "结束流程" sourceRef = "exclusivegateway7" targetRef = "endevent1" > < conditionExpression xsi:type = "tFormalExpression" > <![CDATA[${!reApply}]]> </ conditionExpression > </ sequenceFlow > </ process > |
2,查询候选任务
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
//根据候选组ID查询拥有任务 List<Task> tasks = taskService .createTaskQuery() .taskCandidateGroup(groupA.getId()) .list(); for (Task task : tasks) {System.out.println(task.getName());} //根据用户ID查询任务 tasks = taskService .createTaskQuery() .taskCandidateUser(user.getId()) .list(); for (Task task : tasks) {System.out.println(task.getName());} //调用taskCandidateGroupIn List<String> groupIds = new ArrayList<String>(); groupIds.add(groupA.getId()); groupIds.add(groupB.getId()); tasks = taskService .createTaskQuery() .taskCandidateGroupIn(groupIds) .list(); for (Task task : tasks) {System.out.println(task.getName());} //查询权限数据 List<IdentityLink> links = taskService .getIdentityLinksForTask(tasks.get( 0 ) .getId()); System.out.println( "关系数据量: " + links.size());} |
activiti参考5-任务TASK的更多相关文章
- 定时管理器框架-Task.MainForm
入住博客园4年多了,一直都是看别人的博客,学习别人的知识,为各个默默无私贡献自己技术总结的朋友们顶一个:这几天突然觉得是时候加入该队列中,贡献出自己微弱的力量,努力做到每个月有不同学习总结,知识学习的 ...
- activiti数据库表结构全貌解析
http://www.jianshu.com/p/e6971e8a8dad 下面本人介绍一些activiti这款开源流程设计引擎的数据库表结构,首先阐述:我们刚开始接触或者使用一个新的东西(技术)时我 ...
- Activiti工作流学习(一)部署对象和流程定义
一.前言 前一段时间在工作中,使用了流程审批,对api的调用非常不熟悉,都是调用别人写好的接口在界面上进行显示,基本了解了流程审批的主要步骤,现对流程审批进行学习,主要是调用api进行CRUD操作,感 ...
- [activiti] Activiti 5.18 的Mybatis版本依赖问题
测试activiti 是查询Task时抛出一个异常: org.apache.ibatis.exceptions.PersistenceException: ### Error querying dat ...
- Activiti工作流学习-----基于5.19.0版本(3)
前面关于eventType的属性值的配置简单的说了一下,activiti支持的值如下表所示:这是我摘抄的activiti官网的 Event 的名字 描述 Event的类名 ENGINE_CREATED ...
- c# async Task await Result 死锁
最近项目数据量较大,使用 async Task异步增加执行效率 遇到问题,当前有2个计算非常耗时,现在需要你优化一下,这2个计算并行执行,2个计算执行完成后将2个结果sum返回给用户 当前我是这样实现 ...
- 基于easyui开发Web版Activiti流程定制器详解(六)——Draw2d的扩展(三)
题外话: 最近在忙公司的云项目空闲时间不是很多,所以很久没来更新,今天补上一篇! 回顾: 前几篇介绍了一下设计器的界面和Draw2d基础知识,这篇讲解一下本设计器如何扩展Draw2d. 进入主题: 先 ...
- (原创)task和function语法的使用讨论(Verilog,CPLD/FPGA)
1. Abstract function和task语句的功能有很多的相似之处,在需要有多个相同的电路生成时,可以考虑使用它们来实现.因为个人使用它们比较少,所以对它们没有进行更深的了解,现在时间比较充 ...
- Activiti 5.17 实体对象与类和数据库表的映射
一.Activiti 5.17 mybatis的mapping文件声明映射的实体对象关系. <configuration><settings><settingname=& ...
随机推荐
- NSArray block用法
28.使用block 块遍历整个数组.这个block 需要三个参数,id obj 表示数组中的元素. NSUInteger idx 标示元素的下标, bool *stop 是一个bool类型的参数. ...
- Android 检查设备是否存在 导航栏 NavigationBar
尊重原创.尊重作者,转载请标明出处: http://blog.csdn.net/lnb333666/article/details/41821149 目前也没有可靠的方法来检查设备上是否有导航栏.可以 ...
- 与Wii控制手柄通信的托管代码库(转)
2009-01-16 翻译 HID Human Input Device 人工输入设备 Wii Fit Balance Board 平衡板 IR ...
- 李洪强漫谈iOS开发[C语言-042]-简单计算器
李洪强漫谈iOS开发[C语言-042]-简单计算器
- CF 253B Two Heaps
#include<stdio.h> #include<algorithm> #include<map> using namespace std; struct No ...
- phpeclipse常用快捷键
phpeclipse常用快捷键
- jquery plug-in DataTable API中文文档参考
前言:最近在做一个WEB后台,无意中发现这个插件,试用了一下觉得不错,但网上关于它的资料大多不全,所以利用一些时间将其API文档翻了一下,发在园子里供大家参考.(p.s:个人E文水平很差,对着灵格斯翻 ...
- JavaWeb项目开发案例精粹-第4章博客网站系统-006View层
1.showAllArticle.jsp <%@ page language="java" contentType="text/html; charset=gb23 ...
- http://www.myexception.cn/program/767123.html
http://www.myexception.cn/program/767123.html
- Linux系统安装MySQL步骤及支持远程操作配置方法
一.数据库安装(安装在/usr/local目录) 1. 压缩包拷贝到/users/lengyufang/tools 2. groupadd mysql3. useradd -r -g mysql -s ...