JBPM知识点------JPDL3.1规范
?
???<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任务的其他属性是:
<action 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" 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表达式#{…}中使用!
<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属性,子元素是等价的TypeMultiplicityDescriptionnameAttribute属性Optional可以无名,版本-1the 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.?start-stateelement[0..1]0个或1个the start state of the process. Note that a process without a start-state is valid有效的, but cannot be executed.但不能执行{end-state|state|node|task-node|process-state|super-state|fork|join|decision}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是动作的容器。{action|script|create-timer|cancel-timer}这些是全局定义的动作,脚本,创建定时器,取消定时器。它们必须有名字。可以被事件或转向所引用—通过名字。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.?NameTypeMultiplicityDescription{action|script|create-timer|cancel-timer}一个定制的Action,代表这个节点的行为。element1a custom action that represents the behaviour for this nodecommon node elements公共节点元素??See common node elements16.4.4.?common node elements公共节点元素Table?16.3.?NameTypeMultiplicityDescriptionName节点名attributerequiredthe name of the nodeAsync异步attribute{ true | false }, false is the defaultIf set to true, this node will be executed asynchronously. See also Chapter?13, Asynchronous continuationstransition转向每一个离开转向,离开一个节点,都必须有一个明确的名字。只有一个离开转向,可以没有名字。第一个指定的转向是默认执行的转向。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}exception-handlerelement[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>?NameTypeMultiplicityDescriptionnameattributeoptionalthe name of the nodetask任务这个任务开始一个新的业务程序的实例,或者捕获业务程序的发起者。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.exception-handler异常处理器它们能够处理所有这个节点中的委派类抛出的异常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-stateTable?16.5.?NameTypeMultiplicityDescriptionnameattributerequiredthe name of the end-stateevent事件只有节点进入事件可用,因为无法离开。element[0..*]supported event types: {node-enter}exception-handler处理这个节点中所有的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.?NameTypeMultiplicityDescriptioncommon node elements??See common node elements16.4.8.?task-node任务节点任务,也类似于条件。 只是任务是用户参与的。条件是自动的。条件有true,false。任务有完成、未完成。Table?16.7.?NameTypeMultiplicityDescriptionSignal信号默认是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”attributeoptional{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,离开该节点时,如果任务还没有结束,就关掉所有没关掉的任务实例。attributeoptional{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.common node elements??See common node elements16.4.9.?process-state业务程序实例状态这个节点代表一个业务程序。执行到这里以后,通过在process-state实例上配置子业务程序实例。就会先执行子业务程序实例,子业务程序实例执行完之后,才会继续执行父业务程序实例。Table?16.8.?NameTypeMultiplicity多样性Description描述sub-process子业务程序,指定这个节点代表的子业务程序的定义(这样就不用在运行时指定实例了)element1the sub process that is associated with this nodevariable变量指定数据从父业务程序实例的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.common node elements??See common node elements16.4.10.?super-state节点组超级节点是节点组。用来包括其他子节点。仅仅是一个容器。进入这个节点组,实际会进入它内部的第一个节点。内部当然不能有start-state。Table?16.9.?NameTypeMultiplicityDescription{end-state|state|node|task-node|process-state|super-state|fork|join|decision}element[0..*]the nodes of the superstate. superstates can be nested.common node elements??See common node elements16.4.11.?fork分支业务程序的执行分为多路并行。仅仅是标记Table?16.10.?NameTypeMultiplicityDescriptioncommon node elements??See common node elements16.4.12.?join联接业务程序的执行在这里合并。仅仅是标记。Fork-join必须成对使用。Table?16.11.?NameTypeMultiplicityDescriptioncommon node elements??See common node elements16.4.13.?decision决定根据各个transition转向的条件,决定执行哪一个转向。是遇到第一个true的转向就执行。如果没有条件是真的转向,那么就会执行默认转向(第一个)!??? 所以decision和Node一样,是即时状态,不会停下来让参与者决定。publicinterface 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.?NameTypeMultiplicity多样性Descriptionhandler处理器只需要一个就够了。因为它返回决定采用的transition的名字(2中用法:1,指定DecisionHandler的实现类2,EL表达式)elementeither a 'handler' element or conditions on the transitions should be specified转向们应该指定一个处理器或者若干个条件the name of a org.jbpm.jpdl.Def.DecisionHandler implementationtransition转向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 elementcommon node elements??See common node elements16.4.14.?event事件Table?16.13.?NameTypeMultiplicityDescriptionType类型(事件的类型)?attributerequiredthe event type that is expressed relative to the element on which the event is placed{action|script|create-timer|cancel-timer}响应这个事件的动作类型:ActionHandler,脚本(BeanShell脚本,不是条件的EL表达式),创建定时器,取消定时器element[0..*]the list of actions that should be executed on this event16.4.15.?transition转向Table?16.14.?NameTypeMultiplicityDescriptionName转向的名字注意:每一个转向必须有一个目标名字。attributeOptional可选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>?attributerequiredthe hierarchical name of the destination node. For more information about hierarchical names, see Section?9.6.3, “Hierarchical names”{action|script|create-timer|cancel-timer}在执行这个转向时执行的动作。因为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)exception-handlerelement[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.?NameTypeMultiplicityDescriptionName名字有名字的动作,可以被在业务程序定义中寻找。attributeOptional可选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,表达式)attibuteeither, a ref-name or an expressionthe fully qualified class name of the class that implements the org.jbpm.graph.def.ActionHandler interface. ref-name引用名引用的动作的名字(让被引用的action处理)attibuteeither this or classthe name of the referenced action. The content of this action is not processed further if a referenced action is specified.Expression表达式类EL表达式指定方法attibuteeither this, a class or a ref-nameA jPDL expression that resolves to a method. See also Section?16.3, “Expressions”accept-propagated-events接受传播事件默认true。如果为false,那么action将仅仅在事件激发这个Action时执行。(事件会从低层次向高层次传递,直到process-definition。)同一个事件不会再被上层的action处理。即,事件在这个Action被销毁!attributeoptional{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对象中。attributeoptional{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.?NameTypeMultiplicityDescriptionName脚本类型的动作的名字有名字的脚本,可被查找。