﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-java神谕-随笔分类-工作流</title><link>http://www.blogjava.net/javaora/category/1624.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 14:49:34 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 14:49:34 GMT</pubDate><ttl>60</ttl><item><title>jbpm-server 部署简要说明</title><link>http://www.blogjava.net/javaora/archive/2005/06/22/6535.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Wed, 22 Jun 2005 06:38:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/22/6535.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/6535.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/22/6535.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/6535.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/6535.html</trackback:ping><description><![CDATA[<P>This is a preconfigured jboss 4.0.2 installation that contains jBPM.&nbsp;&nbsp; <BR>这是一个包含jBPM的预先配置好的jboss4.0.2的安装文件</P>
<P>Deployed components<BR>配置组件:<BR>The jBPM service archive: The deploy directory contains a service archive that creates a JbpmSessionFactory at startup of the server and puts it in JNDI. To make use of this JbpmSessionFactory, you have to specify the property jbpm.session.factory.jndi.name=java:/jbpm/JbpmSessionFactory in your jBPM configuration (e.g. in the jbpm.properties in your WEB-INF/classes in your web application). <BR>这个jBPM 服务存档：这个部署目录包含一个服务归档，它创建一个JbpmSessionFactory 在服务器启动并且把它丢到JNDI中。为了使用这个JbpmSessionFactory，你不得不使用指定这个属性 jbpm.session.factory.jndi.name-=java:/jbpm/JbpmSessionFactory 在你的jBPM注册文件（例如在jbpm.properties 在你的web程序中的 WEB-INF/classes 里）</P>
<P>The jBPM database: The server includes a hypersonic database that is preconfigured. with the jBPM database tables. Also an example process is already present in the database. The database can be accessed via a TCP connection to port 1701 with the hsqldb driver. <BR>jBPM数据库：这个服务器包含一个原先配置好的hypersonic 数据库。使用这个jBPM数据库表。也可以使用已经数据库中设置好的.这个数据库可以通过 tcp连接1701端口使用这个hsqldb驱动器。</P>
<P>The jBPM web console application: The jBPM web console application is a simple webapplication that allows access to the jBPM database. Currently the functionality of the webapplication is still limited, but a lot of focus is going to go to the webapplication in the near future for making it easier to manage, maintain and monitor your business processes. <BR>Other customizations<BR>jBPM web控制台程序：这个jBPM web控制台程序是一个简单的web程序，它允许访问jBPM数据库。当前这个web程序的功能仍然是受限制的，但是很多焦点， 在不久的未来打算使它更容易管理、维护和监控你的商业流程。</P>
<P>For reducing download the minimal, default and all server configurations have been removed. Only the jbpm configuration is available. (start with run.bat -c jbpm). </P>
<P>&nbsp;</P>
<P>For improving startup time, some of the default services have been removed. </P><img src ="http://www.blogjava.net/javaora/aggbug/6535.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-22 14:38 <a href="http://www.blogjava.net/javaora/archive/2005/06/22/6535.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jbpm.db build script</title><link>http://www.blogjava.net/javaora/archive/2005/06/22/6524.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Wed, 22 Jun 2005 03:54:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/22/6524.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/6524.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/22/6524.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/6524.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/6524.html</trackback:ping><description><![CDATA[<P>&lt;!--</P>
<P>jbpm.db build script&nbsp; (jbpm.db 编译脚本)<BR>====================</P>
<P>The jbm.db build script consists of a few major sections(jbpm.db 编译脚本包含一些主要部分):</P>
<P>- general setup （普通安装）<BR>- common tasks&nbsp;&nbsp; （公用任务）<BR>- database specific tasks （数据库特定任务）</P>
<P>A database specific task calls common tasks with the database name as a parameter<BR>and carries out its duties. (一个数据库特定任务调用公有的任务使用数据库名作为一个参数，并且执行它的职责。)</P>
<P>The main tasks are the database script creation and the database test run.（主要的任务是数据库脚本创建和数据库测试运行）</P>
<P>Following is a explanation of the flow for both. They start off with the same steps. <BR>The explanation with use hsqldb as an example.（下面是一个流程的说明。他们开始使用同样的步骤）</P>
<P>1. "prepare" target compiles all jbpm.3 classes ("prepare" 目标编译所有的jbpm3.classes )<BR>2. "hsqldb.prepare" target calls the "db.prepare" target with the parameter "hsqldb" ("hsqldb.prepare" 目标调用"db.prepare"目标使用"hsqldb"参数)<BR>3. "db.prepare" copies the resources tree from the jbpm.3 project and ()<BR>4. sources the property file hsqldb/hibernate.properties and replaces the <BR>&nbsp;&nbsp; properties from the main project in the copied hibernate config file with <BR>&nbsp;&nbsp; properties from the file making it database specific to the test settings using<BR>&nbsp;&nbsp; "hibernate.replace". This differs per database.<BR>&nbsp;&nbsp; ("db.prepare"从jbpm.3项目和 hsqldb/hibernate.properties 属性文件复制资源目录，并从在复制的拥有从文件属性的hibernate配置文件中的主项目替换这些属性，使用数据库特定给test 的设置使用"hibernate.replace".这对每个数据库是不同的 。<BR>&nbsp;&nbsp; )</P>
<P>After this preparation the scripts targets （在这准备脚本目标之后）</P>
<P>5. "hsqldb.scripts" target calls the "db.scripts" target with the hsqldb parameter （"hsqldb.script"目标调用"db.script"目标使用hsqldb 参数）<BR>6. "db.scripts" target creates the scripts files in the build/hsqldb/scripts folder based <BR>&nbsp;&nbsp; on the db specific hibernate configuration<BR>&nbsp;&nbsp; ("db.scripts"目标创建脚本文件在db特定hibernate配置文件的build/hsql/scripts/目录 或test目标文件 )<BR>or the the test targets</P>
<P>5. "hsqldb.test" target calls the "db.test" target with the hsqldb parameter ("hsqldb.test" 目标调用"db.test"目标使用hsqldb参数)<BR>6. "db.test" target runs all tests against the hsqldb database and creates a test report<BR>&nbsp;&nbsp; in build/hsqldb/testresults<BR>&nbsp;&nbsp; ("db.test"目标运行所有的测试 靠着hsqldb 数据库和测试报告)<BR>--&gt;</P><img src ="http://www.blogjava.net/javaora/aggbug/6524.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-22 11:54 <a href="http://www.blogjava.net/javaora/archive/2005/06/22/6524.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jBPM的fork</title><link>http://www.blogjava.net/javaora/archive/2005/06/16/6211.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Thu, 16 Jun 2005 06:17:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/16/6211.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/6211.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/16/6211.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/6211.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/6211.html</trackback:ping><description><![CDATA[Fork : A fork spawns（产生） multiple concurrent(并发) paths of execution. <BR>&lt;process-definition name="the fork-in-loop process"&gt;<BR>&nbsp;&nbsp; &lt;swimlane name="initiator"/&gt;<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;start-state name="start" swimlane="initiator"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="aFork"/&gt;<BR>&nbsp;&nbsp; &lt;/start-state&gt;<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;fork name="aFork"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="aState"/&gt;<BR>&nbsp;&nbsp; &lt;/fork&gt;<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;state name="aState" swimlane="initiator"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="aJoin"/&gt;<BR>&nbsp;&nbsp; &lt;/state&gt;<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;join name="aJoin"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="aFork"/&gt;<BR>&nbsp;&nbsp; &lt;/join&gt;<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;end-state name="end"/&gt;<BR>&lt;/process-definition&gt;<BR><img src ="http://www.blogjava.net/javaora/aggbug/6211.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-16 14:17 <a href="http://www.blogjava.net/javaora/archive/2005/06/16/6211.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>scheduling的jdpl的例子</title><link>http://www.blogjava.net/javaora/archive/2005/06/16/6212.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Thu, 16 Jun 2005 06:17:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/16/6212.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/6212.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/16/6212.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/6212.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/6212.html</trackback:ping><description><![CDATA[&lt;process-definition name="the scheduler process"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;swimlane name="initiator"/&gt;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;start-state name="start" swimlane="initiator"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="only state"&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;/start-state&gt;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;state name="only state" swimlane="initator"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;delegation class="org.jbpm.delegation.action.SchedulerJobActionHandler"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;job&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;delegation class="org.jbpm.scheduler.LoggingActionHandler"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;delay&gt;0&lt;/delay&gt; (延迟)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;name&gt;halleluya&lt;/name&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/job&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/delegation&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/action&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action event-type="state-leave"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;delegation class="org.jbpm.delegation.action.CancelJobActionHandler"&gt;halleluya&lt;/delegation&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/action&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="end"/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/state&gt;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;end-state name="end"/&gt;<BR>&lt;/process-definition&gt;<img src ="http://www.blogjava.net/javaora/aggbug/6212.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-16 14:17 <a href="http://www.blogjava.net/javaora/archive/2005/06/16/6212.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jBPM的Decision例子</title><link>http://www.blogjava.net/javaora/archive/2005/06/16/6210.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Thu, 16 Jun 2005 06:14:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/16/6210.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/6210.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/16/6210.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/6210.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/6210.html</trackback:ping><description><![CDATA[Decision : A decision decides between multiple paths of execution which are exclusive(独占的) <BR>&lt;process-definition name="the decision process"&gt;<BR>&nbsp;&nbsp; &lt;swimlane name="initiator"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;start-state name="start" swimlane="initiator"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="only descision"&gt;<BR>&nbsp;&nbsp; &lt;/start-state&gt;<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;decision name="only descision"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;delegation class="org.jbpm.impl.DecisionTestDecisionHandler"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition name="left" to="inside the left street"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition name="right" to="inside the right street"/&gt;<BR>&nbsp;&nbsp; &lt;/decision&gt;<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;state name="inside the left street" swimlane="initiator"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="end"/&gt;<BR>&nbsp;&nbsp; &lt;/state&gt;<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;state name="inside the right street" swimlane="initiator"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="end"/&gt;<BR>&nbsp;&nbsp; &lt;/state&gt;<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;end-state name="end"/&gt;<BR>&lt;/process-definition&gt;<BR><img src ="http://www.blogjava.net/javaora/aggbug/6210.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-16 14:14 <a href="http://www.blogjava.net/javaora/archive/2005/06/16/6210.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>泳道、任务事件、任务定时器及身份组件</title><link>http://www.blogjava.net/javaora/archive/2005/06/15/6159.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Wed, 15 Jun 2005 05:42:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/15/6159.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/6159.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/15/6159.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/6159.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/6159.html</trackback:ping><description><![CDATA[<P>9.4. Swimlanes（咏道）<BR>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. </P>
<P>When the first task in a given swimlane is created, the AssignmentHandler of the swimlane is called. The Assignable that is passed to the AssignmentHandler will be the SwimlaneInstance. Important to know is that all assignments that are done on the task instances in a given swimlane will propagate to the swimlane instance. This behaviour is implemented as the default because the person that takes a task to fulfilling(实行) a certain process role will have the knowledge of that perticular process. So all subsequent(并发的) assignements of task instances to that swimlane are done automatically to that user. </P>
<P>Swimlane is a terminology(术语) borrowed from UML activity(活动) diagrams. </P>
<P>------------------------------------------------------------<BR>9.5. Task events (任务事件)<BR>Tasks can have actions associated with them. There are 4 standard event types defined for tasks: task-create, task-assign, task-start and task-end.</P>
<P>(1)task-create<BR>&nbsp;is fired when a task instance is created.</P>
<P>(2)task-assign <BR>is fired when a task instance is being assigned. Note that in actions that are executed on this event, you can access the previous actor with executionContext.getTaskInstance().getPreviousActorId(); <BR>executionContext.getTaskInstance().getPreviousActorId();</P>
<P>(3)task-start <BR>is fired when TaskInstance.start() is called. This can be used to indicate（指示） that the user is actually starting to work on this task instance. Starting a task is optional.</P>
<P>(4)task-end<BR>&nbsp;is fired when TaskInstance.end(...) is called. This marks the completion of the task. If the task is related to a process execution, this call might trigger the resuming(恢复) of the process execution. </P>
<P>Since tasks can have events and actions associated with them, also exception handlers can be specified on a task. For more information about exception handling, see Section 7.5, “Exception handling”.</P>
<P>---------------------------------------------------------------<BR>9.6. Task timers(任务定时器)<BR>As on nodes, timers can be specified(指定) on tasks. See Section 10.1, “Timers”.</P>
<P>The special(特别的) thing about timers for tasks is that the cancel-event for task timers can be customized(取消事件可以被定制). By default, a timer on a task will be cancelled when the task is ended (=completed). But with the cancel-event attribute on the timer, process developers can customize that to e.g. task-assign or task-start. The cancel-event supports multiple events.|取消事件支持多种事件| The cancel-event types can be combined by specifying them in a comma(逗号) separated list in the attribute.</P>
<P>9.7. Customizing task instances(定制任务实例)<BR>Task instances can be customized. The easiest way to do this is to create a subclass of TaskInstance.|创建一个任务实例的子类| Then update the property jbpm.task.instance.class and specify the class name of your custom class that inherits from TaskInstance. Also create a hibernate mapping file for the subclass (using the hibernate extends="org.jbpm.taskmgmt.exe.TaskInstance"). Then add that mapping file to the list of mapping files in the hibernate.cfg.xml<BR>(1)更新jbpm.task.instance.class 的属性<BR>(2)指定继承TaskInstance的定制类<BR>(3)创建一个子类的影射文件(使用 extends="org.jbpm.taskmgmt.exe.TaskInstance")<BR>(4)将这个影射文件加到 hibernate.cfg.xml</P>
<P>9.8. The identity component(身份组件)<BR>Management of users, groups and permissions is commonly known as identity management. jBPM includes an optional identity component that can be easily replaced by a company's own identity data store. </P>
<P>The jBPM identity management component includes knowledge of the organisational model. Task assignment is typically done with organisational knowledge. So this implies knowledge of an organisational model, describing the users, groups, systems and the relations between them. Optionally, permissions and roles can be included too in an organisational model. Various academic(理论的) research attempts failed, proving that no generic organisational model can be created that fits every organisation. </P>
<P>The way jBPM handles this is by defining an actor as an actual participant(参与者) in a process. An actor is identified by its ID called an actorId. jBPM has only knowledge(知道) about actorId's and they are represented as java.lang.Strings for maximum flexibility. So any knowledge about the organisational model and the structure of that data is outside the scope of the jBPM core engine.</P>
<P>As an extension to jBPM we will provide (in the future) a component to manage that simple user-roles model. This many to many relation between users and roles is the same model as is defined in the J2EE and the servlet specs and it could serve as a starting point in new developments. People interested in contributing should check the jboss jbpm jira issue tracker for more details. 用户和角色 (user-roles 模型)</P>
<P><BR>Note that the user-roles model as it is used in the servlet, ejb and portlet specifications, is not sufficiently powerful for handling task assignments. That model is a many-to-many relation between users and roles. This doesn't include information about the teams and the organisational structure of users involved in a process.</P>
<P><BR>The classes in yellow are the relevant(相关的) classes for the expression assignment handler that is discussed next.</P>
<P>A User represents a user or a service.|一个用户表现为一个用户或一个服务。| A Group is any kind of group of users.|一个组是任何种类用户组。| Groups can be nested to model the relation between a team, a business unit and the whole company.|组可以被内嵌到在团队、商业单元和整个公司的关系模型。 | Groups have a type to differentiate between the hierarchical groups and e.g. haircolor groups.|组可以有一个种类来区分分等级的组和haircolor组。| Memberships represent the many-to-many relation between users and groups. A membership can be used to represent a position in a company.|一个membership可以被用来表现在公司中的位置。| The name of the membership can be used to indicate(指出) the role that the user fullfills in the group.</P>
<P>9.8.2. Assignment expressions （分派表达式）<BR>The identity component comes with one implementation that evaluates an expression for the calculation of actors during assignment of tasks. Here's an example of using the assignment expression in a process definition:</P>
<P>&lt;process-definition&gt;<BR>&nbsp; ...<BR>&nbsp; &lt;task-node name='a'&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;task name='laundry'&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;assignment expression='previous --&gt; group(hierarchy) --&gt; member(boss)' /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/task&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;transition to='b' /&gt;<BR>&nbsp; &lt;/task-node&gt;<BR>&nbsp; ...<BR>Syntax of the assignment expression is like this:</P>
<P>first-term --&gt; next-term --&gt; next-term --&gt; ... --&gt; next-term</P>
<P>where</P>
<P>first-term ::= previous |<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; swimlane(swimlane-name) |<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; variable(variable-name) |<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user(user-name) |<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; group(group-name)</P>
<P>and </P>
<P>next-term ::= group(group-type) |<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; member(role-name)</P>
<P>9.8.2.1. First terms <BR>An expression is resolved（分解） from left to right.|一个表达式被从左到右进行分解| The first-term specifies a User or Group in the identity model.|第一个项目是在身份模型中指定了一个用户或组| Subsequent terms calculate the next term from the intermediate（中间的） user or group.</P>
<P>previous means the task is assigned to the current authenticated actor. This means the actor that performed the previous step in the process.</P>
<P>swimlane(swimlane-name) means the user or group is taken from the specified swimlane instance.</P>
<P>variable(variable-name) means the user or group is taken from the specified variable instance. The variable instance can contain a java.lang.String, in which case that user or group is fetched from the identity component. Or the variable instance contains a User or Group object. </P>
<P>user(user-name) means the given user is taken from the identity component.</P>
<P>group(group-name) means the given group is taken from the identity component.</P>
<P>9.8.2.2. Next terms<BR>group(group-type) gets the group for a user. Meaning that previous terms must have resulted in a User. It searches for the the group with the given group-type in all the memberships for the user.</P>
<P>member(role-name) gets the user that performs a given role for a group. The previous terms must have resulted in a Group. This term searches for the user with a membership to the group for which the name of the membership matches the given role-name.</P>
<P>9.8.3. Removing the identity component<BR>When you want to use your own datasource for organisational information such as your company's user database or ldap system, you can just rip out the jBPM identity component. The only thing you need to do is make sure that you delete the line ...</P>
<P>&lt;mapping resource="org/jbpm/identity/hibernate/identitymappings.hbm.xml"/&gt;<BR>from the hibernate.cfg.xml </P>
<P>The ExpressionAssignmentHandler is dependent on the identity component so you will not be able to use it as is. In case you want to reuse the ExpressionAssignmentHandler and bind it to your user data store, you can extend from the ExpressionAssignmentHandler and override the method getExpressionSession. </P>
<P>protected ExpressionSession getExpressionSession(AssignmentContext assignmentContext);<BR></P><img src ="http://www.blogjava.net/javaora/aggbug/6159.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-15 13:42 <a href="http://www.blogjava.net/javaora/archive/2005/06/15/6159.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jBPM的分派Assignment</title><link>http://www.blogjava.net/javaora/archive/2005/06/15/6147.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Wed, 15 Jun 2005 03:18:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/15/6147.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/6147.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/15/6147.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/6147.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/6147.html</trackback:ping><description><![CDATA[<P>Assignment(分派)<BR>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.<BR>tasknodes--&gt;&gt;task-node---&gt;&gt;tasks&nbsp; </P>
<P>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.&nbsp; {这里提到了一个行为池的概念 pool of actors}</P>
<P>9.3.1. Assignment interfaces<BR>Assigning task instances is done via the interface AssignmentHandler: {任务实例分派是依靠AssignmentHandler来实现的}</P>
<P>public interface AssignmentHandler extends Serializable {<BR>&nbsp; void assign( Assignable assignable, ExecutionContext executionContext );<BR>}<BR>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). </P>
<P>Assignable 流程角色：TaskInstance&nbsp; SwimlaneInstance </P>
<P>public interface Assignable {<BR>&nbsp; public void setActorId(String actorId);<BR>&nbsp; public void setPooledActors(String[] pooledActors);<BR>}</P>
<P>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). </P>
<P>分配对象：<BR>分配给一个用户&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assignable.setActorId(String actorId);<BR>分配给一个侯选用户池 Assignable.setPooledActors(String[] actorIds);</P>
<P>Each task in the process definition can be associated with an assignment handler implementation to perform the assignment at runtime.</P>
<P><BR>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</P>
<P>在一个流程当多于一个任务时应当被分派给一个用户或多用户的组，考虑使用泳道。</P>
<P>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.</P>
<P>9.3.2. The assignment data model<BR>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.</P>
<P>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.</P>
<P><BR>Pull model(拉模式)<BR>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. <BR>Fetching the list of pooled tasks is typically a two step operation : <BR>1) get all the groups for the given user from the identity component. and <BR>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.<BR>&nbsp;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. </P>
<P>TaskMgmtSession.findPooledTaskInstance(String actorId)<BR>TaskMgmtSession.findPooledTaskInstance(List actorIds)</P>
<P>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.<BR></P><img src ="http://www.blogjava.net/javaora/aggbug/6147.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-15 11:18 <a href="http://www.blogjava.net/javaora/archive/2005/06/15/6147.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>任务实例</title><link>http://www.blogjava.net/javaora/archive/2005/06/15/6146.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Wed, 15 Jun 2005 02:33:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/15/6146.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/6146.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/15/6146.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/6146.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/6146.html</trackback:ping><description><![CDATA[<P>9.2. Task instances|任务实例|<BR>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表的所有任务实例的表，你得到指定用户的任务列表。|</P>
<P>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流程任务在一个集中的任务列表库与其他程序中的任务| </P>
<P>9.2.1. Task instance life cycle |任务实例生命周期|<BR>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.|接着，任务实例可能被结束，它意味着任务实例已经被标志已完成。|</P>
<P>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.|任务实例委派不影响任务实例的生命周期。|</P>
<P>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(...)。| </P>
<P>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被访问。|</P>
<P>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表中。|</P>
<P>9.2.2. Task instances and graph execution|任务实例和图表执行|<BR>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. |缺省的任务实例是被信号化且非模块化的。|</P>
<P>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.|接下来是值的列表可以指定给节点的信号属性。|</P>
<P>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.|当在这个的节点的入口没有任务被创建，在任务节点中执行等待直到这些任务被创建。|<BR>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.<BR>first: Proceeds execution when the first task instance is completed. When no tasks are created on entrance of this node, execution is continued.<BR>first-wait: Proceeds execution when the first task instance is completed. When no tasks are created on entrance of this node, execution is continued.<BR>unsynchronized: Execution always continues, regardless wether tasks are created or still unfinished.<BR>never: Execution never continues, regardless wether tasks are created or still unfinished.<BR>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: </P>
<P>public class CreateTasks implements ActionHandler {<BR>&nbsp; public void execute(ExecutionContext executionContext) throws Exception {<BR>&nbsp;&nbsp;&nbsp; Token token = executionContext.getToken();<BR>&nbsp;&nbsp;&nbsp; TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; TaskNode taskNode = (TaskNode) executionContext.getNode();<BR>&nbsp;&nbsp;&nbsp; Task changeNappy = taskNode.getTask("change nappy");</P>
<P>&nbsp;&nbsp;&nbsp; // now, 2 task instances are created for the same task.<BR>&nbsp;&nbsp;&nbsp; tmi.createTaskInstance(changeNappy, token);<BR>&nbsp;&nbsp;&nbsp; tmi.createTaskInstance(changeNappy, token);<BR>&nbsp; }<BR>}<BR>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.</P>
<P>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.</P><img src ="http://www.blogjava.net/javaora/aggbug/6146.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-15 10:33 <a href="http://www.blogjava.net/javaora/archive/2005/06/15/6146.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jBPM任务管理之任务</title><link>http://www.blogjava.net/javaora/archive/2005/06/14/6137.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Tue, 14 Jun 2005 15:03:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/14/6137.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/6137.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/14/6137.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/6137.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/6137.html</trackback:ping><description><![CDATA[<P>Task management『任务管理』<BR>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 允许定义一块软件描述全部的流程，它可以为用户任务持有等待状态』</P>
<P>1. Tasks『任务』<BR>Tasks are part of the process definition and they define how task instances must be created and assigned during process executions.『任务是 流程定义的一部分，并且它们定义了在流程执行中任务实例如何必须被创建和分派。 』</P>
<P>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.『当在任务节点中定义多个任务，缺省行为是等待所有所有任务完成。』 </P>
<P>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. 『实际上，所有的任务（在任务节点中的也一样）可以在流程定义通过名字进行查找』</P>
<P>Task names must be unique in the whole process definition.『任务名称在整个流程定义中必须是不能重复的』</P>
<P><BR>&nbsp;</P><img src ="http://www.blogjava.net/javaora/aggbug/6137.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-14 23:03 <a href="http://www.blogjava.net/javaora/archive/2005/06/14/6137.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JBpm的持久层 Persistence</title><link>http://www.blogjava.net/javaora/archive/2005/06/14/6121.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Tue, 14 Jun 2005 10:04:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/14/6121.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/6121.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/14/6121.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/6121.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/6121.html</trackback:ping><description><![CDATA[<P>（一）结构: <BR>(1)XML定义文件(definition)<BR>(2)plain java&nbsp;&nbsp; JBpm对象模型&nbsp; 定义 执行 日志<BR>(3)DataBase&nbsp; 定义 执行 日志 <BR>（二）<BR>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数据库中的记录}</P>
<P>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}</P>
<P>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的知识，它是建议的}</P>
<P>More information on how to deploy a process archive to the database can be found in Section 13.1.1, “Deploying a process archive” .</P>
<P><BR>（三）Session的层次：<BR>JbpmSessionFactory<BR>|<BR>|<BR>|<BR>JbpmSession<BR>|<BR>|<BR>|<BR>GraphSession<BR>TaskMgmtSession<BR>ContextSession</P>
<P>（四） The jBPM database classes </P>
<P>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中获得}</P>
<P>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 在某种程度准备所有信息那样可以被快速创建）}</P>
<P>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连接。}</P>
<P>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文档。}</P>
<P>public class PersistenceApiTest extends TestCase {</P>
<P>&nbsp; static JbpmSessionFactory jbpmSessionFactory = JbpmSessionFactory.buildJbpmSessionFactory();</P>
<P>&nbsp; public void testStartProcessInstance() {<BR>&nbsp;&nbsp;&nbsp; // obtain a session<BR>&nbsp;&nbsp;&nbsp; JbpmSession jbpmSession = jbpmSessionFactory.openJbpmSession();<BR>&nbsp;&nbsp;&nbsp; try {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // start a user managed transaction<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jbpmSession.beginTransaction();</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // load information from the database <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // (note that process definitions will be cached in memory<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // in the second level cache of hibernate)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ProcessDefinition auctionProcess = <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jbpmSession.getGraphSession().findLatestProcessDefinition("auction");</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // perform a POJO workflow operation on the plain object model.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ProcessInstance auctionInstance = new ProcessInstance(auctionProcess);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; auctionInstance.signal();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // store the result in the database<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jbpmSession.getGraphSession().saveProcessInstance(auctionInstance);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // commit the user transaction<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jbpmSession.commitTransaction();</P>
<P>&nbsp;&nbsp;&nbsp; } finally {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // close the session.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jbpmSession.close();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; }<BR>}</P><img src ="http://www.blogjava.net/javaora/aggbug/6121.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-14 18:04 <a href="http://www.blogjava.net/javaora/archive/2005/06/14/6121.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jBpm流程定义XML格式</title><link>http://www.blogjava.net/javaora/archive/2005/06/06/5621.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Mon, 06 Jun 2005 09:07:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/06/5621.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/5621.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/06/5621.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/5621.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/5621.html</trackback:ping><description><![CDATA[<P>流程定义XML流：<BR>1.定制action：<BR>&lt;process-definition&gt;<BR>&nbsp;&nbsp; &lt;start-state&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="s"/&gt;<BR>&nbsp;&nbsp; &lt;/start-state&gt;<BR>&nbsp;&nbsp; &lt;state name="s"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="end"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action class="com....MyActionHandler"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/transition&gt;<BR>&nbsp;&nbsp; &lt;/state&gt;<BR>&nbsp;&nbsp; &lt;end-state name="end"/&gt;<BR>&lt;/process-definition&gt;<BR>2.有对应事件的<BR>&lt;process-definition&gt;<BR>&nbsp;&nbsp; &lt;start-state&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="s"/&gt;<BR>&nbsp;&nbsp; &lt;/start-state&gt;<BR>&nbsp;&nbsp; &lt;state name="s"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;event type="node-enter"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action calss="com....MyActionHandler"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/event&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;event type="node-leave"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action calss="com....MyActionHandler"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/event&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="end"/&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; &lt;/state&gt;<BR>&nbsp;&nbsp; &lt;end-state name="end"/&gt;<BR>&lt;/process-definition&gt;<BR>3.任务分派XML流程定义<BR>&lt;process-definition name="the baby process"&gt;<BR>&nbsp;&nbsp; &lt;start-state&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition name="baby cries" to="t"/&gt;<BR>&nbsp;&nbsp; &lt;/start-state&gt;<BR>&nbsp;&nbsp; &lt;task-node name="t"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;task name="change nappy"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;assignment class="com....NappyAssignmentHandler"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/task&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;transition to="end" /&gt;<BR>&nbsp;&nbsp; &lt;/task-node&gt;<BR>&nbsp;&nbsp; &lt;end-state name="end"/&gt;<BR>&lt;/process-definition&gt;</P><img src ="http://www.blogjava.net/javaora/aggbug/5621.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-06 17:07 <a href="http://www.blogjava.net/javaora/archive/2005/06/06/5621.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jBPM表的猜测</title><link>http://www.blogjava.net/javaora/archive/2005/06/06/5600.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Mon, 06 Jun 2005 05:27:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/06/5600.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/5600.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/06/5600.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/5600.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/5600.html</trackback:ping><description><![CDATA[JBPM_ACTION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; action记录表<BR>JBPM_DECISIONCONDITIONS&nbsp;&nbsp;&nbsp;&nbsp; 结果条件表<BR>JBPM_DELEGATION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 委托表<BR>JBPM_EVENT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 事件表 处理进入或者离开事件<BR>JBPM_EXCEPTIONHANDLER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 异常处理表<BR>JBPM_ID_GROUP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 用户组表<BR>JBPM_ID_MEMBERSHIP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 用户成员表&nbsp;&nbsp; 表现用户和组之间的多对多关系<BR>JBPM_ID_PERMISSIONS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 用户权限表<BR>JBPM_ID_USER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 用户表<BR>JBPM_MODULEDEFINITION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 模块定义表<BR>JBPM_MODULEINSTANCE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 模块实例表<BR>JBPM_NODE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 流程节点表<BR>JBPM_POOLEDACTOR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;汇集参与着表<BR>JBPM_PROCESSDEFINITION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 流程定义表<BR>JBPM_PROCESSFILE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 流程文件表<BR>JBPM_PROCESSFILEBLOCK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 流程文件块表<BR>JBPM_PROCESSINSTANCE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;流程实例表<BR>JBPM_RUNTIMEACTION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 运行中行为表<BR>JBPM_SCRIPTVARIABLES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 脚本变量表<BR>JBPM_SWIMLANE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;泳道表<BR>JBPM_SWIMLANEINSTANCE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;泳道实例表<BR>JBPM_TASK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;任务表<BR>JBPM_TASKACTORPOOL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 用户行为汇总<BR>JBPM_TASKINSTANCE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 任务实例<BR>JBPM_TIMER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 计时表<BR>JBPM_TOKEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 令牌表<BR>JBPM_TOKENVARIABLEMAP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 令牌变量影射表<BR>JBPM_TRANSITION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;转换表<BR>JBPM_VARIABLEINSTANCE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 变量实例表<BR>JBPM_VARIABLEINSTANCEBLOCK&nbsp; 变量实例块表<BR>JBPM_VARIABLEMAPPING&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;变量影射表<BR><img src ="http://www.blogjava.net/javaora/aggbug/5600.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-06 13:27 <a href="http://www.blogjava.net/javaora/archive/2005/06/06/5600.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于工作流的一些想法</title><link>http://www.blogjava.net/javaora/archive/2005/06/06/5595.html</link><dc:creator>java世界畅谈</dc:creator><author>java世界畅谈</author><pubDate>Mon, 06 Jun 2005 05:02:00 GMT</pubDate><guid>http://www.blogjava.net/javaora/archive/2005/06/06/5595.html</guid><wfw:comment>http://www.blogjava.net/javaora/comments/5595.html</wfw:comment><comments>http://www.blogjava.net/javaora/archive/2005/06/06/5595.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/javaora/comments/commentRss/5595.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/javaora/services/trackbacks/5595.html</trackback:ping><description><![CDATA[　　最近刚刚开始接触工作流，感觉这个东西确实很不错。当然现在自己还没有入门，因为自己的几个朋友在开发中接触类似的东西。现在也开始接触一些。<BR>　　目前选择jBPM作为研究的对象，其他的工作流(OSWorkflow)暂时先放在一边，因为jBPM将hibernate3.0作为其持久层的解决方案，而自己对Hibernate现在也有了一定的认识。想来，上手应该好一些的。<BR>　　昨天和朋友在一起的游泳的时候，也谈了很长时间的工作流。工作流有自己的一套Database，其中主要记录的是状态信息。工作流关心的就是状态信息。可以有流程描述语言来设置流程，jBPM有自己一套绘制流程的工具（提供的是一个插件）。不过在具体的业务信息中也要处理状态信息，方便于流向下个业务层面。流程可以回滚处理。<BR>　　典型的一个流程，甲写了一个请假申请，提交给领导乙，领导拿到后，不给予审批，然后将给第三方丙。丙来处理这个流程。<BR><img src ="http://www.blogjava.net/javaora/aggbug/5595.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/javaora/" target="_blank">java世界畅谈</a> 2005-06-06 13:02 <a href="http://www.blogjava.net/javaora/archive/2005/06/06/5595.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>