JPDL3.1规范手册

  
 
                    JPDL3.1规范手册
jBPM业务程序定义语言(jBPM Process Definition Language (JPDL))
                                
                                  Blog: http://blog.csdn.net/shendl/
 
                                                        2006-10-13
前言:
这是jBPM3.1指南第16章的翻译。但不仅仅是简单的翻译而已。其中加入了我对jBPM的JPDL规范和技术的理解。我已经对其进行了全面的扩充讲解!
应该说,本文是一份非常有用的jBPM的技术参考,其内容已经完全涵盖了jBPM指南的所有要点!
它既可以作为你的jBPM和JPDL的参考速查手册,也可以用作学习jBPM和JPDL规范的教材。它完全浓缩了jBPM官方指南的精华。
另外,我还保留了英文原文。这对于您的理解应该是有好处的。如果有的地方我理解错了,您可以看到原文的表达。另外,对于过于简单的英文,我就不翻译了。这是我的风格,希望您能够喜欢。
希望它对您能够有所助益。希望能够对国内jBPM的普及起到一定的推动作用,谢谢!
 
 
 
注意:
一、节点的命名规则
1,State等待状态,使用被管理的对象的状态作为名字。
 
2,TaskNode任务节点,使用该阶段处理的任务的名字作为名字。而不使用被管理的对象的状态。
 
    该阶段/业务程序、步骤 的任务, 最适合作为节点的名字! 因为,不能够回到start-state。所以,使用被管理对象的状态,在遇到start-state是会出现问题!
二、 jBPM的所有事件
 1<xs:enumeration value="node-enter"/>节点进入(Start-state没有)
 2<xs:enumeration value="node-leave"/>节点离开
 3<xs:enumeration value="process-start"/>业务程序实例开始
 4<xs:enumeration value="process-end"/>业务程序实例结束
 5<xs:enumeration value="task-create"/>任务创建
 6<xs:enumeration value="task-assign"/>任务分配(AssignmentHandler)
  7<xs:enumeration value="task-start"/>任务开始
8<xs:enumeration value="task-end"/>任务结束
 9<xs:enumeration value="before-signal"/>执行转向前
 10<xs:enumeration value="after-signal"/>执行转向后
 11<xs:enumeration value="superstate-enter"/>进入父状态
 12<xs:enumeration value="superstate-leave"/>离开父状态
 13<xs:enumeration value="timer-create"/>创建定时器(创建和首次执行期间可以设duedate延时)
 14<xs:enumeration value="subprocess-created"/>子业务程序实例创建
 15<xs:enumeration value="subprocess-end"/>子业务程序实例结束
 
三、jBPM的WebApp管理程序使用的是:
MyFaces   -----Apache
MyFaces 是JavaServer(tm) Faces(JSF) Web框架 (JSR 127)的一个实现。JavaServer(tm) Faces Web框架是一个新的实现MVC模式的规范.它可以与Struts框架相媲美甚至的一些特性与观念已经超过了Struts.【FacesIDE:Eclipse下的一个辅助开发插件】.
 
四、它们3个总是一起的。这可能是jboss seam容器的功能。可以组装对象。
Class 全类名
attribute
optional
the fully qualified classname of an implementation of org.jbpm.taskmgmt.def.AssignmentHandler
config-type 配置类型
attribute
optional
{field|bean|constructor|configuration-property}. Specifies how the assignment-handler-object should be constructed and how the content of this element should be used as configuration information for that assignment-handler-object.
 
{content}
optional
the content of the assignment-element can be used as configuration information for your AssignmentHandler implementations. This allows the creation of reusable delegation classes. for more about delegation configuration, see Section 16.2.3, “Configuration of delegations”.
 
五、任务实例TaskInstance
1,TaskNode的任务,默认情况下,会在TaskNode的execute方法中自动创建所有任务的实例。
TaskNode可以有多个任务。
2,Start-state也可以有Task,但只能有一个。这叫做开始任务。
这个开始任务,必须由用户创建。它的参与者是当前JbpmContext的参与者。
TaskInstance taskInstance = null ;
 
    jbpmContext .setActorId( "cookie monster" );
    // create a task to start the websale process
    taskInstance = processInstance .getTaskMgmtInstance().createStartTaskInstance();
 
3,没有开始任务,不创建开始任务都是可以的。
 
 
 
正文:
   JPDL specifies an xml schema and the mechanism to package all the process definition related files into a process archive.
JPDL指定了一个 XML模式,这个机制打包所有的业务程序定义相关文件进一个业务程序存档文件。
16.1. The process archive业务程序存档文件
A process archive is a zip file. The central file in the process archive is processdefinition.xml. The main information in that file is the process graph. The processdefinition.xml also contains information about actions and tasks. A process archive can also contain other process related files such as classes, ui-forms for tasks, ...
processdefinition.xml 文件中的主要信息是业务程序图表。也包含动作和任务的相关信息。一个业务程序存档文件也能包含其它业务程序相关文件,例如:类,任务的UI窗体等。(一般不必包含,打包文件实际上是一个目录*.par)
16.1.1. Deploying a process archive部署一个业务程序存档文件
Deploying process archives can be done in 3 ways: with the process designer tool, with an ant task or programatically.
有 3种方法:
1,业务程序设计工具;
2, ant任务
3,编程方式。
Deploying a process archive with the designer tool is still under construction.
设计工具还在开发中。
Deploying a process archive with an ant task can be done as follows:
<target name="deploy.par">
 <taskdef name="deploypar" classname="org.jbpm.ant.DeployParTask">
    <classpath --make sure the jbpm-[version].jar is in this classpath--/> 
  </taskdef> 
  <deploypar par="build/myprocess.par" /> 
</target>
To deploy more process archives at once, use the nested fileset elements. The file attribute itself is optional. Other attributes of the ant task are:
要一次打包和发布多个业务程序定义,需要嵌套地使用 fileset元素。File属性是可选的。Ant任务的其他属性是:
  • cfg: cfg is optional, the default value is 'hibernate.cfg.xml'. The hibernate configuration file that contains the jdbc connection properties to the database and the mapping files.
Cfg:这个是Hibernate数据源的配置文件。
  • properties: properties is optional and overwrites *all* hibernate properties as found in the hibernate.cfg.xml
属性:可选,用来重写hibernate.cfg.xml中 所有的Hibernate属性。不能替换一部分,只能全部替换。
  • createschema: if set to true, the jbpm database schema is created before the processes get deployed.
创建模式(数据库表):如果设为true,那么每一次部署业务程序之前,都会重新创建jBPM初始化的数据库表!
Process archives can also be deployed programmatically with the class org.jbpm.jpdl.par.ProcessArchiveDeployer
16.1.2. Process versioning业务程序版本
Process definitions should never change because it is extremely difficult (if not, impossible) to predict all possible side effects of process definition changes.
业务程序定义应该从不改变。因为它是非常重要的。无法预知定义改变可能带来哪些意想不到的问题。
To get around this problem, jBPM has a sophicticated process versioning mechanism. The versioning mechanism版本机制 allows multiple process definitions of the same name to coexist in the database. A process instance can be started in the latest version available at that time and it will keep on executing in that same process definition for its complete lifetime. When a newer version is deployed, newly created instances will be started in the newest version, while older process instances keep on executing in the older process defintions.
围绕这个问题, jBPM提供了一个版本机制。版本机制允许多个同名的业务程序定义在数据库中共存。旧版本业务程序定义的实例将按照旧的定义执行。新版本业务程序定义的实例,将始终依照新的定义执行。
Process definitions are a combination of a declaratively specified process graph and optionally, a set of related java classes. The java classes can be made available to the jBPM runtime environment in 2 ways : by making sure these classes are visible to the jBPM classloader. This usually means that you can put your delegation classes in a .jar file next to the jbpm-[version].jar. The java classes can also be included in the process archive. When you include your delegation classes in the process archive (and they are not visible to the jbpm classloader), jBPM will also apply versioning版本 on these classes. More information about process classloading can be found in Section 16.2, “Delegation”
业务程序定义是特定的业务程序图表( .xml定义文件)和一系列相关的java类(可以没有)的结合。这些Java类都是在.xml文件中指定的。当然,还有支持jPDL的jBPM引擎。
对 jBPM运行时环境可用的Java类有2种方法:
1,确信这些类对于 jBPM类载入器是可用的。
Java类能够和 jBPM的jar包放在一起。或者,java类能够放在业务程序存档文件中。
总之,在 classpath中,就对程序的类载入器可见。
When a process archive gets deployed, it creates a process definition in the jBPM database. Process definitions can be versioned on the basis of the process definition name. When a named process archive gets deployed, the deployer will assign a version number. To assign this number, the deployer will look up the highest version number for process definitions with the same name and adds 1. Unnamed process definitions will always have version number -1.
当一个业务程序存档文件部署以后,它在 JBPM数据库中创建一个业务程序定义。部署器将分配一个版本号给业务程序定义。未命名的业务程序定义的版本号是-1。
16.1.3. Changing deployed process definitions
更改已部署的业务程序定义
Changing process definitions after they are deployed into the jBPM database has many potential pitfalls. Therefor, this is highly discouraged.
更改已经部署在 jBPM数据库中的业务程序定义有许多潜在的风险,强烈建议你不这样做。应该重新部署新版本的业务程序定义。
Actually实际上 , there is a whole variety of possible changes that can be made to a process definition. Some of those process definitions are harmless, but some other changes have implications far beyond the expected and desirable.
So please consider migrating process instances to a new definition over this approach.
In case you would consider it, these are the points to take into consideration:
需要考虑的事项:
Use hibernate's update: You can just load a process definition, change it and save it with the hibernate session. The hibernate session can be accessed with the method JbpmContext.getSession().
使用 Hibernate的更新:得到Hibernate Session,修改数据库中的业务程序定义。
The second level cache: A process definition would need to be removed from the second level cache after you've updated an existing process definition. See also Section 7.10, “Second level cache”
二级缓存:更改后,必须将业务程序定义从二级缓存中删除。原来使用二级缓存是因为基本上业务程序定义很少更改。
16.1.4. Migrating process instances移植业务程序实例
(尚未开发)
An alternative approach to changing process definitions might be to convert the executions to a new process definition. Please take into account that this is not trivial due to the long-lived nature of business processes. Currently, this is an experimental area so for which there are not yet much out-of-the-box support.
一种可选的改变业务程序定义的方法,可能是把原来业务程序实例转变为依照新的业务程序定义。这样做的理由是,长生命周期的业务程序实例。
如, CMS系统的新闻采集、提交、归档。所有发布中的文档,都是未结束的工作流管理的对象。如果该条工作流的定义发生了变化。那么,非常有可能需要把执行中的大量业务程序实例都发出去。
这是一个实验领域,还没有很多经验。
As you know there is a clear distinction between process definition data, process instance data (the runtime data) and the logging data. With this approach, you create a separate new process definition in the jBPM database (by e.g. deploying a new version of the same process).
业务程序定义数据、业务程序实例数据和日志数据之间有清晰的区别。你创建一个新版本的业务程序定义。
 Then the runtime information is converted to the new process definition. This might involve a translation cause tokens in the old process might be pointing to nodes that have been removed in the new version. So only new data is created in the database. But one execution of a process is spread over two process instance objects.
业务程序实例转换到新的业务程序定义。这可能造成这样的情况, token中的节点指针指向了一个新版本中已经删除的节点。把一个业务程序实例划分为多个业务程序实例对象。
 This might become a bit tricky for the tools and statistics calculations. When resources permit us, we are going to add support for this in the future. E.g. a pointer could be added from one process instance to it's predecessor。
未来我们可能提供:业务程序实例中增加一个能够指向前辈实例的指针。
16.1.5. Process conversion业务程序转化
A conversion class has been made available to assist you with converting your jBPM 2.0 process archives into jBPM 3.0 compatible process archives. Create an output directory to hold the converted process archives. Enter the following command line from the build directory of the jBPM 3.0 distribution:
 
java -jar converter.jar indirectory outdirectory
Substitute the input directory where your jBPM 2.0 process archives reside for "indirectory". Substitute the output directory for the one you created to hold the newly converted process archives for "outdirectory".
 
16.2. Delegation委派
Delegation is the mechanism used to include the users' custom code in the execution of processes.
委派是一个机制,用来在业务程序的执行中包含用户的定制代码。
委派类是指,在业务程序实例的执行过程中被调用的用户自定义的 Java类。
 
委派类,应该是指 jPDL定义中需要用到的Java类。如,ActionHandler,执行动作、业务逻辑。
AssignmentHandler,执行任务分派。把任务或泳道分配给用户或用户池。
条件等。
这些都使用了参数回调模式。用户提供的这些类,会被 jBPM所调用。这些类可以使用jBPM传入的业务程序实例和任务等的信息。
委派模式,就是把任务交给下层助手类去处理。 jBPM中之所以叫我们自定义的类为委派类。就是jBPM把任务交给了这些助手类。通过接口调用这些助手类。ActionHandler等实现类,实际上还是委派模式的委派者。它们可能还会继续把任务委派给助手类!
16.2.1. The jBPM class loader
jBPM类载入器
The jBPM class loader is the class loader that loads the jBPM classes. Meaning, the classloader that has the library jbpm-3.x.jar in its classpath. To make classes visible to the jBPM classloader, put them in a jar file and put the jar file besides the jbpm-3.x.jar. E.g. in the WEB-INF/lib folder in the case of webapplications.
 
16.2.2. The process class loader业务程序类载入器
Delegation classes are loaded with the process class loader of their respective process definition. The process class loader is a class loader that has the jBPM classloader as a parent. The process class loader adds all the classes of one particular process definition. You can add classes to a process definition by putting them in the /classes folder in the process archive. Note that this is only useful when you want to version the classes that you add to the process definition. If versioning is not necessary, it is much more efficient to make the classes available to the jBPM class loader.
在业务程序存档文件的 /classes目录中的类,增加到了业务程序定义中。每个业务程序定义可以有一个类载入器。他们的父类载入器是jBPM的类载入器。
注意,这仅仅在你要版本化你的业务程序定义的委派类时,才值得这么做。
即,一个业务程序定义,需要一种委派类。
 
16.2.3. Configuration of delegations委派的配置
Delegation classes contain user code that is called from within the execution of a process. The most common example is an action. In the case of action, an implementation of the interface ActionHandler can be called on an event in the process. Delegations are specified in the processdefinition.xml. 3 pieces of data can be supplied when specifying a delegation :
委派类是指,在业务程序实例的执行过程中被调用的用户自定义的 Java类。
最普通的例子是 Action。委派的Java类在processdefinition.xml中被指定。
指定一个委派的Java类需要提供3块数据:
// 这是通过字段实现的
<action class="org.test.MyAction">
 <city>Atlanta</city>
 <rounds>5</rounds>
</action>
 
  • 1) the class name (required) : the fully qualified class name of the delegation class.
1,类名:委派类的全名
<action class="org.test.MyAction">
 
  • 2) configuration type (optional) : specifies the way to instantiate and configure the delegation object. By default the default constructor is used and the configuration information is ignored.
2,配置类型:
如:
   <assignment class="com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler" config-type="constructor"></assignment>
有4种配置类型:
1)Field------直接给目标类的字段赋值。 字段没有set/get方法,不是一个属性。该类也不是一个Bean。这应该是使用CGLIB字节码生成实现的。也可能使用反射。
< assignment class = "com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler" >
            < a > a </ a >
         </ assignment >
2)Bean------通过set方法赋值。    这和Spring的<property>是一致的。
< assignment class = "com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler" config-type = "bean" >
            < a > a </ a >
         </ assignment >
3)constructor-----传给构造器的参数。
< assignment class = "com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler" config-type = "constructor" >
            a
         </ assignment >
4)compatibility-----兼容性
< assignment class = "com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler" config-type = "configuration-property" >
            a
         </ assignment >
就是 configuration-property
什么都没有,就是默认构造器。
Field 字段,也不需要。
 
< assignment class = "com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler" config-type = "configuration-property" >
            a
         </ assignment >
配置类型和配置,类似于Spring IOC容器的对象装配。
如:<bean id="odExchangeUserForecastDao" class="com.telecom.ldbs.exchange.ExchangeUserForecast.datadeclare.dao.impl.OdExchangeUserForecastDaoImpl">
        <property name="sessionFactory">
               <ref bean="sessionFactory"/>
        </property>
</bean>
这是对属性的管理
 
<city>
  • 3) configuration (optional) : the configuration of the delegation object in the format as required by the configuration type.
3,配置
Atlanta
 
Next is a description of all the configuration types:
 
配置类型
16.2.3.1. config-type field配置类型字段
 
This is the default configuration type. The config-type field will first instantiate an object of the delegation class and then set values in the fields of the object as specified in the configuration. The configuration is xml, where the elementnames have to correspond with the field names of the class. The content text of the element is put in the corresponding field. If necessary and possible, the content text of the element is converted to the field type.
这是默认的配置类型。不配置,也会使用默认无参构造器生成对象。
config-type ="field" ,或者不设置属性,那么会首先实例化委派/回调java类的对象。然后用配置中的值设置对象的字段的值。字段的配置是xml格式的。xml元素名和类的字段名相同。xml元素的文本内容,赋值给这个字段。Xml的文本元素能够被正确的转换为字段所需的类型。
(Spring也可以。是特殊的类型,在Spring中一般是另一个Spring管理的对象)
Supported type conversions:
支持的类型转换:
  • String doesn't need converting, of course. But it is trimmed.
String不需要转换,但会2边切除空格。
  • primitive types such as int, long, float, double, ...
原生类型
  • and the basic wrapper classes for the primitive types.
原生类型的包装类
  • lists, sets and collections. In that case each element of the xml-content is consitered as an element of the collection and is parsed, recursively applying the conversions. If the type of the elements is different from java.lang.String this can be indicated by specifying a type attribute with the fully qualified type name. For example, following snippet will inject an ArrayList of Strings into field 'numbers':
List,Set,Collection这些集合类。Xml内容的每一个元素被认为是集合的一个元素。这些元素被分别递归转换类型。
如果元素的类型不是String。可以通过指出类型的全类名来进行转换。
·                <numbers>
·                  <element>one</element>
·                  <element>two</element>
·                  <element>three</element>
</numbers>
如,指定元素的属性
·                <numbers>
·                  <element type="com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler">one</element>
·                  <element>two</element>
·                  <element>three</element>
</numbers>
 
 
The text in the elements can be converted to any object that has a String constructor. To use another type then String, specify the element-type in the field element ('numbers' in this case).
Here's another example of a map:
<numbers>
 <entry><key>one</key><value>1</value></entry>
 <entry><key>two</key><value>2</value></entry>
 <entry><key>three</key><value>3</value></entry>
</numbers>
  • maps. In this case, each element of the field-element is expected to have one subelement key and one element value. The key and element are both parsed using the conversion rules recursively. Just the same as with collections, a conversion to java.lang.String is assumed if no type attribute is specified.
  • org.dom4j.Element
  • for any other type, the string constructor is used.
任何使用了String构造器的类。(String唯一参数的构造器)
For example in the following class...
public class MyAction implements ActionHandler {
 // access specifiers can be private, default, protected or public
 private String city;
 Integer rounds;
 ...
}
...this is a valid configuration:
这是有效的配置:
...
<action class="org.test.MyAction">
 <city>Atlanta</city>
 <rounds>5</rounds>
</action>
...
16.2.3.2. config-type bean配置类型Bean
Same as config-type field but then the properties are set via setter methods, rather then directly on the fields. The same conversions are applied.
类似于配置类型字段,但它是通过 set方法设置的。而不是直接作用于字段。
 
必有set方法,是属性(可以没有get方法)。
 
16.2.3.3. config-type constructor配置类型构造器
This instantiator will take the complete contents of the delegation xml element and passes this as text in the delegation class constructor.
把参数作为 String传入到构造器中。类必须有这样的构造器:
Class(String string){
};//这样的构造器。
 
16.2.3.4. config-type configuration-property配置类型----配置属性
First, the default constructor is used, then this instantiator will take the complete contents of the delegation xml element, and pass it as text in method void configure(String);. (as in jBPM 2)
第一,使用默认构造器创建对象。会把 xml元素定义的内容传递到类的方法:
configure(String)
    这个已经不大使用了!
16.3. Expressions表达式
For some of the delegations, there is support for a JSP/JSF EL like expression language. In actions, assignments and decision conditions, you can write an expression like e.g.
在一些委派 Java中,支持EL语言。类似于EL表达式。在action,任务分配,决定条件,你能写一个表达式:
expression="#{myVar.handler[assignments].assign}"
 
注意, jBPM的Web应用页面也使用这种EL。
如: <h:commandButton action="#{taskBean.save}" value="Save"/>
Save是方法名。也可以跟属性名。、
<h2><h:outputText value="#{taskBean.taskInstance.name}" /></h2>    
JSP的 EL 语言 只能通过建立表达式 ${exp1} 来进行调用。
 
The basics of this expression language can be found in the J2EE tutorial.
The jPDL expression language is similar to the JSF expression language. Meaning that jPDL EL is based on JSP EL, but it uses #{...} notation and that it includes support for method binding.
jPDL表达式语言类似于 JSF表达式语言。这意味着,jPDL EL基于JSP EL。但它使用#{ }符号,包括对方法绑定的支持。
Depending on the context, the process variables or task instance variables can be used as starting variables along with the following implicit objects:
依靠上下文,业务程序变量和任务变量连同下面的对象能够被用作 EL表达式的开始变量:   也就是说可以直接在EL表达式#{…}中使用!
  • taskInstance (org.jbpm.taskmgmt.exe.TaskInstance)任务实例
  • processInstance (org.jbpm.graph.exe.ProcessInstance)业务程序实例
  • processDefinition (org.jbpm.graph.def.ProcessDefinition)业务程序定义
  • token (org.jbpm.graph.exe.Token)执行路径
  • taskMgmtInstance (org.jbpm.taskmgmt.exe.TaskMgmtInstance)任务管理实例
  • contextInstance (org.jbpm.context.exe.ContextInstance)上下文实例
This feature becomes really powerfull in a JBoss SEAM environment. Because of the integration between jBPM and JBoss SEAM, all of your backed beans, EJB's and other one-kind-of-stuff becomes available right inside of your process definition. Thanks Gavin ! Absolutely awsome ! :-)
这些特性是 Jboss SEAM这个IOC容器提供的。因为jBPM和Jboss SEAM的综合,所有你的后台JavaBean类,EJB和其他类能够正确地被你的业务程序定义中使用。
我可以使用 Spring容器。通过把Spring容器对象引用放到业务程序实例的临时变量中,在被委派处理类中调用Spring管理的类!
16.4. jPDL xml schema
jPDL的XML模式
The jPDL schema is the schema used in the file processdefinition.xml in the process archive.
16.4.1. Validation确认
When parsing a jPDL XML document, jBPM will validate your document against the jPDL schema when two conditions are met: first, the schema has to be referenced in the XML document like this
要执行 xsd验证,需要2个条件:
1,指定 xmlns
<process-definition xmlns="urn:jbpm.org:jpdl-3.1">
 ...
</process-definition>
And second, the xerces parser has to be on the classpath.
2, xerces的jar包放在classpath中。
The jPDL schema can be found in ${jbpm.home}/src/java.jbpm/org/jbpm/jpdl/xml/jpdl-3.1.xsd or at http://jbpm.org/jpdl-3.1.xsd.
jpdl-3.1.xsd
<?xml version="1.0" encoding="UTF-8"?>
 
<xs:schema xmlns=           "urn:jbpm.org:jpdl-3.1"
           targetNamespace="urn:jbpm.org:jpdl-3.1"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           elementFormDefault="qualified">
 
 <!-- PROCESS-DEFINITION -->
 <!-- ################## -->
 <xs:element name="process-definition">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="swimlane" />
        <xs:element ref="start-state" />
        <xs:group   ref="node-elements"/>
        <xs:group   ref="action-elements" />
        <xs:element ref="event" />
        <xs:element ref="exception-handler" />
        <xs:element ref="task" />
      </xs:choice>
      <xs:attribute name="name" type="xs:string" use="required" />
    </xs:complexType>
 </xs:element>
 
 <!-- SWIMLANE -->
 <!-- ######## -->
 <xs:element name="swimlane">
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="1">
        <xs:element ref="assignment"/>
      </xs:sequence>
      <xs:attribute name="name" type="xs:string" use="required" />
    </xs:complexType>
 </xs:element>
 
 <!-- NODES -->
 <!-- ##### -->
 <xs:element name="start-state">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="task"/>
        <xs:element ref="transition"/>
        <xs:element ref="event"/>
        <xs:element ref="exception-handler"/>
      </xs:choice>
      <xs:attribute name="name" type="xs:string"/>
    </xs:complexType>
 </xs:element>
 
 <xs:element name="end-state">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="event"/>
        <xs:element ref="exception-handler"/>
      </xs:choice>
      <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
 </xs:element>
 
 <xs:element name="decision">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="handler" type="delegation" />
        <xs:element ref="event"/>
        <xs:element ref="exception-handler"/>
        <xs:element name="transition">
          <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element name="condition">
                <xs:complexType mixed="true">
                  <xs:sequence minOccurs="0" maxOccurs="unbounded">
                    <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
                  </xs:sequence>
                  <xs:attribute name="expression" type="xs:string" />
                </xs:complexType>
              </xs:element>
              <xs:group ref="action-elements"/>
              <xs:element ref="exception-handler"/>
            </xs:choice>
            <xs:attribute name="to" type="xs:string" use="required" />
            <xs:attribute name="name" type="xs:string" />
          </xs:complexType>
        </xs:element>
      </xs:choice>
      <xs:attribute name="name" type="xs:string" use="required"/>
      <xs:attribute name="expression" type="xs:string" />
      <xs:attribute name="async" type="xs:string" default="false" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="fork">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="script" />
        <xs:group ref="node-content-elements" />
      </xs:choice>
      <xs:attribute name="name" type="xs:string" use="required"/>
      <xs:attribute name="async" type="xs:string" default="false" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="join">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:group ref="node-content-elements" />
      </xs:choice>
      <xs:attribute name="name" type="xs:string" use="required"/>
      <xs:attribute name="async" type="xs:string" default="false" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="node">
    <xs:complexType>
      <xs:sequence>
        <xs:choice minOccurs="0">
          <xs:group ref="action-elements" />
        </xs:choice>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:group ref="node-content-elements" />
        </xs:choice>
      </xs:sequence>
      <xs:attribute name="name" type="xs:string" use="required"/>
      <xs:attribute name="async" type="xs:string" default="false" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="process-state">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="sub-process">
          <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required" />
            <xs:attribute name="version" type="xs:integer" />
          </xs:complexType>
        </xs:element>
        <xs:element ref="variable" />
        <xs:group ref="node-content-elements" />
      </xs:choice>
      <xs:attribute name="name" type="xs:string" use="required"/>
      <xs:attribute name="async" type="xs:string" default="false" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="state">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:group ref="node-content-elements"/>
      </xs:choice>
      <xs:attribute name="name" type="xs:string" use="required"/>
      <xs:attribute name="async" type="xs:string" default="false" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="super-state">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:group ref="node-elements"/>
        <xs:group ref="node-content-elements"/>
      </xs:choice>
      <xs:attribute name="name" type="xs:string" use="required"/>
      <xs:attribute name="async" type="xs:string" default="false" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="task-node">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="task" />
        <xs:group ref="node-content-elements" />
      </xs:choice>
      <xs:attribute name="name" type="xs:string" use="required"/>
      <xs:attribute name="create-tasks" type="booleanType" default="true" />
      <xs:attribute name="end-tasks" type="booleanType" default="false" />
      <xs:attribute name="signal" default="last">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="unsynchronized"/>
            <xs:enumeration value="never"/>
            <xs:enumeration value="first"/>
            <xs:enumeration value="first-wait"/>
            <xs:enumeration value="last"/>
            <xs:enumeration value="last-wait"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="async" type="xs:string" default="false" />
    </xs:complexType>
 </xs:element>
 
 <!-- TRANSITION -->
 <!-- ########## -->
 <xs:element name="transition">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:group ref="action-elements"/>
        <xs:element ref="exception-handler" />
      </xs:choice>
      <xs:attribute name="to" type="xs:string" use="required" />
      <xs:attribute name="name" type="xs:string" />
    </xs:complexType>
 </xs:element>
 
 <!-- ACTIONS -->
 <!-- ####### -->
 <xs:element name="action">
    <xs:complexType mixed="true">
      <xs:sequence>
        <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
      </xs:sequence>
      <xs:attribute name="class" type="xs:string" />
      <xs:attribute name="config-type" default="field">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="field"/>
            <xs:enumeration value="bean"/>
            <xs:enumeration value="constructor"/>
            <xs:enumeration value="configuration-property"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="name" type="xs:string" />
      <xs:attribute name="ref-name" type="xs:string" />
      <xs:attribute name="accept-propagated-events" type="booleanType" default="true" />
      <xs:attribute name="expression" type="xs:string" />
      <xs:attribute name="async" type="xs:string" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="cancel-timer">
    <xs:complexType>
      <xs:attribute name="name" type="xs:string" use="required" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="create-timer">
    <xs:complexType>
      <xs:choice>
        <xs:element ref="action"/>
        <xs:element ref="script"/>
      </xs:choice>
      <xs:attribute name="duedate" type="xs:string" use="required" />
      <xs:attribute name="name" type="xs:string" />
      <xs:attribute name="repeat" type="xs:string" />
      <xs:attribute name="transition" type="xs:string" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="script">
    <xs:complexType mixed="true">
      <xs:sequence>
        <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
      </xs:sequence>
      <xs:attribute name="name" type="xs:string" />
      <xs:attribute name="accept-propagated-events" type="booleanType" default="true" />
    </xs:complexType>
 </xs:element>
 
 <!-- EVENT -->
 <!-- ##### -->
 <xs:element name="event">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:group ref="action-elements"/>
      </xs:choice>
      <xs:attribute name="type" use="required">
        <xs:simpleType>
          <xs:union>
            <xs:simpleType>
              <xs:restriction base="xs:string"/>
            </xs:simpleType>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="node-enter"/>
                <xs:enumeration value="node-leave"/>
                <xs:enumeration value="process-start"/>
                <xs:enumeration value="process-end"/>
                <xs:enumeration value="task-create"/>
                <xs:enumeration value="task-assign"/>
                <xs:enumeration value="task-start"/>
                <xs:enumeration value="task-end"/>
                <xs:enumeration value="before-signal"/>
                <xs:enumeration value="after-signal"/>
                <xs:enumeration value="superstate-enter"/>
                <xs:enumeration value="superstate-leave"/>
                <xs:enumeration value="timer-create"/>
                <xs:enumeration value="subprocess-created"/>
                <xs:enumeration value="subprocess-end"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:union>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
 </xs:element>
 
 <!-- EXCEPTION-HANDLER -->
 <!-- ################# -->
 <xs:element name="exception-handler">
    <xs:complexType>
      <xs:choice minOccurs="1" maxOccurs="unbounded">
        <xs:element ref="action"/>
        <xs:element ref="script"/>
      </xs:choice>
      <xs:attribute name="exception-class" type="xs:string"/>
    </xs:complexType>
 </xs:element>
 
 <!-- TASK -->
 <!-- #### -->
 <xs:element name="task">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="assignment"/>
        <xs:element ref="controller"/>
        <xs:element ref="event"/>
        <xs:element ref="timer"/>
      </xs:choice>
      <xs:attribute name="name" type="xs:string" />
      <xs:attribute name="blocking" type="booleanType" default="false"/>
      <xs:attribute name="signalling" type="booleanType" default="true"/>
      <xs:attribute name="description" type="xs:string" />
      <xs:attribute name="duedate" type="xs:string" />
      <xs:attribute name="swimlane" type="xs:string" />
      <xs:attribute name="priority" type="priorityType" default="normal" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="controller" type="delegation" />
 
 <xs:element name="assignment">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="delegation">
          <xs:attribute name="expression" type="xs:string" />
          <xs:attribute name="actor-id" type="xs:string" />
          <xs:attribute name="pooled-actors" type="xs:string" />
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
 </xs:element>
 
 <!-- TIMER -->
 <!-- ##### -->
 <xs:element name="timer">
    <xs:complexType>
      <xs:choice>
        <xs:element ref="action"/>
        <xs:element ref="script"/>
      </xs:choice>
      <xs:attribute name="duedate" type="xs:string" use="required" />
      <xs:attribute name="name" type="xs:string" />
      <xs:attribute name="repeat" type="xs:string" />
      <xs:attribute name="transition" type="xs:string" />
    </xs:complexType>
 </xs:element>
 
 <xs:element name="variable">
    <xs:complexType>
      <xs:sequence>
        <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
      </xs:sequence>
      <xs:attribute name="name" type="xs:string" use="required"/>
      <xs:attribute name="access" type="xs:string" default="read,write"/>
      <xs:attribute name="mapped-name" type="xs:string" />
    </xs:complexType>
 </xs:element>
 
 <!-- TYPES AND GROUPS -->
 <!-- ################ -->
 <xs:complexType name="delegation" mixed="true">
    <xs:sequence>
      <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="class" type="xs:string" />
    <xs:attribute name="config-type" default="field">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="field"/>
          <xs:enumeration value="bean"/>
          <xs:enumeration value="constructor"/>
          <xs:enumeration value="configuration-property"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
 </xs:complexType>
 
 <xs:simpleType name="configType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="field"/>
      <xs:enumeration value="bean"/>
      <xs:enumeration value="constructor"/>
      <xs:enumeration value="configuration-property"/>
    </xs:restriction>
 </xs:simpleType>
 
 <xs:simpleType name="booleanType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="yes"/>
      <xs:enumeration value="no"/>
      <xs:enumeration value="true"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value="on"/>
      <xs:enumeration value="off"/>
    </xs:restriction>
 </xs:simpleType>
 
 <xs:simpleType name="priorityType">
    <xs:union>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="highest"/>
          <xs:enumeration value="high"/>
          <xs:enumeration value="normal"/>
          <xs:enumeration value="low"/>
          <xs:enumeration value="lowest"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:int"/>
      </xs:simpleType>
    </xs:union>
 </xs:simpleType>
 
 <xs:group name="node-elements">
    <xs:choice>
      <xs:element ref="node"/>
      <xs:element ref="state"/>
      <xs:element ref="task-node"/>
      <xs:element ref="super-state"/>
      <xs:element ref="process-state"/>
      <xs:element ref="fork"/>
      <xs:element ref="join"/>
      <xs:element ref="decision"/>
      <xs:element ref="end-state"/>
    </xs:choice>
 </xs:group>
 
 <xs:group name="action-elements">
    <xs:choice>
      <xs:element ref="action"/>
      <xs:element ref="script"/>
      <xs:element ref="create-timer"/>
      <xs:element ref="cancel-timer"/>
    </xs:choice>
 </xs:group>
 
 <xs:group name="node-content-elements">
    <xs:choice>
      <xs:element ref="event"/>
      <xs:element ref="exception-handler"/>
      <xs:element ref="timer"/>
      <xs:element ref="transition"/>
    </xs:choice>
 </xs:group>
</xs:schema>
 
16.4.2. process-definition业务程序定义(根节点)
Table 16.1. 
Name
属性,子元素是等价的
Type
Multiplicity
Description
name
Attribute
属性
Optional 可以无名,版本-1
the name of the process
业务程序定义的名字
swimlane 泳道
泳道,表示业务程序的角色,用在任务分派中。
Element 元素
[0..*]
0 个或多个
the swimlanes used in this process. The swimlanes represent process roles and they are used for task assignments.
 
element
[0..1]
0 个或1个
the start state of the process. Note that a process without a start-state is valid 有效的, but cannot be executed.但不能执行
element
[0..*]
任意
the nodes of the process definition. Note that a process without nodes is valid, but cannot be executed. 注意:一个业务程序没有节点是正确的,但不能被执行。
event 事件
process-start 业务程序实例开始
process-end 业务程序实例结束
< event type = " process-start " >
      < action name = "action1" ></ action >
   </ event >
Element 元素
[0..*]
多个
the process events that serve as a container for actions
是动作的容器。
这些是全局定义的动作,脚本,创建定时器,取消定时器。它们必须有名字。可以被事件或转向所引用—通过名字。
element
[0..*]
global defined actions that can be referenced from events and transitions. Note that these actions must specify a name in order to be referenced.
 
task 任务
全局定义的任务,能够被在Action等中使用。
element
[0..*]
global defined tasks that can be used in e.g. actions.
exception-handler 异常处理器
一个异常处理器列表,用于处理所有在这个业务程序定义中被委派类抛出的异常。
element
[0..*]
a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process definition.
16.4.3 . node 节点
Table 16.2. 
Name
Type
Multiplicity
Description
一个定制的Action,代表这个节点的行为。
element
1
a custom action that represents the behaviour for this node
公共节点元素
 
 
16.4.4 . common node elements 公共节点元素
Table 16.3. 
Name
Type
Multiplicity
Description
Name 节点名
attribute
required
the name of the node
Async 异步
attribute
{ true | false }, false is the default
If set to true, this node will be executed asynchronously. See also Chapter 13, Asynchronous continuations
transition 转向
每一个离开转向,离开一个节点,都必须有一个明确的名字。只有一个离开转向,可以没有名字。第一个指定的转向是默认执行的转向。
element
[0..*]
the leaving transitions. Each transition leaving a node *must* have a distinct name. A maximum of one of the leaving transitions is allowed to have no name. The first transition that is specifed is called the default transition. The default transition is taken when the node is left without specifying a transition.
event 事件
支持事件类型:进入节点,离开节点
element
[0..*]
supported event types: {node-enter|node-leave}
element
[0..*]
a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process node.
timer 定时器
监控这个节点的执行
element
[0..*]
specifies a timer that monitors the duration of an execution in this node.
16.4.5 . start-state 开始状态
Table 16.4.
1,task 例子
< process-definition
  xmlns = ""  name = "holidayrequest" >
   < swimlane name = "initiator" ></ swimlane >
   < swimlane name = "holidayManager" ></ swimlane >
 
   < start-state name = "enter request" >
// 这个任务1,捕获业务程序的发起者。
//2 ,在业务程序变量上创建并填写数据。
//3 ,在界面上,这个任务应该是一个表单。
//4 ,不能回到开始状态;也不能离开结束状态。这是规则!
      < task name = "request entry" swimlane = "initiator" >
         < controller >
             < variable name = "start date" access = "read,write,required" ></ variable >
            < variable name = "duration" access = "read,write,required" ></ variable >
         </ controller >
      </ task >
      < transition name = "" to = "evaluate request" ></ transition >
   </ start-state >  
Name
Type
Multiplicity
Description
name
attribute
optional
the name of the node
task 任务
这个任务开始一个新的业务程序的实例,或者捕获业务程序的发起者。
element
[0..1]
0 或1个任务。
有特殊的用途。
the task to start a new instance for this process or to capture the process initiator. See Section 11.7, “Swimlane in start task”
event 事件
开始状态只有节点离开事件,没有节点进入事件。因为不能进入开始状态。
element
[0..*]
supported event types: {node-leave}
transition 转向
每一个离开转向必须有一个目标节点的名字
element
[0..*]
the leaving transitions. Each transition leaving a node *must* have a distinct name.
异常处理器
它们能够处理所有这个节点中的委派类抛出的异常
element
[0..*]
a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process node.
16.4.6 . end-state
Table 16.5. 
Name
Type
Multiplicity
Description
name
attribute
required
the name of the end-state
event 事件
只有节点进入事件可用,因为无法离开。
element
[0..*]
supported event types: {node-enter}
处理这个节点中所有的Java处理类抛出的异常。
element
[0..*]
a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process node.
16.4.7 . state 等待状态
Table 16.6. 
Name
Type
Multiplicity
Description
 
 
16.4.8 . task-node 任务节点
任务,也类似于条件。 只是任务是用户参与的。条件是自动的。条件有true,false。任务有完成、未完成。
Table 16.7. 
Name
Type
Multiplicity
Description
Signal 信号
默认是last。就是全部任务完成后,执行默认转向
Attribute 属性
optional
{unsynchronized 异步|never从不|first第一个任务|first-wait|last全部任务|last-wait}, default is last. signal specifies the effect of task completion on the process execution continuation.
create-tasks
创建任务实例
默认是true。在执行任务节点时,创建任务节点的所有任务。也可以设为false。这样,你可以在运行时决定创建哪些任务实例。
此时,你可以在node-enter事件的处理ActionHandler中创建任务。当然,你也必须把create-tasks=”false”
attribute
optional
{yes|no|true|false}, default is true. can be set to false when a runtime calculation has to determine which of the tasks have to be created. in that case, add an action on node-enter, create the tasks in the action and set create-tasks to false.
end-tasks 结束任务实例
默认false。如果设为true,离开该节点时,如果任务还没有结束,就关掉所有没关掉的任务实例。
attribute
optional
{yes|no|true|false}, default is false. In case remove-tasks is set to true, on node-leave, all the tasks that are still open are ended.
task 任务
当业务程序实例的执行进入该节点时,这些任务的实例会被创建
element
[0..*] 多个
the tasks that should be created when execution arrives in this task node.
 
 
16.4.9 . process-state 业务程序实例状态
这个节点代表一个业务程序。执行到这里以后,通过在 process-state实例上配置子业务程序实例。就会先执行子业务程序实例,子业务程序实例执行完之后,才会继续执行父业务程序实例。
Table 16.8. 
Name
Type
Multiplicity
多样性
Description 描述
子业务程序,指定这个节点代表的子业务程序的定义(这样就不用在运行时指定实例了)
element
1
the sub process that is associated with this node
variable 变量
指定数据从父业务程序实例的RootToken到子业务程序的RootToken中,这会从子业务程序实例的生命周期。最后子业务程序实例结束时,会把变量传回并覆盖父业务程序的变量
element
[0..*]
specifies how data should be copied from the super process to the sub process at the start and from the sub process to the super process upon completion of the sub process.
 
 
16.4.10 . super-state 节点组
超级节点是节点组。用来包括其他子节点。仅仅是一个容器。进入这个节点组,实际会进入它内部的第一个节点。内部当然不能有start-state。
Table 16.9. 
Name
Type
Multiplicity
Description
element
[0..*]
the nodes of the superstate. superstates can be nested.
 
 
16.4.11 . fork 分支
业务程序的执行分为多路并行。仅仅是标记
Table 16.10. 
Name
Type
Multiplicity
Description
 
 
16.4.12 . join 联接
业务程序的执行在这里合并。仅仅是标记。Fork-join必须成对使用。
Table 16.11. 
Name
Type
Multiplicity
Description
 
 
16.4.13 . decision 决定
根据各个transition转向的条件,决定执行哪一个转向。是遇到第一个true的转向就执行。
如果没有条件是真的转向,那么就会执行默认转向(第一个)!
    所以decision和Node一样,是即时状态,不会停下来让参与者决定。
public interface DecisionHandler extends Serializable {
 
 String decide(ExecutionContext executionContext) throws Exception;
返回值,是离开转向的String类型名字!
也就是说,决定
}
进入Decision节点的execute方法之后,
1 ,首先看有没有指定handler。如果有,就得到DecisionHandler返回的转向名。执行该transition。
2 ,看有没有EL决定表达式.如有,执行返回的转向。
3,计算每一个transition带的EL条件表达式。直到有一个转向为true。就执行该转向!
Table 16.12. 
Name
Type
Multiplicity 多样性
Description
handler 处理器
只需要一个就够了。因为它返回决定采用的transition的名字
(2中用法:
1 ,指定DecisionHandler的实现类
2 ,EL表达式)
element
either a 'handler' element or conditions on the transitions should be specified
转向们应该指定一个处理器或者若干个条件
the name of a org.jbpm.jpdl.Def.DecisionHandler implementation
转向
decision 的转向能够使用条件。Decision将使用第一个条件=true的转向。没有条件的转向是true。
element
[0..*] 多个
the leaving transitions. The leaving transitions of a decision can be extended with a condition. The decision will look for the first transition for which the condition evaluates to true. A transition without a condition is considered to evaluate to true (to model the 'otherwise' branch). See the condition element
 
 
16.4.14 . event 事件
Table 16.13. 
Name
Type
Multiplicity
Description
Type 类型(事件的类型)
 
attribute
required
the event type that is expressed relative to the element on which the event is placed
响应这个事件的动作类型:ActionHandler,脚本(BeanShell脚本,不是条件的EL表达式),创建定时器,取消定时器
element
[0..*]
the list of actions that should be executed on this event
16.4.15 . transition 转向
Table 16.14. 
Name
Type
Multiplicity
Description
Name 转向的名字
注意:每一个转向必须有一个目标名字。
attribute
Optional
可选
the name of the transition. Note that each transition leaving a node *must* have a distinct name.
To 目标节点的名字
目标节点的等级名。节点的名字根据节点的作用域而来。类似于目录结构的命名规则。
如:
<state name="preparation">
    <transition to="phase one/invite murphy"/>
 </state>
 <super-state name="phase one">
    <state name="invite murphy"/>
 </super-state>
或:
<super-state name="phase one">
    <state name="preparation">
      <transition to="../phase two/invite murphy"/>
    </state>
 </super-state>
 <super-state name="phase two">
    <state name="invite murphy"/>
 </super-state>
 
attribute
required
the hierarchical name of the destination node. For more information about hierarchical names, see Section 9.6.3, “Hierarchical names”
在执行这个转向时执行的动作。因为transition不像Node那样本身有execute方法,必须通过动作来执行操作。
element
[0..*]
多个
the actions to be executed upon taking this transition. Note that the actions of a transition do not need to be put in an event (because there is only one)
element
[0..*]
a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process node.
16.4.16 . action 动作
Table 16.15. 
Name
Type
Multiplicity
Description
Name 名字
有名字的动作,可以被在业务程序定义中寻找。
attribute
Optional
可选
the name of the action. When actions are given names, they can be looked up from the process definition. This can be useful for runtime actions and declaring actions only once.
Class 全类名
(action需要3者之一:全类名class,引用名ref-name,表达式)
attibute
either, a ref-name or an expression
the fully qualified class name of the class that implements the org.jbpm.graph.def.ActionHandler interface.
ref-name 引用名
引用的动作的名字(让被引用的action处理)
attibute
either this or class
the name of the referenced action. The content of this action is not processed further if a referenced action is specified.
Expression 表达式
类EL表达式指定方法
attibute
either this, a class or a ref-name
A jPDL expression that resolves to a method. See also Section 16.3, “Expressions”
accept-propagated-events 接受传播事件
默认true。如果为false,那么action将仅仅在事件激发这个Action时执行。(事件会从低层次向高层次传递,直到process-definition。)同一个事件不会再被上层的action处理。即,事件在这个Action被销毁!
attribute
optional
{yes|no|true|false}. Default is yes|true. If set to false, the action will only be executed on events that were fired on this action's element. for more information, see Section 9.5.4, “Event propagation”
config-type 配置类型
指定ActionHandler的实现类的对象应该怎样生成。其中的内容元素应该怎样用到action对象中。
attribute
optional
{field|bean|constructor|configuration-property}. Specifies how the action-object should be constructed and how the content of this element should be used as configuration information for that action-object.
Async 异步
默认false。即,动作将在执行线程中同步执行。如果设为true,将发送执行这个action的消息到命令执行器,命令执行器将在一个独立的事务中同时/异步执行这个action。(处于业务程序实例主执行线程之外的线程中)
attibute
{true|false}
Default is false, which means that the action is executed in the thread of the execution. If set to true, a message will be sent to the command executor and that component will execute the action asynchonously in a separate transaction.
  动作的内容应该作为你的ActionHandler实现类的配置信息。传递数据给ActionHandler实现类的对象。这允许你通过配置重用对象和组装对象。
{content}
Optional
可选
the content of the action can be used as configuration information for your custom action implementations. This allows the creation of reusable delegation classes. For more about delegation configuration, see Section 16.2.3, “Configuration of delegations”.
16.4.17 . script 脚本(BeanShell)
Table 16.16. 
Name
Type
Multiplicity
Description
Name 脚本类型的动作的名字
有名字的脚本,可被查找。 (action的ref-name)
attribute
optional
the name of the script-action. When actions are given names, they can be looked up from the process definition. This can be useful for runtime actions and declaring actions only once.
accept-propagated-events
接受传播事件
attribute
optional [0..*]
{yes|no|true|false}. Default is yes|true. If set to false, the action will only be executed on events that were fired on this action's element. for more information, see Section 9.5.4, “Event propagation”
expression 表达式
beanshell 脚本。
如果没有指定variable脚本变量,那么你可以在表达式中使用当前Token(根Token,有fork-join,就有多条子token)的所有变量。也能够直接作为script的文本内容写表达式。不需要作为expression元素指定表达式
element
[0..1]
0 或1个
the beanshell script. If you don't specify variable elements, you can write the expression as the content of the script element (omitting the expression element tag).
variable 脚本变量
如果不指定脚本变量,那么就会把当前Token上的所有变量都引进来,可以被表达式使用!如果指定了变量,那么在表达式中只能使用当前指定的这几个变量。
element
[0..*]
多个
in variable for the script. If no in variables are specified, all the variables of the current token will be loaded into the script evaluation. Use the in variables if you want to limit the number of variables loaded into the script evaluation.
16.4.18 . expression 表达式(beanshell脚本)
Table 16.17. 
Name
Type
Multiplicity
Description
 
{content}
 
a bean shell script.
16.4.19 . variable 变量
当前token的变量
< task name = "WriteNews" >
         < controller >
            < variable name = "infoId" access = "read,write,required" ></ variable >
            < variable name = "infoTitle" access = "read,write,required" ></ variable >
            < variable name = "infoContent" ></ variable >
            < variable name = "infoWriterId" ></ variable >
            < variable name = "infoWritedTime" ></ variable >
         </ controller >
         < assignment class = "com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler" ></ assignment >
      </ task >
Table 16.18. 
Name
Type
Multiplicity
Description
Name 名字
业务程序变量(实际在各个token上,用当前token的)的名字
attribute
required
the process variable name
Access 访问权
默认是:read,write。使用,分割。
read,write,required
attribute
optional
default is read,write. It is a comma separated list of access specifiers. The only access specifiers used so far are read, write and required.
mapped-name 映射名
默认使用变量名。这指定变量名的一个别名。别名的意思,依赖于 variable 元素用在哪里。如果在script内,这是beanshell脚本变量的名字。任务的控制器内,这是任务参数的标签。如果在process-state内,这是子业务程序实例内的变量名。
attribute
optional
this defaults to the variable name. it specifies a name to which the variable name is mapped. the meaning of the mapped-name is dependent on the context in which this element is used. for a script, this will be the script-variable-name. for a task controller, this will be the label of the task form parameter and for a process-state, this will be the variable name used in the sub-process.
16.4.20 . handler 处理器
用于decision,
1,DecisionHandler
2,和DecisionHandler的作用一样。用EL表达式算出应该执行哪一个转向。
Table 16.19. 
Name
Type
Multiplicity
Description
Expression
jPDL 的EL表达式
返回的结果使用toString转换为一个String。应该是一个transition的名字。
attibute
either this or a class
A jPDL expression. The returned result is transformed to a string with the toString() method. The resulting string should match one of the leaving transitions. See also Section 16.3, “Expressions”.
Class 类名
如果使用DecisionHandler而不是EL表达式。
attibute
either this or ref-name
the fully qualified class name of the class that implements the org.jbpm.graph.node.DecisionHandler interface.
config-type 配置类型
(和ActionHandler中一样)
attribute
optional
{field|bean|constructor|configuration-property}. Specifies how the action-object should be constructed and how the content of this element should be used as configuration information for that action-object.
 
{content}
optional
the content of the handler can be used as configuration information for your custom handler implementations. This allows the creation of reusable delegation classes. For more about delegation configuration, see Section 16.2.3, “Configuration of delegations”.
16.4.21 . timer 定时器
< task swimlane = "salesman" >
      < timer duedate = "20 seconds" repeat = "10 seconds" >
        < action class = "org.jbpm.websale.RemindActor" >
          < swimlaneName > salesman </ swimlaneName >
        </ action >
      </ timer >
      < controller >
        < variable name = "item" access = "read" />
        < variable name = "quantity" access = "read" />
        < variable name = "address" access = "read" />
        < variable name = "comment" />
      </ controller >     </ task >
Table 16.20. 
Name
Type
Multiplicity
Description
Name 定时器的名字
如果不定义,就用所属节点的名字。
注意:每个定时器应该有唯一的名字。
attribute
optional
the name of the timer. If no name is specified, the name of the enclosing node is taken. Note that every timer should have a unique name.
Duedate 期间(定时器启动到首次执行的时间)
指定创建定时器和执行定时器之间的时间间隔。
 
attribute
required
the duration (optionally expressed in business hours) that specifies the time period between the creation of the timer and the execution of the timer. See Section 14.1, “Duration” for the syntax.
Repeat 重复(重复执行的间隔)
定时器执行之后,指定离开节点之前,定时器重复执行多少时间。
如果指定”yes””true”,则重复的间隔和启动定时期到执行的间隔duedate一样。
attribute
optional
{duration | 'yes' | 'true'}after a timer has been executed on the duedate, 'repeat' optionally specifies duration between repeating timer executions until the node is left. If yes or true is specified, the same duration as for the due date is taken for the repeat. See Section 14.1, “Duration” for the syntax.
Transition 转向
激发定时器事件或者执行action之后,执行指定名字的转向。
attribute
optional
a transition-name to be taken when the timer executes, after firing the timer event and executing the action (if any).
cancel-event 取消(定时器)(任务)事件
仅用于任务中的定时器。它指定哪个事件发生时,定时器应该被取消。默认是task-end事件。即,定时器所属的任务结束时,任务内的定时器会取消。
但你也能指定为task-assign,task-start。能够使用,给定多个取消定时器事件。
attribute
optional
this attribute is only to be used in timers of tasks. it specifies the event on which the timer should be cancelled. by default, this is the task-end event, but it can be set to e.g. task-assign or task-start. The cancel-event types can be combined by specifying them in a comma separated list in the attribute.
只有一个定时器激发的动作
element
[0..1]
0 或1个
an action that should be executed when this timer fires
16.4.22 . create-timer 创建定时器
Table 16.21. 
Name
Type
Multiplicity
Description
Name 定时器的名字
attribute
optional
the name of the timer. The name can be used for cancelling the timer with a cancel-timer action.
Duedate 延期时间
创建定时器和执行定时器的时间间隔
attribute
required
the duration (optionally expressed in business hours) that specifies the the time period between the creation of the timer and the execution of the timer. See Section 14.1, “Duration” for the syntax.
Repeat 重复执行周期
如:yew/true,和延期时间相同。直到定时器取消(默认是离开该节点)
attribute
optional
{duration | 'yes' | 'true'}after a timer has been executed on the duedate, 'repeat' optionally specifies duration between repeating timer executions until the node is left. If yes of true is specified, the same duration as for the due date is taken for the repeat. See Section 14.1, “Duration” for the syntax.
Transition 转向
定时器事件激发或者执行了定时器的动作之后,执行的转向
attribute
optional
a transition-name to be taken when the timer executes, after firing the the timer event and executing the action (if any).
16.4.23 . cancel-timer 取消定时器
Table 16.22. 
Name
Type
Multiplicity
Description
Name 被取消的定时器的名字
attribute
optional
the name of the timer to be cancelled.
16.4.24 . task 任务
Table 16.23. 
Name
Type
Multiplicity
Description
Name 任务名字
attribute
optional
the name of the task. Named tasks can be referenced and looked up via the TaskMgmtDefinition
Blocking 铁板一块?
默认false。如果为true,那么任务完成之后,才能离开节点。False,允许用户通过signal继续执行和离开节点。
attribute
optional
{yes|no|true|false}, default is false. If blocking is set to true, the node cannot be left when the task is not finished. If set to false (default) a signal on the token is allowed to continue execution and leave the node. The default is set to false, because blocking is normally forced by the user interface.
Signalling 有信号功能
默认true,task能够通过end(transition)离开任务节点。
attribute
optional
{yes|no|true|false}, default is true. If signalling is set to false, this task will never have the capability of trigering the continuation of the token.
Duedate 延迟时间(任务执行的的延迟时间)
attribute
optional
is a duration expressed in absolute or business hours as explained in Chapter 14, Business calendar
Swimlane 泳道
指向一个泳道的名字。如果一个泳道指定在任务上,那么任务分派assignment将会被忽略!
(泳道也有assignment任务分派
attribute
optional
reference to a swimlane. If a swimlane is specified on a task, the assignment is ignored.
Priority 优先权
attribute
optional
one of {highest, high, normal, low, lowest}. alternatively, any integer number can be specified for the priority. FYI: (highest=1, lowest=5)
assignment 任务分派
使用EL表达式或AssignmentHandler来分配任务。优先级低于swimlane
element
optional
describes a delegation that will assign the task to an actor when the task is created.
event 事件
task-assign 任务分派事件,我们已经在TaskInstance中增加了previousActorId属性。表示原来的参与者
element
[0..*]
supported event types: {task-create|task-start|task-assign|task-end}. Especially for the task-assign we have added a non-persisted property previousActorId to the TaskInstance
element
[0..*]
a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process node.
element
[0..*]
specifies a timer that monitors the duration of an execution in this task. special for task timers, the cancel-event can be specified. by default the cancel-event is task-end, but it can be customized to e.g. task-assign or task-start.
controller 控制器
指定业务程序变量怎样传进任务变量。任务变量从GUI中由用户指定值。
element
[0..1]
specifies how the process variables are transformed into task form parameters. the task form paramaters are used by the user interface to render a task form to the user.
16.4.25 . swimlane 泳道
Swimlane泳道,仅仅是 assignment 任务分派的一个代表。
一般放在顶层,供任务去引用!
< process-definition name = "websale"
                    xmlns = "urn:jbpm.org:jpdl-3.1" >
 
  <!-- SWIMLANES (= process roles) -->
// 如果没有指定 assignment ,应该是任意人都可以!
  < swimlane name = "buyer" />
 
  < swimlane name = "salesman" >
    < assignment expression = "user(ernie)" />
  </ swimlane >
 
  < swimlane name = "accountant" >
    < assignment expression = "user(bert)" />
  </ swimlane >
 
  < swimlane name = "shipper" >
    < assignment expression = "user(grover)" />
  </ swimlane >
Table 16.24. 
Name
Type
Multiplicity
Description
Name 名字
attribute
required
the name of the swimlane. Swimlanes can be referenced and looked up via the TaskMgmtDefinition
assignment 任务分配
指定这个泳道的任务分配器。它会在泳道的任务实例第一次被创建时执行。
element
[1..1]
必须且只有一个(但也有不指定的例子。应该是指所有人都可以)
specifies a the assignment of this swimlane. the assignment will be performed when the first task instance is created in this swimlane.
16.4.26 . assignment (任务)分派
jBPM身份组件表达式(jBPM identity component expressions)
Table 16.25. 
Name
Type
Multiplicity
Description
Expression
表达式
由于历史原因,它不是一个jPDL版EL表达式。相反,它是jBPM的身份组建的一个分配表达式。注意:这个实现依赖于jbpm身份组件。如果你不使用jBPM的身份组件,那么就不能使用它!
attribute
optional
For historical reasons, this attribute expression does not refer to the jPDL expression, but instead, it is an assignment expression for the jBPM identity component. For more information on how to write jBPM identity component expressions, see Section 11.11.2, “Assignment expressions”. Note that this implementation has a dependency on the jbpm identity component.
actor-id
参与者id
这是一个beanshell表达式。属性或方法返回一个String
 
attribute
optional
An actorId. Can be used in conjunction with pooled-actors. The actor-id is resolved as an expression. So you can refer to a fixed actorId like this actor-id="bobthebuilder". Or you can refer to a property or method that returns a String like this: actor-id="myVar.actorId", which will invoke the getActorId method on the task instance variable "myVar".
pooled-actors
参与者池。也是beanshell表达式。属性或方法返回一个String[],集合,或者,分割的参与者池的列表
attribute
optional
A comma separated list of actorIds. Can be used in conjunction with actor-id. A fixed set of pooled actors can be specified like this: pooled-actors="chicagobulls, pointersisters". The pooled-actors will be resolved as an expression. So you can also refer to a property or method that has to return, a String[], a Collection or a comma separated list of pooled actors.
Class 全类名
attribute
optional
the fully qualified classname of an implementation of org.jbpm.taskmgmt.def.AssignmentHandler
config-type 配置类型
attribute
optional
{field|bean|constructor|configuration-property}. Specifies how the assignment-handler-object should be constructed and how the content of this element should be used as configuration information for that assignment-handler-object.
 
{content}
optional
the content of the assignment-element can be used as configuration information for your AssignmentHandler implementations. This allows the creation of reusable delegation classes. for more about delegation configuration, see Section 16.2.3, “Configuration of delegations”.
16.4.27 . controller 控制器
public interface TaskControllerHandler extends Serializable {
// 初始化任务实例变量
提取业务程序变量的所有信息,初始化任务实例变量
  void initializeTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token);
 // 提交任务实例变量
当任务完成时,被调用!
  void submitTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token);
 
}
< controller >
            < variable name = "infoId" access = "read" ></ variable >
            < variable name = "infoTitle" access = "read" ></ variable >
            < variable name = "infoContent" access = "read" ></ variable >
            < variable name = "infoWriterId" access = "read" ></ variable >
            < variable name = "infoWritedTime" access = "read" ></ variable >
            < variable name = "checkInfo" ></ variable >
            < variable name = "passed" access = "read,write,required" ></ variable >
            < variable name = "infoCheckerId" access = "read,write,required" ></ variable >
         </ controller >
Table 16.26. 
Name
Type
Multiplicity
Description
Class 全类名
attribute
Optional
可选
the fully qualified classname of an implementation of org.jbpm.taskmgmt.def.TaskControllerHandler
config-type 配置类型
attribute
optional
{field|bean|constructor|configuration-property}. Specifies how the assignment-handler-object should be constructed and how the content of this element should be used as configuration information for that assignment-handler-object.
 
{content}
 
either the content of the controller is the configuration of the specified task controller handler (if the class attribute is specified. if no task controller handler is specified, the content must be a list of variable elements.
variable 任务变量
如果没有指定class属性,controller元素的内容必须是一些任务变量。Task中将可以使用它们。
element
[0..*]
in case no task controller handler is specified by the class attribute, the content of the controller element must be a list of variables.
16.4.28 . sub-process 子业务程序
Process-state中指定指向的子业务程序定义
Table 16.27. 
Name
Type
Multiplicity
Description
Name 子业务程序定义的名字
attribute
required
the name of the sub process. To know how you can test subprocesses, see Section 18.3, “Testing sub processes”
Version 版本
默认为最新版
attribute
optional
the version of the sub process. If no version is specified, the latest version of the given process will be taken.
16.4.29 . condition 条件
Decision节点的transition的条件,为true,就执行该transition。
Table 16.28. 
Name
Type
Multiplicity
Description
 
{content} or attribute expression
内容,或者属性EL表达式。
条件元素的内容是jPDL的EL表达式,返回true/false。
Decision 将执行第一个表达式值为true的转向(次序依照processdefinition.xml中出现的先后顺序)。如果没有条件是真的转向,那么就会执行默认转向(第一个)
required
The contents of the condition element is a jPDL expression that should evaluate to a boolean. A decision takes the first transition (as ordered in the processdefinition.xml) for which the expression resolves to true. If none of the conditions resolve to true, the default leaving transition (== the first one) will be taken.
16.4.30 . exception-handler 异常处理器
Table 16.29. 
Name
Type
Multiplicity
Description
exception-class
异常类
指定要处理的可抛出(异常)类的全类名。如果不指定,那么就可以处理所有节点中ActionHandler等抛出的异常。
attribute
Optional
可选
specifies the fully qualified name of the java throwable class that should match this exception handler. If this attribute is not specified, it matches all exceptions (java.lang.Throwable).
action 动作
当异常处理器处理异常时,执行的动作。
element
[1..*]
1 或多
a list of actions to be executed when an exception is being handled by this exception handler.
 

转载于:https://www.cnblogs.com/armlinux/archive/2006/10/13/2391068.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值