com.ibm.xtools.bpmn2.util
Class QNameUtil

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

public class QNameUtil
extends java.lang.Object


Constructor Summary
QNameUtil()
           
 
Method Summary
static void addQNameReferenceImport(org.eclipse.emf.ecore.EObject referencer, BaseElement referenced, javax.xml.namespace.QName referenceQName)
           
static Import checkIfImportWithDifferentLocationExists(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.common.util.URI location, javax.xml.namespace.QName reference, java.lang.String importType)
           
static void createImportForTargetQName(org.eclipse.emf.ecore.EObject referencer, org.eclipse.emf.ecore.EObject targetObject, javax.xml.namespace.QName targetQName)
          This method will create an import in the definitions based on targetQName details
static org.eclipse.emf.common.util.URI createReferenceURI(org.eclipse.emf.ecore.EObject referencer, javax.xml.namespace.QName referenceQName)
           
static org.eclipse.emf.common.util.URI createReferenceURI(org.eclipse.emf.ecore.EObject referencer, javax.xml.namespace.QName referenceQName, java.lang.String importType)
          This method first try to find an Import in the definitions associated to the referencer If it succeeds it will create a location URI based on the available details in the import
static java.lang.String findVobPart(java.io.File directory)
           
static java.lang.String findVobPart(java.lang.String location)
           
static javax.xml.namespace.QName generateQName(BaseElement owner, BaseElement other)
          Creates and returns a QName for other (which may be a proxy) in the context of the its reference from owner.
static javax.xml.namespace.QName generateQName(java.lang.String targetNamespace, java.lang.String localPart)
          This method will generate a QName for the given name space and local part
static Definitions getDefinitions(org.eclipse.emf.ecore.EObject other)
           
static Import getMatchingImport(org.eclipse.emf.ecore.EObject referencer, BaseElement referenced, javax.xml.namespace.QName referenceQName)
           
static Import getMatchingImport(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.common.util.URI location)
          Gets the first Import in the owner's Definitions that matches the location URI, which represents the location of a referenced BPMN element.
static Import getMatchingImport(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.common.util.URI location, javax.xml.namespace.QName reference, java.lang.String importType)
          Gets the first Import in the owner's Definitions that matches the location URI.
static java.util.Map<org.eclipse.emf.ecore.EReference,org.eclipse.emf.ecore.EAttribute> getQNamedReferences(org.eclipse.emf.ecore.EClass eClass)
           
static boolean matches(Import bpmnImport, org.eclipse.emf.ecore.EObject referencer, javax.xml.namespace.QName referenceQName)
           
static
<T> T
resolveQNameReference(org.eclipse.emf.ecore.EObject referencer, org.eclipse.emf.ecore.EReference feature, javax.xml.namespace.QName referenceQName)
          Resolves the referenceQName to a model object in the the context of the referencer and the referencing feature.
static
<T> T
resolveQNameReference(org.eclipse.emf.ecore.EObject referencer, javax.xml.namespace.QName referenceQName)
          Resolves the referenceQName to a model object in the the context of the referencer.
static void setQNameReference(org.eclipse.emf.ecore.EObject referencer, BaseElement referenced, org.eclipse.emf.ecore.EStructuralFeature reference)
           
static void setQNameReference(org.eclipse.emf.ecore.EObject referencer, java.lang.Object referenced, org.eclipse.emf.ecore.EStructuralFeature reference)
           
static void setQNameReference(org.eclipse.emf.ecore.EObject referencer, org.eclipse.emf.common.util.URI referencedLocation, java.lang.String importType, javax.xml.namespace.QName referenceQName, org.eclipse.emf.ecore.EStructuralFeature reference)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QNameUtil

public QNameUtil()
Method Detail

setQNameReference

public static final void setQNameReference(org.eclipse.emf.ecore.EObject referencer,
                                           BaseElement referenced,
                                           org.eclipse.emf.ecore.EStructuralFeature reference)

checkIfImportWithDifferentLocationExists

public static Import checkIfImportWithDifferentLocationExists(org.eclipse.emf.ecore.EObject owner,
                                                              org.eclipse.emf.common.util.URI location,
                                                              javax.xml.namespace.QName reference,
                                                              java.lang.String importType)

setQNameReference

public static final void setQNameReference(org.eclipse.emf.ecore.EObject referencer,
                                           org.eclipse.emf.common.util.URI referencedLocation,
                                           java.lang.String importType,
                                           javax.xml.namespace.QName referenceQName,
                                           org.eclipse.emf.ecore.EStructuralFeature reference)

addQNameReferenceImport

public static final void addQNameReferenceImport(org.eclipse.emf.ecore.EObject referencer,
                                                 BaseElement referenced,
                                                 javax.xml.namespace.QName referenceQName)

setQNameReference

public static final void setQNameReference(org.eclipse.emf.ecore.EObject referencer,
                                           java.lang.Object referenced,
                                           org.eclipse.emf.ecore.EStructuralFeature reference)

resolveQNameReference

public static <T> T resolveQNameReference(org.eclipse.emf.ecore.EObject referencer,
                                          org.eclipse.emf.ecore.EReference feature,
                                          javax.xml.namespace.QName referenceQName)
Resolves the referenceQName to a model object in the the context of the referencer and the referencing feature.

This method will return a proxy model object if feature is specified and the reference cannot be resolved.

Type Parameters:
T - the type of model object to be resolved
Parameters:
referencer - the referencer
feature - the referencing feature, can be null if the referenced QName is not a modeled BPMN object
referenceQName - the QName to be resolved
Returns:
the model object or proxy

findVobPart

public static java.lang.String findVobPart(java.lang.String location)

findVobPart

public static java.lang.String findVobPart(java.io.File directory)

resolveQNameReference

public static <T> T resolveQNameReference(org.eclipse.emf.ecore.EObject referencer,
                                          javax.xml.namespace.QName referenceQName)
Resolves the referenceQName to a model object in the the context of the referencer.

This method will not return a proxy model object if the reference cannot be resolved.

Type Parameters:
T - the type of model object to be resolved
Parameters:
referencer - the referencer
referenceQName - the QName to be resolved
Returns:
the model object or null if it cannot be resolved

createReferenceURI

public static org.eclipse.emf.common.util.URI createReferenceURI(org.eclipse.emf.ecore.EObject referencer,
                                                                 javax.xml.namespace.QName referenceQName)
Parameters:
referencer -
referenceQName -
Returns:
URI, location URI

createReferenceURI

public static org.eclipse.emf.common.util.URI createReferenceURI(org.eclipse.emf.ecore.EObject referencer,
                                                                 javax.xml.namespace.QName referenceQName,
                                                                 java.lang.String importType)
This method first try to find an Import in the definitions associated to the referencer If it succeeds it will create a location URI based on the available details in the import

Parameters:
referencer -
referenceQName -
importType - the type of import to match, may be null
Returns:
URI, location URI

getMatchingImport

public static Import getMatchingImport(org.eclipse.emf.ecore.EObject referencer,
                                       BaseElement referenced,
                                       javax.xml.namespace.QName referenceQName)

getMatchingImport

public static Import getMatchingImport(org.eclipse.emf.ecore.EObject owner,
                                       org.eclipse.emf.common.util.URI location,
                                       javax.xml.namespace.QName reference,
                                       java.lang.String importType)
Gets the first Import in the owner's Definitions that matches the location URI.

Parameters:
owner - the reference owner
location - the reference location URI; can be null if referenceQName is specified instead
reference - the reference QName; can be null if the location URI is specified instead
importType - the type of import to match; may be null
Returns:
the first Import that matches the location URI (if specified) and the reference QName (if specified)

getMatchingImport

public static Import getMatchingImport(org.eclipse.emf.ecore.EObject owner,
                                       org.eclipse.emf.common.util.URI location)
Gets the first Import in the owner's Definitions that matches the location URI, which represents the location of a referenced BPMN element.

Parameters:
owner - the owner
location - the location URI
Returns:
the first Import that matches the location URI

matches

public static boolean matches(Import bpmnImport,
                              org.eclipse.emf.ecore.EObject referencer,
                              javax.xml.namespace.QName referenceQName)

generateQName

public static final javax.xml.namespace.QName generateQName(BaseElement owner,
                                                            BaseElement other)
Creates and returns a QName for other (which may be a proxy) in the context of the its reference from owner.

Parameters:
owner - the reference owner
other - the referenced element
Returns:
the QName for other

getDefinitions

public static final Definitions getDefinitions(org.eclipse.emf.ecore.EObject other)

getQNamedReferences

public static final java.util.Map<org.eclipse.emf.ecore.EReference,org.eclipse.emf.ecore.EAttribute> getQNamedReferences(org.eclipse.emf.ecore.EClass eClass)

createImportForTargetQName

public static void createImportForTargetQName(org.eclipse.emf.ecore.EObject referencer,
                                              org.eclipse.emf.ecore.EObject targetObject,
                                              javax.xml.namespace.QName targetQName)
This method will create an import in the definitions based on targetQName details

Parameters:
referencer - this references the targetQName
targetObject - External domain object
targetQName - A QName object that represents targetObject

generateQName

public static javax.xml.namespace.QName generateQName(java.lang.String targetNamespace,
                                                      java.lang.String localPart)
This method will generate a QName for the given name space and local part

Parameters:
targetNamespace - target namesapce for the QName
localPart - local part for the QName
Returns:
QName