1.4.2 Detailed process modeling (詳細(xì)的流程建模)
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.
盡管訂書流程也許直接看起來很簡單,但是當(dāng)深入觀察時,發(fā)現(xiàn)需要添加更多的流程邏輯。本節(jié)通過增加驗(yàn)證和錯誤處理邏輯,我們將關(guān)注詳細(xì)的支付任務(wù)流程。這也意味著我們將需要描述性部分或者水平2調(diào)色板的BPMN 2.0構(gòu)件。在圖1.8顯示了支付流程的子流程。它是圖1.7中描述的支付流程的詳細(xì)模型。
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 從訂書流程模型摘取的支付子流程。子流程顯示了錯誤和開始事件的使用和終止結(jié)束事件的使用。
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構(gòu)件。所以讓我們來看看表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構(gòu)件的描述
BPMN 2.0 icon |
BPMN 2.0 name
|
Description |
![clip_image002[5] clip_image002[5]](http://www.tkk7.com/images/blogjava_net/lewhwa/Windows-Live-Writer/1b01dade415f_F7C8/clip_image002%5B5%5D_thumb_2.jpg) |
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.
消息開始事件是開始事件的特例。它的意義是流程由外部信號所觸發(fā),本例是客戶訂書請求。
|
 |
Error end event
錯誤結(jié)束事件
|
An error end event is a specific kind of end event, which can be used to throw an error inside the process model definition.
錯誤結(jié)束事件是結(jié)束事件的特例。它能在流程模型里處理錯誤。
|
 |
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.
錯誤邊界事件用來指示任務(wù)或子流程的故障。
|
 |
Terminate end event
終止結(jié)束事件
|
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.
終止結(jié)束事件是一種特殊的,導(dǎo)致流程終止的結(jié)束事件。如果在子流程中使用終止結(jié)束事件。它只導(dǎo)致子流程終止,而不是父流程。
|
![clip_image002[11] clip_image002[11]](http://www.tkk7.com/images/blogjava_net/lewhwa/Windows-Live-Writer/1b01dade415f_F7C8/clip_image002%5B11%5D_thumb.jpg) |
Service task
服務(wù)任務(wù)
|
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.
服務(wù)任務(wù)是一種特殊的任務(wù)類型,代表自動活動。服務(wù)任務(wù)既可以Web服務(wù)調(diào)用,也可以是Java類調(diào)用。
|
![clip_image002[9] clip_image002[9]](http://www.tkk7.com/images/blogjava_net/lewhwa/Windows-Live-Writer/1b01dade415f_F7C8/clip_image002%5B9%5D_thumb.jpg) |
User task
用戶任務(wù)
|
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.
用戶任務(wù)也是一種特殊的任務(wù)類型,人工活動。通過配置建好的個人或組用戶,對任務(wù)進(jìn)行領(lǐng)取和完成。
|
![clip_image002[7] clip_image002[7]](http://www.tkk7.com/images/blogjava_net/lewhwa/Windows-Live-Writer/1b01dade415f_F7C8/clip_image002%5B7%5D_thumb.jpg) |
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.
子流程是一種復(fù)合活動,它包括多個其它活動:任務(wù),網(wǎng)關(guān)和事件。子流程可以嵌入到父流程中,或者是獨(dú)立的流程模型。獨(dú)立的流程模型能夠通過調(diào)用活動(call activity)由父流程調(diào)用。
|
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中,通過增加類型標(biāo)識符,我們讓任務(wù)更加特殊。例如,將信用卡檢查任務(wù)建模為服務(wù)任務(wù)。因?yàn)樾庞每ǖ挠行詸z查可以通過調(diào)用Web Service來執(zhí)行。我們也增加一個用戶任務(wù)指示它必須由人來執(zhí)行。聯(lián)系客戶活動是一個用戶任務(wù),因?yàn)闀陠T工不得不聯(lián)系客戶來解決信用卡問題。
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構(gòu)件。首先注意子流程總是從開始事件開始。通過調(diào)用自動任務(wù),首先驗(yàn)證信用卡信息,然后采用排他網(wǎng)關(guān)檢查信用卡驗(yàn)證的結(jié)果。一旦信用卡驗(yàn)證成功,支付完成,那么子流程結(jié)束。
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.
當(dāng)信用卡驗(yàn)證不成功,一個錯誤結(jié)束事件拋出一個異常。通過錯誤開始事件處理失敗的信用卡異常,在子流程捕獲異常。在這種情況下,書店的員工查看是否收到信用卡信息,或者客戶以其它方式支付。如果是由客戶來處理,將到達(dá)一個異常處理的正常結(jié)束事件。通過執(zhí)行完成的支付服務(wù)任務(wù),完成子流程。