directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r471867 - in /directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis: common/Constants.java service/ReplicationService.java
Date Mon, 06 Nov 2006 20:16:57 GMT
Author: akarasulu
Date: Mon Nov  6 12:16:56 2006
New Revision: 471867

URL: http://svn.apache.org/viewvc?view=rev&rev=471867
Log:
fixing DIRSERVER-773: failure to hide deleted entries

Modified:
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java?view=diff&rev=471867&r1=471866&r2=471867
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
Mon Nov  6 12:16:56 2006
@@ -49,15 +49,10 @@
         public boolean accept( Invocation invocation, SearchResult result, SearchControls
controls )
             throws NamingException
         {
-            if ( controls.getReturningAttributes() == null )
-            {
-                Attributes entry = result.getAttributes();
-                Attribute deleted = entry.get( ENTRY_DELETED );
-                Object value = deleted == null ? null : deleted.get();
-                return ( value == null || !"true".equalsIgnoreCase( value.toString() ) );
-            }
-
-            return true;
+            Attributes entry = result.getAttributes();
+            Attribute deleted = entry.get( ENTRY_DELETED );
+            Object value = deleted == null ? null : deleted.get();
+            return ( value == null || !"true".equalsIgnoreCase( value.toString() ) );
         }
     };
 

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java?view=diff&rev=471867&r1=471866&r2=471867
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
Mon Nov  6 12:16:56 2006
@@ -372,6 +372,7 @@
     public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds
) throws NamingException
     {
         boolean found = false;
+        
         // Look for 'entryDeleted' attribute is in attrIds.
         for ( int i = 0; i < attrIds.length; i++ )
         {
@@ -408,12 +409,16 @@
     public NamingEnumeration search( NextInterceptor nextInterceptor, LdapDN baseName, Map
environment, ExprNode filter,
         SearchControls searchControls ) throws NamingException
     {
-        NamingEnumeration e = nextInterceptor.search( baseName, environment, filter, searchControls
);
         if ( searchControls.getReturningAttributes() != null )
         {
-            return e;
+            String[] oldAttrIds = searchControls.getReturningAttributes();
+            String[] newAttrIds = new String[oldAttrIds.length + 1];
+            System.arraycopy( oldAttrIds, 0, newAttrIds, 0, oldAttrIds.length );
+            newAttrIds[oldAttrIds.length] = Constants.ENTRY_DELETED.toLowerCase();
+            searchControls.setReturningAttributes( newAttrIds );
         }
-
+        
+        NamingEnumeration e = nextInterceptor.search( baseName, environment, filter, searchControls
);
         return new SearchResultFilteringEnumeration( e, searchControls, InvocationStack.getInstance().peek(),
             Constants.DELETED_ENTRIES_FILTER );
     }



Mime
View raw message