Package org.apache.directory.ldapstudio.browser.core.model

Examples of org.apache.directory.ldapstudio.browser.core.model.IEntry


     */
    public String getText()
    {
        IEntry[] entries = getEntries();
        ISearch[] searches = getSearches();
        IEntry entryInput = getEntryInput();
        ISearch searchInput = getSearchInput();

        if ( entries.length > 0 && searches.length == 0 && entryInput == null && searchInput == null )
        {
            return "Reload Attributes and Children";
View Full Code Here


     */
    public void run()
    {
        IEntry[] entries = getEntries();
        ISearch[] searches = getSearches();
        IEntry entryInput = getEntryInput();
        ISearch searchInput = getSearchInput();
        boolean soa = BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES );

        if ( entries.length > 0 )
View Full Code Here

     */
    public boolean isEnabled()
    {
        IEntry[] entries = getEntries();
        ISearch[] searches = getSearches();
        IEntry entryInput = getEntryInput();
        ISearch searchInput = getSearchInput();

        return entries.length > 0 || searches.length > 0 || entryInput != null || searchInput != null;
    }
View Full Code Here

                            readIn.read( connectionName );
                            connection = BrowserCorePlugin.getDefault().getConnectionManager().getConnection(
                                new String( connectionName ) );
                        }

                        IEntry entry = null;
                        if ( readIn.available() > 1 && connection != null )
                        {
                            int size = readIn.readInt();
                            byte[] dn = new byte[size];
                            readIn.read( dn );
                            entry = connection.getEntryFromCache( new DN( new String( dn ) ) );
                        }
                        else
                        {
                            return null;
                        }

                        IAttribute attribute = null;
                        if ( readIn.available() > 1 && entry != null )
                        {
                            int size = readIn.readInt();
                            byte[] attributeName = new byte[size];
                            readIn.read( attributeName );
                            attribute = entry.getAttribute( new String( attributeName ) );
                        }
                        else
                        {
                            return null;
                        }
View Full Code Here

            public void widgetSelected( SelectionEvent e )
            {
                if ( connection != null )
                {
                    // get root entry
                    IEntry rootEntry = connection.getRootDSE();
                    if( suffix != null && suffix.getRdns().length > 0 )
                    {
                        rootEntry = connection.getEntryFromCache( suffix );
                        if ( rootEntry == null )
                        {
                            ReadEntryJob job = new ReadEntryJob( connection, suffix );
                            RunnableContextJobAdapter.execute( job );
                            rootEntry = job.getReadEntry();
                        }
                    }

                    // calculate initial DN
                    DN initialDN = dn;
                    if( suffix != null && suffix.getRdns().length > 0 )
                    {
                        if( initialDN != null && initialDN.getRdns().length > 0 )
                        {
                            initialDN = new DN( initialDN, suffix );
                        }
                    }

                    // get initial entry
                    IEntry entry = rootEntry;
                    if ( initialDN != null && initialDN.getRdns().length > 0 )
                    {
                        entry = connection.getEntryFromCache( initialDN );
                        if ( entry == null )
                        {
                            ReadEntryJob job = new ReadEntryJob( connection, initialDN );
                            RunnableContextJobAdapter.execute( job );
                            entry = job.getReadEntry();
                        }
                    }


                    // open dialog
                    SelectEntryDialog dialog = new SelectEntryDialog( parent.getShell(), "Select DN", rootEntry, entry );
                    dialog.open();
                    IEntry selectedEntry = dialog.getSelectedEntry();

                    // get selected DN
                    if ( selectedEntry != null )
                    {
                        dn = selectedEntry.getDn();
                        if( suffix != null && suffix.getRdns().length > 0 )
                        {
                            dn = dn.getLocalName( suffix );
                        }
                        dnChanged();
View Full Code Here

                exampleSearch = ( ISearch ) search.clone();
                exampleSearch.setName( null );
            }
            else if ( obj instanceof IEntry )
            {
                IEntry entry = ( IEntry ) obj;
                exampleSearch.setConnection( entry.getConnection() );
                exampleSearch.setSearchBase( entry.getDn() );
            }
            else if ( obj instanceof ISearchResult )
            {
                ISearchResult searchResult = ( ISearchResult ) obj;
                exampleSearch.setConnection( searchResult.getEntry().getConnection() );
                exampleSearch.setSearchBase( searchResult.getEntry().getDn() );
            }
            else if ( obj instanceof IBookmark )
            {
                IBookmark bookmark = ( IBookmark ) obj;
                exampleSearch.setConnection( bookmark.getConnection() );
                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.getConnection() );
                exampleSearch.setSearchBase( entry.getDn() );
                StringBuffer filter = new StringBuffer();
                if ( filterSet.size() > 1 )
                {
                    filter.append( "(&" );
                    for ( Iterator<String> filterIterator = filterSet.iterator(); filterIterator.hasNext(); )
View Full Code Here

        } );

        this.mainWidget.getViewer().expandToLevel( 2 );
        if ( this.initialEntry != null )
        {
            IEntry entry = this.initialEntry;
            this.mainWidget.getViewer().reveal( entry );
            this.mainWidget.getViewer().refresh( entry, true );
            this.mainWidget.getViewer().setSelection( new StructuredSelection( entry ), true );
            this.mainWidget.getViewer().setSelection( new StructuredSelection( entry ), true );
        }
View Full Code Here

        }

        IEntry[] allEntries = ( IEntry[] ) entriesSet.toArray( new IEntry[entriesSet.size()] );
        for ( int i = 0; i < allEntries.length; i++ )
        {
            IEntry entry = allEntries[i];
            if ( entriesSet.contains( entry.getParententry() ) )
            {
                entriesSet.remove( entry );
            }
        }
View Full Code Here

            }
        }
        // check if a required objectClass is selected
        if ( getSelectedValues().length > 0 && !selectedObjectClasses.isEmpty() )
        {
            IEntry entry = getSelectedValues()[0].getAttribute().getEntry();
            // get remaining attributes
            String[] ocValues = entry.getSubschema().getObjectClassNames();
            Set remainingObjectClassesSet = new HashSet( Arrays.asList( ocValues ) );
            remainingObjectClassesSet.removeAll( selectedObjectClasses );
            Set remainingAttributeSet = new HashSet();
            for ( Iterator it = remainingObjectClassesSet.iterator(); it.hasNext(); )
            {
                String oc = ( String ) it.next();
                ObjectClassDescription ocd = entry.getConnection().getSchema().getObjectClassDescription( oc );
                if ( ocd != null )
                {
                    remainingAttributeSet
                        .addAll( Arrays.asList( ocd.getMustAttributeTypeDescriptionNamesTransitive() ) );
                    remainingAttributeSet.addAll( Arrays.asList( ocd.getMayAttributeTypeDescriptionNamesTransitive() ) );
                }
            }
            // check against attributes
            IAttribute[] attributes = entry.getAttributes();
            for ( int i = 0; i < attributes.length; i++ )
            {
                IAttribute attribute = attributes[i];
                if ( attribute.isMayAttribute() || attribute.isMustAttribute() )
                {
View Full Code Here

     *      the Entries
     */
    protected IEntry[] getEntries()
    {

        IEntry entry = null;

        if ( getSelectedEntries().length == 1 )
        {
            entry = getSelectedEntries()[0];
        }
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.browser.core.model.IEntry

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.