directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r279323 - /directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java
Date Wed, 07 Sep 2005 13:44:20 GMT
Author: akarasulu
Date: Wed Sep  7 06:44:16 2005
New Revision: 279323

URL: http://svn.apache.org/viewcvs?rev=279323&view=rev
Log:
fixing a couple bugs with move operations and added entry addition handling

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java?rev=279323&r1=279322&r2=279323&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java
Wed Sep  7 06:44:16 2005
@@ -34,6 +34,7 @@
 import org.apache.ldap.common.subtree.SubtreeSpecificationParser;
 import org.apache.ldap.common.subtree.SubtreeSpecification;
 import org.apache.ldap.common.name.DnParser;
+import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.exception.LdapNoSuchAttributeException;
 import org.apache.ldap.common.exception.LdapInvalidAttributeValueException;
 import org.slf4j.Logger;
@@ -333,6 +334,92 @@
         }
         else
         {
+            Iterator list = subtrees.keySet().iterator();
+            while ( list.hasNext() )
+            {
+                String subentryDnStr = ( String ) list.next();
+                Name subentryDn = new LdapName( subentryDnStr );
+                Name apDn = ( Name ) subentryDn.clone();
+                apDn.remove( apDn.size() - 1 );
+                SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( subentryDn
);
+
+                if ( evaluator.evaluate( ss, apDn, subentryDn, objectClasses ) )
+                {
+                    Attribute administrativeRole = nexus.lookup( apDn ).get( "administrativeRole"
);
+                    NamingEnumeration roles = administrativeRole.getAll();
+                    while ( roles.hasMore() )
+                    {
+                        Attribute operational = null;
+                        String role = ( String ) roles.next();
+
+                        if ( role.equalsIgnoreCase( AUTONOUMOUS_AREA ) )
+                        {
+                            operational = entry.get( AUTONOUMOUS_AREA_SUBENTRY );
+                            if ( operational == null )
+                            {
+                                operational = new LockableAttributeImpl( AUTONOUMOUS_AREA_SUBENTRY
);
+                                entry.put( operational );
+                            }
+                        }
+                        else if ( role.equalsIgnoreCase( AC_AREA ) )
+                        {
+                            operational = ( Attribute ) entry.get( AC_AREA_SUBENTRY ).clone();
+                            if ( operational == null )
+                            {
+                                operational = new LockableAttributeImpl( AC_AREA_SUBENTRY
);
+                                entry.put( operational );
+                            }
+                        }
+                        else if ( role.equalsIgnoreCase( AC_INNERAREA ) )
+                        {
+                            operational = ( Attribute ) entry.get( AC_INNERAREA_SUBENTRY
).clone();
+                            if ( operational == null )
+                            {
+                                operational = new LockableAttributeImpl( AC_INNERAREA_SUBENTRY
);
+                                entry.put( operational );
+                            }
+                        }
+                        else if ( role.equalsIgnoreCase( SCHEMA_AREA ) )
+                        {
+                            operational = ( Attribute ) entry.get( SCHEMA_AREA_SUBENTRY ).clone();
+                            if ( operational == null )
+                            {
+                                operational = new LockableAttributeImpl( SCHEMA_AREA_SUBENTRY
);
+                                entry.put( operational );
+                            }
+                        }
+                        else if ( role.equalsIgnoreCase( COLLECTIVE_AREA ) )
+                        {
+                            operational = ( Attribute ) entry.get( COLLECTIVE_AREA_SUBENTRY
).clone();
+                            if ( operational == null )
+                            {
+                                operational = new LockableAttributeImpl( COLLECTIVE_AREA_SUBENTRY
);
+                                entry.put( operational );
+                            }
+                        }
+                        else if ( role.equalsIgnoreCase( COLLECTIVE_INNERAREA ) )
+                        {
+                            operational = ( Attribute ) entry.get( COLLECTIVE_INNERAREA_SUBENTRY
).clone();
+                            if ( operational == null )
+                            {
+                                operational = new LockableAttributeImpl( COLLECTIVE_INNERAREA_SUBENTRY
);
+                                entry.put( operational );
+                            }
+                        }
+                        else
+                        {
+                            throw new LdapInvalidAttributeValueException( "Encountered invalid
administrativeRole '"
+                                    + role + "' in administrative point of subentry " + subentryDnStr
+ ". The values of this attribute"
+                                    + " are constrained to autonomousArea, accessControlSpecificArea,
accessControlInnerArea,"
+                                    + " subschemaAdminSpecificArea, collectiveAttributeSpecificArea,
and"
+                                    + " collectiveAttributeInnerArea.", ResultCodeEnum.CONSTRAINTVIOLATION
);
+                        }
+
+                        operational.add( subentryDn.toString() );
+                    }
+                }
+            }
+
             next.add( upName, normName, entry );
         }
     }
@@ -715,26 +802,86 @@
             if ( role.equalsIgnoreCase( AUTONOUMOUS_AREA ) )
             {
                 operational = ( Attribute ) entry.get( AUTONOUMOUS_AREA_SUBENTRY ).clone();
+                if ( operational == null )
+                {
+                    operational = new LockableAttributeImpl( AUTONOUMOUS_AREA_SUBENTRY );
+                    operational.add( newName.toString() );
+                }
+                else
+                {
+                    operational.remove( oldName.toString() );
+                    operational.add( newName.toString() );
+                }
             }
             else if ( role.equalsIgnoreCase( AC_AREA ) )
             {
                 operational = ( Attribute ) entry.get( AC_AREA_SUBENTRY ).clone();
+                if ( operational == null )
+                {
+                    operational = new LockableAttributeImpl( AC_AREA_SUBENTRY );
+                    operational.add( newName.toString() );
+                }
+                else
+                {
+                    operational.remove( oldName.toString() );
+                    operational.add( newName.toString() );
+                }
             }
             else if ( role.equalsIgnoreCase( AC_INNERAREA ) )
             {
                 operational = ( Attribute ) entry.get( AC_INNERAREA_SUBENTRY ).clone();
+                if ( operational == null )
+                {
+                    operational = new LockableAttributeImpl( AC_INNERAREA_SUBENTRY );
+                    operational.add( newName.toString() );
+                }
+                else
+                {
+                    operational.remove( oldName.toString() );
+                    operational.add( newName.toString() );
+                }
             }
             else if ( role.equalsIgnoreCase( SCHEMA_AREA ) )
             {
                 operational = ( Attribute ) entry.get( SCHEMA_AREA_SUBENTRY ).clone();
+                if ( operational == null )
+                {
+                    operational = new LockableAttributeImpl( SCHEMA_AREA_SUBENTRY );
+                    operational.add( newName.toString() );
+                }
+                else
+                {
+                    operational.remove( oldName.toString() );
+                    operational.add( newName.toString() );
+                }
             }
             else if ( role.equalsIgnoreCase( COLLECTIVE_AREA ) )
             {
                 operational = ( Attribute ) entry.get( COLLECTIVE_AREA_SUBENTRY ).clone();
+                if ( operational == null )
+                {
+                    operational = new LockableAttributeImpl( COLLECTIVE_AREA_SUBENTRY );
+                    operational.add( newName.toString() );
+                }
+                else
+                {
+                    operational.remove( oldName.toString() );
+                    operational.add( newName.toString() );
+                }
             }
             else if ( role.equalsIgnoreCase( COLLECTIVE_INNERAREA ) )
             {
-                operational = ( Attribute ) entry.get( COLLECTIVE_AREA_SUBENTRY ).clone();
+                operational = ( Attribute ) entry.get( COLLECTIVE_INNERAREA_SUBENTRY ).clone();
+                if ( operational == null )
+                {
+                    operational = new LockableAttributeImpl( COLLECTIVE_INNERAREA_SUBENTRY
);
+                    operational.add( newName.toString() );
+                }
+                else
+                {
+                    operational.remove( oldName.toString() );
+                    operational.add( newName.toString() );
+                }
             }
             else
             {
@@ -743,16 +890,6 @@
                         + " are constrained to autonomousArea, accessControlSpecificArea,
accessControlInnerArea,"
                         + " subschemaAdminSpecificArea, collectiveAttributeSpecificArea,
and"
                         + " collectiveAttributeInnerArea.", ResultCodeEnum.CONSTRAINTVIOLATION
);
-            }
-
-            if ( operational == null )
-            {
-                operational.add( newName.toString() );
-            }
-            else
-            {
-                operational.remove( oldName.toString() );
-                operational.add( newName.toString() );
             }
 
             modList.add( new ModificationItem( DirContext.REPLACE_ATTRIBUTE, operational
) );



Mime
View raw message