Class UserCache

All Implemented Interfaces:
Closeable, AutoCloseable

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
    • getByEmail

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

      protected void lookupBySid(String email) throws AtlanException
      Logic to look up a single object for the cache.
      Overrides:
      lookupBySid in class AbstractMassCache<AtlanUser>
      Parameters:
      email - unique email address for the user
      Throws:
      AtlanException - on any error communicating with Atlan