if ( superior.getType() != ObjectClassTypeEnum.ABSTRACT )
{
// An ABSTRACT OC can only inherit from ABSTRACT OCs
String msg = I18n.err( I18n.ERR_04318, objectClass.getOid(), superior.getObjectType(), superior );
LdapSchemaException ldapSchemaException = new LdapSchemaException(
LdapSchemaExceptionCodes.OC_ABSTRACT_MUST_INHERIT_FROM_ABSTRACT_OC, msg );
ldapSchemaException.setSourceObject( objectClass );
errors.add( ldapSchemaException );
LOG.info( msg );
continue;
}
break;
case AUXILIARY:
if ( superior.getType() == ObjectClassTypeEnum.STRUCTURAL )
{
// An AUXILIARY OC cannot inherit from STRUCTURAL OCs
String msg = I18n.err( I18n.ERR_04319, objectClass.getOid(), superior );
LdapSchemaException ldapSchemaException = new LdapSchemaException(
LdapSchemaExceptionCodes.OC_AUXILIARY_CANNOT_INHERIT_FROM_STRUCTURAL_OC, msg );
ldapSchemaException.setSourceObject( objectClass );
errors.add( ldapSchemaException );
LOG.info( msg );
continue;
}
break;
case STRUCTURAL:
if ( superior.getType() == ObjectClassTypeEnum.AUXILIARY )
{
// A STRUCTURAL OC cannot inherit from AUXILIARY OCs
String msg = I18n.err( I18n.ERR_04320, objectClass.getOid(), superior );
LdapSchemaException ldapSchemaException = new LdapSchemaException(
LdapSchemaExceptionCodes.OC_STRUCTURAL_CANNOT_INHERIT_FROM_AUXILIARY_OC, msg );
ldapSchemaException.setSourceObject( objectClass );
errors.add( ldapSchemaException );
LOG.info( msg );
continue;
}
break;
}
objectClass.getSuperiors().add( superior );
}
catch ( LdapException ne )
{
// Cannot find the OC
String msg = I18n.err( I18n.ERR_04321, objectClass.getOid(), superiorName );
LdapSchemaException ldapSchemaException = new LdapSchemaException(
LdapSchemaExceptionCodes.OC_NONEXISTENT_SUPERIOR, msg, ne );
ldapSchemaException.setSourceObject( objectClass );
ldapSchemaException.setRelatedId( superiorName );
errors.add( ldapSchemaException );
LOG.info( msg );
return;
}