Class MongoProfileDao

java.lang.Object
dev.getelements.elements.dao.mongo.MongoProfileDao
All Implemented Interfaces:
ProfileDao

public class MongoProfileDao extends Object implements ProfileDao
Created by patricktwohig on 6/28/17.
  • Constructor Details

    • MongoProfileDao

      public MongoProfileDao()
  • Method Details

    • findActiveProfile

      public Optional<Profile> findActiveProfile(String profileId)
      Description copied from interface: ProfileDao
      Finds the profile with the supplied profile ID. Returning null if no profile matches the requested profile ID.
      Specified by:
      findActiveProfile in interface ProfileDao
      Parameters:
      profileId - the profile ID
      Returns:
      the active profile with the supplied ID, or null if not found.
    • findActiveMongoProfile

      public Optional<MongoProfile> findActiveMongoProfile(Profile profile)
    • findActiveMongoProfile

      public Optional<MongoProfile> findActiveMongoProfile(String profileId)
    • findActiveMongoProfile

      public Optional<MongoProfile> findActiveMongoProfile(org.bson.types.ObjectId profileId)
    • findActiveProfileForUser

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

      public Pagination<Profile> getActiveProfiles(int offset, int count, String applicationNameOrId, String userId, Long lowerBoundTimestamp, Long upperBoundTimestamp)
      Description copied from interface: ProfileDao
      Gets actives profiles specifying the offset and the count.
      Specified by:
      getActiveProfiles in interface ProfileDao
      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

      public Pagination<Profile> getActiveProfiles(int offset, int count, String search)
      Description copied from interface: ProfileDao
      Gets actives profiles specifying the offset and the count, specifying a search filter.
      Specified by:
      getActiveProfiles in interface ProfileDao
      Parameters:
      offset - the offset
      count - the count
      search - the search string
      Returns:
      a Pagination of Profile objects.
    • parseLegacyQuery

      public dev.morphia.query.Query<MongoProfile> parseLegacyQuery(String search)
    • getActiveProfile

      public Profile getActiveProfile(String profileId)
      Description copied from interface: ProfileDao
      Gets the specific active profile with the id, or throws a NotFoundException if the profile can't be found.
      Specified by:
      getActiveProfile in interface ProfileDao
      Returns:
      the Profile that was requested, never null
    • getActiveMongoProfile

      public MongoProfile getActiveMongoProfile(Profile profile)
    • getActiveMongoProfile

      public MongoProfile getActiveMongoProfile(String profileId)
    • getActiveMongoProfile

      public MongoProfile getActiveMongoProfile(org.bson.types.ObjectId objectId)
    • getActiveMongoProfilesForUser

      public Stream<MongoProfile> getActiveMongoProfilesForUser(MongoUser user)
    • getActiveMongoProfilesForUser

      public Stream<MongoProfile> getActiveMongoProfilesForUser(org.bson.types.ObjectId mongoUserObjectId)
    • updateActiveProfile

      public Profile updateActiveProfile(Profile profile, Map<String,Object> metadata)
      Description copied from interface: ProfileDao
      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.
      Specified by:
      updateActiveProfile in interface ProfileDao
      Parameters:
      metadata - the profile metadata
      Returns:
      the Profile as it was written into the database
    • updateMetadata

      public Profile updateMetadata(String profileId, Map<String,Object> metadata)
      Description copied from interface: ProfileDao
      Updates metadata for the specified Profile, ignoring changes to all other fields.
      Specified by:
      updateMetadata in interface ProfileDao
      Parameters:
      profileId - the profile
      metadata - the metadata
      Returns:
      the updated Profile
    • updateMetadata

      public Profile updateMetadata(Profile profile, Map<String,Object> metadata)
      Description copied from interface: ProfileDao
      Updates metadata for the specified Profile, ignoring changes to all other fields.
      Specified by:
      updateMetadata in interface ProfileDao
      Parameters:
      profile - the profile
      metadata - the metadata
      Returns:
      the updated Profile
    • createOrReactivateProfile

      public Profile createOrReactivateProfile(Profile profile, Map<String,Object> metadata)
      Description copied from interface: ProfileDao
      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.
      Specified by:
      createOrReactivateProfile in interface ProfileDao
      Parameters:
      metadata - the profile metadata
      Returns:
      the Profile as it was written into the database
    • createOrRefreshProfile

      public Profile createOrRefreshProfile(Profile profile)
      Description copied from interface: ProfileDao
      Creates, reactivates, or refreshes a Profile. This is similar to ProfileDao.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.

      Specified by:
      createOrRefreshProfile in interface ProfileDao
      Parameters:
      profile - the user
      Returns:
      the Profile, as written to the database
    • softDeleteProfile

      public void softDeleteProfile(String profileId)
      Description copied from interface: ProfileDao
      Deletes a profile by marking it as inactive. Data is otherwise retained in the database.
      Specified by:
      softDeleteProfile in interface ProfileDao
      Parameters:
      profileId - the profile ID
    • softDeleteProfilesForUser

      public void softDeleteProfilesForUser(MongoUser mongoUser)
    • transform

      public Profile transform(MongoProfile input)
    • getMongoDBUtils

      public MongoDBUtils getMongoDBUtils()
    • setMongoDBUtils

      @Inject public void setMongoDBUtils(MongoDBUtils mongoDBUtils)
    • getDatastore

      public dev.morphia.Datastore getDatastore()
    • setDatastore

      @Inject public void setDatastore(dev.morphia.Datastore datastore)
    • getBeanMapper

      public MapperRegistry getBeanMapper()
    • setBeanMapper

      @Inject public void setBeanMapper(MapperRegistry beanMapperRegistry)
    • getValidationHelper

      public ValidationHelper getValidationHelper()
    • setValidationHelper

      @Inject public void setValidationHelper(ValidationHelper validationHelper)
    • getMongoUserDao

      public MongoUserDao getMongoUserDao()
    • setMongoUserDao

      @Inject public void setMongoUserDao(MongoUserDao mongoUserDao)
    • getMongoApplicationDao

      public MongoApplicationDao getMongoApplicationDao()
    • setMongoApplicationDao

      @Inject public void setMongoApplicationDao(MongoApplicationDao mongoApplicationDao)
    • getMongoConcurrentUtils

      public MongoConcurrentUtils getMongoConcurrentUtils()
    • setMongoConcurrentUtils

      @Inject public void setMongoConcurrentUtils(MongoConcurrentUtils mongoConcurrentUtils)
    • getMongoLargeObjectDao

      public MongoLargeObjectDao getMongoLargeObjectDao()
    • setMongoLargeObjectDao

      @Inject public void setMongoLargeObjectDao(MongoLargeObjectDao mongoLargeObjectDao)
    • getBooleanQueryParser

      public BooleanQueryParser getBooleanQueryParser()
    • setBooleanQueryParser

      @Inject public void setBooleanQueryParser(BooleanQueryParser booleanQueryParser)