This is another video tutorial on YAWL. Finally we‘re putting everything together to access a database from YAWL. You need tutorials 26 and 27 for this one. Now that we know how to deploy codelets and have prepared the database acess, we can do read and write operations on databases. The files you need for this tutorial can be found in the zip file below.
Welcome to another YAWL tutorial. Finally, we are putting everything together to access a database from YAWL. You need tutorials 26 and 27 for this one. Now that we know how to deploy codelets and have prepared the database access, we can do read and write operations on databases. Our workflow is this one. The workflow has three tasks. The first and the third task are automated tasks. You can recognize them by the green triangle that the YAWL editor puts every time that we have an automated task. Readcustomer accesses the database using a codelet and gets the name of one of the customers. The second task is a manual task where we change the name of the customer and then in the third task, we write the changed name back to the database. We need three Java classes here: CustomerDao is a database object for reading and writing to the cust database. ReadDatabaseCodelet is the codelet that is invoked by the task read customer and finally write to database codelet is the codelet that is invoked by the task WriteCustomer. Let's have a closer look how it works. Okay, let's briefly look at our components. Now we have the class CustomerDao that you can see here and it has two methods. One is called find that prepares an SQL statement to find a customer according to his id and the second one is called update which is updating a customer with a certain id. Then we have two codelets ReadFromDatabaseCodelet and the interesting part is the execute method. Of course you can find all these things in the material and you can you can see that this essentially invokes the CustomerDao class to get the parameters to find to retrieve information from the database and the WriteToDatabase codelet is using the database access object to write data back to the database. On the right hand side you can see the workflow specification in the YAWL editor and if we look at the read customer task here we can see that the automated check mark is checked and that the codelet here is ReadFromDatabaseCodelet. So, if we open that, we can see that the ReadFromDatabase codelet is here and if you want to do the same thing you have to make sure to deploy the codelet jar in the same way that we did in the videos before and it's similar for the WriteCustomerCodelet. Let's just execute the whole thing. So, here we have the YAWL control center. I just launched a new case and we can see that something has happened here in the log which looks quite good. There are no error messages and if we now go to the admin queues, we have change name - this is our manual task. Here we assign it directly to our user. We open it and we can see the customer name that has been retrieved is Jack. If we look at pgAdmin here, we can see effectively that the customer number one is Jack. Then we change that to Jill and complete and now our case is finished and we have to go back to the database to check if it really has worked. So, what we can do here is we go to the table and we do view edit data again and now you can see the name has been changed. In one of the first videos of this series, I said that YAWL is good at separating the workflow layer from the software development layer. Workflow development and software development are two worlds requiring different skill sets. Here we have just seen codelets - the border between the two worlds. In the YAWL world, I can help you directly. In the software development world, I can recommend two or three companies who can integrate YAWL into an IT infrastructure or bring your own developers up to speed. If you have more questions concerning the YAWL world, please don't hesitate to ask me. Thank you for watching!