Interface ProfileDao

All Known Implementing Classes:
MongoProfileDao

public interface ProfileDao
Created by patricktwohig on 6/28/17.
  • Method Details

    • findActiveProfile

      Optional<Profile> findActiveProfile(String profileId)
      Finds the profile with the supplied profile ID. Returning null if no profile matches the requested profile ID.
      Parameters:
      profileId - the profile ID
      Returns:
      the active profile with the supplied ID, or null if not found.
    • findActiveProfileForUser

      Optional<Profile> findActiveProfileForUser(String profileId, String userId)
      Finds the profile with the supplied profile ID. Returning null if no profile matches the requested profile ID and user ID.
      Parameters:
      profileId - the profileId
      userId - the id of the profile
      Returns:
      the active profile, or null if not found
    • getActiveProfiles

      Pagination<Profile> getActiveProfiles(int offset, int count, String applicationNameOrId, String userId, Long lowerBoundTimestamp, Long upperBoundTimestamp)
      Gets actives profiles specifying the offset and the count.
      Parameters:
      offset - the offset
      count - the count
      applicationNameOrId - the application name or ID (may be null)
      userId - the user ID (may be null)
      lowerBoundTimestamp - optional last login lower bound cutoff in ms (inclusive). If negative valued, defaults to unix epoch.
      upperBoundTimestamp - optional last login upper bound cutoff in ms (inclusive). If negative valued, defaults to current server time.
      Returns:
      a Pagination of Profile objects.
    • getActiveProfiles

      Pagination<Profile> getActiveProfiles(int offset, int count, String search)
      Gets actives profiles specifying the offset and the count, specifying a search filter.
      Parameters:
      offset - the offset
      count - the count
      search - the search string
      Returns:
      a Pagination of Profile objects.
    • getActiveProfile

      Profile getActiveProfile(String profileId)
      Gets the specific active profile with the id, or throws a NotFoundException if the profile can't be found.
      Returns:
      the Profile that was requested, never null
    • updateActiveProfile

      default Profile updateActiveProfile(Profile profile)
      Updates the specific active profile with the id, or throws a NotFoundException if the profile can't be found. The Profile.getId() is used to key the profile being updated.
      Returns:
      the Profile as it was written into the database
    • updateActiveProfile

      Profile updateActiveProfile(Profile profile, Map<String,Object> metadata)
      Updates the specific active profile with the id, or throws a NotFoundException if the profile can't be found. The Profile.getId() is used to key the profile being updated.
      Parameters:
      metadata - the profile metadata
      Returns:
      the Profile as it was written into the database
    • updateMetadata

      Profile updateMetadata(String profileId, Map<String,Object> metadata)
      Updates metadata for the specified Profile, ignoring changes to all other fields.
      Parameters:
      profileId - the profile
      metadata - the metadata
      Returns:
      the updated Profile
    • updateMetadata

      Profile updateMetadata(Profile profile, Map<String,Object> metadata)
      Updates metadata for the specified Profile, ignoring changes to all other fields.
      Parameters:
      profile - the profile
      metadata - the metadata
      Returns:
      the updated Profile
    • createOrReactivateProfile

      default Profile createOrReactivateProfile(Profile profile)
      Creates or reactivates an inactive profile. If the profile is active then this throws a DuplicateException. The newly created or reactivated profile will contain the ID of the profile as requested. The value of Profile.getId() will be ignored and updates will be keyed using the User and Application.
      Returns:
      the Profile as it was written into the database
    • createOrReactivateProfile

      Profile createOrReactivateProfile(Profile profile, Map<String,Object> metadata)
      Creates or reactivates an inactive profile. If the profile is active then this throws a DuplicateException. The newly created or reactivated profile will contain the ID of the profile as requested. The value of Profile.getId() will be ignored and updates will be keyed using the User and Application.
      Parameters:
      metadata - the profile metadata
      Returns:
      the Profile as it was written into the database
    • createOrRefreshProfile

      Profile createOrRefreshProfile(Profile profile)
      Creates, reactivates, or refreshes a Profile. This is similar to createOrReactivateProfile(Profile) except that it will upsert the Profile.

      If the profile is already active, then this will perform minimal updates of the profile as it is supplied. Specifically, it will not update the display name, application, and user field. It will only update the image url, if it was supplied.

      Parameters:
      profile - the user
      Returns:
      the Profile, as written to the database
    • softDeleteProfile

      void softDeleteProfile(String profileId)
      Deletes a profile by marking it as inactive. Data is otherwise retained in the database.
      Parameters:
      profileId - the profile ID