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

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


    public Object[] getElements( Object inputElement )
    {
        if ( inputElement != null && inputElement instanceof ISearch )
        {
            ISearch search = ( ISearch ) inputElement;
            return search.getSearchResults() != null ? search.getSearchResults() : new Object[0];
        }
        else
        {
            return new Object[]
                {};
View Full Code Here


        {
            return ( ( BrowserSearchResultPage ) child ).getParent();
        }
        else if ( child instanceof ISearch )
        {
            ISearch search = ( ( ISearch ) child );
            return connectionToCategoriesMap.get( search.getBrowserConnection() )[1];
        }
        else if ( child instanceof ISearchResult )
        {
            ISearch parentSearch = ( ( ISearchResult ) child ).getSearch();
            if ( parentSearch != null && searchToSearchResultPagesMap.containsKey( parentSearch ) )
            {
                BrowserSearchResultPage[] srPages = searchToSearchResultPagesMap.get( parentSearch );
                BrowserSearchResultPage srp = null;
                for ( int i = 0; i < srPages.length && srp == null; i++ )
View Full Code Here

                return objects;
            }
        }
        else if ( parent instanceof ISearch )
        {
            ISearch search = ( ISearch ) parent;
            if ( search.getSearchResults() == null )
            {
                new SearchJob( new ISearch[]
                    { search } ).execute();
                return new String[]
                    { "Performing Search..." };
            }
            else if ( search.getSearchResults().length == 0 )
            {
                return new String[]
                    { "No Results" };
            }
            else if ( search.getSearchResults().length <= preferences.getFoldingSize() || !preferences.isUseFolding() )
            {
                ISearchResult[] results = search.getSearchResults();
                return results;
            }
            else
            {
                BrowserSearchResultPage[] srPages = null;
                if ( !searchToSearchResultPagesMap.containsKey( search ) )
                {
                    srPages = getSearchResultPages( search, 0, search.getSearchResults().length - 1 );
                    searchToSearchResultPagesMap.put( search, srPages );
                }
                else
                {
                    srPages = searchToSearchResultPagesMap.get( search );
                    if ( search.getSearchResults().length - 1 != srPages[srPages.length - 1].getLast() )
                    {
                        srPages = getSearchResultPages( search, 0, search.getSearchResults().length - 1 );
                        searchToSearchResultPagesMap.put( search, srPages );
                    }
                }
                return srPages;
            }
View Full Code Here

     * @param selection the current selection
     * @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( SearchScope.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;
View Full Code Here

                    sp.setFilter( Schema.SCHEMA_FILTER );
                    sp.setScope( SearchScope.OBJECT );
                    sp.setReturningAttributes( new String[]
                        { IAttribute.OPERATIONAL_ATTRIBUTE_CREATE_TIMESTAMP,
                            IAttribute.OPERATIONAL_ATTRIBUTE_MODIFY_TIMESTAMP, } );
                    ISearch search = new Search( browserConnection, sp );

                    SearchJob.searchAndUpdateModel( browserConnection, search, monitor );
                    ISearchResult[] results = search.getSearchResults();

                    if ( results != null && results.length == 1 )
                    {
                        String schemaTimestamp = results[0]
                            .getAttribute( IAttribute.OPERATIONAL_ATTRIBUTE_MODIFY_TIMESTAMP ) != null ? results[0]
View Full Code Here

            BrowserSearchResultPage container = ( BrowserSearchResultPage ) obj;
            return "[" + ( container.getFirst() + 1 ) + "..." + ( container.getLast() + 1 ) + "]";
        }
        else if ( obj instanceof ISearch )
        {
            ISearch search = ( ISearch ) obj;
            ISearchResult[] results = search.getSearchResults();
            StringBuffer append = new StringBuffer( search.getName() );
            if ( results != null )
            {
                append.append( " (" ).append( results.length );
                if ( search.isCountLimitExceeded() )
                {
                    append.append( "+" );
                }
                append.append( ")" );
            }
View Full Code Here

        {
            return PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJ_FOLDER );
        }
        else if ( obj instanceof ISearch )
        {
            ISearch search = ( ISearch ) obj;
            if ( search.getSearchResults() != null )
            {
                return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_SEARCH );
            }
            else
            {
View Full Code Here

                            readIn.read( connectionId );
                            connection = BrowserCorePlugin.getDefault().getConnectionManager().getBrowserConnectionById(
                                new String( connectionId, "UTF-8" ) );
                        }

                        ISearch search = null;
                        if ( readIn.available() > 1 && connection != null )
                        {
                            int size = readIn.readInt();
                            byte[] searchName = new byte[size];
                            readIn.read( searchName );
View Full Code Here

        monitor.beginTask( " ", searches.length + 1 ); //$NON-NLS-1$
        monitor.reportProgress( " " ); //$NON-NLS-1$

        for ( int pi = 0; pi < searches.length; pi++ )
        {
            ISearch search = searches[pi];

            monitor.setTaskName( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__search_task, new String[]
                { search.getName() } ) );
            monitor.worked( 1 );

            if ( search.getBrowserConnection() != null )
            {
                searchAndUpdateModel( search.getBrowserConnection(), search, monitor );
            }
        }
    }
View Full Code Here

            entry.setChildrenInitialized( true );
        }
        else
        {
            // search
            ISearch search = new Search( null, entry.getBrowserConnection(), entry.getDn(),
                entry.isSubentry() ? ISearch.FILTER_SUBENTRY : ISearch.FILTER_TRUE, attributes, SearchScope.OBJECT, 0,
                0, entry.getBrowserConnection().getAliasesDereferencingMethod(), entry.getBrowserConnection()
                    .getReferralsHandlingMethod(), false, null );
            SearchJob.searchAndUpdateModel( entry.getBrowserConnection(), search, monitor );
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.