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,否则被退回的时候,所有的人都能得到任务了。

猜你喜欢

转载自13521308103.iteye.com/blog/1897624