Class TypeDefCache
java.lang.Object
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.cache.TypeDefCache
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAttributeTypeDef
(AttributeTypeDef typeDef) Cache the provided attribute type definition for use across threads.static void
addTypeDef
(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<TypeDefLink>
getAllSuperTypes
(String typeDefGUID) Retrieve a list of all supertypes of the provided type definition.getAllTypeDefsForProperty
(String propertyName) Return the names of all type definitions that define the supplied property name.static AttributeTypeDef
getAttributeTypeDef
(String typeDefGUID) Retrieve the attribute type definition for the given GUID.static InstanceStatus
getInitialStatus
(String typeName) Retrieve the initial status to use for an instance of the supplied type.static InstanceType
getInstanceType
(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 TypeDef
getTypeDef
(String typeDefGUID) Retrieve the type definition for the given GUID.static TypeDef
getTypeDefByName
(String typeDefName) Retrieve the type definition for the given name.static boolean
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 Details
-
TypeDefCache
public TypeDefCache()
-
-
Method Details
-
addTypeDef
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
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
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
Remove the cached type definition.- Parameters:
typeDefGUID
- unique identifier of the type definition to remove from the cache
-
addAttributeTypeDef
Cache the provided attribute type definition for use across threads.- Parameters:
typeDef
- the attribute type definition to cache
-
getAttributeTypeDef
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
Remove the cached attribute type definition.- Parameters:
typeDefGUID
- unique identifier of the attribute type definition to remove from the cache
-
getAllSuperTypes
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
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
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 propertypropertyName
- name of the property for which to retrieve the keywords- Returns:
- PropertyKeywords
-
isTypeOf
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 typeexpectedTypeName
- 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
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
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 definitiontypeName
- of the type definition- Returns:
- InstanceType
- Throws:
TypeErrorException
- if there are any errors determining or matching the type definition
-
getInitialStatus
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)
-