Class UserCache


public class UserCache extends AbstractMassCache<AtlanUser>
Lazily-loaded cache for translating Atlan-internal users into their various IDs.
  • Constructor Details

  • Method Details

    • refreshCache

      protected void refreshCache() throws AtlanException
      Logic to refresh a specific cache en-masse (must be implemented).
      Specified by:
      refreshCache in class AbstractMassCache<AtlanUser>
      Throws:
      AtlanException - on any error communicating with Atlan to refresh the cache of objects
    • cache

      protected void cache(String id, String name, AtlanUser object)
      Add an entry to the cache. This should only be called by the lookup methods, which themselves should never directly be invoked.
      Overrides:
      cache in class AbstractMassCache<AtlanUser>
      Parameters:
      id - Atlan-internal ID
      name - human-readable name
      object - the object to cache (if any)
    • getIdForName

      public String getIdForName(String username, boolean allowRefresh) throws AtlanException
      Translate the provided human-readable username to its GUID.
      Overrides:
      getIdForName in class AbstractMassCache<AtlanUser>
      Parameters:
      username - human-readable name of the user
      allowRefresh - 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 refreshed
      NotFoundException - if the user cannot be found (does not exist) in Atlan
      InvalidRequestException - if no name was provided for the user to retrieve
    • getIdForEmail

      public String getIdForEmail(String email) throws AtlanException
      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 refreshed
      NotFoundException - if the user cannot be found (does not exist) in Atlan
      InvalidRequestException - if no name was provided for the user to retrieve
    • getIdForEmail

      public String getIdForEmail(String email, boolean allowRefresh) throws AtlanException
      Translate the provided email address to its GUID.
      Parameters:
      email - email address of the user
      allowRefresh - 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 refreshed
      NotFoundException - if the user cannot be found (does not exist) in Atlan
      InvalidRequestException - if no name was provided for the user to retrieve
    • getNameForId

      public String getNameForId(String id, boolean allowRefresh) throws AtlanException
      Translate the provided user GUID to the user's username.
      Overrides:
      getNameForId in class AbstractMassCache<AtlanUser>
      Parameters:
      id - unique identifier (GUID) of the user
      allowRefresh - 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 refreshed
      NotFoundException - if the user cannot be found (does not exist) in Atlan
      InvalidRequestException - if no name was provided for the user to retrieve
    • lookupByName

      protected void lookupByName(String username) throws AtlanException
      Logic to look up a single object for the cache.
      Specified by:
      lookupByName in class AbstractMassCache<AtlanUser>
      Parameters:
      username - unique name for the object
      Throws:
      AtlanException - on any error communicating with Atlan
    • lookupById

      protected void lookupById(String id) throws AtlanException
      Logic to look up a single object for the cache.
      Specified by:
      lookupById in class AbstractMassCache<AtlanUser>
      Parameters:
      id - unique internal identifier for the object
      Throws:
      AtlanException - on any error communicating with Atlan
    • cacheByEmail

      public void cacheByEmail(String email) throws AtlanException
      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

      protected void lookupByEmail(String email) throws AtlanException
      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