Oracle神谕

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  284 随笔 :: 9 文章 :: 106 评论 :: 0 Trackbacks

Assignment(分派)
A process definition contains can have task nodes. A task-node contains zero or more tasks. Tasks are a static description as part of the process definition. At runtime, tasks result(起源于) in the creation of task instances. A task instance corresponds to(相应) one entry in a person's task list.
tasknodes-->>task-node--->>tasks 

With jBPM, push and pull model (see below) of task assignment can be applied in combination. The process can calculate(考虑) the responsible for a task and push it in his/her tasklist. Or alternatively(作为选择), a task can be assigned to a pool of actors, in which case each of the actors in the pool can pull the task and put it in the actor's personal tasklist.  {这里提到了一个行为池的概念 pool of actors}

9.3.1. Assignment interfaces
Assigning task instances is done via the interface AssignmentHandler: {任务实例分派是依靠AssignmentHandler来实现的}

public interface AssignmentHandler extends Serializable {
  void assign( Assignable assignable, ExecutionContext executionContext );
}
An assignment handler implementation is called when a task instance is created. At that time, the task instance can be assigned to one or more actors. The AssignmentHandler implementation should call the Assignable methods (setActorId or setPooledActors) to assign a task. The Assignable is either a TaskInstance or a SwimlaneInstance (=process role).

Assignable 流程角色:TaskInstance  SwimlaneInstance

public interface Assignable {
  public void setActorId(String actorId);
  public void setPooledActors(String[] pooledActors);
}

Both TaskInstances and SwimlaneInstances can be assigned to a specific user or to a pool of actors. To assign a TaskInstance to a user, call Assignable.setActorId(String actorId). To assign a TaskInstance to a pool of candidate(侯选) actors, call Assignable.setPooledActors(String[] actorIds).

分配对象:
分配给一个用户       Assignable.setActorId(String actorId);
分配给一个侯选用户池 Assignable.setPooledActors(String[] actorIds);

Each task in the process definition can be associated with an assignment handler implementation to perform the assignment at runtime.


When more then one task in a process should be assigned to the same person or group of actors, consider the usage of a swimlane

在一个流程当多于一个任务时应当被分派给一个用户或多用户的组,考虑使用泳道。

To allow for the creation of reusable AssignmentHandlers, each usage of an AssignmentHandler can be configured in the processdefinition.xml. See Section 13.2, “Delegation(委托)” for more information on how to add configuration to assignment handlers.

9.3.2. The assignment data model
The datamodel for managing assignments of task instances and swimlane instances to actors is the following. Each TaskInstance has an actorId and a set of pooled actors.

The actorId is the responsible for the task, while the set of pooled actors represents a collection of candidates that can become responsible if they would take the task. Both actorId and pooledActors are optional and can also be combined.


Pull model(拉模式)
On the other hand, the tasks of pooled tasks for a given user are the tasks for which the given user is referenced in the pooled actors.
Fetching the list of pooled tasks is typically a two step operation :
1) get all the groups for the given user from the identity component. and
2) get the list of all pooled tasks for the combined set of the user's actorId and the actorId's that reference the users' groups.
 Getting the list of pooled tasks that are offered to a given user can be done with the methods TaskMgmtSession.findPooledTaskInstances(String actorId) or TaskMgmtSession.findPooledTaskInstances(List actorIds). These methods will only return task instances for which the actorId is null and one of the given actorIds matches one of the pooled actors.

TaskMgmtSession.findPooledTaskInstance(String actorId)
TaskMgmtSession.findPooledTaskInstance(List actorIds)

To prevent multiple users working on the same pooled task, it is sufficient to update the actorId of the TaskInstance with the user's actorId. After that, the task instance will not appear in the list of pooled tasks, but only in the user's personal task list. Setting the actorId of a taskInstance to null will put the task instance back in the pooled tasks.

posted on 2005-06-15 11:18 java世界畅谈 阅读(1546) 评论(0)  编辑  收藏 所属分类: 工作流

只有注册用户登录后才能发表评论。


网站导航: