This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Could you elaborate if BPMN 2 gives a place holder for programmatically creating models via Java APIs?
I have read tools like Lombardi where BPMN is used for graphical representation.
I am a newbie to the BPM process and have started to learn about BPM and WMB.
It's funny you should ask this, because it is something I have been working on. If you use true BPMN tool such as MagicDraw, then you can save (and load) your BPMN model in XMI format. This is a standard XML based format for saving UML models. Because it is XML, you can programatically generate it in any language. When you read the programatically generated XMI back into the modelling tool, you have a model. This is the first approach.
The second approach needs a BPMN tool that has a scripting language. You can then write plug-in to generate a BPMN model from some other representation that you create programatically externally to the tool.
Personally, I find generating the XMI most flexible. I have tried this with UML and the MagicDraw, Enterprise Architect and Visual Paradigm tools, and it works a treat. It should also work for BPMN in MagicDraw (at least), because if you use MagicDraw with the Cameo BPMN plug-in, BPMN is just treated as another UML profile - so the generated XMI is standard.
In terms of working out precisely what XMI to generate, you can look at the BPMN metamodel, but in many ways it is easier to do it by inspection. So when I wrote an XMI generator for Clojure (a version of Lisp than runs on the JVM), I created simple UML models in MagicDraw and exported these as XMI. I could then see exactly how the tool was representing the model in XML, and therefore, what I needed to generate. I have a blog post on some aspects of this here:
Further to the discussion, the XMI below, when loaded into MagicDraw UML with the Cameo BPMN 2 plug-in, creates a simple BPMN 2 model comprising a start event connected via a control flow to a task called T1, that is connected by a control flow to an end event.
The long xmi:idref strings can be replaced with your own programatically generated unique IDs. MagicDraw seems not to mind what format they are in.
I have only just tried this, and whilst it proves it works in principle, there is an issue - the task T1 is imported as an opaque action, not a task - so the XMI needs some more work.
Also note that this creates BPMN models not diagrams. You have to manually drag the model elements into a diagram in the tool. Creating diagrams is something I have not looked into.