directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r938139 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry: DefaultServerEntry.java client/DefaultClientEntry.java
Date Mon, 26 Apr 2010 17:33:21 GMT
Author: elecharny
Date: Mon Apr 26 17:33:21 2010
New Revision: 938139

URL: http://svn.apache.org/viewvc?rev=938139&view=rev
Log:
Moved the last Remove methods

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java?rev=938139&r1=938138&r2=938139&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java
Mon Apr 26 17:33:21 2010
@@ -443,132 +443,6 @@ public final class DefaultServerEntry ex
 
     /**
      * <p>
-     * Removes the specified binary values from an attribute.
-     * </p>
-     * <p>
-     * If at least one value is removed, this method returns <code>true</code>.
-     * </p>
-     * <p>
-     * If there is no more value after having removed the values, the attribute
-     * will be removed too.
-     * </p>
-     * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
-     * <code>false</code>
-     * </p> 
-     *
-     * @param upId The attribute ID 
-     * @param values the values to be removed
-     * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if not all the values have been removed or if the attribute does not exist. 
-     */
-    public boolean remove( String upId, byte[]... values ) throws LdapException
-    {
-        try
-        {
-            AttributeType attributeType = getAttributeType( upId );
-
-            return remove( attributeType, values );
-        }
-        catch ( LdapException ne )
-        {
-            LOG.error( I18n.err( I18n.ERR_04465, upId ) );
-            return false;
-        }
-        catch ( IllegalArgumentException iae )
-        {
-            LOG.error( I18n.err( I18n.ERR_04466, upId ) );
-            return false;
-        }
-    }
-    
-    
-    /**
-     * <p>
-     * Removes the specified String values from an attribute.
-     * </p>
-     * <p>
-     * If at least one value is removed, this method returns <code>true</code>.
-     * </p>
-     * <p>
-     * If there is no more value after having removed the values, the attribute
-     * will be removed too.
-     * </p>
-     * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
-     * <code>false</code>
-     * </p> 
-     *
-     * @param upId The attribute ID 
-     * @param values the values to be removed
-     * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if not all the values have been removed or if the attribute does not exist. 
-     */
-    public boolean remove( String upId, String... values ) throws LdapException
-    {
-        try
-        {
-            AttributeType attributeType = getAttributeType( upId );
-
-            return remove( attributeType, values );
-        }
-        catch ( LdapException ne )
-        {
-            LOG.error( I18n.err( I18n.ERR_04465, upId ) );
-            return false;
-        }
-        catch ( IllegalArgumentException iae )
-        {
-            LOG.error( I18n.err( I18n.ERR_04466, upId ) );
-            return false;
-        }
-    }
-    
-    
-    /**
-     * <p>
-     * Removes the specified Value values from an attribute.
-     * </p>
-     * <p>
-     * If at least one value is removed, this method returns <code>true</code>.
-     * </p>
-     * <p>
-     * If there is no more value after having removed the values, the attribute
-     * will be removed too.
-     * </p>
-     * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
-     * <code>false</code>
-     * </p> 
-     *
-     * @param upId The attribute ID 
-     * @param values the values to be removed
-     * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if not all the values have been removed or if the attribute does not exist. 
-     */
-    public boolean remove( String upId, Value<?>... values ) throws LdapException
-    {
-        try
-        {
-            AttributeType attributeType = getAttributeType( upId );
-
-            return remove( attributeType, values );
-        }
-        catch ( LdapException ne )
-        {
-            LOG.error( I18n.err( I18n.ERR_04465, upId ) );
-            return false;
-        }
-        catch ( IllegalArgumentException iae )
-        {
-            LOG.error( I18n.err( I18n.ERR_04466, upId ) );
-            return false;
-        }
-    }
-    
-    
-    /**
-     * <p>
      * Put some new attributes using the attributeTypes. 
      * No value is inserted. 
      * </p>

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java?rev=938139&r1=938138&r2=938139&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java
Mon Apr 26 17:33:21 2010
@@ -1764,18 +1764,26 @@ public class DefaultClientEntry implemen
      */
     public boolean remove( String upId, byte[]... values ) throws LdapException
     {
-        try
+        if ( StringTools.isEmpty( upId ) )
+        {
+            String message = I18n.err( I18n.ERR_04457_NULL_ATTRIBUTE_ID );
+            LOG.info( message );
+            return false;
+        }
+        
+        if ( schemaManager == null )
         {
             String id = getId( upId );
-            
+
             EntryAttribute attribute = get( id );
-            
+
             if ( attribute == null )
             {
                 // Can't remove values from a not existing attribute !
                 return false;
             }
             
+
             int nbOldValues = attribute.size();
             
             // Remove the values
@@ -1800,11 +1808,26 @@ public class DefaultClientEntry implemen
                 return false;
             }
         }
-        catch ( IllegalArgumentException iae )
+        else
         {
-            LOG.error( I18n.err( I18n.ERR_04138, upId ) );
-            return false;
+            try
+            {
+                AttributeType attributeType = getAttributeType( upId );
+
+                return remove( attributeType, values );
+            }
+            catch ( LdapException ne )
+            {
+                LOG.error( I18n.err( I18n.ERR_04465, upId ) );
+                return false;
+            }
+            catch ( IllegalArgumentException iae )
+            {
+                LOG.error( I18n.err( I18n.ERR_04466, upId ) );
+                return false;
+            }
         }
+            
     }
 
 
@@ -1831,7 +1854,14 @@ public class DefaultClientEntry implemen
      */
     public boolean remove( String upId, String... values ) throws LdapException
     {
-        try
+        if ( StringTools.isEmpty( upId ) )
+        {
+            String message = I18n.err( I18n.ERR_04457_NULL_ATTRIBUTE_ID );
+            LOG.info( message );
+            return false;
+        }
+
+        if ( schemaManager == null )
         {
             String id = getId( upId );
             
@@ -1867,10 +1897,24 @@ public class DefaultClientEntry implemen
                 return false;
             }
         }
-        catch ( IllegalArgumentException iae )
+        else
         {
-            LOG.error( I18n.err( I18n.ERR_04138, upId ) );
-            return false;
+            try
+            {
+                AttributeType attributeType = getAttributeType( upId );
+
+                return remove( attributeType, values );
+            }
+            catch ( LdapException ne )
+            {
+                LOG.error( I18n.err( I18n.ERR_04465, upId ) );
+                return false;
+            }
+            catch ( IllegalArgumentException iae )
+            {
+                LOG.error( I18n.err( I18n.ERR_04466, upId ) );
+                return false;
+            }
         }
     }
 
@@ -1898,7 +1942,14 @@ public class DefaultClientEntry implemen
      */
     public boolean remove( String upId, Value<?>... values ) throws LdapException
     {
-        try
+        if ( StringTools.isEmpty( upId ) )
+        {
+            String message = I18n.err( I18n.ERR_04457_NULL_ATTRIBUTE_ID );
+            LOG.info( message );
+            return false;
+        }
+
+        if ( schemaManager == null )
         {
             String id = getId( upId );
             
@@ -1934,10 +1985,24 @@ public class DefaultClientEntry implemen
                 return false;
             }
         }
-        catch ( IllegalArgumentException iae )
+        else
         {
-            LOG.error( I18n.err( I18n.ERR_04138, upId ) );
-            return false;
+            try
+            {
+                AttributeType attributeType = getAttributeType( upId );
+
+                return remove( attributeType, values );
+            }
+            catch ( LdapException ne )
+            {
+                LOG.error( I18n.err( I18n.ERR_04465, upId ) );
+                return false;
+            }
+            catch ( IllegalArgumentException iae )
+            {
+                LOG.error( I18n.err( I18n.ERR_04466, upId ) );
+                return false;
+            }
         }
     }
 



Mime
View raw message