if ( log.isInfoEnabled() )
{
log.info( msg + ". Raising LdapSchemaViolationException." );
}
throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_MODS_PROHIBITED, msg );
}
// remove all the objectClass attribute values from a cloned copy and then
// we can analyze what remains in this attribute to make sure a structural
// objectClass is present for the entry
EntryAttribute cloned = entryObjectClasses.clone();
for ( Value<?> value:attribute )
{
cloned.remove( value );
}
// check resultant set of objectClass values for a structural objectClass
for ( Value<?> objectClass:cloned )
{
ObjectClass oc = schemaManager.getObjectClassRegistry().lookup( objectClass.getString() );
if ( oc.getType() == ObjectClassTypeEnum.STRUCTURAL )
{
return;
}
}
// no structural object classes exist for the entry after the modifications
// to the objectClass attribute so we need to complain about that
String msg = I18n.err( I18n.ERR_272, name );
if ( log.isInfoEnabled() )
{
log.info( msg + ". Raising LdapSchemaViolationException." );
}
throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_MODS_PROHIBITED, msg );
}