use of com.emc.storageos.db.client.model.UserPreferences in project coprhd-controller by CoprHD.
the class UserPreferenceService method update.
@PUT
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("")
public UserPreferencesRestRep update(UserPreferencesUpdateParam param) {
StorageOSUser user = getUserFromContext();
String username = param.getUsername();
if (StringUtils.isBlank(username)) {
username = user.getUserName();
}
verifyAuthorized(username, user);
UserPreferences userPreferences = userPreferenceManager.getPreferences(username);
validateParam(param, userPreferences);
updateObject(userPreferences, param);
userPreferenceManager.updatePreferences(userPreferences);
auditOpSuccess(OperationTypeEnum.UPDATE_USER_PREFERENCES, userPreferences.auditParameters());
userPreferences = userPreferenceManager.getPreferences(userPreferences.getUserId());
return map(userPreferences);
}
use of com.emc.storageos.db.client.model.UserPreferences in project coprhd-controller by CoprHD.
the class UserPreferenceManagerImpl method getPreferences.
public UserPreferences getPreferences(String userName) {
UserPreferences preferences = client.preferences().findByUserId(userName);
if (preferences == null) {
preferences = new UserPreferences();
preferences.setNotifyByEmail(DEFAULT_NOTIFY_BY_EMAIL);
preferences.setEmail(DEFAULT_EMAIL);
preferences.setUserId(userName);
client.save(preferences);
}
return preferences;
}
Aggregations