Flowable 6.6.0 BPMN用户指南 - 7 BPMN 2.0简介 - 7.3 入门:10分钟教程(8-10)

Flowable 6.6.0 用户指南相关文档下载


《Flowable 6.6.0 BPMN用户指南》

1. 入门
2. 配置
3 The Flowable API
4 Flowable 6.6.0 BPMN用户指南 - (4)Spring集成
5 Spring Boot
6 部署

7 BPMN 2.0简介

7.1 BPMN是什么?
7.2 定义流程
7.3 入门:10分钟教程


有关Flowable的更多文档,参见:

《Flowable文档大全》


7.3.8 认领任务(Claiming the task)

An accountant now needs to claim the task. By claiming the task, that specific user will become the assignee of the task, and the task will disappear from every task list of the other members of the accountancy group. Claiming a task is programmatically done as follows:

taskService.claim(task.getId(), "fozzie");

The task is now in the personal task list of the user that claimed the task.

List<Task> tasks = taskService.createTaskQuery().taskAssignee("fozzie").list();

In the Flowable Task app, clicking the claim button will call the same operation. The task will now move to the personal task list of the logged on user. You’ll also see that the assignee of the task changed to the current logged in user.

现在需要一个会计师(accountant)来认领这项任务(claim the task)。通过认领任务,该特定用户将成为任务的受让人(assignee ),并且该任务将从accountancy group(会计组)其他成员的任务列表中消失。认领任务的过程如下所示:

taskService.claim(task.getId(), "fozzie");

任务现在位于认领了该任务的用户的个人任务列表(personal task list)中。

List<Task> tasks = taskService.createTaskQuery().taskAssignee("fozzie").list();

在Flowable Task(Flowable任务)应用程序中,单击认领(claim )按钮将调用相同的操作,任务将移动到登录用户的个人任务列表中。您还将看到任务的受让人(assignee)变成了当前登录的用户。

7.3.9 完成任务

The accountant can now start working on the financial report. Once the report is finished, he can complete the task, which means that all work for that task is done.

taskService.complete(task.getId());

For the Flowable engine, this is an external signal that the process instance execution can now continue. The task itself is removed from the runtime data. The single outgoing transition from the task is followed, moving the execution to the second task (‘verification of the report’). The same mechanism as described for the first task will now be used to assign the second task, with the small difference that the task will be assigned to the management group.

In the demo setup, completing the task is done by clicking the complete button in the task list. Since Fozzie isn’t an accountant, we need to log out of the Flowable Task app and login in as kermit (who is a manager). The second task is now visible in the unassigned task lists.

会计(accountant)现在可以开始编制财务报告了。一旦报告完成,他就可以完成任务(complete the task),这意味着该任务的所有工作都已完成。

taskService.complete(task.getId());

对于Flowable引擎,这是流程实例现在可以继续执行的外部信号。任务本身将从运行时数据(runtime data)中删除。跟随任务的某个离港转换(outgoing transition)路径,将执行转移到第二个任务(“验证报告”(verification of the report))。与第一个任务描述的相同机制现在将用于分配第二个任务,细微的差别是任务将分配给management group(管理组)。

在demo设置中,通过单击任务列表中的“完成”(complete )按钮完成任务。因为Fozzie不是会计(accountant),我们需要注销Flowable Task应用程序并以kermit(经理)身份登录。第二个任务现在在未分配的任务列表中可见。

7.3.10 结束流程

The verification task can be retrieved and claimed in exactly the same way as before. Completing this second task will move process execution to the end event, which finishes the process instance. The process instance and all related runtime execution data are removed from the datastore.

Programmatically, you can also verify that the process has ended, using the historyService

验证任务(verification task)可以采用与前述完全相同的方式检索和认领。完成第二个任务将把流程执行移动到结束事件,结束事件完成流程实例。流程实例和所有相关的运行时执行数据都将从数据存储中删除。

通过编程,您还可以使用historyService来验证流程是否已结束。

HistoryService historyService = processEngine.getHistoryService();
HistoricProcessInstance historicProcessInstance =
historyService.createHistoricProcessInstanceQuery().processInstanceId(procId).singleResult();
System.out.println("Process instance end time: " + historicProcessInstance.getEndTime());
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

月满闲庭

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值