Although we are living in a world where systems have replaced many human tasks, processes usually need humans to complete tasks in order to achieve some goal, so it is interesting to investigate a bit how these human tasks can be integrated into systems.
Imagine a very simple process for document writing process, defined like this:
In this case, we have three human tasks to be performed by three different people (or groups of people):
- The person who writes the document.
- The person who translates the document.
- The person who review the original document.
In order to finish the document writing process, these three tasks must be finished by the correct people.
There is a specification for human tasks, WS-HumanTask, which standardize not also the notation and meanings, but the way to interact with a human task service. I won’t go in details with the spec, you can check the link in reference, but let’s see some concepts behind it:
– A task has data that comes with its definition itself, such as name, description, etc.
– A task has runtime data about its execution, such as its state.
– A task has runtime information about the task definition itself. This data should help the person to complete the task. In the document writing example, the tasks “Review Document” and “Translate Document” has as input a document that has to be used to perform the task.
– A task produces output data, that will give some information about what happened in this task, and also can provide information to the system. For example. In the document writing example, the task “Write Document” produces a document to be used in the rest of the process.
There are some roles that are important in the life-cycle of a task. Not only the person who actually performs the task is important, as there can be another actors such as the person who initiates the task, the potential and actual owner, the administrator and notification recipients are some of the roles which could be identified in a task.
To interact with tasks, it is good to have some interfaces to coordinate the task executions, giving enough visibility and functionality. Some needed interfaces could be:
- Task List. An interface where a user can see all the tasks that has assigned, where a summary of the task is displayed.
- Task details, where the user can check more details information of a task, with task input data, status, and more.
- Operate the task. It means a way to start, complete, suspend, the task. It mean, make the task go through its state until finish it.
The task has different states that change when some operation is made to it. For example, in WS-HumanTask spec, the state diagram for a task is defined like this:
That is just an overview, now we can check some examples!
Now.. HOW CAN I MAKE A CENTRALIZED INTERFACE FOR MY HUMAN TASKS?
An interface for human task could like this:
Some interface to select a user (or maybe login), and get some profile for UI customization.
Another interface that should be present is the task list for the user.
And finally the task operation interface, to interact with a selected task.
I have made this example, which let us interact with tasks in a UI pages. The example uses smart task project:
Which allows the interaction between the UI and the task repository, abstracting this job from the producer vendor of the task (can be JBPM, Activiti, I will show an example in another post) and also providing a mechanism to define the configuration of how the information will be shown in the page, defining different profiles and customizations. For now, it does not have support to execute tasks, that’s why in my example I use a simple task client to execute them.
The example can be found here: https://github.com/calcacuervo/HumanTaskExamples
For now, it has three projects:
- human-task-server-example. It is a Jbpm 5 human task server which exposes services to interact with services. Run it with mvn exec:java.
- human-task-client-example. Run it with mvn exec:java. This is a sample client, which has the possibility to:
Start the writing document sample process.
Complete tasks to finish the process
- human-task-web-ui-example. This is a web application, run it with mvn jetty:run. There we can:
List all tasks of a user
Get details, form and actions of each task
It only shows how to show the UI, so the actions are not executed.
That’s it for now, I will continue working with this projects and put in this blog things that may be interesting. Please let me know any suggestion, correction or just a hello!
Thanks for reading!