Package org.apache.directory.api.ldap.model.schema

Examples of org.apache.directory.api.ldap.model.schema.AttributeType


                return;
            }

            for ( Value<?> value : collectiveExclusions )
            {
                AttributeType attrType = schemaManager.lookupAttributeTypeRegistry( value.getString() );
                exclusions.add( attrType );
                LOG.debug( "Adding {} in the list of excluded collectiveAttributes", attrType.getName() );
            }
        }

        /*
         * For each collective subentry referenced by the entry we lookup the
         * attributes of the subentry and copy collective attributes from the
         * subentry into the entry.
         */
        for ( Value<?> value : collectiveAttributeSubentries )
        {
            String subentryDnStr = value.getString();
            Dn subentryDn = dnFactory.create( subentryDnStr );

            LOG.debug( "Applying subentries {}", subentryDn.getName() );

            /*
             * TODO - Instead of hitting disk here can't we leverage the
             * SubentryService to get us cached sub-entries so we're not
             * wasting time with a lookup here? It is ridiculous to waste
             * time looking up this sub-entry.
             */

            LookupOperationContext lookupContext = new LookupOperationContext( session, subentryDn,
                SchemaConstants.ALL_ATTRIBUTES_ARRAY );
            Entry subentry = directoryService.getPartitionNexus().lookup( lookupContext );

            //LOG.debug( "Fetched the subentry : {}", subentry.getDn().getName() );

            for ( Attribute attribute : subentry.getAttributes() )
            {
                AttributeType attributeType = attribute.getAttributeType();

                // Skip the attributes which are not collective
                if ( !attributeType.isCollective() )
                {
                    //LOG.debug( "The {} subentry attribute is not collective", attributeType.getName() );
                    continue;
                }

                /*
                 * Skip the addition of this collective attribute if it is excluded
                 * in the 'collectiveAttributes' attribute.
                 */
                if ( exclusions.contains( attributeType ) )
                {
                    LOG.debug( "The {} subentry attribute has been removed, it's in the exclusion list",
                        attributeType.getName() );
                    continue;
                }

                /*
                 * If not all attributes or this collective attribute requested specifically
                 * then bypass the inclusion process.
                 */
                if ( !opContext.isAllUserAttributes() && !opContext.contains( schemaManager, attributeType ) )
                {
                    LOG.debug( "The {} subentry attribute is not in the list of attributes to return",
                        attributeType.getName() );
                    continue;
                }

                Attribute subentryColAttr = subentry.get( attributeType );
                Attribute entryColAttr = entry.get( attributeType );
View Full Code Here


            // here, to be able to restore it in the readExternal :
            // we need access to the registries, which are not available
            // in the ServerAttribute class.
            for ( Attribute attribute : entry.getAttributes() )
            {
                AttributeType attributeType = attribute.getAttributeType();

                // Write the oid to be able to restore the AttributeType when deserializing
                // the attribute
                String oid = attributeType.getOid();

                out.writeUTF( oid );

                // Write the attribute
                attribute.writeExternal( out );
View Full Code Here

                // Read the attribute's OID
                String oid = in.readUTF();

                try
                {
                    AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( oid );

                    // Create the attribute we will read
                    Attribute attribute = new DefaultAttribute( attributeType );

                    // Read the attribute
View Full Code Here

                // Read the attribute's OID
                String oid = in.readUTF();

                try
                {
                    AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( oid );

                    // Create the attribute we will read
                    Attribute attribute = new DefaultAttribute( attributeType );

                    // Read the attribute
View Full Code Here

        compareContext.getDn().apply( schemaManager );

        // Get the attributeType from the OID
        try
        {
            AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( compareContext.getOid() );

            // Translate the value from binary to String if the AT is HR
            if ( attributeType.getSyntax().isHumanReadable() && ( !compareContext.getValue().isHumanReadable() ) )
            {
                String value = compareContext.getValue().getString();
                compareContext.setValue( new StringValue( value ) );
            }
View Full Code Here

        if ( modifyContext.getModItems() != null )
        {
            for ( Modification modification : modifyContext.getModItems() )
            {
                AttributeType attributeType = schemaManager.getAttributeType( modification.getAttribute().getId() );
                modification.apply( attributeType );
            }
        }

        next( modifyContext );
View Full Code Here

                    entry.add( upId, upValue );
                }
                // 2) The attribute exists
                else
                {
                    AttributeType at = schemaManager.lookupAttributeTypeRegistry( upId );

                    // 2.1 if the attribute is single valued, replace the value
                    if ( at.isSingleValued() )
                    {
                        entry.removeAttributes( upId );
                        entry.add( upId, upValue );
                    }
                    // 2.2 the attribute is multi-valued : add the missing value
View Full Code Here

        Map<String, Index<?, String>> tmp = new HashMap<String, Index<?, String>>();

        for ( String oid : userIndices.keySet() )
        {
            // check that the attributeType has an EQUALITY matchingRule
            AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
            MatchingRule mr = attributeType.getEquality();

            if ( mr != null )
            {
                Index<?, String> index = userIndices.get( oid );
                index = convertAndInit( index );
                tmp.put( oid, index );
            }
            else
            {
                LOG.error( I18n.err( I18n.ERR_4, attributeType.getName() ) );
            }
        }

        userIndices = tmp;
    }
View Full Code Here

            }

            // Now work on the user defined userIndices
            for ( Attribute attribute : entry )
            {
                AttributeType attributeType = attribute.getAttributeType();
                String attributeOid = attributeType.getOid();

                if ( hasUserIndexOn( attributeType ) )
                {
                    Index<Object, String> idx = ( Index<Object, String> ) getUserIndex( attributeType );
View Full Code Here

            }

            // Update the user indexes
            for ( Attribute attribute : entry )
            {
                AttributeType attributeType = attribute.getAttributeType();
                String attributeOid = attributeType.getOid();

                if ( hasUserIndexOn( attributeType ) )
                {
                    Index<?, String> index = getUserIndex( attributeType );
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.schema.AttributeType

Copyright © 2018 www.massapicom. 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.