if ( modifiedAdminRole == null )
{
// We can't remove a value when the attribute does not exist.
String msg = "Cannot remove the administrative role, it does not exist";
LOG.error( msg );
throw new LdapNoSuchAttributeException( msg );
}
// It may be a complete removal
if ( attribute.size() == 0 )
{
// Complete removal. Loop on all the existing roles and remove them
for ( Value<?> role : modifiedAdminRole )
{
//checkDelRole( role, modifiedAdminRole, dn, directoryService.getAdministrativePoints() );
delRole( role.getString(), dn, uuid, acapCacheCopy, caapCacheCopy, teapCacheCopy,
ssapCacheCopy );
}
modifiedAdminRole.clear();
break;
}
// Now deal with the values to remove
for ( Value<?> value : attribute )
{
if ( !isValidRole( value.getString() ) )
{
// Not a valid role : we will throw an exception
String msg = "Invalid role : " + value.getString();
LOG.error( msg );
throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX,
msg );
}
if ( !modifiedAdminRole.contains( value ) )
{
// We can't remove a value if it does not exist !
String msg = "Cannot remove the administrative role value" + value
+ ", it does not exist";
LOG.error( msg );
throw new LdapNoSuchAttributeException( msg );
}
modifiedAdminRole.remove( value );
delRole( value.getString(), dn, uuid, acapCacheCopy, caapCacheCopy, teapCacheCopy,
ssapCacheCopy );