Oracle神谕

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  219 随笔 :: 7 文章 :: 94 评论 :: 0 Trackbacks

2005年6月14日 #

Task management『任务管理』
The core business of jBPM is the ability to persist the execution of a process. 『jBPM的核心业务是有能力持久化流程的执行。』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 允许定义一块软件描述全部的流程,它可以为用户任务持有等待状态』

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.『任务可以被定义在task-nodes和流程定义的中』 The most common way is to define one or more tasks in a task-node.『最通用的方式是在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.『当在任务节点中定义多个任务,缺省行为是等待所有所有任务完成。』

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. 『实际上,所有的任务(在任务节点中的也一样)可以在流程定义通过名字进行查找』

Task names must be unique in the whole process definition.『任务名称在整个流程定义中必须是不能重复的』


 

posted @ 2005-06-14 23:03 java世界畅谈 阅读(498) | 评论 (1)编辑 收藏

(一)结构:
(1)XML定义文件(definition)
(2)plain java   JBpm对象模型  定义 执行 日志
(3)DataBase  定义 执行 日志
(二)
A process definition can be represented in 3 different forms : as xml, as java objects and as records in the jBPM database. Executional (=runtime) information and logging information can be represented in 2 forms : as java objects and as records in the jBPM database.{一个流程定义可以表现为三种不同的形态:XML 、java对象和jBpm数据库中的记录。执行(运行)信息和日志信息可以表现为两种形态:java对象和jBpm数据库中的记录}

For more information about the xml representation of process definitions and process archives, see Chapter 13, jBPM Process Definition Language (JPDL).{Process Definition Language JPDL}

This chapter will discuss the transformations done between the java objects and the jBPM database. To store java objects in the database and retrieve them, jBPM uses hibernate internally. While it is not strictly necessary to have hibernate knowledge for using jBPM, it is recommended. {这个章节将要讨论在java对象和jBPM数据库之间的转换。为了在数据库中存储对象和获取他们,jBPM使用内部使用了Hibernate。当然不是在使用jBPM中严格要拥有Hibernate的知识,它是建议的}

More information on how to deploy a process archive to the database can be found in Section 13.1.1, “Deploying a process archive” .


(三)Session的层次:
JbpmSessionFactory
|
|
|
JbpmSession
|
|
|
GraphSession
TaskMgmtSession
ContextSession

(四) The jBPM database classes

The jBPM persistence operations can be found in the named sessions like e.g. GraphSession, TaskMgmtSession and ContextSession,... The named sessions can be obtained from a JbpmSession. The JbpmSession in its turn can be obtained from a JbpmSessionFactory. {jBPM持久层操作可以发现被命名为sessions,例如想GraphSession TaskMgmtSession和ContextSession.... 这个命名sessions可以从JbpmSession中获得。JbmpSession可以从JbpmSessionFactory中获得}

A JbpmSessionFactory is threadsafe so in your application, you need one JbpmSessionFactory. That singleton can be referenced e.g. in a static variable with lazy initialization (beware about the issues around lazy initialization and double-checked locking). At creation time, the JbpmSessionFactory prepares all information in a way that JbpmSessions can be created super fast. {一个JbpmSessionFactory在你的程序中是线程安全的,你仅仅需要一个JbpmSessionFactory. 那个单例可以被参考在例如在lazy初始化下的静态变量(小心发布在Lazy 初始化并且双层检查锁定。在创建时刻,JbpmSessionFactory 在某种程度准备所有信息那样可以被快速创建)}

As a user, you should create one JbpmSession per thread or per request. The JbpmSession has a JDBC connection to the database. {作为一个用户,你应该创建一个JbpmSession 每一个线程或每一次请求。JbpmSession拥有一个连接数据库的Jdbc连接。}

The purpose of the JbpmSession and JbpmSessionFactory is only to wrap their hibernate counterparts. For advanced features such as detached objects or optimistic locking, see the hibernate documentation. {这个JbpmSession和JbpmSessionFactory的目的仅仅是为了包装Hibernate 副本。 对于高级特征 例如分离对象或乐观锁,看hibernate文档。}

public class PersistenceApiTest extends TestCase {

  static JbpmSessionFactory jbpmSessionFactory = JbpmSessionFactory.buildJbpmSessionFactory();

  public void testStartProcessInstance() {
    // obtain a session
    JbpmSession jbpmSession = jbpmSessionFactory.openJbpmSession();
    try {
      // start a user managed transaction
      jbpmSession.beginTransaction();

      // load information from the database
      // (note that process definitions will be cached in memory
      // in the second level cache of hibernate)
      ProcessDefinition auctionProcess =
        jbpmSession.getGraphSession().findLatestProcessDefinition("auction");

      // perform a POJO workflow operation on the plain object model.
      ProcessInstance auctionInstance = new ProcessInstance(auctionProcess);
      auctionInstance.signal();
     
      // store the result in the database
      jbpmSession.getGraphSession().saveProcessInstance(auctionInstance);
     
      // commit the user transaction
      jbpmSession.commitTransaction();

    } finally {
      // close the session.
      jbpmSession.close();     
    }
  }
}

posted @ 2005-06-14 18:04 java世界畅谈 阅读(1455) | 评论 (0)编辑 收藏