Oracle神谕

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

9.2. Task instances|任务实例|
A task instance can be assigned to an actorId (java.lang.String).|任务实例被分派给一个行为ID。| All task instances are stored in one table of the database (JBPM_TASKINSTANCE).|所有的实例都被存储在数据库的一个表格里(JBPM_TASKINSTANCE)。| By querying this table for all task instances for a given actorId, you get the task list for that perticular user. |通过查询这个行为ID表的所有任务实例的表,你得到指定用户的任务列表。|

The jBPM task list mechanism can combine jBPM tasks with other tasks, even when those tasks are unrelated to a process execution.|jBPM任务列表机制可以与其它任务结合jBPM任务,甚至当这些任务与一个流程执行无关。| That way jBPM developers can easily combine jBPM-process-tasks with tasks of other applications in one centralized task-list-repository.|那种方法jBPM开发人员可以和容易的使jBPM流程任务在一个集中的任务列表库与其他程序中的任务|

9.2.1. Task instance life cycle |任务实例生命周期|
The task instance lifecycle is straightforward: After creation, task instances can optionally be started.|任务生命周期是 简单的:在创建之后,任务实例可以随意地被开始。| Then, task instances can be ended, which means that the task instance is marked as completed.|接着,任务实例可能被结束,它意味着任务实例已经被标志已完成。|

Note that for flexibility, assignment is not part of the life cycle.|注意适应性、委派不是生命周期的一部分。| So task instances can be assigned or not assigned.|所有任务实例可能被委派也可能不被委派。| Task instance assignment does not have an influence on the task instance life cycle.|任务实例委派不影响任务实例的生命周期。|

Task instances are typically created by the process execution entering a task-node (with the method TaskMgmtInstance.createTaskInstance(...)).|任务实例被进入一个任务节点流程执行代典型的创建(使用TaskMgmtInstance.createInstance(...)方法)| Then, a user interface component will query the database for the tasklists using the TaskMgmtSession.findTaskInstancesByActorId(...).|接着一个用户接口组件将要为任务列表查询数据库使用TaskMgmtSession.findTaskInstancesByActorId(...)| Then, after collecting input from the user, the UI component calls TaskInstance.assign(String), TaskInstance.start() or TaskInstance.end(...).|接着,在收集从用户收入之后,这个UI组件调用TaskIntsance.assign(String),TaskInstance.start() 或者 TaskInstance.end(...)。|

A task instance maintains it's state by means of date-properties : create, start and end.|一个任务实例依靠日期属性维护它的状态:创建、开始、结束。| Those properties can be accessed by their respective getters on the TaskInstance.|这些属性可以通过它们的各自在任务实例上的的getters被访问。|

Currently, completed task instances are marked with an end date so that they are not fetched with subsequent queries for tasks lists.|通常地,完成的任务实例被标志为结束状态,所以他们并不通过对任务列表的子查询获得。| But they remain in the JBPM_TASKINSTANCE table.|但是他们仍然保持在JBPM_TASKINGSTANCE表中。|

9.2.2. Task instances and graph execution|任务实例和图表执行|
Task instances are the items in an actor's tasklist.|任务实例是在行动者的任务列表中的项目。| Task instances can be signalling.|任务实例可以被发信号的| A signalling task instance is a task instance that, when completed, can send a signal to its token to continue the process execution.|一个发信号的任务实例是一个这样的任务实例,当被完成时候,可以发送一个信号给它的令牌以继续流程的执行。| Task instances can be blocking, meaning that the related token (=path of execution) is not allowed to leave the task-node before the task instance is completed.|任务实例可以被模块化,意味着有关系的令牌(执行路径)在任务实例完成之前允许离开任务节点。| By default task instances are signalling and non-blocking. |缺省的任务实例是被信号化且非模块化的。|

In case more than one task instance are associated with a task-node, the process developer can specify how completion of the task instances affects continuation of the process.|万一超过一个的任务实例与一个任务节点关联,这个流程开发者可以定义 任务实例的完成如何影响流程的继续。| Following is the list of values that can be given to the signal-property of a task-node.|接下来是值的列表可以指定给节点的信号属性。|

last: This is the default.|最后:这是缺省的。| Proceeds execution when the last task instance is completed.|当最后流程执行完毕,继续进行执行。| When no tasks are created on entrance of this node, execution waits in the task node till tasks are created.|当在这个的节点的入口没有任务被创建,在任务节点中执行等待直到这些任务被创建。|
last-wait: Proceeds execution when the last task instance is completed. When no tasks are created on entrance of this node, execution waits in the task node till tasks are created.
first: Proceeds execution when the first task instance is completed. When no tasks are created on entrance of this node, execution is continued.
first-wait: Proceeds execution when the first task instance is completed. When no tasks are created on entrance of this node, execution is continued.
unsynchronized: Execution always continues, regardless wether tasks are created or still unfinished.
never: Execution never continues, regardless wether tasks are created or still unfinished.
Task instance creation might be based upon a runtime calculation. In that case, add an ActionHandler on the node-enter event of the task-node and set the attribute create-tasks="false". Here is an example of such an action handler implementation:

public class CreateTasks implements ActionHandler {
  public void execute(ExecutionContext executionContext) throws Exception {
    Token token = executionContext.getToken();
    TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance();
     
    TaskNode taskNode = (TaskNode) executionContext.getNode();
    Task changeNappy = taskNode.getTask("change nappy");

    // now, 2 task instances are created for the same task.
    tmi.createTaskInstance(changeNappy, token);
    tmi.createTaskInstance(changeNappy, token);
  }
}
As shown in the example the tasks to be created can be specified in the task-node. They could also be specified in the process-definition and fetched from the TaskMgmtDefinition. TaskMgmtDefinition extends the ProcessDefinition with task management information.

The API method for marking task instances as completed is TaskInstance.end(). Optionally, you can specify a transition in the end method. In case the completion of this task instance triggers continuation of the execution, the task-node is left over the specified transition.

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

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


网站导航: