Class 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 Summary

      Constructors 
      Constructor Description
      TypeDefCache()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addAttributeTypeDef​(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.AttributeTypeDef typeDef)
      Cache the provided attribute type definition for use across threads.
      static void addTypeDef​(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef typeDef)
      Cache the provided type definition for use across threads.
      static Map<String,​PropertyKeywords> getAllPropertyKeywordsForTypeDef​(String typeDefGUID)
      Retrieve a map of all property keywords for the provided type definition.
      static List<org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefLink> getAllSuperTypes​(String typeDefGUID)
      Retrieve a list of all supertypes of the provided type definition.
      static Set<String> getAllTypeDefsForProperty​(String propertyName)
      Return the names of all type definitions that define the supplied property name.
      static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.AttributeTypeDef getAttributeTypeDef​(String typeDefGUID)
      Retrieve the attribute type definition for the given GUID.
      static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceStatus getInitialStatus​(String typeName)
      Retrieve the initial status to use for an instance of the supplied type.
      static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceType getInstanceType​(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory category, String typeName)
      Retrieve the instance type representing the provided type definition.
      static PropertyKeywords getPropertyKeywords​(String typeDefGUID, String propertyName)
      Retrieve the property keywords for the provided property in the specified type definition.
      static String getPropertyNamespaceForType​(String typeDefGUID)
      Retrieve the namespace for the provided type definition's properties.
      static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef getTypeDef​(String typeDefGUID)
      Retrieve the type definition for the given GUID.
      static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef getTypeDefByName​(String typeDefName)
      Retrieve the type definition for the given name.
      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.
      static boolean isValidClassificationForEntity​(String classificationTypeName, String entityTypeName)
      Return boolean indicating if a classification type can be applied to a specified entity.
      static void removeAttributeTypeDef​(String typeDefGUID)
      Remove the cached attribute type definition.
      static void removeTypeDef​(String typeDefGUID)
      Remove the cached type definition.
    • Constructor Detail

      • TypeDefCache

        public TypeDefCache()
    • Method Detail

      • addTypeDef

        public static void addTypeDef​(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef typeDef)
                               throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException
        Cache the provided type definition for use across threads.
        Parameters:
        typeDef - the type definition to cache
        Throws:
        org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException - if there is any issue with the contents of the type definition
      • getTypeDef

        public static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.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 org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.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​(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.AttributeTypeDef typeDef)
        Cache the provided attribute type definition for use across threads.
        Parameters:
        typeDef - the attribute type definition to cache
      • getAttributeTypeDef

        public static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.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<org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.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 org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceType getInstanceType​(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory category,
                                                                                                                                                           String typeName)
                                                                                                                                                    throws org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeErrorException
        Retrieve the instance type representing the provided type definition.
        Parameters:
        category - of the type definition
        typeName - of the type definition
        Returns:
        InstanceType
        Throws:
        org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeErrorException - if there are any errors determining or matching the type definition
      • getInitialStatus

        public static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.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)