use of org.craftercms.profile.utils.db.ProfileUpdater in project profile by craftercms.
the class ProfileServiceImpl method updateProfile.
protected Profile updateProfile(String profileId, UpdateCallback callback, String... attributesToReturn) throws ProfileException {
// We need to filter the attributes after save, if not, the attributes to return will replace all the
// attributes
Profile profile = getNonNullProfile(profileId);
UpdateHelper updateHelper = new UpdateHelper();
ProfileUpdater profileUpdater = new ProfileUpdater(profile, updateHelper, profileRepository);
callback.doWithProfile(profileUpdater);
profileUpdater.setLastModified(new Date());
try {
profileUpdater.update();
} catch (MongoDataException e) {
throw new I10nProfileException(ERROR_KEY_UPDATE_PROFILE_ERROR, e, profileId);
}
return filterAttributes(profile, attributesToReturn);
}
Aggregations