Just some simple thoughts about things that I like (or not) and work related subjects...

Wednesday, September 05, 2012

Displaying jBPM diagram of the current process

In large enough processes, user might need to see where in the diagram process stopped. Now jBPM console comes with this, but to actually integrate it with front end application, I had to change it slightly. Code base used was from bpm-console. First part is setting up properties with the location of your Guvnor (jbpm.console.properties):

To run everything I use JIBX to compile XSD schemas for BPMN2 (you can find them in jbpm-bpmn2-5.2.0.Final.jar). You will need to slightly modify JIBX output with extending classes to compile it, but after that it should work OK.

Before running this, you will need BPMN2 file and PNG in you resources directory (named same as process ID). In case that in the future versions of Designer positioning of the elements inside BPMN2 becomes absolute, then JIBX will not be needed as PNG you can get from Guvnor directly and source will not be parsed as positions are already in the metadata of the node. Currently, as positions are relative we need to calculate the offset to overlay the arrow correctly over PNG. Please also note that I only offset positions for the Lanes and not, for example, from the Sub-process. You can extend this code to fit your needs.

It should be possible with 5.X version with small code adjustments where needed as far as I can remember. You can copy it locally and try to compile and if there are errors you can always download source for jBPM and take a look what is different there (packages and structure).