int pos = 0;
for ( Value<?> value : attr )
{
ObjectClass objectClass = null;
try
{
objectClass = objectClassParser.parseObjectClassDescription( value.getString() );
}
catch ( ParseException e )
{
LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err( I18n.ERR_417,
value.getString() ) );
iave.initCause( e );
throw iave;
}
// if the super objectClasses are provided make sure it exists in some schema
if ( objectClass.getSuperiorOids() != null && objectClass.getSuperiorOids().size() > 0 )
{
for ( String superiorOid : objectClass.getSuperiorOids() )
{
if ( superiorOid.equals( SchemaConstants.TOP_OC_OID )
|| superiorOid.equalsIgnoreCase( SchemaConstants.TOP_OC ) )
{
continue;
}
if ( !schemaManager.getObjectClassRegistry().contains( superiorOid ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM,
I18n.err( I18n.ERR_418, superiorOid ) );
}
}
}
// if the may list is provided make sure attributes exists in some schema
if ( objectClass.getMayAttributeTypeOids() != null && objectClass.getMayAttributeTypeOids().size() > 0 )
{
for ( String mayAttrOid : objectClass.getMayAttributeTypeOids() )
{
if ( !schemaManager.getAttributeTypeRegistry().contains( mayAttrOid ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM,
I18n.err( I18n.ERR_419, mayAttrOid ) );
}
}
}
// if the must list is provided make sure attributes exists in some schema
if ( objectClass.getMustAttributeTypeOids() != null && objectClass.getMustAttributeTypeOids().size() > 0 )
{
for ( String mustAttrOid : objectClass.getMustAttributeTypeOids() )
{
if ( !schemaManager.getAttributeTypeRegistry().contains( mustAttrOid ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM,
I18n.err( I18n.ERR_420, mustAttrOid ) );