Package dev.getelements.elements.sdk.dao
Interface ProfileDao
- All Known Implementing Classes:
MongoProfileDao
public interface ProfileDao
Created by patricktwohig on 6/28/17.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ProfilecreateOrReactivateProfile(Profile profile) Creates or reactivates an inactive profile.createOrReactivateProfile(Profile profile, Map<String, Object> metadata) Creates or reactivates an inactive profile.createOrRefreshProfile(Profile profile) Creates, reactivates, or refreshes aProfile.findActiveProfile(String profileId) Finds the profile with the supplied profile ID.findActiveProfileForUser(String profileId, String userId) Finds the profile with the supplied profile ID.getActiveProfile(String profileId) Gets the specific active profile with the id, or throws aNotFoundExceptionif 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.voidsoftDeleteProfile(String profileId) Deletes a profile by marking it as inactive.default ProfileupdateActiveProfile(Profile profile) Updates the specific active profile with the id, or throws aNotFoundExceptionif the profile can't be found.updateActiveProfile(Profile profile, Map<String, Object> metadata) Updates the specific active profile with the id, or throws aNotFoundExceptionif 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.
-
Method Details
-
findActiveProfile
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
Finds the profile with the supplied profile ID. Returning null if no profile matches the requested profile ID and user ID.- Parameters:
profileId- the profileIduserId- 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 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
PaginationofProfileobjects.
-
getActiveProfiles
Gets actives profiles specifying the offset and the count, specifying a search filter.- Parameters:
offset- the offsetcount- the countsearch- the search string- Returns:
- a
PaginationofProfileobjects.
-
getActiveProfile
Gets the specific active profile with the id, or throws aNotFoundExceptionif the profile can't be found.- Returns:
- the
Profilethat was requested, never null
-
updateActiveProfile
Updates the specific active profile with the id, or throws aNotFoundExceptionif the profile can't be found. TheProfile.getId()is used to key the profile being updated.- Returns:
- the
Profileas it was written into the database
-
updateActiveProfile
Updates the specific active profile with the id, or throws aNotFoundExceptionif the profile can't be found. TheProfile.getId()is used to key the profile being updated.- Parameters:
metadata- the profile metadata- Returns:
- the
Profileas it was written into the database
-
updateMetadata
Updates metadata for the specifiedProfile, ignoring changes to all other fields.- Parameters:
profileId- the profilemetadata- the metadata- Returns:
- the updated
Profile
-
updateMetadata
Updates metadata for the specifiedProfile, ignoring changes to all other fields.- Parameters:
profile- the profilemetadata- the metadata- Returns:
- the updated
Profile
-
createOrReactivateProfile
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 theUserandApplication.- Returns:
- the
Profileas it was written into the database
-
createOrReactivateProfile
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 theUserandApplication.- Parameters:
metadata- the profile metadata- Returns:
- the
Profileas it was written into the database
-
createOrRefreshProfile
Creates, reactivates, or refreshes aProfile. This is similar tocreateOrReactivateProfile(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.
- Parameters:
profile- the user- Returns:
- the
Profile, as written to the database
-
softDeleteProfile
Deletes a profile by marking it as inactive. Data is otherwise retained in the database.- Parameters:
profileId- the profile ID
-