You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2009/10/08 14:21:17 UTC

svn commit: r823141 - in /directory/studio/trunk: ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/ ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/ ldapbrowser-ui/src/main/java/org/apache/director...

Author: seelmann
Date: Thu Oct  8 12:21:17 2009
New Revision: 823141

URL: http://svn.apache.org/viewvc?rev=823141&view=rev
Log:
DIRSTUDIO-519: removed support for moddn by modifying the DN in the LDIF entry editor, it's too error-prone

Modified:
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java?rev=823141&r1=823140&r2=823141&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java Thu Oct  8 12:21:17 2009
@@ -38,7 +38,6 @@
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.parsers.AttributeTypeDescription;
 import org.apache.directory.shared.ldap.util.LdapURL;
-import org.apache.directory.studio.connection.core.DnUtils;
 import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
@@ -53,17 +52,13 @@
 import org.apache.directory.studio.ldifparser.LdifFormatParameters;
 import org.apache.directory.studio.ldifparser.LdifUtils;
 import org.apache.directory.studio.ldifparser.model.LdifFile;
-import org.apache.directory.studio.ldifparser.model.container.LdifChangeModDnRecord;
 import org.apache.directory.studio.ldifparser.model.container.LdifChangeModifyRecord;
 import org.apache.directory.studio.ldifparser.model.container.LdifModSpec;
 import org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifChangeTypeLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifControlLine;
-import org.apache.directory.studio.ldifparser.model.lines.LdifDeloldrdnLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifDnLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifModSpecSepLine;
-import org.apache.directory.studio.ldifparser.model.lines.LdifNewrdnLine;
-import org.apache.directory.studio.ldifparser.model.lines.LdifNewsuperiorLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifSepLine;
 import org.eclipse.core.runtime.Preferences;
 
@@ -394,25 +389,6 @@
     {
         LdifFile model = new LdifFile();
 
-        // check if entry needs to be renamed
-        if ( !t0.getDn().equals( t1.getDn() ) )
-        {
-            LdifChangeModDnRecord modDnRecord = new LdifChangeModDnRecord( LdifDnLine.create( t0.getDn().getUpName() ) );
-            if ( t0.isReferral() )
-            {
-                modDnRecord.addControl( LdifControlLine
-                    .create( StudioControl.MANAGEDSAIT_CONTROL.getOid(),
-                        StudioControl.MANAGEDSAIT_CONTROL.isCritical(), StudioControl.MANAGEDSAIT_CONTROL
-                            .getControlValue() ) );
-            }
-            modDnRecord.setChangeType( LdifChangeTypeLine.createModDn() );
-            modDnRecord.setNewrdn( LdifNewrdnLine.create( t1.getRdn().getUpName() ) );
-            modDnRecord.setNewsuperior( LdifNewsuperiorLine.create( DnUtils.getParent( t1.getDn() ).getUpName() ) );
-            modDnRecord.setDeloldrdn( LdifDeloldrdnLine.create1() );
-            modDnRecord.finish( LdifSepLine.create() );
-            model.addContainer( modDnRecord );
-        }
-
         // check attributes of old entry
         Set<String> attributesToDelAdd = new HashSet<String>();
         Set<String> attributesToReplace = new HashSet<String>();

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java?rev=823141&r1=823140&r2=823141&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java Thu Oct  8 12:21:17 2009
@@ -40,7 +40,6 @@
 import org.apache.directory.studio.connection.ui.RunnableContextRunner;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent;
-import org.apache.directory.studio.ldapbrowser.core.events.EntryRenamedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryUpdateListener;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.jobs.UpdateEntryRunnable;
@@ -54,8 +53,6 @@
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.apache.directory.studio.ldifparser.LdifFormatParameters;
 import org.apache.directory.studio.ldifparser.model.LdifFile;
-import org.apache.directory.studio.ldifparser.model.container.LdifChangeModDnRecord;
-import org.apache.directory.studio.ldifparser.model.container.LdifRecord;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtension;
@@ -952,17 +949,6 @@
                     {
                         updateOscSharedReferenceCopy( originalEntry );
                         updateOscSharedWorkingCopy( originalEntry );
-
-                        // check if the entry was renamed, fire an appropriate event in that case
-                        for ( LdifRecord record : diff.getRecords() )
-                        {
-                            if ( record instanceof LdifChangeModDnRecord )
-                            {
-                                IEntry newEntry = originalEntry.getBrowserConnection().getEntryFromCache(
-                                    workingCopy.getDn() );
-                                EventRegistry.fireEntryUpdated( new EntryRenamedEvent( originalEntry, newEntry ), this );
-                            }
-                        }
                     }
                     return status;
                 }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java?rev=823141&r1=823140&r2=823141&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java Thu Oct  8 12:21:17 2009
@@ -35,6 +35,7 @@
 import org.apache.directory.studio.ldapbrowser.core.utils.ModelConverter;
 import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.apache.directory.studio.ldifeditor.editor.LdifDocumentProvider;
 import org.apache.directory.studio.ldifparser.model.container.LdifContainer;
 import org.apache.directory.studio.ldifparser.model.container.LdifContentRecord;
@@ -83,11 +84,6 @@
             throw new CoreException( new Status( IStatus.ERROR, BrowserUIConstants.PLUGIN_ID, Messages
                 .getString( "LdifEntryEditorDocumentProvider.InvalidRecordType" ) ) ); //$NON-NLS-1$
         }
-        if ( !LdapDN.isValid( records[0].getDnLine().getUnfoldedDn() ) )
-        {
-            throw new CoreException( new Status( IStatus.ERROR, BrowserUIConstants.PLUGIN_ID, Messages
-                .getString( "LdifEntryEditorDocumentProvider.InvalidDN" ) ) ); //$NON-NLS-1$
-        }
         if ( !records[0].isValid() )
         {
             throw new CoreException( new Status( IStatus.ERROR, BrowserUIConstants.PLUGIN_ID, NLS.bind( Messages
@@ -104,9 +100,25 @@
         }
 
         EntryEditorInput input = getEntryEditorInput( element );
+        try
+        {
+            LdapDN newDN = new LdapDN( records[0].getDnLine().getUnfoldedDn() );
+            if(!newDN.equals( input.getResolvedEntry().getDn() ))
+            {
+                throw new CoreException( new Status( IStatus.ERROR, BrowserUIConstants.PLUGIN_ID, NLS.bind( Messages
+                    .getString( "LdifEntryEditorDocumentProvider.ModDnNotSupported" ), records[0].getInvalidString() ) ) ); //$NON-NLS-1$
+            }
+        }
+        catch ( InvalidNameException e )
+        {
+            throw new CoreException( new Status( IStatus.ERROR, BrowserUIConstants.PLUGIN_ID, Messages
+                .getString( "LdifEntryEditorDocumentProvider.InvalidDN" ) ) ); //$NON-NLS-1$
+        }
+        
         IStatus status = input.saveSharedWorkingCopy( false, editor );
         if ( status != null && !status.isOK() )
         {
+            BrowserUIPlugin.getDefault().getLog().log( status );
             throw new CoreException( status );
         }
     }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties?rev=823141&r1=823140&r2=823141&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties Thu Oct  8 12:21:17 2009
@@ -23,6 +23,7 @@
 LdifEntryEditorDocumentProvider.InvalidDN=Invalid distinguished name.
 LdifEntryEditorDocumentProvider.InvalidLdif=Invalid LDIF: {0}
 LdifEntryEditorDocumentProvider.InvalidRecordType=Exactly one LDIF content record expected.
+LdifEntryEditorDocumentProvider.ModDnNotSupported=Modification of distinguished name is not supported by the LDIF Entry Editor.
 OpenEntryEditorAction.EditEntry=Edit Entry...
 OpenEntryEditorPreferencePageAction.Preferences=Preferences...
 OpenEntryEditorPreferencePageAction.PreferencesToolTip=Preferences...

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties?rev=823141&r1=823140&r2=823141&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties Thu Oct  8 12:21:17 2009
@@ -23,6 +23,7 @@
 LdifEntryEditorDocumentProvider.InvalidDN=Ung\u00fcltiger Distinguished Name.
 LdifEntryEditorDocumentProvider.InvalidLdif=Ung\u00fcltiges LDIF: {0}
 LdifEntryEditorDocumentProvider.InvalidRecordType=Genau ein LDIF Inhaltsdatensatz erwartet.
+LdifEntryEditorDocumentProvider.ModDnNotSupported=\u00c4nderung des Distinguished Name wird vom LDIF-Eintrags-Editor nicht unterst\u00fctzt.
 OpenEntryEditorAction.EditEntry=Eintrag bearbeiten...
 OpenEntryEditorPreferencePageAction.Preferences=Benutzervorgaben...
 OpenEntryEditorPreferencePageAction.PreferencesToolTip=Benutzervorgaben...

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties?rev=823141&r1=823140&r2=823141&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties Thu Oct  8 12:21:17 2009
@@ -23,6 +23,7 @@
 LdifEntryEditorDocumentProvider.InvalidDN=TODO: Invalid distinguished name.
 LdifEntryEditorDocumentProvider.InvalidLdif=TODO: Invalid LDIF: {0}
 LdifEntryEditorDocumentProvider.InvalidRecordType=TODO: Exactly one LDIF content record expected.
+LdifEntryEditorDocumentProvider.ModDnNotSupported=TODO: Modification of distinguished name is not supported by the LDIF Entry Editor.
 OpenEntryEditorAction.EditEntry=Editer l'entr\u00E9e...
 OpenEntryEditorPreferencePageAction.Preferences=Pr\u00E9f\u00E9rences...
 OpenEntryEditorPreferencePageAction.PreferencesToolTip=Pr\u00E9f\u00E9rences...