throw new UserProfileException(e.getMessage(), e);
}
}
public void setUserProfile(String username, UserProfileDTO profile) throws UserProfileException {
UserRealm realm = null;
try {
if (!this.isAuthorized(username)) {
throw new UserProfileException("You are not authorized to perform this action.");
}
realm = getUserRealm();
UserFieldDTO[] udatas = profile.getFieldValues();
Map<String, String> map = new HashMap<String, String>();
for (UserFieldDTO data : udatas) {
String claimURI = data.getClaimUri();
String value = data.getFieldValue();
map.put(claimURI, value);
}
if (profile.getProfileConifuration() != null) {
map.put(UserCoreConstants.PROFILE_CONFIGURATION, profile.getProfileConifuration());
} else {
map.put(UserCoreConstants.PROFILE_CONFIGURATION,
UserCoreConstants.DEFAULT_PROFILE_CONFIGURATION);
}
UserStoreManager admin = realm.getUserStoreManager();
admin.setUserClaimValues(username, map, profile.getProfileName());
} catch (UserStoreException e) {
// Not logging. Already logged.
throw new UserProfileException(e.getMessage(), e);