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

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


                    throw new LdapInvalidAttributeTypeException( message );
                }
                else
                {
                    // TODO : handle options
                    AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id );
                    modificationsList.add( toServerModification( modification, attributeType ) );
                }
            }

            return modificationsList;
View Full Code Here


                // -------------------------------------------------------------------
                // END DIRSERVER-646 Fix
                // -------------------------------------------------------------------

                // TODO : handle options
                AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id );
                modificationsList.add( toServerModification( modification, attributeType ) );
            }

            return modificationsList;
        }
View Full Code Here

        }

        // for special handling of entryDN attribute, see DIRSERVER-1902
        Entry originalEntry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();

        AttributeType entryDnType = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ENTRY_DN_AT_OID );
       
        // First, remove all the attributes if we have the NoAtribute flag set to true
        if ( operationContext.isNoAttributes() )
        {
            for ( Attribute attribute : originalEntry )
            {
                AttributeType attributeType = attribute.getAttributeType();
                entry.remove( entry.get( attributeType ) );
            }

            entry.removeAttributes( entryDnType );
           
            return;
        }

        // If the user has requested all the User attributes ('*') only, we filter the entry's attribute to keep only
        // the USER attributes, plus the Operational attributes in the returning list
        if ( operationContext.isAllUserAttributes() )
        {
            for ( Attribute attribute : originalEntry )
            {
                AttributeType attributeType = attribute.getAttributeType();

                if ( attributeType.isOperational() )
                {
                    if ( !operationContext.contains( schemaManager, attributeType ) )
                    {
                        entry.removeAttributes( attributeType );
                    }
                    else if ( typesOnly )
                    {
                        entry.get( attributeType ).clear();
                    }
                }
                else if ( typesOnly )
                {
                    entry.get( attributeType ).clear();
                }
            }

            // DIRSERVER-1953
            if ( !operationContext.contains( schemaManager, entryDnType ) )
            {
                entry.removeAttributes( entryDnType );
            }
           
            return;
        }

        // If the user has requested all the Operational attributes ('+') only, we filter the entry's attribute to keep only
        // the OPERATIONAL attributes, plus the User attributes in the returning list
        if ( operationContext.isAllOperationalAttributes() )
        {
            for ( Attribute attribute : originalEntry )
            {
                AttributeType attributeType = attribute.getAttributeType();

                if ( attributeType.isUser() )
                {
                    if ( !operationContext.contains( schemaManager, attributeType ) )
                    {
                        entry.removeAttributes( attributeType );
                    }
                    else if ( typesOnly )
                    {
                        entry.get( attributeType ).clear();
                    }
                }
                else if ( typesOnly )
                {
                    entry.get( attributeType ).clear();
                }
            }

            if ( !operationContext.contains( schemaManager, entryDnType ) )
            {
                entry.removeAttributes( entryDnType );
            }
            else if ( typesOnly )
            {
                entry.get( entryDnType ).clear();
            }

            return;
        }

        // Last, not least, check if the attributes are in the returning list
        if ( operationContext.getReturningAttributes() != null )
        {
            for ( Attribute attribute : originalEntry )
            {
                if ( !operationContext.contains( schemaManager, attribute.getAttributeType() ) )
                {
                    entry.removeAttributes( attribute.getAttributeType() );
                    continue;
                }
                AttributeType attributeType = attribute.getAttributeType();
                boolean isNotRequested = true;

                for ( AttributeTypeOptions attrOptions : operationContext.getReturningAttributes() )
                {
                    if ( attrOptions.getAttributeType().equals( attributeType ) ||
View Full Code Here

            return false;
        }

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

            return contains( schemaManager, attributeType );
        }
        catch ( LdapException le )
        {
View Full Code Here

                try
                {
                    String id = SchemaUtils.stripOptions( returnAttribute );
                    Set<String> options = SchemaUtils.getOptions( returnAttribute );

                    AttributeType attributeType = session.getDirectoryService()
                        .getSchemaManager().lookupAttributeTypeRegistry( id );
                    AttributeTypeOptions attrOptions = new AttributeTypeOptions( attributeType, options );

                    collectedAttributes.add( attrOptions );
                }
View Full Code Here

    }


    void initIndex() throws Exception
    {
        AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.OU_AT );
        MavibotIndex<String> index = new MavibotIndex<String>( attributeType.getName(), false );
        index.setWkDirPath( dbFileDir.toURI() );
        initIndex( index );
    }
View Full Code Here

    }


    void initIndex( MavibotIndex<String> mavibotIdx ) throws Exception
    {
        AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.OU_AT );

        if ( mavibotIdx == null )
        {
            mavibotIdx = new MavibotIndex<String>( attributeType.getName(), false );
        }

        mavibotIdx.setRecordManager( recordMan );
        mavibotIdx.init( schemaManager, attributeType );
        this.idx = mavibotIdx;
View Full Code Here

    {
        MavibotIndex<Object> MavibotIndex = new MavibotIndex<Object>( "1.1", false );

        try
        {
            AttributeType noEqMatchAttribute = new AttributeType( "1.1" );
            MavibotIndex.setWkDirPath( dbFileDir.toURI() );
            MavibotIndex.setRecordManager( recordMan );
            MavibotIndex.init( schemaManager, noEqMatchAttribute );
            fail( "should not get here" );
        }
View Full Code Here

    {
        for ( Modification mod : mods )
        {
            // TODO: handle http://issues.apache.org/jira/browse/DIRSERVER-1198
            Attribute attr = mod.getAttribute();
            AttributeType attrType = attr.getAttributeType();

            // Defensive programming. Very unlikely to happen here...
            if ( attrType == null )
            {
                try
                {
                    attrType = schemaManager.lookupAttributeTypeRegistry( attr.getUpId() );
                }
                catch ( LdapException le )
                {
                    throw new LdapInvalidAttributeTypeException();
                }
            }

            ModificationOperation modOp = mod.getOperation();

            // If the AT is collective and we don't try to remove it, then we can return.
            if ( attrType.isCollective() && ( modOp != ModificationOperation.REMOVE_ATTRIBUTE ) )
            {
                return true;
            }
        }
View Full Code Here

     */
    private boolean containsAnyCollectiveAttributes( Entry entry ) throws LdapException
    {
        for ( Attribute attribute : entry.getAttributes() )
        {
            AttributeType attributeType = attribute.getAttributeType();

            if ( attributeType.isCollective() )
            {
                return true;
            }
        }

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.