Package org.apache.directory.studio.ldapbrowser.core.internal.model

Examples of org.apache.directory.studio.ldapbrowser.core.internal.model.Search


          entry.setChildrenInitialized( true );
        }
        else
        {
          // search
          ISearch search = new Search( null, entry.getBrowserConnection(), entry.getDn(), entry.isSubentry()?ISearch.FILTER_SUBENTRY:ISearch.FILTER_TRUE, attributes,
              ISearch.SCOPE_OBJECT, 0, 0, IBrowserConnection.DEREFERENCE_ALIASES_NEVER, IBrowserConnection.HANDLE_REFERRALS_IGNORE,
              false, false, null );
          entry.getBrowserConnection().search( search, monitor );
 
          // set initialized state
View Full Code Here


                subParam.setAliasesDereferencingMethod( IBrowserConnection.DEREFERENCE_ALIASES_NEVER );
                subParam.setReferralsHandlingMethod( IBrowserConnection.HANDLE_REFERRALS_IGNORE );
                subParam.setReturningAttributes( new String[]
                    { IAttribute.OBJECTCLASS_ATTRIBUTE, IAttribute.REFERRAL_ATTRIBUTE } );
                subParam.setCountLimit( 100 );
                ISearch search = new Search( entry.getBrowserConnection(), subParam );
                entry.getBrowserConnection().search( search, monitor );

                ISearchResult[] srs = search.getSearchResults();
                for ( int i = 0; !monitor.isCanceled() && srs != null && i < srs.length; i++ )
                {
                    IEntry childEntry = srs[i].getEntry();
                    numberOfDeletedEntries = this.deleteEntryRecursive( childEntry, true, numberOfDeletedEntries,
                        monitor );
                    numberInBatch++;
                }
            }
            while ( numberInBatch > 0 && !monitor.isCanceled() && !monitor.errorsReported() );

            if ( !monitor.isCanceled() && !monitor.errorsReported() )
            {

                // check for referrals
                if ( !refInitialized )
                {
                    SearchParameter param = new SearchParameter();
                    param.setSearchBase( entry.getDn() );
                    param.setFilter( ISearch.FILTER_TRUE );
                    param.setScope( ISearch.SCOPE_OBJECT );
                    param.setAliasesDereferencingMethod( IBrowserConnection.DEREFERENCE_ALIASES_NEVER );
                    param.setReferralsHandlingMethod( IBrowserConnection.HANDLE_REFERRALS_IGNORE );
                    param.setReturningAttributes( new String[]
                        { IAttribute.OBJECTCLASS_ATTRIBUTE, IAttribute.REFERRAL_ATTRIBUTE } );
                    ISearch search = new Search( entry.getBrowserConnection(), param );
                    entry.getBrowserConnection().search( search, monitor );

                    ISearchResult[] srs = search.getSearchResults();
                    if ( !monitor.isCanceled() && srs != null && srs.length == 1 )
                    {
                        entry = srs[0].getEntry();
                    }
                }
View Full Code Here

            param.setScope( ISearch.SCOPE_OBJECT );
            param.setAliasesDereferencingMethod( IBrowserConnection.DEREFERENCE_ALIASES_NEVER );
            param.setReferralsHandlingMethod( IBrowserConnection.HANDLE_REFERRALS_IGNORE );
            param.setReturningAttributes( new String[]
                { ISearch.ALL_USER_ATTRIBUTES, IAttribute.REFERRAL_ATTRIBUTE } );
            ISearch search = new Search( entryToCopy.getBrowserConnection(), param );
            entryToCopy.getBrowserConnection().search( search, monitor );

            ISearchResult[] srs = search.getSearchResults();
            if ( !monitor.isCanceled() && srs != null && srs.length == 1 )
            {
                entryToCopy = srs[0].getEntry();
                IAttribute[] attributesToCopy = entryToCopy.getAttributes();

                // create new entry
                RDN rdn = entryToCopy.getRdn();
                IEntry newEntry = new Entry( parent, rdn );

                // change RDN if entry already exists
                StudioProgressMonitor testMonitor = new StudioProgressMonitor( monitor );
                IEntry testEntry = parent.getBrowserConnection().getEntry( newEntry.getDn(), testMonitor );
                if ( testEntry != null )
                {
                    String rdnValue = rdn.getValue();
                    String newRdnValue = BrowserCoreMessages.bind( BrowserCoreMessages.copy_n_of_s, "", rdnValue ); //$NON-NLS-1$
                    RDN newRdn = getNewRdn( rdn, newRdnValue );
                    newEntry = new Entry( parent, newRdn );
                    testEntry = parent.getBrowserConnection().getEntry( newEntry.getDn(), testMonitor );
                    for ( int i = 2; testEntry != null; i++ )
                    {
                        newRdnValue = BrowserCoreMessages.bind( BrowserCoreMessages.copy_n_of_s, i + " ", rdnValue ); //$NON-NLS-1$
                        newRdn = getNewRdn( rdn, newRdnValue );
                        newEntry = new Entry( parent, newRdn );
                        testEntry = parent.getBrowserConnection().getEntry( newEntry.getDn(), testMonitor );
                    }
                }

                // copy attributes
                for ( int i = 0; i < attributesToCopy.length; i++ )
                {
                    IAttribute attributeToCopy = attributesToCopy[i];

                    if ( SchemaUtils.isModifyable( attributeToCopy.getAttributeTypeDescription() )
                        || IAttribute.REFERRAL_ATTRIBUTE.equalsIgnoreCase( attributeToCopy.getDescription() ) )
                    {
                        IAttribute newAttribute = new Attribute( newEntry, attributeToCopy.getDescription() );
                        newEntry.addAttribute( newAttribute );
                        IValue[] valuesToCopy = attributeToCopy.getValues();
                        for ( int j = 0; j < valuesToCopy.length; j++ )
                        {
                            IValue valueToCopy = valuesToCopy[j];
                            IValue newValue = new Value( newAttribute, valueToCopy.getRawValue() );
                            newAttribute.addValue( newValue );
                        }
                    }
                }

                // check if RDN attributes ar present
                RDN newRdn = newEntry.getRdn();
                RDNPart[] oldRdnParts = rdn.getParts();
                for ( int i = 0; i < oldRdnParts.length; i++ )
                {
                    RDNPart part = oldRdnParts[i];
                    IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
                    if ( rdnAttribute != null )
                    {
                        IValue[] values = rdnAttribute.getValues();
                        for ( int ii = 0; ii < values.length; ii++ )
                        {
                            if ( part.getUnencodedValue().equals( values[ii].getRawValue() ) )
                            {
                                rdnAttribute.deleteValue( values[ii] );
                            }
                            if ( rdnAttribute.getValueSize() == 0 )
                            {
                                newEntry.deleteAttribute( rdnAttribute );
                            }
                        }
                    }
                }
                RDNPart[] newRdnParts = newRdn.getParts();
                for ( int i = 0; i < newRdnParts.length; i++ )
                {
                    RDNPart part = newRdnParts[i];
                    IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
                    if ( rdnAttribute == null )
                    {
                        rdnAttribute = new Attribute( newEntry, part.getType() );
                        newEntry.addAttribute( rdnAttribute );
                        rdnAttribute.addValue( new Value( rdnAttribute, part.getUnencodedValue() ) );
                    }
                    else
                    {
                        boolean mustAdd = true;
                        IValue[] values = rdnAttribute.getValues();
                        for ( int ii = 0; ii < values.length; ii++ )
                        {
                            if ( part.getUnencodedValue().equals( values[ii].getStringValue() ) )
                            {
                                mustAdd = false;
                                break;
                            }
                        }
                        if ( mustAdd )
                        {
                            rdnAttribute.addValue( new Value( rdnAttribute, part.getUnencodedValue() ) );
                        }
                    }
                }

                newEntry.getBrowserConnection().create( newEntry, monitor );
                newEntry.getParententry().addChild( newEntry );
                newEntry.setHasChildrenHint( false );

                num++;
                monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.model__copied_n_entries,
                    new String[]
                        { Integer.toString( num ) } ) );

                // check for children
                if ( !monitor.isCanceled() && ( scope == ISearch.SCOPE_ONELEVEL || scope == ISearch.SCOPE_SUBTREE ) )
                {

                    SearchParameter subParam = new SearchParameter();
                    subParam.setSearchBase( entryToCopy.getDn() );
                    subParam.setFilter( ISearch.FILTER_TRUE );
                    subParam.setScope( ISearch.SCOPE_ONELEVEL );
                    subParam.setReturningAttributes( ISearch.NO_ATTRIBUTES );
                    ISearch subSearch = new Search( entryToCopy.getBrowserConnection(), subParam );
                    entryToCopy.getBrowserConnection().search( subSearch, monitor );

                    ISearchResult[] subSrs = subSearch.getSearchResults();
                    if ( !monitor.isCanceled() && subSrs != null && subSrs.length > 0 )
                    {

                        for ( int i = 0; i < subSrs.length; i++ )
                        {
View Full Code Here

                handleReferralsMethod = parent.isReferral() ? IBrowserConnection.HANDLE_REFERRALS_FOLLOW
                    : IBrowserConnection.HANDLE_REFERRALS_IGNORE;
            }

            // get children,
            ISearch search = new Search( null, parent.getBrowserConnection(), parent.getDn(), parent.getChildrenFilter(),
                ISearch.NO_ATTRIBUTES, scope, parent.getBrowserConnection().getCountLimit(),
                parent.getBrowserConnection().getTimeLimit(), derefAliasMethod, handleReferralsMethod, BrowserCorePlugin
                    .getDefault().getPluginPreferences().getBoolean( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN ),
                BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean(
                    BrowserCoreConstants.PREFERENCE_SHOW_ALIAS_AND_REFERRAL_OBJECTS ), null );
            parent.getBrowserConnection().search( search, monitor );
            ISearchResult[] srs = search.getSearchResults();
            monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_progress_subcount,
                new String[]
                    { srs == null ? Integer.toString( 0 ) : Integer.toString( srs.length ), parent.getDn().toString() } ) );

            // fill children in search result
            if ( srs != null && srs.length > 0 )
            {

                /*
                 * clearing old children before filling new subenties is
                 * necessary to handle aliases and referrals.
                 */
                IEntry[] connChildren = parent.getChildren();
                for ( int i = 0; connChildren != null && i < connChildren.length; i++ )
                {
                    if ( connChildren[i] != null )
                    {
                        parent.deleteChild( connChildren[i] );
                    }
                }
                parent.setChildrenInitialized( false );

                for ( int i = 0; srs != null && i < srs.length; i++ )
                {
                    if ( parent.isReferral() )
                    {
                        ReferralBaseEntry referralBaseEntry = new ReferralBaseEntry( srs[i].getEntry().getBrowserConnection(),
                            srs[i].getEntry().getDn() );
                        parent.addChild( referralBaseEntry );
                        // System.out.println("Ref: " +
                        // referralBaseEntry.getUrl());
                    }
                    else if ( parent.isAlias() )
                    {
                        AliasBaseEntry aliasBaseEntry = new AliasBaseEntry( srs[i].getEntry().getBrowserConnection(), srs[i]
                            .getEntry().getDn() );
                        parent.addChild( aliasBaseEntry );
                        // System.out.println("Ali: " +
                        // aliasBaseEntry.getUrl());
                    }
                    else
                    {
                        parent.addChild( srs[i].getEntry() );
                    }
                }
            }
            else
            {
                parent.setHasChildrenHint( false );
            }

            // get subentries
            ISearch subSearch = new Search( null, parent.getBrowserConnection(), parent.getDn(), parent.getChildrenFilter()!=null?parent.getChildrenFilter():ISearch.FILTER_SUBENTRY,
                ISearch.NO_ATTRIBUTES, scope, parent.getBrowserConnection().getCountLimit(),
                parent.getBrowserConnection().getTimeLimit(), derefAliasMethod, handleReferralsMethod, BrowserCorePlugin
                    .getDefault().getPluginPreferences().getBoolean( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN ),
                BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean(
                    BrowserCoreConstants.PREFERENCE_SHOW_ALIAS_AND_REFERRAL_OBJECTS ), new Control[]
                    { Control.SUBENTRIES_CONTROL } );
            if ( BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean(
                BrowserCoreConstants.PREFERENCE_FETCH_SUBENTRIES ) )
            {
                parent.getBrowserConnection().search( subSearch, monitor );
                ISearchResult[] subSrs = subSearch.getSearchResults();
                monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_progress_subcount,
                    new String[]
                        { subSrs == null ? Integer.toString( 0 ) : Integer.toString( subSrs.length ),
                            parent.getDn().toString() } ) );
                // fill children in search result
                if ( subSrs != null && subSrs.length > 0 )
                {

                    for ( int i = 0; subSrs != null && i < subSrs.length; i++ )
                    {
                        parent.addChild( subSrs[i].getEntry() );
                    }
                }
            }

            // check exceeded limits / canceled
            parent.setHasMoreChildren( search.isCountLimitExceeded() || subSearch.isCountLimitExceeded()
                || monitor.isCanceled() );
           
            // set initialized state
            parent.setChildrenInitialized( true );
        }
View Full Code Here

        {
            this.search = search;
        }
        else
        {
            this.search = new Search();
        }

        super.setMessage( "Search " + Utils.shorten( search.getName(), 30 ) );

        Composite composite = BaseWidgetUtils.createColumnContainer( parent, 3, 1 );
View Full Code Here

     * @return a prototype search
     */
    public static ISearch getExampleSearch( ISelection selection )
    {

        ISearch exampleSearch = new Search();
        String oldName = exampleSearch.getSearchParameter().getName();
        exampleSearch.getSearchParameter().setName( null );
        exampleSearch.setScope( ISearch.SCOPE_SUBTREE );

        if ( selection != null && !selection.isEmpty() && selection instanceof StructuredSelection )
        {

            Object[] objects = ( ( IStructuredSelection ) selection ).toArray();
            Comparator<Object> comparator = new Comparator<Object>()
            {
                public int compare( Object o1, Object o2 )
                {
                    if ( ( o1 instanceof IValue ) && !( o2 instanceof IValue ) )
                    {
                        return -1;
                    }
                    else if ( !( o1 instanceof IValue ) && ( o2 instanceof IValue ) )
                    {
                        return 1;
                    }
                    else if ( ( o1 instanceof IAttribute ) && !( o2 instanceof IAttribute ) )
                    {
                        return -1;
                    }
                    else if ( !( o1 instanceof IAttribute ) && ( o2 instanceof IAttribute ) )
                    {
                        return 1;
                    }
                    else if ( ( o1 instanceof AttributeHierarchy ) && !( o2 instanceof AttributeHierarchy ) )
                    {
                        return -1;
                    }
                    else if ( !( o1 instanceof AttributeHierarchy ) && ( o2 instanceof AttributeHierarchy ) )
                    {
                        return 1;
                    }
                    return 0;
                }
            };
            Arrays.sort( objects, comparator );
            Object obj = objects[0];

            if ( obj instanceof ISearch )
            {
                ISearch search = ( ISearch ) obj;
                exampleSearch = ( ISearch ) search.clone();
                exampleSearch.setName( null );
            }
            else if ( obj instanceof IEntry )
            {
                IEntry entry = ( IEntry ) obj;
                exampleSearch.setConnection( entry.getBrowserConnection() );
                exampleSearch.setSearchBase( entry.getDn() );
            }
            else if ( obj instanceof ISearchResult )
            {
                ISearchResult searchResult = ( ISearchResult ) obj;
                exampleSearch.setConnection( searchResult.getEntry().getBrowserConnection() );
                exampleSearch.setSearchBase( searchResult.getEntry().getDn() );
            }
            else if ( obj instanceof IBookmark )
            {
                IBookmark bookmark = ( IBookmark ) obj;
                exampleSearch.setConnection( bookmark.getBrowserConnection() );
                exampleSearch.setSearchBase( bookmark.getDn() );
            }

            else if ( obj instanceof AttributeHierarchy || obj instanceof IAttribute || obj instanceof IValue )
            {

                IEntry entry = null;
                Set<String> filterSet = new LinkedHashSet<String>();
                for ( int i = 0; i < objects.length; i++ )
                {
                    Object object = objects[i];
                    if ( object instanceof AttributeHierarchy )
                    {
                        AttributeHierarchy ah = ( AttributeHierarchy ) object;
                        for ( Iterator it = ah.iterator(); it.hasNext(); )
                        {
                            IAttribute attribute = ( IAttribute ) it.next();
                            entry = attribute.getEntry();
                            IValue[] values = attribute.getValues();
                            for ( int v = 0; v < values.length; v++ )
                            {
                                filterSet.add( LdapFilterUtils.getFilter( values[v] ) );
                            }
                        }
                    }
                    else if ( object instanceof IAttribute )
                    {
                        IAttribute attribute = ( IAttribute ) object;
                        entry = attribute.getEntry();
                        IValue[] values = attribute.getValues();
                        for ( int v = 0; v < values.length; v++ )
                        {
                            filterSet.add( LdapFilterUtils.getFilter( values[v] ) );
                        }
                    }
                    else if ( object instanceof IValue )
                    {
                        IValue value = ( IValue ) object;
                        entry = value.getAttribute().getEntry();
                        filterSet.add( LdapFilterUtils.getFilter( value ) );
                    }
                }

                exampleSearch.setConnection( entry.getBrowserConnection() );
                exampleSearch.setSearchBase( entry.getDn() );
                StringBuffer filter = new StringBuffer();
                if ( filterSet.size() > 1 )
                {
                    filter.append( "(&" );
                    for ( Iterator<String> filterIterator = filterSet.iterator(); filterIterator.hasNext(); )
                    {
                        filter.append( filterIterator.next() );
                    }
                    filter.append( ")" );
                }
                else if ( filterSet.size() == 1 )
                {
                    filter.append( filterSet.toArray()[0] );
                }
                else
                {
                    filter.append( ISearch.FILTER_TRUE );
                }
                exampleSearch.setFilter( filter.toString() );
            }

            else if ( obj instanceof IBrowserConnection )
            {
                IBrowserConnection connection = ( IBrowserConnection ) obj;
                exampleSearch.setConnection( connection );
                if ( connection.getRootDSE().getChildrenCount() > 0 )
                {
                    exampleSearch.setSearchBase( connection.getRootDSE().getChildren()[0].getDn() );
                }
                else
                {
                    exampleSearch.setSearchBase( connection.getRootDSE().getDn() );
                }
            }
            else if ( obj instanceof BrowserCategory )
            {
                BrowserCategory cat = ( BrowserCategory ) obj;
                exampleSearch.setConnection( cat.getParent() );
                if ( cat.getParent().getRootDSE().getChildrenCount() > 0 )
                {
                    exampleSearch.setSearchBase( cat.getParent().getRootDSE().getChildren()[0].getDn() );
                }
                else
                {
                    exampleSearch.setSearchBase( cat.getParent().getRootDSE().getDn() );
                }
            }

        }

        exampleSearch.getSearchParameter().setName( oldName );
        return exampleSearch;
    }
View Full Code Here

                            if ( object[i].length > 0 )
                            {
                                SearchParameter[] searchParameters = ( SearchParameter[] ) object[i][1];
                                for ( int k = 0; k < searchParameters.length; k++ )
                                {
                                    ISearch search = new Search( browserConnection, searchParameters[k] );
                                    browserConnection.getSearchManager().addSearch( search );
                                }
                            }
   
                            if ( object[i].length > 1 )
View Full Code Here

            param.setScope( ISearch.SCOPE_OBJECT );
            param.setAliasesDereferencingMethod( IBrowserConnection.DEREFERENCE_ALIASES_NEVER );
            param.setReferralsHandlingMethod( IBrowserConnection.HANDLE_REFERRALS_IGNORE );
            param.setReturningAttributes( new String[]
                { ISearch.ALL_USER_ATTRIBUTES, IAttribute.REFERRAL_ATTRIBUTE } );
            ISearch search = new Search( entryToCopy.getBrowserConnection(), param );
            entryToCopy.getBrowserConnection().search( search, monitor );

            ISearchResult[] srs = search.getSearchResults();
            if ( !monitor.isCanceled() && srs != null && srs.length == 1 )
            {
                entryToCopy = srs[0].getEntry();
                IAttribute[] attributesToCopy = entryToCopy.getAttributes();

                // create new entry
                RDN rdn = entryToCopy.getRdn();
                IEntry newEntry = new Entry( parent, rdn );

                // change RDN if entry already exists
                StudioProgressMonitor testMonitor = new StudioProgressMonitor( monitor );
                IEntry testEntry = parent.getBrowserConnection().getEntry( newEntry.getDn(), testMonitor );
                if ( testEntry != null )
                {
                    String rdnValue = rdn.getValue();
                    String newRdnValue = BrowserCoreMessages.bind( BrowserCoreMessages.copy_n_of_s, "", rdnValue ); //$NON-NLS-1$
                    RDN newRdn = getNewRdn( rdn, newRdnValue );
                    newEntry = new Entry( parent, newRdn );
                    testEntry = parent.getBrowserConnection().getEntry( newEntry.getDn(), testMonitor );
                    for ( int i = 2; testEntry != null; i++ )
                    {
                        newRdnValue = BrowserCoreMessages.bind( BrowserCoreMessages.copy_n_of_s, i + " ", rdnValue ); //$NON-NLS-1$
                        newRdn = getNewRdn( rdn, newRdnValue );
                        newEntry = new Entry( parent, newRdn );
                        testEntry = parent.getBrowserConnection().getEntry( newEntry.getDn(), testMonitor );
                    }
                }

                // copy attributes
                for ( int i = 0; i < attributesToCopy.length; i++ )
                {
                    IAttribute attributeToCopy = attributesToCopy[i];

                    if ( SchemaUtils.isModifyable( attributeToCopy.getAttributeTypeDescription() )
                        || IAttribute.REFERRAL_ATTRIBUTE.equalsIgnoreCase( attributeToCopy.getDescription() ) )
                    {
                        IAttribute newAttribute = new Attribute( newEntry, attributeToCopy.getDescription() );
                        newEntry.addAttribute( newAttribute );
                        IValue[] valuesToCopy = attributeToCopy.getValues();
                        for ( int j = 0; j < valuesToCopy.length; j++ )
                        {
                            IValue valueToCopy = valuesToCopy[j];
                            IValue newValue = new Value( newAttribute, valueToCopy.getRawValue() );
                            newAttribute.addValue( newValue );
                        }
                    }
                }

                // check if RDN attributes ar present
                RDN newRdn = newEntry.getRdn();
                RDNPart[] oldRdnParts = rdn.getParts();
                for ( int i = 0; i < oldRdnParts.length; i++ )
                {
                    RDNPart part = oldRdnParts[i];
                    IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
                    if ( rdnAttribute != null )
                    {
                        IValue[] values = rdnAttribute.getValues();
                        for ( int ii = 0; ii < values.length; ii++ )
                        {
                            if ( part.getUnencodedValue().equals( values[ii].getRawValue() ) )
                            {
                                rdnAttribute.deleteValue( values[ii] );
                            }
                            if ( rdnAttribute.getValueSize() == 0 )
                            {
                                newEntry.deleteAttribute( rdnAttribute );
                            }
                        }
                    }
                }
                RDNPart[] newRdnParts = newRdn.getParts();
                for ( int i = 0; i < newRdnParts.length; i++ )
                {
                    RDNPart part = newRdnParts[i];
                    IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
                    if ( rdnAttribute == null )
                    {
                        rdnAttribute = new Attribute( newEntry, part.getType() );
                        newEntry.addAttribute( rdnAttribute );
                        rdnAttribute.addValue( new Value( rdnAttribute, part.getUnencodedValue() ) );
                    }
                    else
                    {
                        boolean mustAdd = true;
                        IValue[] values = rdnAttribute.getValues();
                        for ( int ii = 0; ii < values.length; ii++ )
                        {
                            if ( part.getUnencodedValue().equals( values[ii].getStringValue() ) )
                            {
                                mustAdd = false;
                                break;
                            }
                        }
                        if ( mustAdd )
                        {
                            rdnAttribute.addValue( new Value( rdnAttribute, part.getUnencodedValue() ) );
                        }
                    }
                }

                newEntry.getBrowserConnection().create( newEntry, monitor );
                newEntry.setHasChildrenHint( false );

                num++;
                monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.model__copied_n_entries,
                    new String[]
                        { Integer.toString( num ) } ) );

                // check for children
                if ( !monitor.isCanceled() && ( scope == ISearch.SCOPE_ONELEVEL || scope == ISearch.SCOPE_SUBTREE ) )
                {

                    SearchParameter subParam = new SearchParameter();
                    subParam.setSearchBase( entryToCopy.getDn() );
                    subParam.setFilter( ISearch.FILTER_TRUE );
                    subParam.setScope( ISearch.SCOPE_ONELEVEL );
                    subParam.setReturningAttributes( ISearch.NO_ATTRIBUTES );
                    ISearch subSearch = new Search( entryToCopy.getBrowserConnection(), subParam );
                    entryToCopy.getBrowserConnection().search( subSearch, monitor );

                    ISearchResult[] subSrs = subSearch.getSearchResults();
                    if ( !monitor.isCanceled() && subSrs != null && subSrs.length > 0 )
                    {

                        for ( int i = 0; i < subSrs.length; i++ )
                        {
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldapbrowser.core.internal.model.Search

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.