gov.nih.nci.cagrid.data.utilities
Class DomainModelUtils

java.lang.Object
  extended by gov.nih.nci.cagrid.data.utilities.DomainModelUtils

public class DomainModelUtils
extends java.lang.Object

DomainModelUtils Utilities for walking and manipulating a DomainModel

Version:
$Id$
Author:
David W. Ervin, Scott Oster

Constructor Summary
DomainModelUtils()
           
 
Method Summary
static UMLClass[] getAllSuperclasses(DomainModel model, java.lang.String className)
          Gets all superclasses of the specified UMLCLass
static UMLClass[] getAllSuperclasses(DomainModel model, UMLClass umlClass)
          Gets all superclasses of the specified UMLCLass
static UMLClassReference getClassReference(DomainModel model, java.lang.String className)
          Gets the UMLClassReference for a class in a domain model
static java.lang.String getQualifiedClassname(UMLClass clazz)
           
static UMLClass getReferencedUMLClass(DomainModel model, UMLClassReference reference)
          Return the UMLClass from the DomainModel's exposed UML Classes if the UMLClass with an id exists which is equal to the refid of the UMLClassReference.
static UMLClass[] getUMLClassForConcept(DomainModel model, java.lang.String conceptCode, boolean primaryConceptOnly)
           
static java.util.Map<gov.nih.nci.cagrid.data.utilities.DomainModelUtils.CDE,gov.nih.nci.cagrid.data.utilities.DomainModelUtils.CDE> mapCommonDataElements(DomainModel domainModel1, DomainModel domainModel2)
          Finds common data elements between two domain models, useful for finding join points for DCQL queries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainModelUtils

public DomainModelUtils()
Method Detail

getReferencedUMLClass

public static UMLClass getReferencedUMLClass(DomainModel model,
                                             UMLClassReference reference)
Return the UMLClass from the DomainModel's exposed UML Classes if the UMLClass with an id exists which is equal to the refid of the UMLClassReference. In all other cases, null is returned.

Parameters:
model - the DomainModel to look in
reference - the UMLClassReference to the UMLClass to look for in the model
Returns:
null or the referenced UMLClass

getAllSuperclasses

public static UMLClass[] getAllSuperclasses(DomainModel model,
                                            UMLClass umlClass)
Gets all superclasses of the specified UMLCLass

Parameters:
model - The domain model to search for superclasses
umlClass - The class to retrieve superclasses of
Returns:
All superclasses of the specified UMLClass

getAllSuperclasses

public static UMLClass[] getAllSuperclasses(DomainModel model,
                                            java.lang.String className)
Gets all superclasses of the specified UMLCLass

Parameters:
model - The domain model to search for superclasses
className - The name of the class to retrieve superclasses of
Returns:
All superclasses of the named class

getClassReference

public static UMLClassReference getClassReference(DomainModel model,
                                                  java.lang.String className)
Gets the UMLClassReference for a class in a domain model

Parameters:
model - The domain model
className - The fully qualified name of the class
Returns:
The UMLClassReference, or null if no class was found

getQualifiedClassname

public static java.lang.String getQualifiedClassname(UMLClass clazz)
Parameters:
clazz -
Returns:
the package qualified classname of the given class

getUMLClassForConcept

public static UMLClass[] getUMLClassForConcept(DomainModel model,
                                               java.lang.String conceptCode,
                                               boolean primaryConceptOnly)
Parameters:
model - the DomainModel to examine
conceptCode - the concept code to look for
Returns:
the UMLClasses in the given DomainModel which are based on the given concept code

mapCommonDataElements

public static java.util.Map<gov.nih.nci.cagrid.data.utilities.DomainModelUtils.CDE,gov.nih.nci.cagrid.data.utilities.DomainModelUtils.CDE> mapCommonDataElements(DomainModel domainModel1,
                                                                                                                                                                 DomainModel domainModel2)
Finds common data elements between two domain models, useful for finding join points for DCQL queries. The CDEs are considered "common" if they use the same public ID and version. The SemanticMetadata of the returned CDE map can then be checked for appropriate Semantic Equivalence

Parameters:
domainModel1 - the first domain model
domainModel2 - the second domain model
Returns:
a Map of CDEs from the first model, which map to CDEs in the second model