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

Examples of org.apache.directory.studio.ldapbrowser.core.model.ISearch


                referralsHandlingMethod = ReferralHandlingMethod.MANAGE;
            }
            Control[] controls = null;

            // get children,
            ISearch search = new Search( null, parent.getBrowserConnection(), parent.getDn(), parent
                .getChildrenFilter(), ISearch.NO_ATTRIBUTES, scope, parent.getBrowserConnection().getCountLimit(),
                parent.getBrowserConnection().getTimeLimit(), aliasesDereferencingMethod, referralsHandlingMethod,
                BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean(
                    BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN ), controls );
            SearchRunnable.searchAndUpdateModel( parent.getBrowserConnection(), 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().getUpName() } ) );

            // fill children in search result
            if ( srs != null && srs.length > 0 )
            {
                // clearing old children before filling new children 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.isAlias() && !( srs[i].getEntry() instanceof AliasBaseEntry ) )
                    {
                        AliasBaseEntry aliasBaseEntry = new AliasBaseEntry( srs[i].getEntry().getBrowserConnection(),
                            srs[i].getEntry().getDn() );
                        parent.addChild( aliasBaseEntry );
                    }
                    else
                    {
                        parent.addChild( srs[i].getEntry() );
                    }
                }
            }
            else
            {
                parent.setHasChildrenHint( false );
            }

            // get sub-entries
            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(), aliasesDereferencingMethod, referralsHandlingMethod,
                BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean(
                    BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN ), new Control[]
                    { Control.SUBENTRIES_CONTROL } );
            if ( BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean(
                BrowserCoreConstants.PREFERENCE_FETCH_SUBENTRIES ) )
            {
                SearchRunnable.searchAndUpdateModel( parent.getBrowserConnection(), 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().getUpName() } ) );

                // 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


//                derefAliasMethod = AliasDereferencingMethod.FINDING;
//                scope = SearchScope.OBJECT;
//            }
           
            // 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 ), controls );
            SearchJob.searchAndUpdateModel( parent.getBrowserConnection(), 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().getUpName() } ) );

            // fill children in search result
            if ( srs != null && srs.length > 0 )
            {
                // clearing old children before filling new children 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.isAlias() && !( srs[i].getEntry() instanceof AliasBaseEntry ) )
                    {
                        AliasBaseEntry aliasBaseEntry = new AliasBaseEntry( srs[i].getEntry().getBrowserConnection(), srs[i]
                            .getEntry().getDn() );
                        parent.addChild( aliasBaseEntry );
                    }
                    else
                    {
                        parent.addChild( srs[i].getEntry() );
                    }
                }
            }
            else
            {
                parent.setHasChildrenHint( false );
            }

            // get sub-entries
            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 ), new Control[]
                    { Control.SUBENTRIES_CONTROL } );
            if ( BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean(
                BrowserCoreConstants.PREFERENCE_FETCH_SUBENTRIES ) )
            {
                SearchJob.searchAndUpdateModel( parent.getBrowserConnection(), 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().getUpName() } ) );

                // 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

            {
                return entry;
            }

            // search in directory
            ISearch search = new Search( null, browserConnection, dn, null, ISearch.NO_ATTRIBUTES, SearchScope.OBJECT,
                1, 0, browserConnection.getAliasesDereferencingMethod(),
                browserConnection.getReferralsHandlingMethod(), true, null );
            SearchJob.searchAndUpdateModel( browserConnection, search, monitor );
            ISearchResult[] srs = search.getSearchResults();
            if ( srs.length > 0 )
            {
                return srs[0].getEntry();
            }
            else
View Full Code Here

                {
                    for ( Iterator<?> i = searchesElement.elementIterator( SEARCH_PARAMETER_TAG ); i.hasNext(); )
                    {
                        Element searchParameterElement = ( Element ) i.next();
                        SearchParameter searchParameter = readSearch( searchParameterElement, browserConnection );
                        ISearch search = new Search( browserConnection, searchParameter );
                        browserConnection.getSearchManager().addSearch( search );
                    }
                }
               
                Element bookmarksElement = element.element( BOOKMARKS_TAG );
View Full Code Here

     */
    protected Control createContents( Composite parent )
    {

        // declare search
        ISearch search = ( ISearch ) getElement();
        if ( search != null )
        {
            this.search = search;
        }
        else
        {
            this.search = new Search();
        }

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

        Composite composite = BaseWidgetUtils.createColumnContainer( parent, 3, 1 );

        spw = new SearchPageWrapper( SearchPageWrapper.CONNECTION_READONLY );
        spw.createContents( composite );
View Full Code Here

    {
        Object objectToSelect = null;

        if ( obj instanceof ISearch )
        {
            ISearch search = ( ISearch ) obj;

            universalListener.setInput( search.getBrowserConnection() );

            mainWidget.getViewer().expandToLevel( search, 0 );

            objectToSelect = search;
        }
        if ( obj instanceof ISearchResult )
        {
            ISearchResult searchResult = ( ISearchResult ) obj;
            ISearch search = searchResult.getSearch();

            universalListener.setInput( search.getBrowserConnection() );

            mainWidget.getViewer().expandToLevel( search, 1 );

            objectToSelect = searchResult;
        }
View Full Code Here

                    }
                    else if ( obj instanceof ISearchResult )
                    {
                        ISearchResult sr = ( ISearchResult ) obj;
                        ISearch search = sr.getSearch();
                        select( search );
                    }
                    return true;
                }
            };
View Full Code Here

            && connections[0].getJNDIConnectionWrapper().isConnected()
            || searches.length + entries.length + searchResults.length + bookmarks.length + attributes.length
                + values.length > 0 )
        {

            ISearch search = BrowserSelectionUtils.getExampleSearch( selection );
            search.setName( null );
            this.connection = search.getBrowserConnection();

            applyOnPage = new BatchOperationApplyOnWizardPage( BatchOperationApplyOnWizardPage.class.getName(), this );
            addPage( applyOnPage );

            typePage = new BatchOperationTypeWizardPage( BatchOperationTypeWizardPage.class.getName(), this );
View Full Code Here

            LdapDN[] dns = applyOnPage.getApplyOnDns();
            if ( dns == null )
            {
                if ( applyOnPage.getApplyOnSearch() != null )
                {
                    ISearch search = applyOnPage.getApplyOnSearch();
                    if ( search.getBrowserConnection() != null )
                    {
                        SearchJob job = new SearchJob( new ISearch[]
                            { search } );
                        RunnableContextJobAdapter.execute( job, getContainer() );
                        if ( job.getExternalResult().isOK() )
                        {
                            ISearchResult[] srs = search.getSearchResults();
                            dns = new LdapDN[srs.length];
                            for ( int i = 0; i < srs.length; i++ )
                            {
                                dns[i] = srs[i].getDn();
                            }
View Full Code Here

        // update state
        String url = "";
        boolean enabled = true;
        if ( input != null && input instanceof ISearch )
        {
            ISearch search = ( ISearch ) input;

            if ( filteredAndSortedElements.length < elements.length )
            {
                url += filteredAndSortedElements.length + " of ";
            }

            if ( search.getSearchResults() == null )
            {
                url += "Search not performed  -  ";
                enabled = false;
            }
            else if ( search.getSearchResults().length == 1 )
            {
                url += search.getSearchResults().length + " Result  -  ";
            }
            else
            {
                url += search.getSearchResults().length + " Results  -  ";
            }

            // url += search.getURL();
            url += "Search Base: " + search.getSearchBase().getUpName() + "  -  ";
            url += "Filter: " + search.getFilter();

            boolean showDn = BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
                BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN )
                || search.getReturningAttributes().length == 0;
            this.configuration.getFilter().inputChanged( search, showDn );
            this.configuration.getSorter().inputChanged( search, showDn );
        }
        else
        {
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldapbrowser.core.model.ISearch

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.