In this video we talk about two of the so-called resource patterns in YAWL. The first one is the four-eyes principle also known as the separation of duties. The other one is called retain familiar. Both of these patterns appear very frequently in practice. This is why they are implemented in YAWL. The attached zip file contains a complete YAWL specification to start with an a ybkp file with the users and roles.
Hello and welcome to another YAWL tutorial! Today I've brought with me the book on workflow patterns and we will talk about the four-eyes principle and also the retain familiar pattern. And they are something like two sides of the same coin. So if we look at the four-eyes principle in the book - it is also called separation of duties - it says "the ability to specify that two tasks must be executed by different resources in any given case". This four-eyes principle is often applied when we have something like payments for example. You do not want that only one person is issuing the payment but you want to control this action by another person. Well the opposite pattern of this is called retain familiar. So you want to have the same person that for example has issued a purchase request to execute the work item where this person is informed of the successful or the unsuccessful outcome of this case. Both of these patterns are inbuilt in YAWL and we will take an example of tutorial 10 and extend it to have this. We will also use a set of users and roles to demonstrate how that works. And we will start off with the complete specification that you can find in the supplementary material. Okay! We have the YAWL engine running and the editor open with the specification that we have already prepared and that you can upload from the supplementary material. So you can see, there is a first task "Prepare purchase request". Then there is a complex task "Order" and then, after the ordering is finished, the shipment is received and the invoice as well and after these two are completed, we can proceed to payment. And the first restriction that we have here is that we want to have the same user receiving the shipment that has prepared the purchase request. So here, we use the pattern retained familiar and in the YAWL editor, if we select "Receive shipment", we can see that here under resourcing, if we select that, we see that here there is a check mark "choose completer of task" and here this refers to "Prepare purchase request". So this guarantees that the same user will open this work item here for receiving the shipment. The next thing is that the "Prepare payment" is the same as "Receive invoice". "Receive invoice" is this task and "Prepare payment" is here inside the payment subtask. And if we select "Prepare payment", we look at the resourcing here and we can see "choose completer of task" "Receive invoice" and net is mentioned here because this is part of another subnet.
And the third one is that "Execute payment" is different from "Prepare payment". So here we have "Prepare payment" and here we have "Execute payment". And if we look at "Execute payment", we can see that this is offered to someone with the finance role but we do not want to choose the completer of task "Prepare payment". Now let's see if this is doing what it's supposed to do. Llet's first look at our organizational structure. The organizational structure is here in this Excel sheet.
And you can see all the users with their user ids and they all have the same password and their roles. This can be uploaded from the supplementary material into the YAWL system. Aand so what are we expected to see with the restrictions that we have. The first thing is that we want to check if we use "Prepare purchase request" then we have the same user for "Receive shipment". So we have created two users here with the role requester. And so in "Receive shipment" we should see the same one that we use the first time. The second thing is that "Receive invoice" and "Prepare payment" should be the same. So that's why we have here the role finance and we have two users with the role finance here. And last but not least, the four-eyes principle, we want to make sure that "Execute payment" is offered to a user that has not prepared the payment. We upload the specification to the YAWL engine and launch a new case. And a new case is launched with case id 3. Okay! We look at the admin queues and look at who has work items. And the "Prepare purchase request" which is the first task in our specification is now offered to two users as we would have expected. The two users we have here in our list. And let us now choose the first one here.
So the username is ror. We login and we see "Prepare purchase request", accept, and start. View/edit and we complete this purchase request. And next we look at the admin worklist and see what's happened. So now we have "Approve purchase" which is part of the subnet order. The first task in the subnet and this is assigned to one user because we only have one manager user with the role manager. And so here, we just log out and use this manager user: acceptance, start and we approve this.
Go back to the admin queue and see what's happened. So "Prepare purchase order" is the next task and this is assigned to Peter Parker and Peter Parker is the one that the only user from purchasing. So we have to login as this user and we can just fill in some values here and prepare the purchase order. So now we go back to "Receive shipment" and "Receive invoice". So we should see both work items in our list. And "Receive shipment" is assigned to one user and this is the one we have chosen in the first place. So this is correct. So it's not assigned to both, because here we have used the pattern retain familiar.
So we log in as ror, accept and start and we enter a shipment number. And complete this. And the other one is "Receive invoice". This is assigned to two users because we have two users in the financial department. And we will just use the first user Fred Flintstone here. Input and invoice number and then we are done. So now these two tasks "Receive shipment" and "Receive invoice" are completed and we proceed to the pay sub workflow and the first task is "Prepare payment".
So here "Prepare payment" is offered to one because we have used the retain familiar pattern here. And this is the one we would expect. So I just refresh here. I get this task and I enter an account number and then we're done. And now the next one because we have used the four-eyes principle.
We would expect that this is not the same user and in fact we can see that this is assigned to Fleur Forsite. So we have to log out and complete it. And then the case is finished. You may have wondered what happens if the manager does not approve of the purchase. We didn't include any logic in here we will treat this topic in a later tutorial when we'll introduce the concept of exlets. So stay tuned!