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

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


                    }
                }
            }

            // set new DN
            DN dn = new DN( dnBuilderWidget.getRdn(), dnBuilderWidget.getParentDn() );
            newEntry.setDn( dn );

            // add new RDN
            RDNPart[] newRdnParts = dn.getRdn().getParts();
            for ( int i = 0; i < newRdnParts.length; i++ )
            {
                IAttribute rdnAttribute = newEntry.getAttribute( newRdnParts[i].getType() );
                if ( rdnAttribute == null )
                {
View Full Code Here


        dnBuilderWidget.validate();
        final RDN[] rdns = new RDN[]
            { dnBuilderWidget.getRdn() };
        final DN[] parentDns = new DN[]
            { dnBuilderWidget.getParentDn() };
        final DN dn = new DN( rdns[0], parentDns[0] );

        // check if parent exists or new entry already exists
        ReadEntryJob readEntryJob1 = new ReadEntryJob( wizard.getSelectedConnection(), parentDns[0] );
        RunnableContextJobAdapter.execute( readEntryJob1, getContainer(), false );
        IEntry parentEntry = readEntryJob1.getReadEntry();
        if ( parentEntry == null )
        {
            getShell().getDisplay().syncExec( new Runnable()
            {
                public void run()
                {
                    MessageDialog.openError( getShell(), "Error", "Parent " + dnBuilderWidget.getParentDn().toString()
                        + " doesn't exists" );
                }
            } );
            return null;
        }
        ReadEntryJob readEntryJob2 = new ReadEntryJob( wizard.getSelectedConnection(), dn );
        RunnableContextJobAdapter.execute( readEntryJob2, getContainer(), false );
        IEntry entry = readEntryJob2.getReadEntry();
        if ( entry != null )
        {
            getShell().getDisplay().syncExec( new Runnable()
            {
                public void run()
                {
                    MessageDialog.openError( getShell(), "Error", "Entry " + dn.toString() + " already exists" );
                }
            } );
            return null;
        }
View Full Code Here

    public boolean performFinish()
    {
        if ( selectedEntry != null )
        {
            String name = mainPage.getBookmarkName();
            DN dn = mainPage.getBookmarkDn();
            IBookmark bookmark = new Bookmark( selectedEntry.getConnection(), dn, name );
            selectedEntry.getConnection().getBookmarkManager().addBookmark( bookmark );
        }
        mainPage.saveDialogSettings();
        return true;
View Full Code Here

            }
        }
        else if ( getSelectedSearchResults().length > 0 )
        {
            DN dn = getSelectedSearchResults()[0].getDn();

            if ( mode == MODE_UTF8 )
            {
                text.append( LdifUtils.utf8decode( dn.toString().getBytes() ) );
            }
            else if ( mode == MODE_BASE64 )
            {
                text.append( LdifUtils.base64encode( dn.toString().getBytes() ) );
            }
            else if ( mode == MODE_HEX )
            {
                text.append( LdifUtils.hexEncode( dn.toString().getBytes() ) );
            }
            else if ( mode == MODE_LDIF )
            {
                text.append( ModelConverter.dnToLdifDnLine( dn ).toFormattedString() );
            }
View Full Code Here

            connection.setAuthMethod( cpw.getAuthenticationMethod() );

            connection.setFetchBaseDNs( cpw.isAutoFetchBaseDns() );
            try
            {
                connection.setBaseDN( new DN( cpw.getBaseDN() ) );
            }
            catch ( NameException e )
            {
            }
            connection.setCountLimit( cpw.getCountLimit() );
View Full Code Here

    {
        ConnectionAndDn connectionAndDn = getConnectionAndDn();
        if ( connectionAndDn != null )
        {
            IConnection connection = connectionAndDn.connection;
            DN dn = connectionAndDn.dn;

            IEntry entry = connection.getEntryFromCache( dn );
            if ( entry == null )
            {
                ReadEntryJob job = new ReadEntryJob( connection, dn );
View Full Code Here

                        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;
                        }
View Full Code Here

        if ( showParent )
        {
            try
            {
                // calculate DN
                parentDn = new DN( parentEntryWidget.getDn() );
            }
            catch ( Exception e )
            {
                parentE = e;
                parentDn = null;
            }
        }

        String s = "";
        if ( rdnE != null )
        {
            s += rdnE.getMessage() != null ? rdnE.getMessage() : "Error in RDN ";
        }
        if ( parentE != null )
        {
            s += ", " + parentE.getMessage() != null ? parentE.getMessage() : "Error in Parent DN ";
        }

        if ( previewText != null )
        {
            if ( s.length() > 0 )
            {
                previewText.setText( s );
            }
            else
            {
                DN dn;
                if ( showParent && showRDN )
                {
                    dn = new DN( rdn, parentDn );
                }
                else if ( showParent )
                {
                    dn = new DN( parentDn );
                }
                else if ( showRDN )
                {
                    dn = new DN( rdn );
                }
                else
                {
                    dn = new DN();
                }
                previewText.setText( dn.toString() );
            }
        }

        notifyListeners();
    }
View Full Code Here

        {
            public void modifyText( ModifyEvent e )
            {
                try
                {
                    dn = new DN( dnCombo.getText() );
                }
                catch ( NameException e1 )
                {
                    dn = null;
                }

                internalSetEnabled();
                notifyListeners();
            }
        } );

        // Up button
        upButton = new Button( textAndUpComposite, SWT.PUSH );
        upButton.setToolTipText( "Parent" );
        upButton.setImage( BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_PARENT ) );
        upButton.setEnabled( false );
        upButton.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent e )
            {
                if ( dn != null && dn.getParentDn() != null )
                {
                    dn = dn.getParentDn();
                    dnChanged();
                    internalSetEnabled();
                    notifyListeners();
                }
            }
        } );

        // Browse button
        entryBrowseButton = BaseWidgetUtils.createButton( parent, "Br&owse...", 1 );
        entryBrowseButton.addSelectionListener( new SelectionAdapter()
        {
            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 );
View Full Code Here

        }

        if ( search.getConnection() != null )
        {
            IConnection connection = search.getConnection();
            DN searchBase = search.getSearchBase();

            if ( connectionWidget != null )
            {
                connectionWidget.setConnection( connection );
            }
View Full Code Here

TOP

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

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.