JBPM 中的泳道(swimlane)概念

A swimlane is a process role(角色). It is a mechanism to specify that multiple tasks in the process should be done by the same actor.(多个任务被同一个用户执行) So after the first task instance is created for a given swimlane, the actor should be remembered in the process for all subsequent(后来的) tasks that are in the same swimlane. A swimlane therefore has one assignment and all tasks that reference a swimlane should not specify an assignment.

泳道是用来处理一个流程中的多个任务必须由同一个人来处理的机制。所以,当一个流程的第一个任务实例被创建到指定的泳道后,第一个任务实例中的执行人被保存,该泳道中的后续任务的处理人都是第一个任务的处理人。所以一个泳道有一个人员被分配,并且泳道中的任务不需要再分配人员。

学习泳道,最容易忽略的就是类图了。以后要注意多看看类图。

泳道(swimlane)用起来比较方便。比如,一个单子可以有多个人填写,一旦A填写了,别人就不能填写。而且当A提交的单子被退回的时候还应该有A来继续。

泳道的分配应该是动态的,实现AssianedHaddle接口:

public class AssignBuyer implements AssignmentHandler {

public void assign(Assignable assignable, ExecutionContext executionContext)
throws Exception {
String[] buyers={"shennan","limeng","mizizai"};
// System.out.print((new String[]{"this "})[0]);
// System.out.println("buyer's:"+buyers.length);

assignable.setPooledActors(buyers);

//assignable.setActorId("shennan");
}
}


当使用setPooledActors的时候,需要用findPooledTaskInstances.但是很奇怪的是,当退回以后,就得使用findTaskInstances来得到任务了。
当任务一旦被A执行了,一定要记住设置泳道的actorId,否则被退回的时候,所有的人都能得到任务了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值