org.LexGrid.LexBIG.Utility
Class ServiceUtility

java.lang.Object
  extended by org.LexGrid.LexBIG.Utility.ServiceUtility

public class ServiceUtility
extends java.lang.Object

Utility ServiceUtility Class with various helper methods.

Author:
Kevin Peterson

Constructor Summary
ServiceUtility()
           
 
Method Summary
static AbsoluteCodingSchemeVersionReference getAbsoluteCodingSchemeVersionReference(java.lang.String codingScheme, CodingSchemeVersionOrTag tagOrVersion, boolean strict)
          Gets the absolute coding scheme version reference.
static java.lang.String getCodingSchemeName(java.lang.String codingScheme, java.lang.String version)
          Gets the coding scheme name.
static Entity getEntity(java.lang.String codingSchemeUri, java.lang.String codingSchemeVersion, java.lang.String entityCode, java.lang.String entityCodeNamespace)
          Gets the entity.
static AbsoluteCodingSchemeVersionReference getParentOfSupplement(java.lang.String codingScheme, CodingSchemeVersionOrTag tagOrVersion)
          Gets the parent of a supplement.
static AbsoluteCodingSchemeVersionReference getParentOfSupplement(java.lang.String uri, java.lang.String version)
          Gets the parent of a supplement.
static java.lang.String getSchemaVersionForCodingScheme(java.lang.String codingSchemeName, CodingSchemeVersionOrTag versionOrTag)
          Gets the schema version for coding scheme.
static java.lang.String getVersion(java.lang.String codingScheme, CodingSchemeVersionOrTag tagOrVersion)
          Gets the version.
static boolean isSortAlgorithmValid(java.lang.String algorithm, SortContext context)
          Checks if is sort algorithm valid.
static boolean isSupplement(java.lang.String codingScheme, CodingSchemeVersionOrTag tagOrVersion)
          Checks if a given coding scheme is a supplement.
static boolean isSupplement(java.lang.String uri, java.lang.String version)
          Checks if a given coding scheme is a supplement.
static boolean passFilters(ResolvedConceptReference candidate, Filter[] filterOptions)
          Pass filters.
static AbsoluteCodingSchemeVersionReference resolveCodingSchemeFromLocalName(java.lang.String uri, java.lang.String version, java.lang.String codingSchemeLocalName, java.lang.String localCodingSchemeVersion)
          Resolve coding scheme from local name.
static Entity resolveConceptReference(ResolvedConceptReference conceptReference)
          Resolve concept reference.
static
<T extends ResolvedConceptReference>
T
resolveResolvedConceptReference(java.lang.String uri, java.lang.String version, LocalNameList propertyNames, CodedNodeSet.PropertyType[] propertyTypes, NamespaceHandler namespaceHandler, T resolvedConceptReference)
          Resolve resolved concept reference.
static
<T extends ResolvedConceptReference>
T
resolveResolvedConceptReference(java.lang.String uri, java.lang.String version, LocalNameList propertyNames, CodedNodeSet.PropertyType[] propertyTypes, T resolvedConceptReference)
          Resolve resolved concept reference.
static
<T extends java.lang.Throwable,O>
O
throwExceptionOrReturnDefault(T exception, O defaultReturnValue, boolean strict)
          Throw exception or return default.
static Filter[] validateFilters(LocalNameList filterOptions)
          Validate filters.
static void validateParameter(java.lang.String codingSchemeNameOrUri, java.lang.String codingSchemeVersion, LocalNameList list, java.lang.Class<? extends URIMap> supportedAttributeClass)
          Validate parameter.
static void validateParameter(java.lang.String codingSchemeNameOrUri, java.lang.String codingSchemeVersion, java.lang.String localId, java.lang.Class<? extends URIMap> supportedAttributeClass)
          Validate parameter.
static void validateSortOptions(SortOptionList sortOptions)
          Validate sort options.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceUtility

public ServiceUtility()
Method Detail

resolveCodingSchemeFromLocalName

public static AbsoluteCodingSchemeVersionReference resolveCodingSchemeFromLocalName(java.lang.String uri,
                                                                                    java.lang.String version,
                                                                                    java.lang.String codingSchemeLocalName,
                                                                                    java.lang.String localCodingSchemeVersion)
                                                                             throws LBParameterException
Resolve coding scheme from local name.

Parameters:
uri - the uri
version - the version
relationsCodingSchemeLocalName - the relations coding scheme local name
relationsCodingSchemeVersion - the relations coding scheme version
Returns:
the absolute coding scheme version reference
Throws:
LBParameterException - the LB parameter exception

resolveConceptReference

public static Entity resolveConceptReference(ResolvedConceptReference conceptReference)
                                      throws LBParameterException
Resolve concept reference.

Parameters:
conceptReference - the concept reference
Returns:
the entity
Throws:
LBParameterException - the LB parameter exception

getAbsoluteCodingSchemeVersionReference

public static AbsoluteCodingSchemeVersionReference getAbsoluteCodingSchemeVersionReference(java.lang.String codingScheme,
                                                                                           CodingSchemeVersionOrTag tagOrVersion,
                                                                                           boolean strict)
                                                                                    throws LBParameterException
Gets the absolute coding scheme version reference.

Parameters:
codingScheme - the coding scheme
tagOrVersion - the tag or version
strict - the strict
Returns:
the absolute coding scheme version reference
Throws:
LBParameterException - the LB parameter exception

getVersion

public static java.lang.String getVersion(java.lang.String codingScheme,
                                          CodingSchemeVersionOrTag tagOrVersion)
                                   throws LBParameterException
Gets the version.

Parameters:
codingScheme - the coding scheme
tagOrVersion - the tag or version
Returns:
the version
Throws:
LBParameterException - the LB parameter exception

getCodingSchemeName

public static java.lang.String getCodingSchemeName(java.lang.String codingScheme,
                                                   java.lang.String version)
                                            throws LBParameterException
Gets the coding scheme name.

Parameters:
codingScheme - the coding scheme
version - the version
Returns:
the coding scheme name
Throws:
LBParameterException - the LB parameter exception

validateParameter

public static void validateParameter(java.lang.String codingSchemeNameOrUri,
                                     java.lang.String codingSchemeVersion,
                                     LocalNameList list,
                                     java.lang.Class<? extends URIMap> supportedAttributeClass)
                              throws LBParameterException
Validate parameter.

Parameters:
codingSchemeNameOrUri - the coding scheme name or uri
codingSchemeVersion - the coding scheme version
list - the list
supportedAttributeClass - the supported attribute class
Throws:
LBParameterException - the LB parameter exception

throwExceptionOrReturnDefault

public static <T extends java.lang.Throwable,O> O throwExceptionOrReturnDefault(T exception,
                                                                                O defaultReturnValue,
                                                                                boolean strict)
                                       throws T extends java.lang.Throwable
Throw exception or return default.

Parameters:
exception - the exception
defaultReturnValue - the default return value
strict - the strict
Returns:
the o
Throws:
T - the T
T extends java.lang.Throwable

validateParameter

public static void validateParameter(java.lang.String codingSchemeNameOrUri,
                                     java.lang.String codingSchemeVersion,
                                     java.lang.String localId,
                                     java.lang.Class<? extends URIMap> supportedAttributeClass)
                              throws LBParameterException
Validate parameter.

Parameters:
codingSchemeNameOrUri - the coding scheme name or uri
codingSchemeVersion - the coding scheme version
localId - the local id
supportedAttributeClass - the supported attribute class
Throws:
LBParameterException - the LB parameter exception

validateFilters

public static Filter[] validateFilters(LocalNameList filterOptions)
                                throws LBParameterException
Validate filters.

Parameters:
filterOptions - the filter options
Returns:
the filter[]
Throws:
LBParameterException - the LB parameter exception

isSortAlgorithmValid

public static boolean isSortAlgorithmValid(java.lang.String algorithm,
                                           SortContext context)
Checks if is sort algorithm valid.

Parameters:
algorithm - the algorithm
context - the context
Returns:
true, if is sort algorithm valid

passFilters

public static boolean passFilters(ResolvedConceptReference candidate,
                                  Filter[] filterOptions)
Pass filters.

Parameters:
candidate - the candidate
filterOptions - the filter options
Returns:
true, if successful

resolveResolvedConceptReference

public static <T extends ResolvedConceptReference> T resolveResolvedConceptReference(java.lang.String uri,
                                                                                     java.lang.String version,
                                                                                     LocalNameList propertyNames,
                                                                                     CodedNodeSet.PropertyType[] propertyTypes,
                                                                                     NamespaceHandler namespaceHandler,
                                                                                     T resolvedConceptReference)
                                                                          throws LBParameterException
Resolve resolved concept reference.

Parameters:
uri - the uri
version - the version
propertyNames - the property names
propertyTypes - the property types
namespaceHandler - the namespace handler
resolvedConceptReference - the resolved concept reference
Returns:
the t
Throws:
LBParameterException - the LB parameter exception

resolveResolvedConceptReference

public static <T extends ResolvedConceptReference> T resolveResolvedConceptReference(java.lang.String uri,
                                                                                     java.lang.String version,
                                                                                     LocalNameList propertyNames,
                                                                                     CodedNodeSet.PropertyType[] propertyTypes,
                                                                                     T resolvedConceptReference)
Resolve resolved concept reference.

Parameters:
uri - the uri
version - the version
propertyNames - the property names
propertyTypes - the property types
resolvedConceptReference - the resolved concept reference
Returns:
the t

getSchemaVersionForCodingScheme

public static java.lang.String getSchemaVersionForCodingScheme(java.lang.String codingSchemeName,
                                                               CodingSchemeVersionOrTag versionOrTag)
                                                        throws LBParameterException
Gets the schema version for coding scheme.

Parameters:
codingSchemeName - the coding scheme name
versionOrTag - the version or tag
Returns:
the schema version for coding scheme
Throws:
LBParameterException - the LB parameter exception

getEntity

public static Entity getEntity(java.lang.String codingSchemeUri,
                               java.lang.String codingSchemeVersion,
                               java.lang.String entityCode,
                               java.lang.String entityCodeNamespace)
                        throws LBException
Gets the entity.

Parameters:
codingSchemeUri - the coding scheme uri
codingSchemeVersion - the coding scheme version
entityCode - the entity code
entityCodeNamespace - the entity code namespace
Returns:
the entity
Throws:
LBException - the LB exception

validateSortOptions

public static void validateSortOptions(SortOptionList sortOptions)
                                throws LBParameterException
Validate sort options.

Parameters:
sortOptions - the sort options
Throws:
LBParameterException - the LB parameter exception

isSupplement

public static boolean isSupplement(java.lang.String codingScheme,
                                   CodingSchemeVersionOrTag tagOrVersion)
                            throws LBParameterException
Checks if a given coding scheme is a supplement.

Parameters:
codingScheme - the coding scheme
tagOrVersion - the tag or version
Returns:
true, if is supplement
Throws:
LBParameterException - the LB parameter exception

isSupplement

public static boolean isSupplement(java.lang.String uri,
                                   java.lang.String version)
                            throws LBParameterException
Checks if a given coding scheme is a supplement.

Parameters:
uri - the uri
version - the version
Returns:
true, if is supplement
Throws:
LBParameterException - the LB parameter exception

getParentOfSupplement

public static AbsoluteCodingSchemeVersionReference getParentOfSupplement(java.lang.String codingScheme,
                                                                         CodingSchemeVersionOrTag tagOrVersion)
                                                                  throws LBParameterException
Gets the parent of a supplement.

Parameters:
uri - the uri
version - the version
Returns:
the parent of supplement
Throws:
LBParameterException - the LB parameter exception

getParentOfSupplement

public static AbsoluteCodingSchemeVersionReference getParentOfSupplement(java.lang.String uri,
                                                                         java.lang.String version)
                                                                  throws LBParameterException
Gets the parent of a supplement.

Parameters:
uri - the uri
version - the version
Returns:
the parent of supplement
Throws:
LBParameterException - the LB parameter exception

Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER.