for ( String superiorName : superiorOids )
{
try
{
ObjectClass superior = ocRegistry.lookup( ocRegistry.getOidByName( superiorName ) );
// Before adding the superior, check that the ObjectClass type is consistent
switch ( objectClass.getType() )
{
case ABSTRACT:
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(