use of org.forgerock.openam.authentication.modules.deviceprint.exceptions.NotUniqueUserProfileException in project OpenAM by OpenRock.
the class UserProfilesDao method saveProfiles.
/**
* Saves the DAO's internal user profiles cache to LDAP.
*
* @throws NotUniqueUserProfileException If two or more user profiles have the same uuid or name.
*/
public void saveProfiles() throws NotUniqueUserProfileException {
validate();
Set<String> vals = new HashSet<String>();
for (UserProfile userProfile : profiles) {
Writer strWriter = new StringWriter();
try {
mapper.writeValue(strWriter, userProfile);
vals.add(strWriter.toString());
} catch (Exception e) {
DEBUG.error("Error while serializing profiles. " + e);
}
}
Map<String, Set> attrMap = new HashMap<String, Set>();
attrMap.put(LDAP_DEVICE_PRINT_ATTRIBUTE_NAME, vals);
try {
amIdentity.setAttributes(attrMap);
amIdentity.store();
DEBUG.message("Profiles stored");
} catch (Exception e) {
DEBUG.error("Could not store profiles. " + e);
}
}
Aggregations