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):
Following is the code (you can remove
static if you want):
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.
Usage in xhtml:
And not to forget, you need to initialize JPAWorkingMemoryDbLogger and add corresponding Entities to persistence.xml (ProcessInstanceLog, NodeInstanceLog, VariableInstanceLog).
As always, if you have any suggestions, please drop me a note.
Thanks to tsurdilo for help!