com.ibm.xtools.bpmn2.util
Class RelationshipUtil

java.lang.Object
  extended by com.ibm.xtools.bpmn2.util.RelationshipUtil

public class RelationshipUtil
extends java.lang.Object

Utility class for handling relationships Current approach for creating Relationship in BPMN Modeler uses single source and single target for a Relationship Methods in this class may not work properly when the Relationships contains multiple sources and targets.


Constructor Summary
RelationshipUtil()
           
 
Method Summary
static Relationship createRelationship(BaseElement baseElement, java.lang.String relType, java.lang.String name, javax.xml.namespace.QName targetQName, org.eclipse.emf.ecore.EObject targetObject)
          This method will create a relationship between the given baseElement object and external domain element targetObject.
static Relationship createRelationship(BaseElement baseElement, java.lang.String relType, java.lang.String name, javax.xml.namespace.QName targetQName, org.eclipse.emf.ecore.EObject targetObject, boolean createImport)
           
static Relationship getRelationship(BaseElement baseElement, java.lang.String relType)
          This method will return existing relationship when it finds a relationship associated to this base element that matches the given relationship type
static Relationship getRelationship(BaseElement baseElement, java.lang.String relType, java.lang.String targetID)
          This method will return existing relationship when it finds a relationship associated to this base element that matches the given relationship type and targetID matches the local part of the target QName
static java.util.Collection<Relationship> getRelationships(BaseElement baseElement)
          This method will return existing relationships associated to this base element that matches the given relationship type
static java.util.Collection<Relationship> getRelationships(BaseElement baseElement, java.lang.String relType)
          This method will return existing relationships associated to this base element that matches the given relationship type
static boolean removeRelationship(Relationship relShip)
          This method will remove the target from the given relationship It returns true if it succeeds otherwise returns false
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationshipUtil

public RelationshipUtil()
Method Detail

getRelationship

public static Relationship getRelationship(BaseElement baseElement,
                                           java.lang.String relType)
This method will return existing relationship when it finds a relationship associated to this base element that matches the given relationship type

Parameters:
baseElement -
relType -
Returns:
an instance of Relationship if it finds it in the model, otherwise null

getRelationship

public static Relationship getRelationship(BaseElement baseElement,
                                           java.lang.String relType,
                                           java.lang.String targetID)
This method will return existing relationship when it finds a relationship associated to this base element that matches the given relationship type and targetID matches the local part of the target QName

Parameters:
baseElement -
relType -
targetID -
Returns:
an instance of Relationship if it finds it in the model, otherwise null

getRelationships

public static java.util.Collection<Relationship> getRelationships(BaseElement baseElement,
                                                                  java.lang.String relType)
This method will return existing relationships associated to this base element that matches the given relationship type

Parameters:
baseElement -
relType -
Returns:
Collection of relationships, otherwise an empty collection

getRelationships

public static java.util.Collection<Relationship> getRelationships(BaseElement baseElement)
This method will return existing relationships associated to this base element that matches the given relationship type

Parameters:
baseElement -
relType -
Returns:
Collection of relationships, otherwise an empty collection

removeRelationship

public static boolean removeRelationship(Relationship relShip)
This method will remove the target from the given relationship It returns true if it succeeds otherwise returns false


createRelationship

public static Relationship createRelationship(BaseElement baseElement,
                                              java.lang.String relType,
                                              java.lang.String name,
                                              javax.xml.namespace.QName targetQName,
                                              org.eclipse.emf.ecore.EObject targetObject)
This method will create a relationship between the given baseElement object and external domain element targetObject. If there is a relationship already present for the same element, the existing relationship will be removed first prior to creating a new relationship An import also added for the target object

Parameters:
baseElement - bpmn element that is the source of this relationship
relType - relationship type string
name - name of the relationship (e.g. name of the external element)
targetQName - A QName object that represents targetObject (external domain object)
targetObject - External domain object
Returns:
relationship between given baseObject and external domain element targetObject

createRelationship

public static Relationship createRelationship(BaseElement baseElement,
                                              java.lang.String relType,
                                              java.lang.String name,
                                              javax.xml.namespace.QName targetQName,
                                              org.eclipse.emf.ecore.EObject targetObject,
                                              boolean createImport)