com.ibm.xtools.bpmn2.modeler.ui.util
Class BPMNModeler

java.lang.Object
  extended by com.ibm.xtools.bpmn2.ui.diagram.util.Bpmn2ResourceUtil
      extended by com.ibm.xtools.bpmn2.modeler.ui.util.BPMNModeler

public class BPMNModeler
extends com.ibm.xtools.bpmn2.ui.diagram.util.Bpmn2ResourceUtil

A utility class that exposes bpmn model and provides some basic operations associated with it.


Method Summary
static void closeModel(BaseElement element)
          It closes a model.
static RootElement createResource(org.eclipse.emf.common.util.URI uri, com.ibm.xtools.bpmn2.ui.diagram.util.Bpmn2DiagramType diagramType)
          It creates a bpmn resource for a given uri.
static org.eclipse.emf.transaction.TransactionalEditingDomain getEditingdomain()
          It returns shared editing domain for BPMN2 models.
static java.util.Collection<Definitions> getOpenModelDefinitions()
          It returns Definitionss of all the open bpmn2 models.
static Definitions openModel(org.eclipse.emf.common.util.URI uri)
          It loads a resource represented by passed uri.
static void saveModel(BaseElement element)
          It saves a bpmn model.
 
Methods inherited from class com.ibm.xtools.bpmn2.ui.diagram.util.Bpmn2ResourceUtil
createDiagram, createResource, getResource, getResource, getResource, getResource, isSupportedResource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEditingdomain

public static org.eclipse.emf.transaction.TransactionalEditingDomain getEditingdomain()
It returns shared editing domain for BPMN2 models.

Returns:
Shared BPMN2 editing domain, or null if it could not be found or created.

createResource

public static RootElement createResource(org.eclipse.emf.common.util.URI uri,
                                         com.ibm.xtools.bpmn2.ui.diagram.util.Bpmn2DiagramType diagramType)
It creates a bpmn resource for a given uri. Type of bpmn model created is determined by passed Bpmn2DiagramType.
Only following Bpmn2DiagramTypes are supported:
Bpmn2DiagramType.PRIVATE_PROCESS : It corresponds to Process model in bpmn.
Bpmn2DiagramType.COLLABORATION : It corresponds to Collaboration model in bpmn.
Bpmn2DiagramType.CHOREOGRAPHY : It corresponds to Choreography model in bpmn.

Created model contains Definitions with Extension applied to it. Model is initialized with corresponding RootElement and resource is initialized with corresponding gmf Diagram .
It is expected that this function is called inside write Transaction.

Parameters:
uri - The URI of resource to create.
diagramType - Type of bpmn model to create.
Returns:
RootElement of the created bpmn model.

getOpenModelDefinitions

public static java.util.Collection<Definitions> getOpenModelDefinitions()
It returns Definitionss of all the open bpmn2 models.

Returns:
Collection of definitions of all the open bpmn2 models.

openModel

public static Definitions openModel(org.eclipse.emf.common.util.URI uri)
It loads a resource represented by passed uri.

Parameters:
uri - URI of the resource to be loaded.
Returns:
Definitions of the loaded model.
Throws:
java.lang.NullPointerException - if uri is null.
java.lang.IllegalStateException - if loaded resource doesn't contains Definitions. All bpmn models are expected to contain this element.

closeModel

public static void closeModel(BaseElement element)
It closes a model.

Parameters:
element - which is part of model that is to be closed.
Throws:
java.lang.NullPointerException - if passed element is null
java.lang.IllegalArgumentException - if passed element is not part of a Resource.

saveModel

public static void saveModel(BaseElement element)
It saves a bpmn model.

Parameters:
element - which is part of model that is to be saved.
Throws:
java.lang.NullPointerException - if passed element is null
java.lang.IllegalArgumentException - if passed element is not part of a Resource.