Package com.atlan.cache
Class CustomMetadataCache
- All Implemented Interfaces:
Closeable
,AutoCloseable
Lazily-loaded cache for translating between Atlan-internal ID strings and human-readable names for
custom metadata (including attributes).
-
Field Summary
Fields inherited from class com.atlan.cache.AbstractMassCache
bulkRefresh, lock
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
deserializePrimitive
(com.fasterxml.jackson.databind.JsonNode jsonValue) Retrieve all the (active) custom metadata attributes.getAllCustomAttributes
(boolean includeDeleted) Retrieve all the custom metadata attributes.getAllCustomAttributes
(boolean includeDeleted, boolean forceRefresh) Retrieve all the custom metadata attributes.getAttributeDef
(String attributeId) Retrieve a specific custom metadata attribute definition by its unique Atlan-internal ID string.getAttributeDef
(String attributeId, boolean allowRefresh) Retrieve a specific custom metadata attribute definition by its unique Atlan-internal ID string.getAttributeForSearchResults
(String setName, String attributeName) Retrieve a single custom attribute name to include on search results.getAttributeForSearchResults
(String setName, String attributeName, boolean allowRefresh) Retrieve a single custom attribute name to include on search results.getAttributesForSearchResults
(String setName) Retrieve the full set of custom attributes to include on search results.getAttributesForSearchResults
(String setName, boolean allowRefresh) Retrieve the full set of custom attributes to include on search results.void
getAttributesFromCustomMetadata
(String cmId, String cmName, CustomMetadataAttributes cma, Map<String, Object> attributes) Translate the provided custom metadata attributes object into a hashed-string ID map of attributes and values.void
getAttributesFromCustomMetadata
(String cmId, String cmName, CustomMetadataAttributes cma, Map<String, Object> attributes, boolean allowRefresh) Translate the provided custom metadata attributes object into a hashed-string ID map of attributes and values.getAttrIdForName
(String setName, String attributeName) Translate the provided human-readable custom metadata set and attribute names to the Atlan-internal ID string for the attribute.getAttrIdForName
(String setName, String attributeName, boolean allowRefresh) Translate the provided human-readable custom metadata set and attribute names to the Atlan-internal ID string for the attribute.void
getBusinessAttributesFromCustomMetadata
(Map<String, CustomMetadataAttributes> customMetadata, Map<String, Map<String, Object>> businessAttributes) Translate the provided custom metadata object into a business attributes object.void
getBusinessAttributesFromCustomMetadata
(Map<String, CustomMetadataAttributes> customMetadata, Map<String, Map<String, Object>> businessAttributes, boolean allowRefresh) Translate the provided custom metadata object into a business attributes object.getCustomMetadataAttributes
(String cmId, com.fasterxml.jackson.databind.JsonNode attributes) Translate the provided attributes structure into a human-readable map of attribute names to values.getCustomMetadataAttributes
(String cmId, com.fasterxml.jackson.databind.JsonNode attributes, boolean allowRefresh) Translate the provided attributes structure into a human-readable map of attribute names to values.getCustomMetadataFromBusinessAttributes
(com.fasterxml.jackson.databind.JsonNode businessAttributes) Translate the provided business attributes object into a custom metadata object.getCustomMetadataFromBusinessAttributes
(com.fasterxml.jackson.databind.JsonNode businessAttributes, boolean allowRefresh) Translate the provided business attributes object into a custom metadata object.getCustomMetadataFromSearchResult
(Map<String, com.fasterxml.jackson.databind.JsonNode> embeddedAttributes) Translate the provided search result-embedded custom metadata into a custom metadata object.getCustomMetadataFromSearchResult
(Map<String, com.fasterxml.jackson.databind.JsonNode> embeddedAttributes, boolean allowRefresh) Translate the provided search result-embedded custom metadata into a custom metadata object.getEmptyAttributes
(String customMetadataName) Construct a full set of attributes for the given custom metadata, but where all the values are null.getEmptyAttributes
(String customMetadataName, boolean allowRefresh) Construct a full set of attributes for the given custom metadata, but where all the values are null.void
getIdMapFromNameMap
(String customMetadataName, Map<String, Object> nameToValue, Map<String, Object> idToValue) Translate the provided map keyed by human-readable attribute name into a map of keyed by attribute id.void
getIdMapFromNameMap
(String customMetadataName, Map<String, Object> nameToValue, Map<String, Object> idToValue, boolean allowRefresh) Translate the provided map keyed by human-readable attribute name into a map of keyed by attribute id.protected void
lookupById
(String id) Logic to look up a single object for the cache.protected void
lookupByName
(String name) Logic to look up a single object for the cache.protected void
Logic to refresh a specific cache en-masse (must be implemented).Methods inherited from class com.atlan.cache.AbstractMassCache
cache, cache, cacheById, cacheByName, cacheBySid, close, entrySet, getBulkRefresh, getById, getById, getByName, getByName, getBySid, getBySid, getIdForName, getIdForName, getIdForSid, getIdForSid, getIdFromName, getIdFromSid, getNameForId, getNameForId, getNameForSid, getNameForSid, getNameFromId, getNameFromId, getNameFromSid, getObjectById, getSidForName, getSidForName, getSidFromId, getSidFromName, isEmpty, isIdKnown, isNameKnown, lookupBySid, refresh
-
Constructor Details
-
CustomMetadataCache
-
-
Method Details
-
refreshCache
Logic to refresh a specific cache en-masse (must be implemented).- Specified by:
refreshCache
in classAbstractMassCache<CustomMetadataDef>
- Throws:
AtlanException
- on any error communicating with Atlan to refresh the cache of objects
-
lookupByName
Logic to look up a single object for the cache.- Specified by:
lookupByName
in classAbstractMassCache<CustomMetadataDef>
- Parameters:
name
- unique name for the object
-
lookupById
Logic to look up a single object for the cache.- Specified by:
lookupById
in classAbstractMassCache<CustomMetadataDef>
- Parameters:
id
- unique internal identifier for the object
-
getAllCustomAttributes
Retrieve all the (active) custom metadata attributes. The map will be keyed by custom metadata set name, and the value will be a listing of all the (active) attributes within that set (with all the details of each of those attributes).- Returns:
- a map from custom metadata set name to all details about all its active attributes
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getAllCustomAttributes
public Map<String,List<AttributeDef>> getAllCustomAttributes(boolean includeDeleted) throws AtlanException Retrieve all the custom metadata attributes. The map will be keyed by custom metadata set name, and the value will be a listing of all the attributes within that set (with all the details of each of those attributes).- Parameters:
includeDeleted
- if true, include the archived (deleted) custom attributes; otherwise only include active custom attributes- Returns:
- a map from custom metadata set name to all details about all its attributes
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getAllCustomAttributes
public Map<String,List<AttributeDef>> getAllCustomAttributes(boolean includeDeleted, boolean forceRefresh) throws AtlanException Retrieve all the custom metadata attributes. The map will be keyed by custom metadata set name, and the value will be a listing of all the attributes within that set (with all the details of each of those attributes).- Parameters:
includeDeleted
- if true, include the archived (deleted) custom attributes; otherwise only include active custom attributesforceRefresh
- if true, will refresh the custom metadata cache; if false, will only refresh the cache if it is empty- Returns:
- a map from custom metadata set name to all details about all its attributes
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getAttrIdForName
Translate the provided human-readable custom metadata set and attribute names to the Atlan-internal ID string for the attribute.- Parameters:
setName
- human-readable name of the custom metadata setattributeName
- human-readable name of the attribute- Returns:
- Atlan-internal ID string for the attribute
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshedNotFoundException
- if the custom metadata cannot be found (does not exist) in AtlanInvalidRequestException
- if no name was provided for the custom metadata to retrieve
-
getAttrIdForName
public String getAttrIdForName(String setName, String attributeName, boolean allowRefresh) throws AtlanException Translate the provided human-readable custom metadata set and attribute names to the Atlan-internal ID string for the attribute.- Parameters:
setName
- human-readable name of the custom metadata setattributeName
- human-readable name of the attributeallowRefresh
- whether to allow a refresh of the cache (true) or not (false)- Returns:
- Atlan-internal ID string for the attribute
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshedNotFoundException
- if the custom metadata cannot be found (does not exist) in AtlanInvalidRequestException
- if no name was provided for the custom metadata to retrieve
-
getAttributeForSearchResults
public String getAttributeForSearchResults(String setName, String attributeName) throws AtlanException Retrieve a single custom attribute name to include on search results.- Parameters:
setName
- human-readable name of the custom metadata set for which to retrieve the custom metadata attribute nameattributeName
- human-readable name of the attribute- Returns:
- the attribute name, strictly useful for inclusion in search results
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshedNotFoundException
- if the custom metadata cannot be found (does not exist) in AtlanInvalidRequestException
- if no name was provided for the custom metadata to retrieve- See Also:
-
getAttributeForSearchResults
public String getAttributeForSearchResults(String setName, String attributeName, boolean allowRefresh) throws AtlanException Retrieve a single custom attribute name to include on search results.- Parameters:
setName
- human-readable name of the custom metadata set for which to retrieve the custom metadata attribute nameattributeName
- human-readable name of the attributeallowRefresh
- whether to allow a refresh of the cache (true) or not (false)- Returns:
- the attribute name, strictly useful for inclusion in search results
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshedNotFoundException
- if the custom metadata cannot be found (does not exist) in AtlanInvalidRequestException
- if no name was provided for the custom metadata to retrieve- See Also:
-
getAttributesForSearchResults
Retrieve the full set of custom attributes to include on search results.- Parameters:
setName
- human-readable name of the custom metadata set for which to retrieve a set of attribute names- Returns:
- a set of the attribute names, strictly useful for inclusion in search results
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshedNotFoundException
- if the custom metadata cannot be found (does not exist) in AtlanInvalidRequestException
- if no name was provided for the custom metadata to retrieve- See Also:
-
getAttributesForSearchResults
public Set<String> getAttributesForSearchResults(String setName, boolean allowRefresh) throws AtlanException Retrieve the full set of custom attributes to include on search results.- Parameters:
setName
- human-readable name of the custom metadata set for which to retrieve a set of attribute namesallowRefresh
- whether to allow a refresh of the cache (true) or not (false)- Returns:
- a set of the attribute names, strictly useful for inclusion in search results
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshedNotFoundException
- if the custom metadata cannot be found (does not exist) in AtlanInvalidRequestException
- if no name was provided for the custom metadata to retrieve- See Also:
-
getAttributeDef
Retrieve a specific custom metadata attribute definition by its unique Atlan-internal ID string.- Parameters:
attributeId
- Atlan-internal ID string for the custom metadata attribute- Returns:
- attribute definition for the custom metadata attribute
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getAttributeDef
Retrieve a specific custom metadata attribute definition by its unique Atlan-internal ID string.- Parameters:
attributeId
- Atlan-internal ID string for the custom metadata attributeallowRefresh
- whether to allow a refresh of the cache (true) or not (false)- Returns:
- attribute definition for the custom metadata attribute
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getEmptyAttributes
Construct a full set of attributes for the given custom metadata, but where all the values are null.- Parameters:
customMetadataName
- for which to construct the empty map- Returns:
- a map from custom metadata attribute name (human-readable) to null values
- Throws:
AtlanException
- on any API issues
-
getEmptyAttributes
public Map<String,Object> getEmptyAttributes(String customMetadataName, boolean allowRefresh) throws AtlanException Construct a full set of attributes for the given custom metadata, but where all the values are null.- Parameters:
customMetadataName
- for which to construct the empty mapallowRefresh
- whether to allow a refresh of the cache (true) or not (false)- Returns:
- a map from custom metadata attribute name (human-readable) to null values
- Throws:
AtlanException
- on any API issues
-
getBusinessAttributesFromCustomMetadata
public void getBusinessAttributesFromCustomMetadata(Map<String, CustomMetadataAttributes> customMetadata, Map<String, throws AtlanExceptionMap<String, Object>> businessAttributes) Translate the provided custom metadata object into a business attributes object. We receive the businessAttributes object (rather than creating a new one) to initialize it with any existing business attributes.- Parameters:
customMetadata
- custom metadata objectbusinessAttributes
- business attributes object, which will be changed- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getBusinessAttributesFromCustomMetadata
public void getBusinessAttributesFromCustomMetadata(Map<String, CustomMetadataAttributes> customMetadata, Map<String, throws AtlanExceptionMap<String, Object>> businessAttributes, boolean allowRefresh) Translate the provided custom metadata object into a business attributes object. We receive the businessAttributes object (rather than creating a new one) to initialize it with any existing business attributes.- Parameters:
customMetadata
- custom metadata objectbusinessAttributes
- business attributes object, which will be changedallowRefresh
- whether to allow a refresh of the cache (true) or not (false)- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getAttributesFromCustomMetadata
public void getAttributesFromCustomMetadata(String cmId, String cmName, CustomMetadataAttributes cma, Map<String, Object> attributes) throws AtlanExceptionTranslate the provided custom metadata attributes object into a hashed-string ID map of attributes and values. We receive the attributes object (rather than creating a new one) to initialize it with any existing attributes.- Parameters:
cmId
- hashed-string ID of the custom metadata set (structure)cmName
- human-readable name of the custom metadata set (structure)cma
- custom metadata attributes in human-readable formattributes
- map of custom metadata attributes keyed by hashed-string ID of the attribute- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getAttributesFromCustomMetadata
public void getAttributesFromCustomMetadata(String cmId, String cmName, CustomMetadataAttributes cma, Map<String, Object> attributes, boolean allowRefresh) throws AtlanExceptionTranslate the provided custom metadata attributes object into a hashed-string ID map of attributes and values. We receive the attributes object (rather than creating a new one) to initialize it with any existing attributes.- Parameters:
cmId
- hashed-string ID of the custom metadata set (structure)cmName
- human-readable name of the custom metadata set (structure)cma
- custom metadata attributes in human-readable formattributes
- map of custom metadata attributes keyed by hashed-string ID of the attributeallowRefresh
- whether to allow a refresh of the cache (true) or not (false)- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getIdMapFromNameMap
public void getIdMapFromNameMap(String customMetadataName, Map<String, Object> nameToValue, Map<String, throws AtlanExceptionObject> idToValue) Translate the provided map keyed by human-readable attribute name into a map of keyed by attribute id. We receive the idToValue map (rather than creating a new one) to initialize it with any existing business attributes.- Parameters:
customMetadataName
- human-readable name of the custom metadatanameToValue
- the attributes and their values for the custom metadataidToValue
- the business metadata to map into- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getIdMapFromNameMap
public void getIdMapFromNameMap(String customMetadataName, Map<String, Object> nameToValue, Map<String, throws AtlanExceptionObject> idToValue, boolean allowRefresh) Translate the provided map keyed by human-readable attribute name into a map of keyed by attribute id. We receive the idToValue map (rather than creating a new one) to initialize it with any existing business attributes.- Parameters:
customMetadataName
- human-readable name of the custom metadatanameToValue
- the attributes and their values for the custom metadataidToValue
- the business metadata to map intoallowRefresh
- whether to allow a refresh of the cache (true) or not (false)- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getCustomMetadataFromBusinessAttributes
public Map<String,CustomMetadataAttributes> getCustomMetadataFromBusinessAttributes(com.fasterxml.jackson.databind.JsonNode businessAttributes) throws AtlanException Translate the provided business attributes object into a custom metadata object.- Parameters:
businessAttributes
- business attributes object- Returns:
- custom metadata object
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getCustomMetadataFromBusinessAttributes
public Map<String,CustomMetadataAttributes> getCustomMetadataFromBusinessAttributes(com.fasterxml.jackson.databind.JsonNode businessAttributes, boolean allowRefresh) throws AtlanException Translate the provided business attributes object into a custom metadata object.- Parameters:
businessAttributes
- business attributes objectallowRefresh
- whether to allow a refresh of the cache (true) or not (false)- Returns:
- custom metadata object
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getCustomMetadataAttributes
public CustomMetadataAttributes getCustomMetadataAttributes(String cmId, com.fasterxml.jackson.databind.JsonNode attributes) throws AtlanException Translate the provided attributes structure into a human-readable map of attribute names to values.- Parameters:
cmId
- custom metadata hashed-string IDattributes
- embedded attributes structure with hashed-string IDs- Returns:
- deserialized CustomMetadataAttributes object
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getCustomMetadataAttributes
public CustomMetadataAttributes getCustomMetadataAttributes(String cmId, com.fasterxml.jackson.databind.JsonNode attributes, boolean allowRefresh) throws AtlanException Translate the provided attributes structure into a human-readable map of attribute names to values.- Parameters:
cmId
- custom metadata hashed-string IDattributes
- embedded attributes structure with hashed-string IDsallowRefresh
- whether to allow a refresh of the cache (true) or not (false)- Returns:
- deserialized CustomMetadataAttributes object
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getCustomMetadataFromSearchResult
public Map<String,CustomMetadataAttributes> getCustomMetadataFromSearchResult(Map<String, com.fasterxml.jackson.databind.JsonNode> embeddedAttributes) throws AtlanExceptionTranslate the provided search result-embedded custom metadata into a custom metadata object.- Parameters:
embeddedAttributes
- map of custom metadata that was embedded in search result attributes, keyed by<cmId>.<attrId>
with the value of that custom attribute- Returns:
- custom metadata object
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
getCustomMetadataFromSearchResult
public Map<String,CustomMetadataAttributes> getCustomMetadataFromSearchResult(Map<String, com.fasterxml.jackson.databind.JsonNode> embeddedAttributes, boolean allowRefresh) throws AtlanExceptionTranslate the provided search result-embedded custom metadata into a custom metadata object.- Parameters:
embeddedAttributes
- map of custom metadata that was embedded in search result attributes, keyed by<cmId>.<attrId>
with the value of that custom attributeallowRefresh
- whether to allow a refresh of the cache (true) or not (false)- Returns:
- custom metadata object
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
deserializePrimitive
public static Object deserializePrimitive(com.fasterxml.jackson.databind.JsonNode jsonValue) throws LogicException - Throws:
LogicException
-