Class MongoProfileDao
java.lang.Object
dev.getelements.elements.dao.mongo.MongoProfileDao
- All Implemented Interfaces:
ProfileDao
Created by patricktwohig on 6/28/17.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateOrReactivateProfile
(Profile profile, Map<String, Object> metadata) Creates or reactivates an inactive profile.createOrRefreshProfile
(Profile profile) Creates, reactivates, or refreshes aProfile
.findActiveMongoProfile
(Profile profile) findActiveMongoProfile
(String profileId) findActiveMongoProfile
(org.bson.types.ObjectId profileId) findActiveProfile
(String profileId) Finds the profile with the supplied profile ID.findActiveProfileForUser
(String profileId, String userId) Finds the profile with the supplied profile ID.getActiveMongoProfile
(Profile profile) getActiveMongoProfile
(String profileId) getActiveMongoProfile
(org.bson.types.ObjectId objectId) getActiveMongoProfilesForUser
(org.bson.types.ObjectId mongoUserObjectId) getActiveProfile
(String profileId) Gets the specific active profile with the id, or throws aNotFoundException
if the profile can't be found.getActiveProfiles
(int offset, int count, String search) Gets actives profiles specifying the offset and the count, specifying a search filter.getActiveProfiles
(int offset, int count, String applicationNameOrId, String userId, Long lowerBoundTimestamp, Long upperBoundTimestamp) Gets actives profiles specifying the offset and the count.dev.morphia.Datastore
dev.morphia.query.Query
<MongoProfile> parseLegacyQuery
(String search) void
setBeanMapper
(MapperRegistry beanMapperRegistry) void
setBooleanQueryParser
(BooleanQueryParser booleanQueryParser) void
setDatastore
(dev.morphia.Datastore datastore) void
setMongoApplicationDao
(MongoApplicationDao mongoApplicationDao) void
setMongoConcurrentUtils
(MongoConcurrentUtils mongoConcurrentUtils) void
setMongoDBUtils
(MongoDBUtils mongoDBUtils) void
setMongoLargeObjectDao
(MongoLargeObjectDao mongoLargeObjectDao) void
setMongoUserDao
(MongoUserDao mongoUserDao) void
setValidationHelper
(ValidationHelper validationHelper) void
softDeleteProfile
(String profileId) Deletes a profile by marking it as inactive.void
softDeleteProfilesForUser
(MongoUser mongoUser) transform
(MongoProfile input) updateActiveProfile
(Profile profile, Map<String, Object> metadata) Updates the specific active profile with the id, or throws aNotFoundException
if the profile can't be found.updateMetadata
(Profile profile, Map<String, Object> metadata) Updates metadata for the specifiedProfile
, ignoring changes to all other fields.updateMetadata
(String profileId, Map<String, Object> metadata) Updates metadata for the specifiedProfile
, ignoring changes to all other fields.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.getelements.elements.sdk.dao.ProfileDao
createOrReactivateProfile, updateActiveProfile
-
Constructor Details
-
MongoProfileDao
public MongoProfileDao()
-
-
Method Details
-
findActiveProfile
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 interfaceProfileDao
- Parameters:
profileId
- the profile ID- Returns:
- the active profile with the supplied ID, or null if not found.
-
findActiveMongoProfile
-
findActiveMongoProfile
-
findActiveMongoProfile
-
findActiveProfileForUser
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 interfaceProfileDao
- Parameters:
profileId
- the profileIduserId
- 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 interfaceProfileDao
- Parameters:
offset
- the offsetcount
- the countapplicationNameOrId
- 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
ofProfile
objects.
-
getActiveProfiles
Description copied from interface:ProfileDao
Gets actives profiles specifying the offset and the count, specifying a search filter.- Specified by:
getActiveProfiles
in interfaceProfileDao
- Parameters:
offset
- the offsetcount
- the countsearch
- the search string- Returns:
- a
Pagination
ofProfile
objects.
-
parseLegacyQuery
-
getActiveProfile
Description copied from interface:ProfileDao
Gets the specific active profile with the id, or throws aNotFoundException
if the profile can't be found.- Specified by:
getActiveProfile
in interfaceProfileDao
- Returns:
- the
Profile
that was requested, never null
-
getActiveMongoProfile
-
getActiveMongoProfile
-
getActiveMongoProfile
-
getActiveMongoProfilesForUser
-
getActiveMongoProfilesForUser
public Stream<MongoProfile> getActiveMongoProfilesForUser(org.bson.types.ObjectId mongoUserObjectId) -
updateActiveProfile
Description copied from interface:ProfileDao
Updates the specific active profile with the id, or throws aNotFoundException
if the profile can't be found. TheProfile.getId()
is used to key the profile being updated.- Specified by:
updateActiveProfile
in interfaceProfileDao
- Parameters:
metadata
- the profile metadata- Returns:
- the
Profile
as it was written into the database
-
updateMetadata
Description copied from interface:ProfileDao
Updates metadata for the specifiedProfile
, ignoring changes to all other fields.- Specified by:
updateMetadata
in interfaceProfileDao
- Parameters:
profileId
- the profilemetadata
- the metadata- Returns:
- the updated
Profile
-
updateMetadata
Description copied from interface:ProfileDao
Updates metadata for the specifiedProfile
, ignoring changes to all other fields.- Specified by:
updateMetadata
in interfaceProfileDao
- Parameters:
profile
- the profilemetadata
- the metadata- Returns:
- the updated
Profile
-
createOrReactivateProfile
Description copied from interface:ProfileDao
Creates or reactivates an inactive profile. If the profile is active then this throws aDuplicateException
. The newly created or reactivated profile will contain the ID of the profile as requested. The value ofProfile.getId()
will be ignored and updates will be keyed using theUser
andApplication
.- Specified by:
createOrReactivateProfile
in interfaceProfileDao
- Parameters:
metadata
- the profile metadata- Returns:
- the
Profile
as it was written into the database
-
createOrRefreshProfile
Description copied from interface:ProfileDao
Creates, reactivates, or refreshes aProfile
. This is similar toProfileDao.createOrReactivateProfile(Profile)
except that it will upsert theProfile
.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 interfaceProfileDao
- Parameters:
profile
- the user- Returns:
- the
Profile
, as written to the database
-
softDeleteProfile
Description copied from interface:ProfileDao
Deletes a profile by marking it as inactive. Data is otherwise retained in the database.- Specified by:
softDeleteProfile
in interfaceProfileDao
- Parameters:
profileId
- the profile ID
-
softDeleteProfilesForUser
-
transform
-
getMongoDBUtils
-
setMongoDBUtils
-
getDatastore
public dev.morphia.Datastore getDatastore() -
setDatastore
@Inject public void setDatastore(dev.morphia.Datastore datastore) -
getBeanMapper
-
setBeanMapper
-
getValidationHelper
-
setValidationHelper
-
getMongoUserDao
-
setMongoUserDao
-
getMongoApplicationDao
-
setMongoApplicationDao
-
getMongoConcurrentUtils
-
setMongoConcurrentUtils
-
getMongoLargeObjectDao
-
setMongoLargeObjectDao
-
getBooleanQueryParser
-
setBooleanQueryParser
-