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

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


            {
                if ( dnCombo.getText().length() > 0 )
                {
                    try
                    {
                        dn = new DN( dnCombo.getText() );
                    }
                    catch ( NameException e1 )
                    {
                        dn = null;
                    }
View Full Code Here


        DummyEntry newEntry = wizard.getPrototypeEntry();

        Subschema subschema = newEntry.getSubschema();
        String[] attributeNames = subschema.getAllAttributeNames();

        DN parentDn = null;
        if ( newEntry.getDn().getParentDn() != null )
        {
            parentDn = newEntry.getDn().getParentDn();
        }
        else if ( wizard.getSelectedEntry() != null )
View Full Code Here

                    }
                }
            }

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

            {
                if ( values[v].isString() )
                {
                    try
                    {
                        DN dn = new DN( values[v].getStringValue() );
                        internalDnSet.add( dn );
                    }
                    catch ( NameException e )
                    {
                    }
                }
            }

            for ( int a = 0; a < attributes.length; a++ )
            {
                IValue[] vals = attributes[a].getValues();
                for ( int v = 0; v < vals.length; v++ )
                {
                    if ( vals[v].isString() )
                    {
                        try
                        {
                            DN dn = new DN( vals[v].getStringValue() );
                            internalDnSet.add( dn );
                        }
                        catch ( NameException e )
                        {
                        }
View Full Code Here

    protected void moveEntries( final IEntry[] entries )
    {
        MoveEntriesDialog moveDialog = new MoveEntriesDialog( getShell(), entries );
        if ( moveDialog.open() == Dialog.OK )
        {
            DN newParentDn = moveDialog.getParentDn();
            if ( newParentDn != null /* && !newRdn.equals(entry.getRdn()) */)
            {
                IEntry newParentEntry = entries[0].getConnection().getEntryFromCache( newParentDn );
                if ( newParentEntry != null )
                {
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

        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

        }

        if ( selectedConnection != null )
        {
            selectedConnection.suspend();
            prototypeEntry = new DummyEntry( new DN(), selectedConnection );
        }
    }
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

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.