directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r895496 - /directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java
Date Sun, 03 Jan 2010 22:27:31 GMT
Author: seelmann
Date: Sun Jan  3 22:27:31 2010
New Revision: 895496

URL: http://svn.apache.org/viewvc?rev=895496&view=rev
Log:
Added a new constructor, to pass the user provided name

Modified:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java?rev=895496&r1=895495&r2=895496&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java
Sun Jan  3 22:27:31 2010
@@ -216,6 +216,63 @@
      * @param normType The normalized type
      * @param upValue The User Provided value
      * @param normValue The normalized value
+     * @param upName The User Provided name (may be escaped)
+     */
+    public AttributeTypeAndValue( String upType, String normType, Value<?> upValue,
Value<?> normValue, String upName )
+        throws InvalidNameException
+    {
+        String upTypeTrimmed = StringTools.trim( upType );
+        String normTypeTrimmed = StringTools.trim( normType );
+
+        if ( StringTools.isEmpty( upTypeTrimmed ) )
+        {
+            if ( StringTools.isEmpty( normTypeTrimmed ) )
+            {
+                String message = "The type cannot be empty or null";
+                LOG.error( message );
+                throw new InvalidNameException( message );
+            }
+            else
+            {
+                // In this case, we will use the normType instead
+                this.normType = StringTools.lowerCaseAscii( normTypeTrimmed );
+                this.upType = normType;
+            }
+        }
+        else if ( StringTools.isEmpty( normTypeTrimmed ) )
+        {
+            // In this case, we will use the upType instead
+            this.normType = StringTools.lowerCaseAscii( upTypeTrimmed );
+            this.upType = upType;
+        }
+        else
+        {
+            this.normType = StringTools.lowerCaseAscii( normTypeTrimmed );
+            this.upType = upType;
+
+        }
+
+        this.normValue = normValue;
+        this.upValue = upValue;
+
+        this.upName = upName;
+        start = 0;
+        length = upName.length();
+    }
+
+
+    /**
+     * Construct an AttributeTypeAndValue. The type and value are normalized :
+     * <li> the type is trimmed and lowercased </li>
+     * <li> the value is trimmed </li>
+     * <p>
+     * Note that the upValue should <b>not</b> be null or empty, or resolved
+     * to an empty string after having trimmed it. 
+     *
+     * @param upType The User Provided type
+     * @param normType The normalized type
+     * @param upValue The User Provided value
+     * @param normValue The normalized value
      * @param start Start of this ATAV in the RDN
      * @param length Length of this ATAV
      * @param upName The user provided name



Mime
View raw message