You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/10/22 22:48:21 UTC

svn commit: r327694 - /directory/shared/ldap/trunk/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java

Author: elecharny
Date: Sat Oct 22 13:48:17 2005
New Revision: 327694

URL: http://svn.apache.org/viewcvs?rev=327694&view=rev
Log:
Added a member to store the User Provided DN

Modified:
    directory/shared/ldap/trunk/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java

Modified: directory/shared/ldap/trunk/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java?rev=327694&r1=327693&r2=327694&view=diff
==============================================================================
--- directory/shared/ldap/trunk/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java (original)
+++ directory/shared/ldap/trunk/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java Sat Oct 22 13:48:17 2005
@@ -165,6 +165,9 @@
     /** The RDNs that are elements of the DN */
     private List rdns = new ArrayList(5); 
     
+    /** The user provided name */
+    private String upName;
+    
     /** A null LdapDN */
     public transient static final LdapDN EMPTY_LDAPDN = new LdapDN();
 
@@ -176,6 +179,7 @@
     public LdapDN()
     {
         super();
+        upName = "";
     }
     
     /**
@@ -210,6 +214,7 @@
         }
         
         normalize();
+        upName = string;
     }
     
     /**
@@ -227,8 +232,10 @@
     {
         try
         {
-            DNParser.parse( new String( bytes, "UTF-8" ), rdns );
-            this.string = toString();
+            upName = new String( bytes, "UTF-8" );
+            DNParser.parse( upName, rdns );
+            string = toString();
+             
             normalize();
         }
         catch ( UnsupportedEncodingException uee )
@@ -283,8 +290,8 @@
     }
     
     /**
-     * Return the DN as a String
-     * @return A String representing the DN
+     * Return the normalized DN as a String,
+     * @return A String representing the normalized DN
      */
     public String toString()
     {
@@ -321,7 +328,7 @@
      */
     public String getName()
     {
-        return ( string == null ? "" : string );
+        return ( upName == null ? "" : upName );
     }
 
     /**
@@ -551,6 +558,7 @@
 
         newLdapDN.normalize();
         newLdapDN.string = newLdapDN.toString();
+        newLdapDN.upName = newLdapDN.string;
         
         return newLdapDN;
     }
@@ -591,6 +599,7 @@
 
         newLdapDN.normalize();
         newLdapDN.string = newLdapDN.toString();
+        newLdapDN.upName = newLdapDN.string;
 
         return newLdapDN;
     }
@@ -647,6 +656,8 @@
             // Regenerate the normalized name and the original string
             normalize();
             
+            upName = toString();
+            
             return this;
         }
         else
@@ -672,7 +683,9 @@
         
         rdns.add( 0, newRdn );
         normalize();
-        
+
+        upName = toString();
+
         return this;
     }
 
@@ -708,6 +721,8 @@
         rdns.add( realPos, newRdn );
         normalize();
         
+        upName = toString();
+        
         return this;
     }
 
@@ -742,6 +757,8 @@
         int realPos = size() - posn - 1;
         LdapRDN rdn = (LdapRDN)rdns.remove( realPos );
         normalize();
+        
+        upName = toString();
         
         return rdn;
     }