@Override
public void roleChanged(UserAdminEvent event) {
if (UserAdminEvent.ROLE_CHANGED == event.getType()) {
// Only the changes are interesting, as the creation and
// removal are already caught by #addRole and #removeRole....
Role changedRole = event.getRole();
try {
DBCollection coll = getCollection();
DBObject query = getTemplateObject(changedRole);
DBObject update = m_helper.serializeUpdate(changedRole);
WriteResult result = coll.update(query, update, false /* upsert */, false /* multi */);
if (result.getLastError() != null) {
result.getLastError().throwOnError();
}
}
catch (MongoException e) {
m_log.log(LogService.LOG_WARNING, "Failed to update changed role: " + changedRole.getName(), e);
}
}
}