Examples of EntryFilteringCursor


Examples of org.apache.directory.server.core.api.filtering.EntryFilteringCursor

            SearchOperationContext searchOperationContext = new SearchOperationContext( moveContext.getSession(),
                baseDn,
                filter, controls );
            searchOperationContext.setAliasDerefMode( AliasDerefMode.NEVER_DEREF_ALIASES );

            EntryFilteringCursor subentries = nexus.search( searchOperationContext );

            try
            {
                // Modify all the entries under this subentry
                while ( subentries.next() )
                {
                    Entry candidate = subentries.get();
                    Dn dn = candidate.getDn();
                    dn.apply( schemaManager );

                    if ( directoryService.getEvaluator().evaluate( ss, apName, dn, candidate ) )
                    {
                        nexus.modify( new ModifyOperationContext( moveContext.getSession(), dn,
                            getOperationalModsForReplace(
                                oldDn, newName, subentry, candidate ) ) );
                    }
                }
            }
            catch ( Exception e )
            {
                throw new LdapOperationException( e.getMessage(), e );
            }
            finally
            {
                try
                {
                    subentries.close();
                }
                catch ( Exception e )
                {
                    LOG.error( I18n.err( I18n.ERR_168 ), e );
                }
View Full Code Here

Examples of org.apache.directory.server.core.api.filtering.EntryFilteringCursor

            SearchOperationContext searchOperationContext = new SearchOperationContext(
                moveAndRenameContext.getSession(), baseDn,
                filter, controls );
            searchOperationContext.setAliasDerefMode( AliasDerefMode.NEVER_DEREF_ALIASES );

            EntryFilteringCursor subentries = nexus.search( searchOperationContext );

            try
            {
                while ( subentries.next() )
                {
                    Entry candidate = subentries.get();
                    Dn dn = candidate.getDn();
                    dn.apply( schemaManager );

                    if ( directoryService.getEvaluator().evaluate( ss, apName, dn, candidate ) )
                    {
                        nexus.modify( new ModifyOperationContext( moveAndRenameContext.getSession(), dn,
                            getOperationalModsForReplace(
                                oldDn, newName, subentry, candidate ) ) );
                    }
                }
            }
            catch ( Exception e )
            {
                throw new LdapOperationException( e.getMessage(), e );
            }
            finally
            {
                try
                {
                    subentries.close();
                }
                catch ( Exception e )
                {
                    LOG.error( I18n.err( I18n.ERR_168 ), e );
                }
View Full Code Here

Examples of org.apache.directory.server.core.api.filtering.EntryFilteringCursor

            SearchOperationContext searchOperationContext = new SearchOperationContext( renameContext.getSession(),
                baseDn,
                filter, controls );
            searchOperationContext.setAliasDerefMode( AliasDerefMode.NEVER_DEREF_ALIASES );

            EntryFilteringCursor subentries = nexus.search( searchOperationContext );

            try
            {
                while ( subentries.next() )
                {
                    Entry candidate = subentries.get();
                    Dn dn = candidate.getDn();
                    dn.apply( schemaManager );

                    if ( directoryService.getEvaluator().evaluate( ss, apName, dn, candidate ) )
                    {
                        nexus.modify( new ModifyOperationContext( renameContext.getSession(), dn,
                            getOperationalModsForReplace(
                                oldDn, newName, subentry, candidate ) ) );
                    }
                }
            }
            catch ( Exception e )
            {
                throw new LdapOperationException( e.getMessage(), e );
            }
            finally
            {
                try
                {
                    subentries.close();
                }
                catch ( Exception e )
                {
                    LOG.error( I18n.err( I18n.ERR_168 ), e );
                }
View Full Code Here

Examples of org.apache.directory.server.core.api.filtering.EntryFilteringCursor

    /**
     * {@inheritDoc}
     */
    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
    {
        EntryFilteringCursor cursor = next( searchContext );

        // object scope searches by default return subentries
        if ( searchContext.getScope() == SearchScope.OBJECT )
        {
            return cursor;
        }

        // DO NOT hide subentries for replication operations
        if ( searchContext.isSyncreplSearch() )
        {
            return cursor;
        }

        // for subtree and one level scope we filter
        if ( !isSubentryVisible( searchContext ) )
        {
            cursor.addEntryFilter( new HideSubentriesFilter() );
        }
        else
        {
            cursor.addEntryFilter( new HideEntriesFilter() );
        }

        return cursor;
    }
View Full Code Here

Examples of org.apache.directory.server.core.api.filtering.EntryFilteringCursor

     * @throws Exception If the Dn is not valid or if the deletion failed
     */
    private void deleteRecursive( Dn rootDn, Map<Dn, EntryFilteringCursor> cursorMap ) throws Exception
    {
        LOG.debug( "searching for {}", rootDn.getName() );
        EntryFilteringCursor cursor = null;

        try
        {
            if ( cursorMap == null )
            {
View Full Code Here

Examples of org.apache.directory.server.core.api.filtering.EntryFilteringCursor

        }

        // Call the Search method
        Interceptor head = directoryService.getInterceptor( searchContext.getNextInterceptor() );

        EntryFilteringCursor cursor = null;

        lockRead();

        try
        {
View Full Code Here

Examples of org.apache.directory.server.core.api.filtering.EntryFilteringCursor

                { "*", "+" } );

            SearchOperationContext searchOperationContext = new SearchOperationContext( session,
                baseDn, filter, ctls );
            searchOperationContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
            EntryFilteringCursor results = nexus.search( searchOperationContext );

            try
            {
                while ( results.next() )
                {
                    Entry result = results.get();
                    Dn groupDn = result.getDn().apply( schemaManager );
                    Attribute members = getMemberAttribute( result );

                    if ( members != null )
                    {
                        Set<String> memberSet = new HashSet<String>( members.size() );
                        addMembers( memberSet, members );

                        Element cacheElement = new Element( groupDn.getNormName(), memberSet );
                        ehCache.put( cacheElement );
                    }
                    else
                    {
                        LOG.warn( "Found group '{}' without any member or uniqueMember attributes", groupDn.getName() );
                    }
                }

                results.close();
            }
            catch ( Exception e )
            {
                LOG.error( "Exception while initializing the groupCache:  {}", e.getCause() );
                LdapOperationException le = new LdapOperationException( e.getMessage(), e );
View Full Code Here

Examples of org.apache.directory.server.core.api.filtering.EntryFilteringCursor

                    searchContext.getSession(), contextDn );

                if ( partition.hasEntry( hasEntryContext ) )
                {
                    searchContext.setDn( contextDn );
                    EntryFilteringCursor cursor = partition.search( searchContext );
                    cursors.add( cursor );
                }
            }

            // don't feed the above Cursors' list to a BaseEntryFilteringCursor it is skipping the naming context entry of each partition
View Full Code Here

Examples of org.apache.directory.server.core.api.filtering.EntryFilteringCursor

            Dn suffixDn = directoryService.getDnFactory().create( suffix );

            SearchOperationContext searchOperationContext = new SearchOperationContext( adminSession, suffixDn,
                referralFilter, searchControl );
            searchOperationContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
            EntryFilteringCursor cursor = nexus.search( searchOperationContext );

            try
            {
                // Move to the first entry in the cursor
                cursor.beforeFirst();

                while ( cursor.next() )
                {
                    Entry entry = cursor.get();

                    // Lock the referralManager
                    lockWrite();

                    try
                    {
                        // Add it at the right place
                        addReferral( entry );
                    }
                    finally
                    {
                        // Unlock the referralManager
                        unlock();
                    }
                }

                cursor.close();
            }
            catch ( Exception e )
            {
                throw new LdapOperationException( e.getMessage(), e );
            }
View Full Code Here

Examples of org.apache.directory.server.core.api.filtering.EntryFilteringCursor

        // We will store each entry's Dn into the Referral tree
        SearchOperationContext searchOperationContext = new SearchOperationContext( adminSession, suffix,
            referralFilter, searchControl );
        searchOperationContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
        EntryFilteringCursor cursor = nexus.search( searchOperationContext );

        // Move to the first entry in the cursor
        cursor.beforeFirst();

        while ( cursor.next() )
        {
            Entry entry = cursor.get();

            // Add it at the right place
            removeReferral( entry );
        }
    }
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.