Tuesday, February 19, 2013

Process diagrams community contribution

It's great to see that the number of community contributions is rising for Activiti lately. One great addition you'll see in Activiti 5.12 is the Javascript process diagrams component created by Dmitry Farafonov. You can already check out this component by running the latest Explorer web application from the Github master.

The process diagram component uses the Raphaƫl framework to draw a process definition image based on the BPMN DI information in the process definition XML. In addition, the component is capable of showing the current status of a process instance.

Until 5.11 we only supported a static process image and a generated process instance image. But with the addition of the process diagram component we don't need to server-side generate a custom process instance image. And there's now the option to add more interaction in the process image, to for example show more information about a specific activity in the process definition.

The review sales lead example process of the Activiti Explorer looks like this in the process diagram component:

The current status of a process instance of the review sales lead process is drawn like this:


In addition to showing the process diagram as part of the Activiti Explorer, it's also very easy to only show the process diagram itself, for example to include it in another application. With the following URL you can retrieve the process image of the sales review process for example:

http://localhost:8080/activiti-explorer/diagram-viewer/index.html?processDefinitionId=reviewSaledLead:1:36

And to also highlight the current status of a process instance, just add a processInstanceId request parameter like this:

http://localhost:8080/activiti-explorer/diagram-viewer/index.html?processDefinitionId=reviewSaledLead:1:36&processInstanceId=41

So a big thanks to Dmitry Farafonov for contributing this component to Activiti and I hope to see more contributions coming!

Tuesday, February 5, 2013

Activiti in Action updates (part 1)

Hi all,

One of the difficulties with writing a book is that it's quite hard to provide updates when it's printed. The great thing about Activiti is that it's based on the BPMN standard and in that respect a large part of the Activiti in Action book describes functionality like it was available in version 5.9, but also still in 5.11 and the upcoming 5.12 release. But of course some parts have changed, and that's why I decided to publish a series of articles about these changes so you can use these articles together with the book to learn about the latest releases of Activiti.

In this first article I want to focus on the installation procedure and Activiti's main components.

Installation procedure

The installation of Activiti has changed quite a bit in Activiti 5.11. In the 5.11 release we decided that it would be better to get rid of all setup scripts, because they were causing a lot of environment specific issues without providing a lot of help. In the book I reference the use of ant demo.start a couple of times to start the H2 database. That script is not available anymore starting from the 5.11 release. So let's walk through the new installation procedure of Activiti (also described in the Activiti userguide).

1.Download the Activiti distribution from the Activiti download page.

2. Unzip the distribution to for example: c:\activiti (Windows), /user/local/activiti(Linux/Mac)

3. You should now have the following directory content:














The database folder holds the database scripts that can be used to create the database schema or upgrade to the 5.11 schema for your database. The docs contain the userguide, javadocs, and xsd files. The libs folder has all the Activiti modules in JAR files and the wars folder has the Explorer and REST WAR files. So no scripts folder anymore to create a development environment. But that doesn't mean that things got harder to get started, on the contrary.

4. Download a Tomcat 6 or 7 distribution if you don't have one already. Copy the activiti-explorer.war and activiti-rest.war (if you want to use the REST interface) files to the Tomcat webapps folder.

5. Note that the Explorer application contains examples and an in-memory H2 database to quickly get started. So when you start the Tomcat server and open your browser at http://localhost:8080/activiti-explorer you can get started without additional installation steps. For the REST application this is not true, since that is referencing a standalone H2 database by default. So to use the REST application you first have to install the H2 database like described in the following steps.

6. Download H2 from the H2 download page, and follow the installer steps or in case of a platform independent ZIP, unzip the contents to the folder of your preference.

7. To start the H2 database server you can start it via the start menu for Windows (see the h2 quick start page)  or use the following command on Linux and Mac from the H2 bin folder:
java -jar h2*.jar

8. Now the H2 standalone database is running and you can also use the Activiti REST web application.

But note that for just running the Explorer web application, you don't even need a H2 standalone database. You only need to be aware that every time you restart the Tomcat server, previous changes are made undone.

Activiti main component changes

The main components of the Activiti project, the Engine, Designer, Explorer and REST application are still there. The main difference is the addition of the Modeler component (see also my previous post about the Modeler announcement). In the book we use the Signavio Modeler component that you how to download and install separately. That's not necessary anymore, the Modeler is part of the Explorer web application in the 5.11 release. The modeling of processes is still very similar to the description in the book. And when you would like to import a Modeler process into the Designer you can use the export action in the Modeler workspace (in the Processes section of the Explorer) to download the BPMN 2.0 XML file.






In the next part of this Activiti in Action update series I'll focus on smaller differences such as the history configuration and SLf4j logging (coming in 5.12). But I also welcome feedback about which parts I should highlight on.