log.debug("User role mapping for user: " + userId + " source: " + userSource
+ " could not be deleted because it does not exist.");
}
}
else {
CUserRoleMapping roleMapping = new CUserRoleMapping();
roleMapping.setUserId(userId);
roleMapping.setSource(userSource);
for (RoleIdentifier roleIdentifier : roleIdentifiers) {
// make sure we only save roles that we manage
// TODO: although we shouldn't need to worry about this.
if (getSource().equals(roleIdentifier.getSource())) {
roleMapping.addRole(roleIdentifier.getRoleId());
}
}
// try to update first
try {