{
// Collective Attributes are not allowed in MAY or MUST
String msg = I18n.err( I18n.ERR_04484_COLLECTIVE_NOT_ALLOWED_IN_MUST, mustAttributeTypeName,
objectClass.getOid() );
LdapSchemaException ldapSchemaException = new LdapSchemaException(
LdapSchemaExceptionCodes.OC_COLLECTIVE_NOT_ALLOWED_IN_MUST, msg );
ldapSchemaException.setSourceObject( objectClass );
ldapSchemaException.setRelatedId( mustAttributeTypeName );
errors.add( ldapSchemaException );
LOG.info( msg );
break;
}
if ( objectClass.getMustAttributeTypes().contains( attributeType ) )
{
// Already registered : this is an error
String msg = I18n.err( I18n.ERR_04324, objectClass.getOid(), mustAttributeTypeName );
LdapSchemaException ldapSchemaException = new LdapSchemaException(
LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MUST, msg );
ldapSchemaException.setSourceObject( objectClass );
ldapSchemaException.setRelatedId( mustAttributeTypeName );
errors.add( ldapSchemaException );
LOG.info( msg );
break;
}
// Check that the MUST AT is not also present in the MAY AT
if ( objectClass.getMayAttributeTypes().contains( attributeType ) )
{
// Already registered : this is an error
String msg = I18n.err( I18n.ERR_04325, objectClass.getOid(), mustAttributeTypeName );
LdapSchemaException ldapSchemaException = new LdapSchemaException(
LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MAY_AND_MUST,
msg );
ldapSchemaException.setSourceObject( objectClass );
ldapSchemaException.setRelatedId( mustAttributeTypeName );
errors.add( ldapSchemaException );
LOG.info( msg );
break;
}
objectClass.getMustAttributeTypes().add( attributeType );
}
catch ( LdapException ne )
{
// Cannot find the AT
String msg = I18n.err( I18n.ERR_04326, objectClass.getOid(), mustAttributeTypeName );
LdapSchemaException ldapSchemaException = new LdapSchemaException(
LdapSchemaExceptionCodes.OC_NONEXISTENT_MUST_AT, msg, ne );
ldapSchemaException.setSourceObject( objectClass );
ldapSchemaException.setRelatedId( mustAttributeTypeName );
errors.add( ldapSchemaException );
LOG.info( msg );
break;
}