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=& ...
随机推荐
- POJ 3276
Face The Right Way Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 2193 Accepted: 103 ...
- POJ 1411
#include<iostream> #include<stdio.h> #include<math.h> #define MAXN 50000 using nam ...
- 什么是Nib文件?(Nib文件是一种特殊类型的资源文件,它用于保存iPhone OS或Mac OS X应用程序的用户接口)
Nib文件是一种特殊类型的资源文件,它用于保存iPhone OS或Mac OS X应用程序的用户接口.Nib文件是Interface Builder文档.通常您会使用Interface Builder ...
- 【HDU 5030】Rabbit's String (二分+后缀数组)
Rabbit's String Problem Description Long long ago, there lived a lot of rabbits in the forest. One d ...
- Android安卓开发环境搭建详细教程
安装目录:步骤1 安装JDK步骤2 安装 Android SDK ----http://www.androiddevtools.cn/ 步骤3 安装Tomcat步骤4 安装Ant步骤5 安装Eclip ...
- android-exploitme(三):安全连接
今天我来测试连接的安全,数据是否可嗅探. android模拟器提供了内置的tcpdump,我们使用这个来抓包. 1. 启动带tcpdump的模拟器 santoku@santoku-virtual-ma ...
- PHP使用CURL详解
CURL是一个非常强大的开源库,支持很多协议,包括HTTP.FTP.TELNET等,我们使用它来发送HTTP请求.它给我 们带来的好处是可以通过灵活的选项设置不同的HTTP协议参数,并且支持HTTPS ...
- Android 使用全局变量传递数据
使用全局变量传递数据,所谓的全局变量类似于jee开发中的application变量.申明后,全局调用.只有当内存被清理后,才被销毁.否则一直可以调用. 还是使用点击一个button,传递一个数据到另一 ...
- 笔记二、本地git命令
参考书籍: <Pro Git>中文版.pdf git init // 建立一个git仓库, 本地目录为工作目录, .git目录是中央数据目录 git ini ...
- 数组工具类 - ArrayUtil.java
数组工具类,提供数组.对象之间转换的方法. 源码如下:(点击下载 - ArrayUtil.java .commons-lang-2.6.jar) import java.lang.reflect.Ar ...