jBPM Developers Guide(jBPM开发指南)--Chapter 3. BPMN 2.0(第二部分)
?
?? ?The root of an BPMN 2.0 XMLprocess is the?definitions?elements. As the name states, thesubelements will contain the actual definitions of the business process(es).Every?process?child will be able to have an?id?and?name. An empty business process inBPMN 2.0 looks as follows. Also note that it is handy to have the BPMN2.xsd onthe classpath, to enable XML completion.
?
?? ?BPMN 2.0 XML流程的根是definitions元素。子元素会则包含真正的业务流程定义。每个process子元素可以拥有一个id和name。一个空的BPMN 2.0业务流程定义如下所示。注意需要把BPMN2.xsd放在classpath下,来启用XML自动补全功能。
?
?? ?If an id is defined for aprocess element, it will be used as business key for that process (ie. startinga process can be done by calling executionService.startProcessInstanceByKey("myBusinessProcess"),otherwise the jBPM engine will create a unique process key (same mechanism asfor JPDL).
?
?
?? ?如果一个process元素定义了id,它会作为业务流程的key使用。比如,启动流程可以通过调用executionService.startProcessInstanceByKey("myBusinessProcess"),否则jBPM引擎会流程创建一个唯一key(这一点与jPDL相同)。
?
3.8.?Basic constructs(基本结构)
?
3.8.1.?Events(事件)
?
?? ?Together withactivitites and gateways, events are used in practically every businessprocess. Events allow process modelers to describe business processes in a verynatural way, such as?'Thisprocess starts when I receive a customer order',?'If the task is not finished in 2 days, terminate theprocess'?or'When Ireceive a cancel e-mail when the process is running, handle the e-mail usingthis sub-process'. Notice that typical businesses always work in avery event-driven way. People are not hard-coded sequential creatures, but theytend to react on things that happen in their environment (ie. events). In theBPMN specification, a great number of event types are described, to cover therange of possible things that might occur in context of a business.
?
?? ?活动、网关和事件几乎在每个业务流程中被使用。事件让业务流程建模者用很自然的方式描述业务流程,比如'当我接收到客户的订单时启动该流程','如果两天内任务没结束,就终止流程'?或者'当我收到一封取消邮件,当流程在运行时,使用子流程处理邮件'。注意典型的业务通常使用这种事件驱动的方式。人们不是按照一定顺序进行处理事情,而是倾向于根据在他们的环境中发生的事情(比如,事件)来进行处理。在BPMN规范中,定义了很多事件类型,为了能够覆盖可能在业务环境中出现的各种情况。
?
3.8.2.?Event: None startevent(事件:空启动事件)
?
?? ?A start eventindicates the start of process (or a subprocess). Graphically, it is visualizedas a circle with (possibly) a small icon inside. The icon specifies the actualtype of event that will trigger the process instance creation.
?
?? ?一个启动事件指示流程(或子流程)的开始。它看起来是一个圆(可能)内部有一个小图标。图标表示了事件的实际类型,将会在流程实例创建时被触发。
?
?? ?The 'none startevent' is drawn as a circle without an icon inside, which means that thetrigger is unknown or unspecified. The start activity of JPDL basically has thesame semantics. Process instances whose process definition has a 'none startevent' are created using the typical API calls on the?executionService.
?? ?
?? ?空启动事件用一个圆来表示,内部没有图标,意思是这个触发器是未知或者未指定的。这与jPDL的开始活动是一样的。 流程实例的流程定义中包含了一个空启动事件,可以使用executionService的调用创建。
?? ?
?? ?A none start eventis defined as follows. An id is required, a name is optional.
?
?? ?一个空启动事件定义如下。id是必需的,name则是可选的。
?
??
?
3.8.3.?Event: None endevent(事件:空结束事件)
?
?? ?An end event indicatesthe end of an execution path in a process instance. Graphically, it isvisualized as a circle with a thick border with (possibly) a small icon inside.The icon specifies the type of signal that is thrown when the end is reached.
?
?? ?结束事件表示流程实例中一个流程路径的结束。它看起来就是一个圆拥有厚边框(可能)内部有小图标。图标表示了流程结束的时候那种信号将会被抛出。
?
?? ?The 'none end event'is drawn as a circle with thick border with no icon inside, which means that nosignal is thrown when the execution reaches the event. The end activity in JPDLhas the same semantics as the none end event.
?
?? ?空结束用一个拥有厚边框的圆,内部没有图标来表示,这意味着当流程到达事件时,不会抛出任何信号。与jPDL中的结束事件的语义相同。
?
?? ?A none end event isdefined as follows. An id is required, a name is optional.
?
?
?? 空结束事件定义如下。id是必需的,name则是可选的。
?
?
?? ?The followingexample shows a process with only a none start and end event:
?
?
?? ?下面的例子显示了只使用空开始和结束事件的流程:
?? ?The correspondingexecutable XML for this process looks like this (omitting the?definitions?root element for clarity)?? ?
?? ?这个流程对应的可执行XML像这样(忽略声明用的definitions根元素)
?
?
?
?? ?A process instancescan now be created by calling the?startProcessInstanceXXX?operations.
?
?? ?现在可以通过调用startProcessInstanceXXX操作,创建一个流程实例。
?
?
?
?
?? ?A terminate endevent is depicted as an end event (circle with thick border), with a fullcircle as icon inside. In the following example, completing the 'task1' willend the process instance, while completing the 'task2' will only end the pathof execution which enters the end event, leaving the task1 open.
?
?? ?终止结束事件使用一个拥有厚边框的圆和内部图标为实心圆来表示。在下面的例子中,完成task1会结束流程实例,当完成task2时只会结束到达结束事件的流程路径,而task1保持为打开状态不变。
?? ?See the examplesshipped with the jBPM distribution for the unit test and XML counterpart ofthis business process.??
?? 可以参考jBPM发布包中的示例,单元测试和业务流程对应XML。
?