分享
 
 
 

Task management 任务管理

王朝other·作者佚名  2006-05-19
窄屏简体版  字體: |||超大  

The core business of jBPM is the ability to persist the execution of a process. A situation in which this feature is extremely useful is the management of tasks and tasklists for people. jBPM allows to specify a piece of software describing an overall process which can have wait states for human tasks.

jBPM的核心逻辑是有能力持久化流程的执行。一个为人们用来管理任务和任务列表的特征的情形是非常有用的。jBPM允许指定一些软件描述一个全面的流程,它可以为人任务拥有等待状态。

9.1. Tasks 任务

Tasks are part of the process definition and they define how task instances must be created and assigned during process executions.

任务是流程定义的一部分,并且他们定义了任务实例如何在流程执行中必须被创建并且委派。

Tasks can be defined in task-nodes and in the process-definition. The most common way is to define one or more tasks in a task-node. In that case the task-node represents a task to be done by the user and the process execution should wait until the actor completes the task. When the actor completes the task, process execution should continue. When more tasks are specified in a task-node, the default behaviour is to wait for all the tasks to complete.

任务可以在task-nodes和process-definition中被定义。最常用的方式是在task-node中定义一个或多个任务。如果是那样的话,task-node表现一个任务被用户执行并且流程执行应该等待知道actor完成这个任务。当这个actor完成这个任务,流程定义应该继续。当更多任务在task-node被定义,缺省的行为是等待所有任务的完成。

Tasks can also be specified on the process-definition. Tasks specified on the process definition can be looked up by name and referenced from within task-nodes or used from inside actions. In fact, all tasks (also in task-nodes) that are given a name can be looked up by name in the process-definition.

任务也被定义在process-definition中。指定在流程定义上的任务可以通过名称查询并且参考从内部的task-nodes或者从内部actions中使用。事实上,所有的给定名称任务(也在task-nodes)可以在流程定义中通过名字查询。

Task names must be unique in the whole process definition. Tasks can be given a priority. This priority will be used as the initial priority for each task instance that is created for this task. TaskInstances can change this initial priority afterwards.

任务名称在整个流程定义中是非重复。任务可以被指定一个优先权。这个优先权将被使用在初始化优先权为每个为任务创建的流程实例。任务实例然后可以修改初始化优先权

9.2. Task instances

A task instance can be assigned to an actorId (java.lang.String). All task instances are stored in one table of the database (JBPM_TASKINSTANCE). By querying this table for all task instances for a given actorId, you get the task list for that perticular user.

一个任务实例可以被委派给一个actorId(java.lang.String).所有任务实例被储存在数据库的一个表中(JBPM_TASKINGSTANCE)。通过给定的actorId来对所有的任务实例查询这个表,你为特定用户得到任务列表。

The jBPM task list mechanism can combine jBPM tasks with other tasks, even when those tasks are unrelated to a process execution. That way jBPM developers can easily combine jBPM-process-tasks with tasks of other applications in one centralized task-list-repository.

这个jBPM任务列表机制可以组合jBPM任务和其他任务,甚至当这些任务于流程执行无关。那种方法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(...)). Then, a user interface component will query the database for the tasklists using the TaskMgmtSession.findTaskInstancesByActorId(...). Then, after collecting input from the user, the UI component calls TaskInstance.assign(String), TaskInstance.start() or TaskInstance.end(...).

TaskMgmtInstance.createTaskInstance(...)

TaskMgmtSession.findTaskInstancesByActorId(...)

TaskInstance.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.

一个任务实例维护它的状态借助于日期属性:create,start 和end. 这些属性可以在任务实例中通过他们分别的getter获得通道。

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_TASKINSTANCE.

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 is continued.

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 waits in the task node till tasks are created.

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.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有