BPMN 2.0 EMF

Open BPMN makes use of the Eclipse Modeling Framework (EMF) to describe the graphical model elements. The file bpmn-graph.ecore defines the EMF model. The adapted node and edge elements of Open BPMN described within this model are designed to meet the basic requirements for the graphical modeling of a BPMN diagram. This makes the model very compact and easy to integrate.

The Elements used in Open BPMN

Within the ecore model of Open BPMN we are using the following elements which build on each other. You can find the Java classes under

/open-bpmn.glsp-server/src/main/java-gen/

BPMNGNode

The BPMNGNode extends the glsp GNode and provides the core properties used by each kind of BPMN Flow Elements

  • name - used in the graphical view to label the element
  • kind - sub type to define variants
  • documentation - an optional documentation for the element

BPMNGEdge

The BPMNGEdge extends the glsp GEdge and provides the basic properties used by each kind of BPMN Edge Elements

  • name - used in the graphical view to label the element
  • kind - sub type to define variants
  • documentation - an optional documentation for the element

Sub Elements

The following EMF classes define sub types of the BPMNGNode class used for the BPMN graphical core elements:

  • TaskGNode - represents a BPMN Activity
  • GatewayGNode - represents a BPMN Gateway
  • EventGNode - represents a BPMN Event
  • IconGCompartment - represents an embedded icon (used by task elements)
  • LabelGNode - represents a BPMN Label below a graphical Node (used by Events and Gateways)
  • DataObjectGNode - represents a BPMN Data Object
  • MessageGNode - represents a BPMN Message Object
  • GroupGNode - represents a BPMN Group
  • TextAnnotationGNode - represents a BPMN Text Annotation
  • PoolGNode - represents a BPMN Participant (Pool)
  • LaneGNode - represents a Lane within a Pool

Build the Open BPMN EMF Model

Open-BPMN provides a EMF model for the BPMN 2.0 standard (work in progress). The model is located in /model/bpmn-graph.ecore. The model file extends the GLSP model schema.

The interfaces and classes can be generated by the Eclipse Modeling Framework. Eclipse will create the necessary java classes out of the EMF model description. To create the model follow these steps:

  • Create or update the EMF Model file bpmn-glsp.ecore
  • Generate a bpmn-glsp.genmodel file
  • Generate Java Classes based on your .genmodel file

Create a new EMF model

you can change or update the existing bpmn.ecore file using the Eclipse Modeling Framework.

In EMF Model File you typically extend the GLSP super types. See the following example defining a ‘Task’ element

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="wfgraph" nsURI="http://www.imixs.org/bpmn/glsp/graph"
    nsPrefix="bpmngraph">
  <eClassifiers xsi:type="ecore:EClass" name="ActivityNode" eSuperTypes="glsp-graph.ecore#//GNode">
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="nodeType" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
  </eClassifiers>
 
  <eClassifiers xsi:type="ecore:EClass" name="Icon" eSuperTypes="glsp-graph.ecore#//GCompartment"/>

</ecore:EPackage>	

Note: Take care about the nsURI and nsPrefix which will be part of the generated interface definitions.

Create a .genmodel file

After the EMF file is defined you can need to recreate the genmodel file. Choose from the Eclipse IDE context menu of the bpmn-glsp.ecore file:

‘New->Other->EMF Generator Model’

and create a new file ‘bpmn.genmodel’. Choose the importer ‘ecoremodel’.

Click on load will verify the EMF model file created before.

Next select both packages in the ‘Package Selection’ (the glsp-graph package includes the core elements form the GLSP project)

Click on ‘Finish’ to generate the .genmodel file.

Generate java classes

Now you can generate the java classes. Before you can start, you need to change some of the details of the new .genfile. Open the .genfile and choose the root element of the bpmn graph elements. In the property view change the package name into org.openbpmn.glsp

Next choose the root element of your glsp graph model. In the property view change the package name to org.eclipse.glsp.

Change the tag modelDirectory to /open-bpmn.glsp-server/src/main/java-gen - this will be the source location for the files

Finally you can now generate the code of your model. Select again only the root element of your model and Choose Generate Model Code.

This will now generate all necessary classes referencing the GLSP core model types.