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 2007/02/05 13:06:07 UTC

svn commit: r503655 - /directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java

Author: elecharny
Date: Mon Feb  5 04:06:06 2007
New Revision: 503655

URL: http://svn.apache.org/viewvc?view=rev&rev=503655
Log:
Added some javaDoco

Modified:
    directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java

Modified: directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java?view=diff&rev=503655&r1=503654&r2=503655
==============================================================================
--- directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java (original)
+++ directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java Mon Feb  5 04:06:06 2007
@@ -53,23 +53,31 @@
         this.attrTypeRegistry = attrTypeRegistry;
     }
 
+    /**
+     * Check that the attribute does not contain collective attributes if it does not
+     * have the collectiveAttributeSubentry ObjectClass declared
+     * 
+     * @param normName The entry DN
+     * @param entry The entry attributes
+     * @throws LdapSchemaViolationException 
+     * @throws NamingException
+     */
     public void checkAdd( LdapDN normName, Attributes entry ) throws LdapSchemaViolationException, NamingException
     {
         Attribute objectClass = entry.get( "objectClass" );
 
+        // If the objectclass contains "collectiveAttributeSubentry", then we don't have to
+        // check for the existence on collectivbe attributes : it's already allowed
         if ( AttributeUtils.containsValueCaseIgnore( objectClass, "collectiveAttributeSubentry" ) )
         {
             return;
         }
-
-        if ( containsAnyCollectiveAttributes( entry ) )
+        else if ( containsAnyCollectiveAttributes( entry ) )
         {
-            /*
-             * TODO: Replace the Exception and the ResultCodeEnum with the correct ones.
-             */
+            // We have some collective attributes, which is not allowed
             throw new LdapSchemaViolationException(
                 "Collective attributes cannot be stored in non-collectiveAttributeSubentries",
-                ResultCodeEnum.OTHER);
+                ResultCodeEnum.OBJECTCLASSVIOLATION );
         }
     }
 
@@ -131,7 +139,13 @@
         return false;
     }
 
-
+    /**
+     * Check if an entry contains some collective attributes or not
+     *
+     * @param entry The entry to be checked
+     * @return <code>true</code> if the entry contains a collective attribute, <code>false</code> otherwise
+     * @throws NamingException If something went wrong
+     */
     private boolean containsAnyCollectiveAttributes( Attributes entry ) throws NamingException
     {
         NamingEnumeration allIDs = entry.getIDs();