Interface ProfileService

All Known Implementing Classes:
SuperUserProfileService, UserProfileService

public interface ProfileService
Manages instances of Profile. Created by patricktwohig on 6/27/17.
  • Field Details

  • Method Details

    • getProfiles

      Pagination<Profile> getProfiles(int offset, int count, String applicationNameOrId, String userId, Long lowerBoundTimestamp, Long upperBoundTimestamp)
      Lists all Profile instances starting with the offset and count.
      Parameters:
      offset - the offset
      count - the count
      applicationNameOrId - the application name or ID to use when fetching the profiles
      userId - the userId which to use when filtering. If null, then no filtering will be applied.
      lowerBoundTimestamp -
      upperBoundTimestamp -
      Returns:
      a Pagination of Profile instances
    • getProfiles

      Pagination<Profile> getProfiles(int offset, int count, String search)
      Lists all Profile instances, specifying a search query.
      Parameters:
      offset -
      count -
      search -
      Returns:
    • redactPrivateInformation

      default Profile redactPrivateInformation(Profile profile)
      Redacts any private information from the Profile and returns either a new instance or the current instance modified. The default implementation simply sets the user to null and returns the supplied instance. Other implementations such as those used for superuser access may redact information differently.
      Parameters:
      profile - the Profile from which to redact private information
      Returns:
      a Profile with the information redacted (may be the same instance provided
    • getProfile

      Profile getProfile(String profileId)
      Fetches a specific Profile instance based on ID. If not found, an exception is raised.
      Parameters:
      profileId - the profile ID
      Returns:
      the Profile, never null
    • getCurrentProfile

      Profile getCurrentProfile()
      Returns the Profile of the currently logged-in user. If the user has no profile, or that information is not available, then this will throw an exception. Using a profile is not required for all calls. Therefore, it should be expected that this will throw NotFoundException under normal circumstances.
      Returns:
      the Profile, or null, if no profile is found.
    • findCurrentProfile

      Optional<Profile> findCurrentProfile()
      Finds the currently active profile, if any.
      Returns:
      an Optional<Profile>
    • updateProfile

      Profile updateProfile(String profileId, UpdateProfileRequest profileRequest)
      Updates the supplied Profile. The Profile.getId() method is used to key the Profile.
      Parameters:
      profileId - the profile id of the Profile to update
      profileRequest - the UpdateProfileRequest with the information to update
      Returns:
      the Profile as it was changed by the service.
    • createProfile

      Profile createProfile(CreateProfileRequest profileRequest)
      Creates a new profile. The ID of the profile, as specified by Profile.getId(), should be null and will be assigned.
      Parameters:
      profileRequest - the CreateProfileRequest with the information to create
      Returns:
      the Profile as it was created by the service.
    • deleteProfile

      void deleteProfile(String profileId)
      Deletes the Profile with the supplied profile ID.
      Parameters:
      profileId - the profile ID.
    • updateProfileImage

      Profile updateProfileImage(String profileId, UpdateProfileImageRequest updateProfileImageRequest) throws IOException
      Update profile image related fields
      Parameters:
      updateProfileImageRequest - request with image object values
      Throws:
      IOException