1.4.2 Detailed process modeling (详细的流程建模)
Although a book ordering process may seem simple at first hand, when looking at it in more detail a lot of process logic is needed. In this section we’ll focus on detailing the process payment task by adding validation and error handling logic. This also means we’ll need BPMN 2.0 constructs that are part of the descriptive or level 2 palette. In figure 1.8 the subprocess process payment is shown, which is a more detailed model of the process payment task of figure 1.7.
尽管订书流程也许直接看起来很简单,但是当深入观察时,发现需要添加更多的流程逻辑。本节通过增加验证和错误处理逻辑,我们将关注详细的支付任务流程。这也意味着我们将需要描述性部分或者水平2调色板的BPMN 2.0构件。在图1.8显示了支付流程的子流程。它是图1.7中描述的支付流程的详细模型。
Figure 1.8 The extracted process payment subprocess from the book order process model. The subprocess shows the use of error end and start events and the use of terminate end event.
图 1.8 从订书流程模型摘取的支付子流程。子流程显示了错误和开始事件的使用和终止结束事件的使用。
As you can see we use a number of additional BPMN 2.0 constructs in the process model of figure 1.8. So let’s first look at these extra element definitions in table 1.2.
正如你所见,我们使用了图1.8流程模型的额外的BPMN 2.0构件。所以让我们来看看表1.2中那些另外的元素定义。
Table 1.2 Overview of the additional BPMN 2.0 constructs used in figure 1.8.
表1.2 图1.8中使用的额外的BPMN 2.0构件的描述
BPMN 2.0 icon |
BPMN 2.0 name
|
Description |
|
Message start event
消息开始事件
|
A message start event is a more specific type of start event. The meaning is that the process is
triggered by an external signal, in this case a customer book order request.
消息开始事件是开始事件的特例。它的意义是流程由外部信号所触发,本例是客户订书请求。
|
|
Error end event
错误结束事件
|
An error end event is a specific kind of end event, which can be used to throw an error inside the process model definition.
错误结束事件是结束事件的特例。它能在流程模型里处理错误。
|
|
Error start event
错误开始事件
|
An error start event can be used to catch a specific error thrown by an error end event.
错误开始事件可用来捕获由错误事件抛出的错误。
|
|
Error boundary event
错误边界事件
|
An error boundary event can be used to indicate a fault on a task or a subprocess.
错误边界事件用来指示任务或子流程的故障。
|
|
Terminate end event
终止结束事件
|
A terminate end event is a special kind of end event that causes the process to be terminated. If a terminate end event is used in a subprocess it only causes the subprocess to be terminated, not the parent process.
终止结束事件是一种特殊的,导致流程终止的结束事件。如果在子流程中使用终止结束事件。它只导致子流程终止,而不是父流程。
|
|
Service task
服务任务
|
A service task is a specific type of task, which represents an automated activity. A service task can be a web service call or for example a Java class invocation.
服务任务是一种特殊的任务类型,代表自动活动。服务任务既可以Web服务调用,也可以是Java类调用。
|
|
User task
用户任务
|
A user task is a specific type of task, which represents a manual activity. A user task can be claimed and completed by a configured individual or group of users.
用户任务也是一种特殊的任务类型,人工活动。通过配置建好的个人或组用户,对任务进行领取和完成。
|
|
Subprocess
子流程
|
A subprocess is a compound activity, which can contain multiple other activities including tasks, gateways and events. A subprocess can be embedded in the parent process or be a standalone process model that can be invoked by the parent process via a call activity.
子流程是一种复合活动,它包括多个其它活动:任务,网关和事件。子流程可以嵌入到父流程中,或者是独立的流程模型。独立的流程模型能够通过调用活动(call activity)由父流程调用。
|
In figure 1.8 we made the tasks more specific by adding a type identifier. For example the check credit card task is modeled as a service task, because the validity of the credit card can be checked by invoking a web service. We also added a user task to indicate that the task has to be performed by a human. The contact customer activity is a user task, because an employee of the book store has to get in contact with the customer to solve the bad credit card problem.
在图 1.8中,通过增加类型标识符,我们让任务更加特殊。例如,将信用卡检查任务建模为服务任务。因为信用卡的有效性检查可以通过调用Web Service来执行。我们也增加一个用户任务指示它必须由人来执行。联系客户活动是一个用户任务,因为书店员工不得不联系客户来解决信用卡问题。
In the process payment subprocess shown in figure 1.8, we see a couple of other new BPMN 2.0 constructs. First note that a subprocess always starts with a start event. First the credit card information is validated by invoking an automated task. Then we check the outcome of this credit card validation with an exclusive gateway. In case the credit card validation was successful the payment is finished and the subprocess is ended.
在图1.8所示的支付流程中,我们看见一对其它的新的BPMN 2.0构件。首先注意子流程总是从开始事件开始。通过调用自动任务,首先验证信用卡信息,然后采用排他网关检查信用卡验证的结果。一旦信用卡验证成功,支付完成,那么子流程结束。
When the credit card validation didn’t succeed an error end event throws an exception. This exception is caught within the subprocess by the error start event handling the bad credit card exception. In this case the customer is contacted personally by an employee of the book store to see if the credit card information was not received in a good manner or that the customer can pay in another way. If the payment can be settled with the customer a normal end event in the exception handler is reached and the subprocess is completed by executing the finish payment service task.
当信用卡验证不成功,一个错误结束事件抛出一个异常。通过错误开始事件处理失败的信用卡异常,在子流程捕获异常。在这种情况下,书店的员工查看是否收到信用卡信息,或者客户以其它方式支付。如果是由客户来处理,将到达一个异常处理的正常结束事件。通过执行完成的支付服务任务,完成子流程。