Package com.atlan.cache
Class UserCache
Lazily-loaded cache for translating Atlan-internal users into their various IDs.
-
Field Summary
Fields inherited from class com.atlan.cache.AbstractMassCache
bulkRefresh, lock -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdd an entry to the cache.voidcacheByEmail(String email) Wraps a single object lookup for the cache with necessary concurrency controls.getIdForEmail(String email) Translate the provided email address to its GUID.getIdForEmail(String email, boolean allowRefresh) Translate the provided email address to its GUID.getIdForName(String username, boolean allowRefresh) Translate the provided human-readable username to its GUID.getNameForId(String id, boolean allowRefresh) Translate the provided user GUID to the user's username.protected voidlookupByEmail(String email) Logic to look up a single object for the cache.protected voidlookupById(String id) Logic to look up a single object for the cache.protected voidlookupByName(String username) Logic to look up a single object for the cache.protected voidLogic to refresh a specific cache en-masse (must be implemented).Methods inherited from class com.atlan.cache.AbstractMassCache
cacheById, cacheByName, entrySet, getBulkRefresh, getById, getById, getByName, getByName, getIdForName, getIdFromName, getNameForId, getNameFromId, getObjectById, isEmpty, isIdKnown, isNameKnown, refresh
-
Constructor Details
-
UserCache
-
-
Method Details
-
refreshCache
Logic to refresh a specific cache en-masse (must be implemented).- Specified by:
refreshCachein classAbstractMassCache<AtlanUser>- Throws:
AtlanException- on any error communicating with Atlan to refresh the cache of objects
-
cache
Add an entry to the cache. This should only be called by the lookup methods, which themselves should never directly be invoked.- Overrides:
cachein classAbstractMassCache<AtlanUser>- Parameters:
id- Atlan-internal IDname- human-readable nameobject- the object to cache (if any)
-
getIdForName
Translate the provided human-readable username to its GUID.- Overrides:
getIdForNamein classAbstractMassCache<AtlanUser>- Parameters:
username- human-readable name of the userallowRefresh- whether to allow a refresh of the cache (true) or not (false)- Returns:
- unique identifier (GUID) of the user
- Throws:
AtlanException- on any API communication problem if the cache needs to be refreshedNotFoundException- if the user cannot be found (does not exist) in AtlanInvalidRequestException- if no name was provided for the user to retrieve
-
getIdForEmail
Translate the provided email address to its GUID.- Parameters:
email- email address of the user- Returns:
- unique identifier (GUID) of the user
- Throws:
AtlanException- on any API communication problem if the cache needs to be refreshedNotFoundException- if the user cannot be found (does not exist) in AtlanInvalidRequestException- if no name was provided for the user to retrieve
-
getIdForEmail
Translate the provided email address to its GUID.- Parameters:
email- email address of the userallowRefresh- whether to allow a refresh of the cache (true) or not (false)- Returns:
- unique identifier (GUID) of the user
- Throws:
AtlanException- on any API communication problem if the cache needs to be refreshedNotFoundException- if the user cannot be found (does not exist) in AtlanInvalidRequestException- if no name was provided for the user to retrieve
-
getNameForId
Translate the provided user GUID to the user's username.- Overrides:
getNameForIdin classAbstractMassCache<AtlanUser>- Parameters:
id- unique identifier (GUID) of the userallowRefresh- whether to allow a refresh of the cache (true) or not (false)- Returns:
- username of the user
- Throws:
AtlanException- on any API communication problem if the cache needs to be refreshedNotFoundException- if the user cannot be found (does not exist) in AtlanInvalidRequestException- if no name was provided for the user to retrieve
-
lookupByName
Logic to look up a single object for the cache.- Specified by:
lookupByNamein classAbstractMassCache<AtlanUser>- Parameters:
username- unique name for the object- Throws:
AtlanException- on any error communicating with Atlan
-
lookupById
Logic to look up a single object for the cache.- Specified by:
lookupByIdin classAbstractMassCache<AtlanUser>- Parameters:
id- unique internal identifier for the object- Throws:
AtlanException- on any error communicating with Atlan
-
cacheByEmail
Wraps a single object lookup for the cache with necessary concurrency controls.- Parameters:
email- unique email address for the user- Throws:
AtlanException- on any error communicating with Atlan
-
lookupByEmail
Logic to look up a single object for the cache.- Parameters:
email- unique email address for the user- Throws:
AtlanException- on any error communicating with Atlan
-