Examples of ObjectClassDescription


Examples of org.apache.directory.shared.ldap.schema.parsers.ObjectClassDescription

            }
            String[] ocValues = ocAttribute.getStringValues();
            boolean structuralObjectClassAvailable = false;
            for ( String ocValue : ocValues )
            {
                ObjectClassDescription ocd = entry.getBrowserConnection().getSchema().getObjectClassDescription(
                    ocValue );
                if ( ocd.getKind() == ObjectClassTypeEnum.STRUCTURAL )
                {
                    structuralObjectClassAvailable = true;
                    break;
                }
            }
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.parsers.ObjectClassDescription

       
        int pos = 0;
       
        for ( Value<?> value:attr )
        {
            ObjectClassDescription desc = null;
           
            try
            {
                desc = objectClassParser.parseObjectClassDescription( value.getString() );
            }
            catch ( ParseException e )
            {
                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
                    "The following does not conform to the objectClassDescription syntax: " + value.getString(),
                    ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                iave.setRootCause( e );
                throw iave;
            }
           
            // if the super objectClasses are provided make sure it exists in some schema
            if ( desc.getSuperiorObjectClasses() != null && desc.getSuperiorObjectClasses().size() > 0 )
            {
                for ( String superior : desc.getSuperiorObjectClasses() )
                {
                    if ( superior.equals( SchemaConstants.TOP_OC_OID ) ||
                        superior.equalsIgnoreCase( SchemaConstants.TOP_OC ) )
                    {
                        continue;
                    }
                   
                    if ( ! dao.hasObjectClass( superior ) )
                    {
                        throw new LdapOperationNotSupportedException(
                            "Cannot permit the addition of an objectClass with an invalid superior objectClass: "
                                + superior,
                            ResultCodeEnum.UNWILLING_TO_PERFORM );
                    }
                }
            }
           
            // if the may list is provided make sure attributes exists in some schema
            if ( desc.getMayAttributeTypes() != null && desc.getMayAttributeTypes().size() > 0 )
            {
                for ( String mayAttr : desc.getMayAttributeTypes() )
                {
                    if ( ! dao.hasAttributeType( mayAttr ) )
                    {
                        throw new LdapOperationNotSupportedException(
                            "Cannot permit the addition of an objectClass with an invalid " +
                            "attributeType in the mayList: " + mayAttr,
                            ResultCodeEnum.UNWILLING_TO_PERFORM );
                    }
                }
            }
           
            // if the must list is provided make sure attributes exists in some schema
            if ( desc.getMustAttributeTypes() != null && desc.getMustAttributeTypes().size() > 0 )
            {
                for ( String mustAttr : desc.getMustAttributeTypes() )
                {
                    if ( ! dao.hasAttributeType( mustAttr ) )
                    {
                        throw new LdapOperationNotSupportedException(
                            "Cannot permit the addition of an objectClass with an invalid " +
                            "attributeType in the mustList: " + mustAttr,
                            ResultCodeEnum.UNWILLING_TO_PERFORM );
                    }
                }
            }
           
            ObjectClassImpl oc = new ObjectClassImpl( desc.getNumericOid(), globalRegistries );
            oc.setMayListOids( desc.getMayAttributeTypes().toArray( EMPTY) );
            oc.setMustListOids( desc.getMustAttributeTypes().toArray( EMPTY ) );
            oc.setSuperClassOids( desc.getSuperiorObjectClasses().toArray( EMPTY ) );
            oc.setType( desc.getKind() );
            setSchemaObjectProperties( desc, oc );
           
            objectClasses[pos++] = oc;
        }
       
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.parsers.ObjectClassDescription

        // check first to see if it is present in the subschemaSubentry
        // -------------------------------------------------------------------
       
        Attributes attrs = getSubschemaSubentryAttributes();
        Attribute attrTypes = attrs.get( "objectClasses" );
        ObjectClassDescription objectClassDescription = null;
        for ( int ii = 0; ii < attrTypes.size(); ii++ )
        {
            String desc = ( String ) attrTypes.get( ii );
            if ( desc.indexOf( oid ) != -1 )
            {
                objectClassDescription = objectClassDescriptionSchemaParser.parseObjectClassDescription( desc );
                break;
            }
        }
    
        if ( isPresent )
        {
            assertNotNull( objectClassDescription );
            assertEquals( oid, objectClassDescription.getNumericOid() );
        }
        else
        {
            assertNull( objectClassDescription );
        }
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription

                .toLowerCase() );
            String[] ocValues = ocAttribute.getStringValues();
            boolean structuralObjectClassAvailable = false;
            for ( int i = 0; i < ocValues.length; i++ )
            {
                ObjectClassDescription ocd = getBrowserConnection().getSchema().getObjectClassDescription( ocValues[i] );
                if ( ocd.getKind() == ObjectClassTypeEnum.STRUCTURAL )
                {
                    structuralObjectClassAvailable = true;
                    break;
                }
            }
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription

            {
                if ( attributeName.equalsIgnoreCase( Schema.SCHEMA_ATTRIBUTE_OBJECTCLASSES ) )
                {
                    ObjectClassDescriptionSchemaParser parser = new ObjectClassDescriptionSchemaParser();
                    parser.setQuirksMode( true );
                    ObjectClassDescription ocd = parser.parseObjectClassDescription( value );
                    ocd.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
                    addObjectClassDescription( ocd );
                }
                else if ( attributeName.equalsIgnoreCase( Schema.SCHEMA_ATTRIBUTE_ATTRIBUTETYPES ) )
                {
                    AttributeTypeDescriptionSchemaParser parser = new AttributeTypeDescriptionSchemaParser();
                    parser.setQuirksMode( true );
                    AttributeTypeDescription atd = parser.parseAttributeTypeDescription( value );
                    atd.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
                    addAttributeTypeDescription( atd );
                }
                else if ( attributeName.equalsIgnoreCase( Schema.SCHEMA_ATTRIBUTE_LDAPSYNTAXES ) )
                {
                    LdapSyntaxDescriptionSchemaParser parser = new LdapSyntaxDescriptionSchemaParser();
                    parser.setQuirksMode( true );
                    LdapSyntaxDescription lsd = parser.parseLdapSyntaxDescription( value );
                    lsd.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
                    addLdapSyntaxDescription( lsd );
                }
                else if ( attributeName.equalsIgnoreCase( Schema.SCHEMA_ATTRIBUTE_MATCHINGRULES ) )
                {
                    MatchingRuleDescriptionSchemaParser parser = new MatchingRuleDescriptionSchemaParser();
                    parser.setQuirksMode( true );
                    MatchingRuleDescription mrd = parser.parseMatchingRuleDescription( value );
                    mrd.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
                    addMatchingRuleDescription( mrd );
                }
                else if ( attributeName.equalsIgnoreCase( Schema.SCHEMA_ATTRIBUTE_MATCHINGRULEUSE ) )
                {
                    MatchingRuleUseDescriptionSchemaParser parser = new MatchingRuleUseDescriptionSchemaParser();
                    parser.setQuirksMode( true );
                    MatchingRuleUseDescription mrud = parser.parseMatchingRuleUseDescription( value );
                    mrud.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
                    addMatchingRuleUseDescription( mrud );
                }
                else if ( attributeName.equalsIgnoreCase( IAttribute.OPERATIONAL_ATTRIBUTE_CREATE_TIMESTAMP ) )
                {
                    setCreateTimestamp( value );
                }
                else if ( attributeName.equalsIgnoreCase( IAttribute.OPERATIONAL_ATTRIBUTE_MODIFY_TIMESTAMP ) )
                {
                    setModifyTimestamp( value );
                }
            }
            catch ( Exception e )
            {
                System.out.println( e.getMessage() + ": " + attributeName + " - " + value );
                e.printStackTrace();
            }
        }

        // set extensibleObject may attributes
        ObjectClassDescription extensibleObjectOcd = this
            .getObjectClassDescription( SchemaConstants.EXTENSIBLE_OBJECT_OC );
        Collection<AttributeTypeDescription> userAtds = SchemaUtils.getUserAttributeDescriptions( this );
        Collection<String> atdNames = SchemaUtils.getNames( userAtds );
        List<String> atdNames2 = new ArrayList<String>( atdNames );
        extensibleObjectOcd.setMayAttributeTypes( atdNames2 );
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription

        else
        {
            // DUMMY
            List<String> names = new ArrayList<String>();
            names.add( nameOrOid );
            ObjectClassDescription ocd = new ObjectClassDescription();
            ocd.setNumericOid( nameOrOid );
            ocd.setNames( names );
            ocd.setExtensions( DUMMY_EXTENSIONS );
            return ocd;
        }
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription

        IAttribute ocAttribute = attributeMap.get( IAttribute.OBJECTCLASS_ATTRIBUTE_OID.toLowerCase() );
        String[] ocValues = ocAttribute.getStringValues();
        boolean structuralObjectClassAvailable = false;
        for ( String ocValue : ocValues )
        {
            ObjectClassDescription ocd = this.getBrowserConnection().getSchema().getObjectClassDescription( ocValue );
            if ( ocd.getKind() == ObjectClassTypeEnum.STRUCTURAL )
            {
                structuralObjectClassAvailable = true;
                break;
            }
        }
View Full Code Here

Examples of org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription

         */
        public boolean select( Viewer viewer, Object parentElement, Object element )
        {
            if ( element instanceof ObjectClassDescription )
            {
                ObjectClassDescription ocd = ( ObjectClassDescription ) element;
                Collection<String> lowerCaseIdentifiers = SchemaUtils.getLowerCaseIdentifiers( ocd );
                for ( String s : lowerCaseIdentifiers )
                {
                    if ( s.toLowerCase().startsWith( filterText.getText().toLowerCase() ) )
                    {
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription

            {
                String[] ocValues = ocAttribute.getStringValues();
                for ( int i = 0; i < ocValues.length; i++ )
                {
                    String ocValue = ocValues[i];
                    ObjectClassDescription ocd = wizard.getSelectedConnection().getSchema().getObjectClassDescription(
                        ocValue );
                    availableObjectClasses.remove( ocd );
                    selectedObjectClasses.add( ocd );
                }
            }
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription

            {
                ocAttribute.deleteValue( values[i] );
            }
            for ( Iterator<ObjectClassDescription> it = selectedObjectClasses.iterator(); it.hasNext(); )
            {
                ObjectClassDescription ocd = it.next();
                ocAttribute.addValue( new Value( ocAttribute, ocd.getNames()[0] ) );
            }
        }
        finally
        {
            EventRegistry.resumeEventFireingInCurrentThread();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.