directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r494653 - in /directory/trunks/ldapstudio: ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/ ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ ldapstudi...
Date Tue, 09 Jan 2007 23:42:28 GMT
Author: seelmann
Date: Tue Jan  9 15:42:27 2007
New Revision: 494653

URL: http://svn.apache.org/viewvc?view=rev&rev=494653
Log:
Renamed RDN#name to RDN#type, added Javadoc, removed warings

Modified:
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Value.java
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/CopyEntriesJob.java
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/DN.java
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/RDN.java
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/RDNPart.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/DeleteAction.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/DnBuilderWidget.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserLabelProvider.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryDnWizardPage.java

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Value.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Value.java?view=diff&rev=494653&r1=494652&r2=494653
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Value.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Value.java
Tue Jan  9 15:42:27 2007
@@ -274,7 +274,7 @@
         RDNPart[] parts = getAttribute().getEntry().getRdn().getParts();
         for ( int p = 0; p < parts.length; p++ )
         {
-            if ( getAttribute().getDescription().equals( parts[p].getName() )
+            if ( getAttribute().getDescription().equals( parts[p].getType() )
                 && getStringValue().equals( parts[p].getValue() ) )
             {
                 return true;

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/CopyEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/CopyEntriesJob.java?view=diff&rev=494653&r1=494652&r2=494653
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/CopyEntriesJob.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/CopyEntriesJob.java
Tue Jan  9 15:42:27 2007
@@ -198,7 +198,7 @@
                 for ( int i = 0; i < oldRdnParts.length; i++ )
                 {
                     RDNPart part = oldRdnParts[i];
-                    IAttribute rdnAttribute = newEntry.getAttribute( part.getName() );
+                    IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
                     if ( rdnAttribute != null )
                     {
                         IValue[] values = rdnAttribute.getValues();
@@ -219,10 +219,10 @@
                 for ( int i = 0; i < newRdnParts.length; i++ )
                 {
                     RDNPart part = newRdnParts[i];
-                    IAttribute rdnAttribute = newEntry.getAttribute( part.getName() );
+                    IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
                     if ( rdnAttribute == null )
                     {
-                        rdnAttribute = new Attribute( newEntry, part.getName() );
+                        rdnAttribute = new Attribute( newEntry, part.getType() );
                         newEntry.addAttribute( rdnAttribute, newEntry.getConnection() );
                         rdnAttribute.addValue( new Value( rdnAttribute, part.getUnencodedValue()
), newEntry
                             .getConnection() );
@@ -303,7 +303,7 @@
 
     private RDN getNewRdn( RDN rdn, String newRdnValue ) throws NameException
     {
-        String[] names = rdn.getNames();
+        String[] names = rdn.getTypes();
         String[] values = rdn.getValues();
         values[0] = newRdnValue;
         RDN newRdn = new RDN( names, values, true );

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/DN.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/DN.java?view=diff&rev=494653&r1=494652&r2=494653
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/DN.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/DN.java
Tue Jan  9 15:42:27 2007
@@ -29,23 +29,40 @@
 import org.apache.directory.ldapstudio.browser.core.model.schema.Schema;
 
 
+/**
+ * A DN represents a LDAP distinguished name.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class DN implements Serializable
 {
 
+    /** The generated serialVersionUID. */
     private static final long serialVersionUID = 2343676941769163982L;
 
+    /** The rdns */
     private RDN[] rdns;
 
 
+    /**
+     * Creates an empty DN.
+     *
+     */
     public DN()
     {
         this.rdns = new RDN[0];
     }
 
 
+    /**
+     * Creates a new instance of DN containing only on RDN.
+     * The given RDN is cloned.
+     *
+     * @param rdn the rdn
+     */
     public DN( RDN rdn )
     {
-
         if ( rdn == null )
         {
             throw new IllegalArgumentException( BrowserCoreMessages.model__empty_rdn );
@@ -56,9 +73,14 @@
     }
 
 
+    /**
+     * Creates a new instance of DN. The given string is parsed.
+     *
+     * @param dn the dn
+     * @throws NameException if parsing fails.
+     */
     public DN( String dn ) throws NameException
     {
-
         if ( dn == null )
         {
             throw new IllegalArgumentException( BrowserCoreMessages.model__empty_dn );
@@ -69,9 +91,13 @@
     }
 
 
+    /**
+     * Creates a clone of the given DN.
+     *
+     * @param dn the DN
+     */
     public DN( DN dn )
     {
-
         if ( dn == null )
         {
             throw new IllegalArgumentException( BrowserCoreMessages.model__empty_dn );
@@ -85,9 +111,15 @@
     }
 
 
+    /**
+     * Creates a new instance of DN using the given RDN and parent.
+     * The given RDN and parent are cloned.
+     *
+     * @param rdn the RDN
+     * @param parent the parent DN
+     */
     public DN( RDN rdn, DN parent )
     {
-
         if ( rdn == null )
         {
             throw new IllegalArgumentException( BrowserCoreMessages.model__empty_rdn );
@@ -106,6 +138,13 @@
     }
 
 
+    /**
+     * Creates a new instance of DN. The given strings are parsed.
+     *
+     * @param rdn the rdn
+     * @param parent the parent dn
+     * @throws NameException if parsing fails
+     */
     public DN( String rdn, String parent ) throws NameException
     {
 
@@ -128,6 +167,11 @@
     }
 
 
+    /**
+     * Gets the RDN of this DN.
+     *
+     * @return the RDN
+     */
     public RDN getRdn()
     {
         if ( this.rdns.length > 0 )
@@ -141,6 +185,11 @@
     }
 
 
+    /**
+     * Gets the parent DN.
+     * 
+     * @return the parent DN
+     */
     public DN getParentDn()
     {
         if ( this.rdns.length < 2 )
@@ -161,6 +210,9 @@
     }
 
 
+    /**
+     * Returns the string representation of this DN.
+     */
     public String toString()
     {
         StringBuffer sb = new StringBuffer();
@@ -178,6 +230,13 @@
     }
 
 
+    /**
+     * Returns the string representation of this DN, but with
+     * the numerid OIDs instead of the types.
+     *
+     * @param schema the schema
+     * @return the OID-fizied string representation of this DN
+     */
     public String toOidString( Schema schema )
     {
         StringBuffer sb = new StringBuffer();
@@ -195,10 +254,15 @@
     }
 
 
+    /**
+     * Parses the dn.
+     *
+     * @param dn the dn
+     * @throws NameException if parsing fails
+     */
     private void parseDn( String dn ) throws NameException
     {
-
-        List rdnList = new ArrayList( 3 );
+        List<RDN> rdnList = new ArrayList<RDN>( 3 );
 
         boolean backslash = false;
         int start = 0;
@@ -234,22 +298,35 @@
             }
         }
 
-        this.rdns = ( RDN[] ) rdnList.toArray( new RDN[rdnList.size()] );
+        this.rdns = rdnList.toArray( new RDN[rdnList.size()] );
     }
 
 
+    /**
+     * Gets the RDNs.
+     * 
+     * @return the RDNs
+     */
     public RDN[] getRdns()
     {
         return rdns;
     }
 
 
+    /**
+     * Sets the RDNs.
+     * 
+     * @param rdns the RDNs
+     */
     public void setRdns( RDN[] rdns )
     {
         this.rdns = rdns;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals( Object o ) throws ClassCastException
     {
         if ( o instanceof DN )
@@ -260,6 +337,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode()
     {
         return this.toString().hashCode();

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/RDN.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/RDN.java?view=diff&rev=494653&r1=494652&r2=494653
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/RDN.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/RDN.java
Tue Jan  9 15:42:27 2007
@@ -31,23 +31,40 @@
 import org.apache.directory.ldapstudio.browser.core.model.schema.Schema;
 
 
+/**
+ * A RDN represents a LDAP relative distinguished name.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class RDN implements Serializable
 {
 
+    /** The generated serialVersionUID. */
     private static final long serialVersionUID = -4165959915339033047L;
 
+    /** The attribute type-value pairs */
     private RDNPart[] parts;
 
 
+    /**
+     * Creates an empty RDN.
+     *
+     */
     public RDN()
     {
         this.parts = new RDNPart[0];
     }
 
 
+    /**
+     * Creates a new instance of RDN. The given string is parsed.
+     *
+     * @param rdn the rdn
+     * @throws NameException if parsing fails.
+     */
     public RDN( String rdn ) throws NameException
     {
-
         if ( rdn == null )
         {
             throw new IllegalArgumentException( BrowserCoreMessages.model__empty_rdn );
@@ -58,9 +75,13 @@
     }
 
 
+    /**
+     * Creates a clone of the given RDN.
+     *
+     * @param rdn the RDN
+     */
     public RDN( RDN rdn )
     {
-
         if ( rdn == null )
         {
             throw new IllegalArgumentException( BrowserCoreMessages.model__empty_rdn );
@@ -75,15 +96,16 @@
 
 
     /**
-     * Create a single-valued RDN with the given name and value
+     * Create a single-valued RDN with the given type and value.
      * 
-     * @param name
-     * @param value
+     * @param type the attribute type
+     * @param value the value
+     * @param isValueEncoded true if the value is already encoded according RFC4514, Section
2.4
+     * @throws NameException if the type or value are invalid
      */
-    public RDN( String name, String value, boolean isValueEncoded ) throws NameException
+    public RDN( String type, String value, boolean isValueEncoded ) throws NameException
     {
-
-        if ( name == null )
+        if ( type == null )
         {
             throw new IllegalArgumentException( BrowserCoreMessages.model__empty_attribute
);
         }
@@ -93,14 +115,22 @@
         }
 
         this.parts = new RDNPart[1];
-        this.parts[0] = new RDNPart( name, value, isValueEncoded );
+        this.parts[0] = new RDNPart( type, value, isValueEncoded );
     }
 
 
-    public RDN( String[] names, String[] values, boolean areValuesEncoded ) throws NameException
+    /**
+     * Creates a multi-values RDN with the given types and values.
+     *
+     * @param types the attribute types
+     * @param values the attribute values
+     * @param areValuesEncoded true if the values is already encoded according RFC4514, Section
2.4
+     * @throws NameException if the types or values are invalid
+     */
+    public RDN( String[] types, String[] values, boolean areValuesEncoded ) throws NameException
     {
 
-        if ( names == null || names.length < 1 )
+        if ( types == null || types.length < 1 )
         {
             throw new IllegalArgumentException( BrowserCoreMessages.model__empty_attribute
);
         }
@@ -108,69 +138,104 @@
         {
             throw new IllegalArgumentException( BrowserCoreMessages.model__empty_value );
         }
-        if ( names.length != values.length )
+        if ( types.length != values.length )
         {
-            throw new IllegalArgumentException( "Size of names and values is not equal" );
//$NON-NLS-1$
+            throw new IllegalArgumentException( "Size of types and values is not equal" );
//$NON-NLS-1$
         }
 
-        this.parts = new RDNPart[names.length];
+        this.parts = new RDNPart[types.length];
         for ( int i = 0; i < this.parts.length; i++ )
         {
-            this.parts[i] = new RDNPart( names[i], values[i], areValuesEncoded );
+            this.parts[i] = new RDNPart( types[i], values[i], areValuesEncoded );
         }
     }
 
 
+    /**
+     * Checks if the RDN is multi-valued.
+     * 
+     * @return true, if the RDN is multi-valued
+     */
     public boolean isMultivalued()
     {
         return this.parts.length > 1;
     }
 
 
-    public String getName()
+    /**
+     * Gets the first attribute type.
+     * 
+     * @return the first attribute type
+     */
+    public String getType()
     {
-        return this.parts.length > 0 ? this.parts[0].getName() : ""; //$NON-NLS-1$
+        return this.parts.length > 0 ? this.parts[0].getType() : ""; //$NON-NLS-1$
     }
 
 
+    /**
+     * Gets the first attribute value.
+     * 
+     * @return the first attribute value
+     */
     public String getValue()
     {
         return this.parts.length > 0 ? this.parts[0].getValue() : ""; //$NON-NLS-1$
     }
 
 
+    /**
+     * Gets the parts.
+     * 
+     * @return the parts
+     */
     public RDNPart[] getParts()
     {
         return this.parts;
     }
 
 
+    /**
+     * Sets the parts.
+     * 
+     * @param parts the parts
+     */
     public void setParts( RDNPart[] parts )
     {
         this.parts = parts;
     }
 
 
-    public String[] getNames()
+    /**
+     * Gets the attribute types.
+     * 
+     * @return the attribute types
+     */
+    public String[] getTypes()
     {
         if ( !isMultivalued() )
         {
             return new String[]
-                { getName() };
+                { getType() };
         }
         else
         {
-            Set nameSet = new LinkedHashSet();
+            Set<String> typeSet = new LinkedHashSet<String>();
             for ( int i = 0; i < this.parts.length; i++ )
             {
                 RDNPart entry = this.parts[i];
-                nameSet.add( entry.getName() );
+                typeSet.add( entry.getType() );
             }
-            return ( String[] ) nameSet.toArray( new String[nameSet.size()] );
+            return typeSet.toArray( new String[typeSet.size()] );
         }
     }
 
 
+    /**
+     * Gets the values.
+     * 
+     * @return the values
+     */
     public String[] getValues()
     {
         if ( !isMultivalued() )
@@ -180,23 +245,29 @@
         }
         else
         {
-            Set valueSet = new LinkedHashSet();
+            Set<String> valueSet = new LinkedHashSet<String>();
             for ( int i = 0; i < this.parts.length; i++ )
             {
                 RDNPart entry = this.parts[i];
                 valueSet.add( entry.getValue() );
             }
-            return ( String[] ) valueSet.toArray( new String[valueSet.size()] );
+            return valueSet.toArray( new String[valueSet.size()] );
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode()
     {
         return this.toString().hashCode();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals( Object o )
     {
         if ( o instanceof RDN )
@@ -207,6 +278,10 @@
     }
 
 
+    /**
+     * Returns the string representation of this RDN, 
+     * for example &lt;type&gt;=&lt;value&gt;
+     */
     public String toString()
     {
         StringBuffer sb = new StringBuffer();
@@ -217,9 +292,6 @@
             {
                 RDNPart part = this.parts[i];
                 sb.append( part.toString() );
-                // sb.append(part.getName());
-                // sb.append("="); //$NON-NLS-1$
-                // sb.append(part.getValue());
 
                 if ( i + 1 < this.parts.length )
                 {
@@ -231,15 +303,19 @@
         {
             RDNPart part = this.parts[0];
             sb.append( part.toString() );
-            // sb.append(part.getName());
-            // sb.append("="); //$NON-NLS-1$
-            // sb.append(part.getValue());
         }
 
         return sb.toString();
     }
 
 
+    /**
+     * Returns the string representation of this RDN, but with
+     * the numerid OIDs instead of the types.
+     *
+     * @param schema the schema
+     * @return the OID-fizied string representation of this RDN
+     */
     public String toOidString( Schema schema )
     {
         StringBuffer sb = new StringBuffer();
@@ -267,10 +343,15 @@
     }
 
 
+    /**
+     * Parses the RDN.
+     *
+     * @param multirdn the rdn
+     * @throws NameException if parsing fails
+     */
     private void parseMultiRdn( String multirdn ) throws NameException
     {
-
-        List partList = new ArrayList( 1 );
+        List<RDNPart> partList = new ArrayList<RDNPart>( 1 );
 
         boolean backslash = false;
         int start = 0;
@@ -298,10 +379,9 @@
                     {
                         throw new NameException( BrowserCoreMessages.model__invalid_rdn );
                     }
-                    String name = rdn.substring( 0, index );
+                    String type = rdn.substring( 0, index );
                     String value = rdn.substring( index + 1, rdn.length() );
-                    // partList.add(new RDNPart(name.trim(), value.trim()));
-                    partList.add( new RDNPart( name, value, true ) );
+                    partList.add( new RDNPart( type, value, true ) );
                     start = i + 1;
                 }
                 backslash = false;
@@ -313,8 +393,7 @@
 
         }
 
-        this.parts = ( RDNPart[] ) partList.toArray( new RDNPart[partList.size()] );
-
+        this.parts = partList.toArray( new RDNPart[partList.size()] );
     }
 
 }

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/RDNPart.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/RDNPart.java?view=diff&rev=494653&r1=494652&r2=494653
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/RDNPart.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/RDNPart.java
Tue Jan  9 15:42:27 2007
@@ -27,35 +27,55 @@
 import org.apache.directory.ldapstudio.browser.core.model.schema.Schema;
 
 
+/**
+ * A RDNPart represents a attribute type-value-pair, used in RDN. 
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class RDNPart implements Serializable
 {
-
+    /** The generated serialVersionUID */
     private static final long serialVersionUID = 3250931604639940667L;
 
-    private String name;
+    /** The attribute type */
+    private String type;
 
+    /** The value */
     private String value;
 
 
+    /**
+     * Creates a new instance of RDNPart with an empty type an value 
+     *
+     */
     public RDNPart()
     {
-        this.name = ""; //$NON-NLS-1$
+        this.type = ""; //$NON-NLS-1$
         this.value = ""; //$NON-NLS-1$
     }
 
 
-    public RDNPart( String name, String value, boolean isValueEncoded ) throws NameException
+    /**
+     * Creates a new instance of RDNPart with the given type and value.
+     *
+     * @param type the attribute type
+     * @param value the value
+     * @param isValueEncoded true if the value is already encoded according RFC4514, Section
2.4
+     * @throws NameException if the type or value are invalid
+     */
+    public RDNPart( String type, String value, boolean isValueEncoded ) throws NameException
     {
-        if ( name == null || !name.matches( "([A-Za-z][A-Za-z0-9-]*)|([0-9]+(\\.[0-9]+)+)"
) ) { //$NON-NLS-1$
+        if ( type == null || !type.matches( "([A-Za-z][A-Za-z0-9-]*)|([0-9]+(\\.[0-9]+)+)"
) ) { //$NON-NLS-1$
             throw new NameException( BrowserCoreMessages.model__empty_attribute );
         }
         if ( value == null || value.length() < 1 )
         {
             throw new NameException( BrowserCoreMessages.model__empty_value );
         }
-        // this.name = name.trim();
+        // this.type = type.trim();
         // this.value = value.trim();
-        this.setName( name );
+        this.setType( type );
         if ( isValueEncoded )
         {
             this.setValue( value );
@@ -67,44 +87,46 @@
     }
 
 
+    /**
+     * Creates a clone of the given RDNPart.
+     *
+     * @param rdnPart the RDNPart.
+     */
     public RDNPart( RDNPart rdnPart )
     {
-        this.name = rdnPart.name;
+        this.type = rdnPart.type;
         this.value = rdnPart.value;
     }
 
 
-    public String getName()
+    /**
+     * Gets the type.
+     * 
+     * @return the type
+     */
+    public String getType()
     {
-        return name;
+        return type;
     }
 
 
-    public void setName( String name )
+    /**
+     * Sets the type.
+     * 
+     * @param type the type
+     */
+    public void setType( String type )
     {
-        this.name = name;
+        this.type = type;
     }
 
 
-    // If the UTF-8 string does not have any of the following characters
-    // which need escaping, then that string can be used as the string
-    // representation of the value.
-    //
-    // o a space or "#" character occurring at the beginning of the
-    // string
-    //
-    // o a space character occurring at the end of the string
-    //
-    // o one of the characters ",", "+", """, "\", "<", ">" or ";"
-    //
-    // Implementations MAY escape other characters.
-    //
-    // If a character to be escaped is one of the list shown above, then it
-    // is prefixed by a backslash ('\' ASCII 92).
-    //
-    // Otherwise the character to be escaped is replaced by a backslash and
-    // two hex digits, which form a single byte in the code of the
-    // character.
+    /**
+     * Gets the unencoded value. All escaped characters are unescaped
+     * before returning the vaue.
+     *
+     * @return the unencoded value.
+     */
     public String getUnencodedValue()
     {
         StringBuffer unencodedValue = new StringBuffer( this.value );
@@ -113,7 +135,6 @@
         {
             if ( unencodedValue.charAt( i ) == '\\' )
             {
-
                 if ( i == 0 && unencodedValue.length() > i + 1 && unencodedValue.charAt(
i + 1 ) == ' ' )
                 {
                     unencodedValue.deleteCharAt( i );
@@ -135,7 +156,6 @@
                 {
                     unencodedValue.deleteCharAt( i );
                 }
-
             }
         }
 
@@ -143,9 +163,14 @@
     }
 
 
+    /**
+     * Sets the unencoded value. The unencoded value will be encoded 
+     * according RFC4514, Section 2.4.
+     * 
+     * @param unencodedValue the unencoded value
+     */
     public void setUnencodedValue( String unencodedValue )
     {
-
         unencodedValue = unencodedValue.replaceAll( "\\\\", "\\\\\\\\" ); //$NON-NLS-1$ //$NON-NLS-2$
         unencodedValue = unencodedValue.replaceAll( "\\+", "\\\\+" ); //$NON-NLS-1$ //$NON-NLS-2$
         unencodedValue = unencodedValue.replaceAll( ",", "\\\\," ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -155,34 +180,59 @@
         unencodedValue = unencodedValue.replaceAll( ";", "\\\\;" ); //$NON-NLS-1$ //$NON-NLS-2$
 
         if ( unencodedValue.startsWith( " " ) ) //$NON-NLS-1$
+        {
             unencodedValue = "\\" + unencodedValue; //$NON-NLS-1$
-        if ( unencodedValue.startsWith( "#" ) ) //$NON-NLS-1$
+        }
+        else if ( unencodedValue.startsWith( "#" ) ) //$NON-NLS-1$
+        {
             unencodedValue = "\\" + unencodedValue; //$NON-NLS-1$
+        }
+
         if ( unencodedValue.endsWith( " " ) ) //$NON-NLS-1$
+        {
             unencodedValue = unencodedValue.substring( 0, unencodedValue.length() - 1 ) +
"\\ "; //$NON-NLS-1$
+        }
 
         this.value = unencodedValue;
     }
 
 
+    /**
+     * Gets the value. Note that the value is encoded
+     * according RFC 4514, Section 2.4.
+     * 
+     * @return the value
+     */
     public String getValue()
     {
         return value;
     }
 
 
+    /**
+     * Sets the value. Note that the value must be encoded
+     * according RFC 4514, Section 2.4.
+     * 
+     * @param value the value
+     */
     public void setValue( String value )
     {
         this.value = value;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode()
     {
         return this.toString().hashCode();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals( Object o )
     {
         if ( o instanceof RDNPart )
@@ -193,15 +243,26 @@
     }
 
 
+    /**
+     * Returns the string representation of this RDNPart, namely
+     * &lt;type&gt;=&lt;value&gt;
+     */
     public String toString()
     {
-        return getName() + "=" + getValue(); //$NON-NLS-1$
+        return getType() + "=" + getValue(); //$NON-NLS-1$
     }
 
 
+    /**
+     * Returns the string representation of this RDNPart, but with
+     * the numerid OID instead of the type.
+     *
+     * @param schema the schema
+     * @return the OID-fizied string representation of this RDNPart
+     */
     public String toOidString( Schema schema )
     {
-        String oid = schema != null ? schema.getAttributeTypeDescription( getName() ).getNumericOID()
: getName();
+        String oid = schema != null ? schema.getAttributeTypeDescription( getType() ).getNumericOID()
: getType();
         return oid + "=" + getValue(); //$NON-NLS-1$
     }
 

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/DeleteAction.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/DeleteAction.java?view=diff&rev=494653&r1=494652&r2=494653
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/DeleteAction.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/DeleteAction.java
Tue Jan  9 15:42:27 2007
@@ -654,7 +654,7 @@
             RDNPart[] parts = this.getSelectedValues()[i].getAttribute().getEntry().getRdn().getParts();
             for ( int p = 0; p < parts.length; p++ )
             {
-                if ( getSelectedValues()[i].getAttribute().getDescription().equals( parts[p].getName()
)
+                if ( getSelectedValues()[i].getAttribute().getDescription().equals( parts[p].getType()
)
                     && getSelectedValues()[i].getStringValue().equals( parts[p].getValue()
) )
                 {
                     throw new Exception();

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/DnBuilderWidget.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/DnBuilderWidget.java?view=diff&rev=494653&r1=494652&r2=494653
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/DnBuilderWidget.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/DnBuilderWidget.java
Tue Jan  9 15:42:27 2007
@@ -125,7 +125,7 @@
                 for ( int i = 0; i < parts.length; i++ )
                 {
                     addRdnLine( this.rdnComposite, i );
-                    ( ( RdnLine ) rdnLineList.get( i ) ).rdnNameCombo.setText( parts[i].getName()
);
+                    ( ( RdnLine ) rdnLineList.get( i ) ).rdnNameCombo.setText( parts[i].getType()
);
                     ( ( RdnLine ) rdnLineList.get( i ) ).rdnValueText.setText( parts[i].getUnencodedValue()
);
                     if ( i == 0 )
                     {

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserLabelProvider.java?view=diff&rev=494653&r1=494652&r2=494653
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserLabelProvider.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserLabelProvider.java
Tue Jan  9 15:42:27 2007
@@ -329,16 +329,16 @@
             for ( int i = 0; i < rdnParts.length; i++ )
             {
                 RDNPart part = rdnParts[i];
-                if ( "cn".equals( part.getName() ) || "sn".equals( part.getName() ) || "uid".equals(
part.getName() )
-                    || "userid".equals( part.getName() ) )
+                if ( "cn".equals( part.getType() ) || "sn".equals( part.getType() ) || "uid".equals(
part.getType() )
+                    || "userid".equals( part.getType() ) )
                 {
                     return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_ENTRY_PERSON
);
                 }
-                else if ( "ou".equals( part.getName() ) || "o".equals( part.getName() ) )
+                else if ( "ou".equals( part.getType() ) || "o".equals( part.getType() ) )
                 {
                     return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_ENTRY_ORG
);
                 }
-                else if ( "dc".equals( part.getName() ) || "c".equals( part.getName() ) ||
"l".equals( part.getName() ) )
+                else if ( "dc".equals( part.getType() ) || "c".equals( part.getType() ) ||
"l".equals( part.getType() ) )
                 {
                     return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_ENTRY_DC
);
                 }

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryDnWizardPage.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryDnWizardPage.java?view=diff&rev=494653&r1=494652&r2=494653
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryDnWizardPage.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryDnWizardPage.java
Tue Jan  9 15:42:27 2007
@@ -132,7 +132,7 @@
             RDNPart[] oldRdnParts = newEntry.getRdn().getParts();
             for ( int i = 0; i < oldRdnParts.length; i++ )
             {
-                IAttribute attribute = newEntry.getAttribute( oldRdnParts[i].getName() );
+                IAttribute attribute = newEntry.getAttribute( oldRdnParts[i].getType() );
                 if ( attribute != null )
                 {
                     IValue[] values = attribute.getValues();
@@ -154,10 +154,10 @@
             RDNPart[] newRdnParts = dn.getRdn().getParts();
             for ( int i = 0; i < newRdnParts.length; i++ )
             {
-                IAttribute rdnAttribute = newEntry.getAttribute( newRdnParts[i].getName()
);
+                IAttribute rdnAttribute = newEntry.getAttribute( newRdnParts[i].getType()
);
                 if ( rdnAttribute == null )
                 {
-                    rdnAttribute = new Attribute( newEntry, newRdnParts[i].getName() );
+                    rdnAttribute = new Attribute( newEntry, newRdnParts[i].getType() );
                     newEntry.addAttribute( rdnAttribute, wizard );
                 }
                 String rdnValue = newRdnParts[i].getUnencodedValue();



Mime
View raw message