Package com.atlan.cache
Class UserCache
- All Implemented Interfaces:
Closeable
,AutoCloseable
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
-
Method Summary
Modifier and TypeMethodDescriptiongetByEmail
(String email) Retrieve a user by their email address.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 void
lookupById
(String id) Logic to look up a single object for the cache.protected void
lookupByName
(String username) Logic to look up a single object for the cache.protected void
lookupBySid
(String email) 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, getIdForSid, getIdForSid, getIdFromName, getIdFromSid, getNameForId, getNameForSid, getNameForSid, getNameFromId, getNameFromId, getNameFromSid, getObjectById, getSidForName, getSidForName, getSidFromId, getSidFromName, isEmpty, isIdKnown, isNameKnown, refresh
-
Constructor Details
-
UserCache
-
-
Method Details
-
refreshCache
Logic to refresh a specific cache en-masse (must be implemented).- Specified by:
refreshCache
in classAbstractMassCache<AtlanUser>
- Throws:
AtlanException
- on any error communicating with Atlan to refresh the cache of objects
-
getByEmail
Retrieve a user by their email address.- Parameters:
email
- of the user- Returns:
- the user, if any exists with that email address
- 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 email was provided for the user to retrieve
-
getIdForName
Translate the provided human-readable username to its GUID.- Overrides:
getIdForName
in 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:
getNameForId
in 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:
lookupByName
in 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:
lookupById
in classAbstractMassCache<AtlanUser>
- Parameters:
id
- unique internal identifier for the object- Throws:
AtlanException
- on any error communicating with Atlan
-
lookupBySid
Logic to look up a single object for the cache.- Overrides:
lookupBySid
in classAbstractMassCache<AtlanUser>
- Parameters:
email
- unique email address for the user- Throws:
AtlanException
- on any error communicating with Atlan
-