domingo, 1 de maio de 2016

A CRUD using jBPM

Here's one interesting thing: everything gets better with jBPM. Even a CRUD (which does not exactly represent a business process) can be quickly created and you can have a much better overview of what's going on without having to read any line of code. In this post, I am going to show you a CRUD I created using the JPA Work Item Handler from my last post.

The CRUD business process

The CRUD actions are based on an Object of type Person created using the Data Modeller tool:


The object used in our CRUD. It was created using the data modeller

 The business process to create the CRUD make use of human tasks to get users input. A human task is responsible for creating an application menu for the user, the other tasks read users provided data. See the process diagram:

A jBPM CRUD Diagram

The box with text "Select Contact" is a reusable subprocess which goal is let users select one of the existing contacts (Person):
User can select a contact from the existing contacts
If you know BPMN, you might already understand how it works. There's no need to look any source code or read documentation, the diagram above tells you everything about the application.

Our process has variables to hold the users input. To pass information from users to the process, we must first understand how we can actually execute the process, and there are three ways:

  • Use the jBPM Console tool as the process executor engine. This way you can interact with the process using the console itself or the console remote APIs;
  • Create an application that use jBPM APIs to control the process execution using Java;
  • Use the new KIE Execution server. Recently it was added BPM capabilities to the server, so you can deploy your business process to it and control the execution using the KIE Server remote APIs.
Tasks and process can have HTML forms to take the user input or you can use a client application to interact with the server in order to pass parameters when starting process and when handling tasks. Now I see your surprise face: You don't  need to make any coding to create HTML forms for the process, you can generate a form for your task and process (jBPM Designer can generate it based on the task/process input) and then use the powerful jBPM forms tool to modify the form. Although you can customize the forms using Javascript and CSS,  no coding skill is required! See what it looks like:

Form for a task of our CRUD process
If you use the jbpm console itself as the process execution server, it will render the form for you when starting process and completing tasks, and you can even embed the form in an external web application!

Demo

The CRUD full project is also available in github, but here's a small video showing it in action with everything I described above:





Um comentário:

  1. Hi William
    thanks to your great post. now I have some questions. I could run your previous example (jpa task) and I get result of (p_products) in a list, but how can i show this list in the jbpm form. i cannot find any data grid in jbpm default form generator.
    another question is how can I show this list in a drop down (combo box) in the jbpm forms?

    kind regards
    masoud

    ResponderExcluir