java.lang.Object
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.cache.TypeDefCache

public class TypeDefCache extends Object
A shadow cache of all typeDef information. This is necessary to maintain due to fact that caching in the OMRSRepositoryContentManager does not occur until AFTER the OMRSMetadataCollection operation (i.e. addTypeDef) is fully completed: making it impossible to use the repositoryHelper inside any method that addTypeDef itself may call.
  • Constructor Details

    • TypeDefCache

      public TypeDefCache()
  • Method Details

    • addTypeDef

      public static void addTypeDef(TypeDef typeDef) throws InvalidParameterException
      Cache the provided type definition for use across threads.
      Parameters:
      typeDef - the type definition to cache
      Throws:
      InvalidParameterException - if there is any issue with the contents of the type definition
    • getTypeDef

      public static TypeDef getTypeDef(String typeDefGUID)
      Retrieve the type definition for the given GUID.
      Parameters:
      typeDefGUID - unique identifier of the type definition
      Returns:
      TypeDef that matches the GUID, or null if there is no such type definition
    • getTypeDefByName

      public static TypeDef getTypeDefByName(String typeDefName)
      Retrieve the type definition for the given name.
      Parameters:
      typeDefName - unique name of the type definition
      Returns:
      TypeDef that matches the name, or null if there is no such type definition
    • removeTypeDef

      public static void removeTypeDef(String typeDefGUID)
      Remove the cached type definition.
      Parameters:
      typeDefGUID - unique identifier of the type definition to remove from the cache
    • addAttributeTypeDef

      public static void addAttributeTypeDef(AttributeTypeDef typeDef)
      Cache the provided attribute type definition for use across threads.
      Parameters:
      typeDef - the attribute type definition to cache
    • getAttributeTypeDef

      public static AttributeTypeDef getAttributeTypeDef(String typeDefGUID)
      Retrieve the attribute type definition for the given GUID.
      Parameters:
      typeDefGUID - unique identifier of the attribute type definition
      Returns:
      AttributeTypeDef that matches the GUID, or null if there is no such attribute type definition
    • removeAttributeTypeDef

      public static void removeAttributeTypeDef(String typeDefGUID)
      Remove the cached attribute type definition.
      Parameters:
      typeDefGUID - unique identifier of the attribute type definition to remove from the cache
    • getAllSuperTypes

      public static List<TypeDefLink> getAllSuperTypes(String typeDefGUID)
      Retrieve a list of all supertypes of the provided type definition.
      Parameters:
      typeDefGUID - unique identifier of the type definition for which to retrieve all supertypes
      Returns:
      List<TypeDefLink> of all supertypes
    • getAllPropertyKeywordsForTypeDef

      public static Map<String,PropertyKeywords> getAllPropertyKeywordsForTypeDef(String typeDefGUID)
      Retrieve a map of all property keywords for the provided type definition.
      Parameters:
      typeDefGUID - unique identifier of the type definition for which to retrieve all properties
      Returns:
      Map<String, PropertyKeywords> keyed by unqualified (simple) property name with the qualified property keywords as the value
    • getPropertyKeywords

      public static PropertyKeywords getPropertyKeywords(String typeDefGUID, String propertyName)
      Retrieve the property keywords for the provided property in the specified type definition.
      Parameters:
      typeDefGUID - unique identifier of the type definition for which to retrieve the property
      propertyName - name of the property for which to retrieve the keywords
      Returns:
      PropertyKeywords
    • isTypeOf

      public static boolean isTypeOf(String actualTypeName, String expectedTypeName)
      Validate that an entity's type is of the expected/desired type, which may be a subtype of the expected type.
      Parameters:
      actualTypeName - name of the entity type
      expectedTypeName - name of the expected type
      Returns:
      boolean if they match (a null in actualTypeName results in false; a null in expectedType results in true)
    • getAllTypeDefsForProperty

      public static Set<String> getAllTypeDefsForProperty(String propertyName)
      Return the names of all type definitions that define the supplied property name.
      Parameters:
      propertyName - property name to query.
      Returns:
      set of names of the TypeDefs that define a property with this name
    • getPropertyNamespaceForType

      public static String getPropertyNamespaceForType(String typeDefGUID)
      Retrieve the namespace for the provided type definition's properties.
      Parameters:
      typeDefGUID - unique identifier of the type definition for which to retrieve the property namespace
      Returns:
      String
    • getInstanceType

      public static InstanceType getInstanceType(TypeDefCategory category, String typeName) throws TypeErrorException
      Retrieve the instance type representing the provided type definition.
      Parameters:
      category - of the type definition
      typeName - of the type definition
      Returns:
      InstanceType
      Throws:
      TypeErrorException - if there are any errors determining or matching the type definition
    • getInitialStatus

      public static InstanceStatus getInitialStatus(String typeName)
      Retrieve the initial status to use for an instance of the supplied type.
      Parameters:
      typeName - of the type definition for which to retrieve the initial status
      Returns:
      InstanceStatus
    • isValidClassificationForEntity

      public static boolean isValidClassificationForEntity(String classificationTypeName, String entityTypeName)
      Return boolean indicating if a classification type can be applied to a specified entity.
      Parameters:
      classificationTypeName - name of the classification's type (ClassificationDef)
      entityTypeName - name of the entity's type (EntityDef)
      Returns:
      boolean indicating if the classification is valid for the entity (true) or not (false)