maandag 30 juli 2007

Configuring Tasks in the jBPM jPDL Graphical Process Designer

So here I am again with a continuation of my promised series of articles. I have been occupied last month, fixing bugs and cleaning out some of the code of the jBPM jPDL Graphical Process Designer (GPD), resulting in the release of a second beta last weekend. Particularly interesting about this release is the reintroduction of Seam pageflow.
For this entry, I want to focus on the jBPM task support. Tasks are in fact one of the strong features of jBPM and it will take more than one article to treat them fully. For now, let's keep things simple and start with a slightly modified version of the process we used in the previous entry.

As you can see, the process definition contains three nodes: a start state, a task node and an end state. The focus of the discussion will be on the task node. This type of node is actually a special kind of wait state. The difference with a normal wait state is that the execution engine will create task instances when it enters a task node. The number and type of task instances that are created depend on the task definitions that are configured on the task node. You can inspect these configured task definitions by selecting the 'Task' tab in the tabbed properties view when a task node is selected.

In order to create a task definition, either use the popup menu shown above or the button on the property views action bar. A task has a fair number of configuration possibilities. You can either select the target task definition directly in the outline page of the editor and access the properties through the tabbed properties view or else select the target task in the treeview of the 'Task' tab of the containing node. If you do the latter an embedded tabbed form will appear, with tab pages for the different categories of properties.

On the 'General' page, you can specify a name for the task as well as a description.

The 'Details' page is already somewhat more complicated. The due date is a mandatory property for the task. All the other ones are optional. The due date is of course the date on which the task should be accomplished. For this example, the set due date is 2 business days. The priority is set to high and the signalling and notification attributes are set to true. This means respectively that the process will continue when the task is accomplished and that the assignee will be notified by email when the task is assigned. The blocking attribute indicates that the process will not be able to continue if this task is still unaccomplished. The purpose of the 'Generate Form...' button on this page is to create a simple task form that can be rendered by the jBPM console. Form generation and customization will be treated in another article.

The 'Assignment' page allows to specify how this task should be assigned. We will talk about the details of assigning tasks and swimlanes in a later article and for now simply assign this task to the actor id 'Bruce'.

The 'Reminder' page is the place where you can specify whether the assignee will be reminded of the task that awaits him. In this particular example the assignee will receive an email after 2 business hours and this email will be resent every business hour after that.
So what does all this configuring do behind the scenes? It creates a bunch of xml of course, that you are able to see in the final screenshot below.

So far for this second article. If you are eager to try our new release download it here. As always, we welcome comments and ideas on our forum and bugreports and feature requests in our JIRA. Also note that this latest release has been built with Eclipse 3.3 which you also might want to download.

Have fun,

dinsdag 3 juli 2007

jBPM jPDL Made Easy: Part 1 - Actions

Last week we released a first beta of the jBPM jPDL Graphical Process Designer (GPD). It represents the end of a major overhaul of all the configuration forms for the different jPDL elements. Support of the jPDL language is now complete. I want to take this opportunity to start a series of blog entries each highlighting some item of jPDL and showing how to configure this using the GPD. I know I have made this promise earlier, let's hope I am able to stick to my promise this time.

Though this entry will focus on the use and the configuration of Actions, I want to start with showing a screen shot of the graphical jPDL editor showing a simple process.

As you can see the current selection is the transition that leaves the start state and enters the second node, which is a state. Below the graphical canvas, you see the tabbed properties view. This view is dynamic and allows you to configure all the relevant properties of the current selection. For transitions, the tabbed properties view contains four tabs. The first one is the General tab in which you are able to specify a name and a description for the transition. Both of these properties are optional for transitions. I will treat the Condition and the Exceptions tabs in another entry and concentrate on the Actions tab for this time.

You can use the Actions tab to add action elements to the transition. These action elements get executed when the transition is taken during process execution. The first way to add an Action is to use the popup menu of the action element container as is shown on the screenshot above. The other way is to simply use the dropdown menu that is available under the action icon in the right upper corner of the Properties View. As you can see an Action is only one of the five action elements that you can add. For now, let's focus on the Action and take a closer look at how you can configure it. After adding the Action a tabbed view with three pages will appear. The result is shown in the screenshot below.

The first of these three pages allows you to give the Action a name, making it possible to reuse it somewhere else in your process definition by referencing to it by its name. The last page contains some advanced attributes such as whether the Action is asynchronous. The most interesting page is the Details page where you are able to choose and configure the actual action handler implementation. This is shown below.

The chosen action handler is the class MessageActionHandler which has one configurable field message. The configured value for this field is the string 'hello'. The example is a bit simplistic in the sense that this particular action handler will only store the configured value as a variable in the process context. Of course it is possible to make action handlers do much more interesting stuff.
A transition can contain many action elements. Each of these will appear in the action element list of the Actions tab. But each Action also has a properties view of itself. You can navigate to this view by selecting the added Action in the outline view. The screenshot below shows that the Action properties view contains the same three tabs as before offering the same configuration possibilities. It also shows how this configuration has been translated in the corresponding XML in the source view of the editor.

This ends the first entry of this series. If you want to try out our new GPD, please download it here. Note that the GPD is an Eclipse plug-in so you will also need the Eclipse 3.2.x SDK. To use it, extract both the Eclipse SDK archive and the GPD archive into a folder of your choice and launch the Eclipse executable. Note also that in order to create jPDL projects, you may need to download a jPDL runtime. Just extract the archive somewhere on your hard drive and point to it when asked by the wizard when you are creating the jPDL project. If you want to know more about jBPM and jPDL, go to our community pages.

Have fun,