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

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


    {
        Object o = super.getRawValue( value );
        if ( o != null && o instanceof String )
        {
            IConnection connection = value.getAttribute().getEntry().getConnection();
            DN dn = value.getAttribute().getEntry().getDn();
            return new SubtreeSpecificationValueWrapper( connection, dn, value.getStringValue() );
        }

        return null;
    }
View Full Code Here


        BaseWidgetUtils.createLabel( composite, Messages.getString( "ExclusionValueEditor.label.rdn" ), 1 ); //$NON-NLS-1$
        entryWidget = new EntryWidget( connection, null, base );
        entryWidget.createWidget( composite );
        try
        {
            DN dn = new DN( initalDN );
            entryWidget.setInput( connection, dn, base );
        }
        catch ( NameException e )
        {
        }
View Full Code Here

    public IWizardPage getNextPage()
    {
        if ( templateButton.getSelection() )
        {
            final IConnection connection = entryWidget.getConnection();
            final DN dn = entryWidget.getDn();
            final IEntry[] templateEntries = new IEntry[1];

            if ( connection == null )
            {
                getShell().getDisplay().syncExec( new Runnable()
                {
                    public void run()
                    {
                        MessageDialog.openError( getShell(), "Error", "No connection" );
                    }
                } );
                return null;
            }
            if ( dn == null )
            {
                getShell().getDisplay().syncExec( new Runnable()
                {
                    public void run()
                    {
                        MessageDialog.openError( getShell(), "Error", "No dn" );
                    }
                } );
                return null;
            }

            // check if selected DN exists
            ReadEntryJob readEntryJob = new ReadEntryJob( connection, dn );
            RunnableContextJobAdapter.execute( readEntryJob, getContainer(), false );
            templateEntries[0] = readEntryJob.getReadEntry();
            if ( templateEntries[0] == null )
            {
                getShell().getDisplay().syncExec( new Runnable()
                {
                    public void run()
                    {
                        MessageDialog.openError( getShell(), "Error", "Entry " + dn.toString() + " doesn't exists" );
                    }
                } );
                return null;
            }

            // init attributes
            if ( !templateEntries[0].isAttributesInitialized() )
            {
                InitializeAttributesJob job = new InitializeAttributesJob( templateEntries, false );
                RunnableContextJobAdapter.execute( job, getContainer() );
            }

            // clone entry and remove non-modifyable attributes
            try
            {
                EventRegistry.suspendEventFireingInCurrentThread();

                LdifContentRecord record = ModelConverter.entryToLdifContentRecord( templateEntries[0] );
                DummyEntry prototypeEntry = ModelConverter.ldifContentRecordToEntry( record, connection );
                IAttribute[] attributes = prototypeEntry.getAttributes();
                for ( int i = 0; i < attributes.length; i++ )
                {
                    if ( !SchemaUtils.isModifyable( attributes[i].getAttributeTypeDescription() ) )
                    {
                        prototypeEntry.deleteAttribute( attributes[i] );
                    }
                }
                wizard.setPrototypeEntry( prototypeEntry );
            }
            catch ( Exception e )
            {
                e.printStackTrace();
            }
            finally
            {
                EventRegistry.resumeEventFireingInCurrentThread();
            }
        }
        else
        {
            wizard.setPrototypeEntry( new DummyEntry( new DN(), wizard.getSelectedConnection() ) );
        }

        return super.getNextPage();
    }
View Full Code Here

        }

        if ( selectedConnection != null )
        {
            selectedConnection.suspend();
            prototypeEntry = new DummyEntry( new DN(), selectedConnection );
        }
    }
View Full Code Here

    {
        Object value = getValue();
        if ( value != null && value instanceof DnValueEditorRawValueWrapper )
        {
            DnValueEditorRawValueWrapper wrapper = ( DnValueEditorRawValueWrapper ) value;
            DN dn;
            try
            {
                dn = new DN( wrapper.dn );
            }
            catch ( NameException e )
            {
                dn = null;
            }
View Full Code Here

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

        BaseWidgetUtils.createLabel( composite, Messages.getString( "SubtreeValueEditor.label.base" ), 1 ); //$NON-NLS-1$

        DN base = null;
        DN suffix = null;
        try
        {
            base = new DN( subtreeSpecification.getBase().toNormName() );
            suffix = subentryDN != null ? subentryDN.getParentDn() : null;
        }
        catch ( NameException e )
        {
        }
View Full Code Here

     */
    private void validate()
    {
        boolean valid = true;

        DN base = entryWidget.getDn();
        valid &= base != null;

        String ss = buildSubreeSpecification();

        try
View Full Code Here

        // build subtree specification tree
        StringBuffer sb = new StringBuffer();
        sb.append( "{" ); //$NON-NLS-1$

        // Adding base
        DN base = entryWidget.getDn();
        if ( base != null && !SubtreeValueEditor.EMPTY.equals( base.toString() ) )
        {
            sb.append( " base \"" + base.toString() + "\"," ); //$NON-NLS-1$ //$NON-NLS-2$
        }

        // Adding Minimum
        int minimum = minimumSpinner.getSelection();
        if ( minimum != 0 )
View Full Code Here

    /**
     * Opens the editor and adds the new Exclusion value to the list.
     */
    private void addValueExclusionsTable()
    {
        DN chopBase = null;
        try
        {
            chopBase = new DN( subtreeSpecification.getBase().toNormName() );
        }
        catch ( NameException e )
        {
        }
        if ( subentryDN != null && subentryDN.getParentDn() != null )
        {
            DN suffix = subentryDN != null ? subentryDN.getParentDn() : null;
            chopBase = new DN( chopBase, suffix );
        }

        ExclusionDialog dialog = new ExclusionDialog( getShell(), connection, chopBase, "" ); //$NON-NLS-1$
        if ( dialog.open() == TextDialog.OK && !SubtreeValueEditor.EMPTY.equals( dialog.getType() ) && !SubtreeValueEditor.EMPTY.equals( dialog.getDN() ) )
        {
View Full Code Here

    private void editValueExclusionsTable()
    {
        String oldValue = getSelectedValueExclusionsTable();
        if ( oldValue != null )
        {
            DN chopBase = null;
            try
            {
                chopBase = new DN( subtreeSpecification.getBase().toNormName() );
            }
            catch ( NameException e )
            {
            }
            if ( subentryDN != null && subentryDN.getParentDn() != null )
            {
                DN suffix = subentryDN != null ? subentryDN.getParentDn() : null;
                chopBase = new DN( chopBase, suffix );
            }

            ExclusionDialog dialog = new ExclusionDialog( getShell(), connection, chopBase, oldValue );
            if ( dialog.open() == TextDialog.OK && !SubtreeValueEditor.EMPTY.equals( dialog.getType() )
                && !SubtreeValueEditor.EMPTY.equals( dialog.getDN() ) )
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.