`
cd826
  • 浏览: 129043 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

jBPM Developers Guide(jBPM开发指南)--Chapter 3. BPMN 2.0(第二部分)

    博客分类:
  • BPMN
阅读更多

 

3.7. Process root element(流程根元素)

    The root of an BPMN 2.0 XML process is the definitions elements. As the name states, the subelements 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 in BPMN 2.0 looks as follows. Also note that it is handy to have the BPMN2.xsd on the classpath, to enable XML completion.

 

    BPMN 2.0 XML流程的根是definitions元素。子元素会则包含真正的业务流程定义。每个process子元素可以拥有一个idname。一个空的BPMN 2.0业务流程定义如下所示。注意需要把BPMN2.xsd放在classpath下,来启用XML自动补全功能。

 

<definitions id="myProcesses"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 BPMN20.xsd"
  xmlns="http://schema.omg.org/spec/BPMN/2.0" 
  typeLanguage="http://www.w3.org/2001/XMLSchema"
  expressionLanguage="http://www.w3.org/1999/XPath" 
  targetNamespace="http://jbpm.org/example/bpmn2">

  <process id="myBusinessProcess" name="My business processs"> 
  
      ...
      
  </process>
<definitions>     

    If an id is defined for a process element, it will be used as business key for that process (ie. starting a process can be done by calling executionService.startProcessInstanceByKey("myBusinessProcess"), otherwise the jBPM engine will create a unique process key (same mechanism as for JPDL).

 

 

    如果一个process元素定义了id,它会作为业务流程的key使用。比如,启动流程可以通过调用executionService.startProcessInstanceByKey("myBusinessProcess"),否则jBPM引擎会流程创建一个唯一key(这一点与jPDL相同)。

 

3.8. Basic constructs(基本结构)

 

3.8.1. Events(事件)

 

    Together with activitites and gateways, events are used in practically every business process. Events allow process modelers to describe business processes in a very natural way, such as 'This process starts when I receive a customer order', 'If the task is not finished in 2 days, terminate the process' or'When I receive a cancel e-mail when the process is running, handle the e-mail using this sub-process'. Notice that typical businesses always work in a very event-driven way. People are not hard-coded sequential creatures, but they tend to react on things that happen in their environment (ie. events). In the BPMN specification, a great number of event types are described, to cover the range of possible things that might occur in context of a business.

 

    活动、网关和事件几乎在每个业务流程中被使用。事件让业务流程建模者用很自然的方式描述业务流程,比如'当我接收到客户的订单时启动该流程''如果两天内任务没结束,就终止流程' 或者'当我收到一封取消邮件,当流程在运行时,使用子流程处理邮件'。注意典型的业务通常使用这种事件驱动的方式。人们不是按照一定顺序进行处理事情,而是倾向于根据在他们的环境中发生的事情(比如,事件)来进行处理。在BPMN规范中,定义了很多事件类型,为了能够覆盖可能在业务环境中出现的各种情况。

 

3.8.2. Event: None start event(事件:空启动事件)

 

    A start event indicates the start of process (or a subprocess). Graphically, it is visualized as a circle with (possibly) a small icon inside. The icon specifies the actual type of event that will trigger the process instance creation.

 

    一个启动事件指示流程(或子流程)的开始。它看起来是一个圆(可能)内部有一个小图标。图标表示了事件的实际类型,将会在流程实例创建时被触发。

 

    The 'none start event' is drawn as a circle without an icon inside, which means that the trigger is unknown or unspecified. The start activity of JPDL basically has the same semantics. Process instances whose process definition has a 'none start event' are created using the typical API calls on the executionService.

    

    空启动事件用一个圆来表示,内部没有图标,意思是这个触发器是未知或者未指定的。这与jPDL的开始活动是一样的。 流程实例的流程定义中包含了一个空启动事件,可以使用executionService的调用创建。

    

    A none start event is defined as follows. An id is required, a name is optional.

 

    一个空启动事件定义如下。id是必需的,name则是可选的。

 

<startEvent id="start" name="myStart" />
 

 

 

3.8.3. Event: None end event(事件:空结束事件)

 

    An end event indicates the end of an execution path in a process instance. Graphically, it is visualized 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 no signal is thrown when the execution reaches the event. The end activity in JPDL has the same semantics as the none end event.

 

    空结束用一个拥有厚边框的圆,内部没有图标来表示,这意味着当流程到达事件时,不会抛出任何信号。与jPDL中的结束事件的语义相同。

 

    A none end event is defined as follows. An id is required, a name is optional.

 

 

   空结束事件定义如下id是必需的,name则是可选的

 

<endEvent id="end" name="myEnd" />

 

    The following example shows a process with only a none start and end event:

 

 

    下面的例子显示了只使用空开始和结束事件的流程:



    The corresponding executable XML for this process looks like this (omitting the definitions root element for clarity)

    

    这个流程对应的可执行XML像这样(忽略声明用的definitions根元素)

 

<process id="noneStartEndEvent" name="BPMN2 Example none start and end event">

    <startEvent id="start" />

    <sequenceFlow id="flow1" name="fromStartToEnd"
      sourceRef="start" targetRef="end" />

    <endEvent id="end" name="End" />

  </process>        

 

 

    A process instances can now be created by calling the startProcessInstanceXXX operations.

 

    现在可以通过调用startProcessInstanceXXX操作,创建一个流程实例。

 

 

ProcessInstance processInstance = executionService.startProcessInstanceByKey("noneStartEndEvent"); 
 

 

 

3.8.4. Event: Terminate end event(事件:终止结束事件)

 

 

    The difference between a 'terminate' and a 'none' end event lies in the fact how a path of execution is treated (or a 'token' in BPMN 2.0 terminology). The 'terminate' end event will end the complete process instance, whereas the 'none' end event will only end the current path of execution. They both don't throw anything when the end event is reached.

 

    终止和空结束事件的区别是实际中流程的路径是如何处理的(或者使用BPMN 2.0的术语叫做token)。 终止结束事件会结束整个流程实例,而空结束事件只会结束当前流程路径。他们在到达结束事件的时候都不会抛出任何信息。

 

    A terminate end event is defined as follows. An id is required, a name is optional.

 

    一个终止结束事件定义如下。id是必需的,name则是可选的

 

<endEvent id="terminateEnd" name="myTerminateEnd">
  <terminateEventDefinition/>
</endEvent>

 

 

    A terminate end event is depicted as an end event (circle with thick border), with a full circle as icon inside. In the following example, completing the 'task1' will end the process instance, while completing the 'task2' will only end the path of execution which enters the end event, leaving the task1 open.

 

    终止结束事件使用一个拥有厚边框的圆和内部图标为实心圆来表示。在下面的例子中,完成task1会结束流程实例,当完成task2时只会结束到达结束事件的流程路径,而task1保持为打开状态不变。




    See the examples shipped with the jBPM distribution for the unit test and XML counterpart of this business process.

  

   可以参考jBPM发布包中的示例,单元测试和业务流程对应XML

 

  • 大小: 2.3 KB
  • 大小: 11.3 KB
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics