You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by lu...@apache.org on 2015/02/14 18:28:34 UTC

svn commit: r1659819 - in /directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template: LdapConnectionOperations.java LdapConnectionTemplate.java ModelFactory.java ModelFactoryImpl.java

Author: lucastheisen
Date: Sat Feb 14 17:28:34 2015
New Revision: 1659819

URL: http://svn.apache.org/r1659819
Log:
added overloaded search methods to template for filter builder

Modified:
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/LdapConnectionOperations.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/LdapConnectionTemplate.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/ModelFactory.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/ModelFactoryImpl.java

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/LdapConnectionOperations.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/LdapConnectionOperations.java?rev=1659819&r1=1659818&r2=1659819&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/LdapConnectionOperations.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/LdapConnectionOperations.java Sat Feb 14 17:28:34 2015
@@ -34,6 +34,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.message.SearchRequest;
 import org.apache.directory.api.ldap.model.message.SearchScope;
 import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.ldap.client.api.search.FilterBuilder;
 import org.apache.directory.ldap.client.template.exception.LdapRequestUnsuccessfulException;
 import org.apache.directory.ldap.client.template.exception.PasswordException;
 
@@ -305,6 +306,21 @@ public interface LdapConnectionOperation
      * @return The mapped entries
      * @see {@link #search(SearchRequest, EntryMapper)}
      */
+    public abstract <T> List<T> search( String baseDn, FilterBuilder filter, SearchScope scope,
+        EntryMapper<T> entryMapper );
+
+
+    /**
+     * Searches for the entries matching the supplied criteria, feeding the 
+     * result into the <code>entryMapper</code>.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param entryMapper
+     * @return The mapped entries
+     * @see {@link #search(SearchRequest, EntryMapper)}
+     */
     public abstract <T> List<T> search( String baseDn, String filter, SearchScope scope,
         EntryMapper<T> entryMapper );
 
@@ -320,6 +336,21 @@ public interface LdapConnectionOperation
      * @return The mapped entries
      * @see {@link #search(SearchRequest, EntryMapper)}
      */
+    public abstract <T> List<T> search( Dn baseDn, FilterBuilder filter, SearchScope scope,
+        EntryMapper<T> entryMapper );
+
+
+    /**
+     * Searches for the entries matching the supplied criteria, feeding the 
+     * result into the <code>entryMapper</code>.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param entryMapper
+     * @return The mapped entries
+     * @see {@link #search(SearchRequest, EntryMapper)}
+     */
     public abstract <T> List<T> search( Dn baseDn, String filter, SearchScope scope,
         EntryMapper<T> entryMapper );
 
@@ -337,6 +368,23 @@ public interface LdapConnectionOperation
      * @return The mapped entries
      * @see {@link #search(SearchRequest, EntryMapper)}
      */
+    public abstract <T> List<T> search( String baseDn, FilterBuilder filter, SearchScope scope,
+        String[] attributes, EntryMapper<T> entryMapper );
+
+
+    /**
+     * Searches for the entries matching the supplied criteria, feeding the 
+     * result into the <code>entryMapper</code>, querying only the requested 
+     * attributes.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param attributes
+     * @param entryMapper
+     * @return The mapped entries
+     * @see {@link #search(SearchRequest, EntryMapper)}
+     */
     public abstract <T> List<T> search( String baseDn, String filter, SearchScope scope,
         String[] attributes, EntryMapper<T> entryMapper );
 
@@ -354,6 +402,23 @@ public interface LdapConnectionOperation
      * @return The mapped entries
      * @see {@link #search(SearchRequest, EntryMapper)}
      */
+    public abstract <T> List<T> search( Dn baseDn, FilterBuilder filter, SearchScope scope,
+        String[] attributes, EntryMapper<T> entryMapper );
+
+
+    /**
+     * Searches for the entries matching the supplied criteria, feeding the 
+     * result into the <code>entryMapper</code>, querying only the requested 
+     * attributes.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param attributes
+     * @param entryMapper
+     * @return The mapped entries
+     * @see {@link #search(SearchRequest, EntryMapper)}
+     */
     public abstract <T> List<T> search( Dn baseDn, String filter, SearchScope scope,
         String[] attributes, EntryMapper<T> entryMapper );
 
@@ -382,6 +447,21 @@ public interface LdapConnectionOperation
      * @return The mapped entries
      * @see {@link #searchFirst(SearchRequest, EntryMapper)}
      */
+    public abstract <T> T searchFirst( String baseDn, FilterBuilder filter, SearchScope scope,
+        EntryMapper<T> entryMapper );
+    
+    
+    /**
+     * Searches for the first entry matching the supplied criteria, feeding the 
+     * result into the <code>entryMapper</code>.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param entryMapper
+     * @return The mapped entries
+     * @see {@link #searchFirst(SearchRequest, EntryMapper)}
+     */
     public abstract <T> T searchFirst( String baseDn, String filter, SearchScope scope,
         EntryMapper<T> entryMapper );
 
@@ -397,6 +477,21 @@ public interface LdapConnectionOperation
      * @return The mapped entries
      * @see {@link #searchFirst(SearchRequest, EntryMapper)}
      */
+    public abstract <T> T searchFirst( Dn baseDn, FilterBuilder filter, SearchScope scope,
+        EntryMapper<T> entryMapper );
+
+
+    /**
+     * Searches for the first entry matching the supplied criteria, feeding the 
+     * result into the <code>entryMapper</code>.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param entryMapper
+     * @return The mapped entries
+     * @see {@link #searchFirst(SearchRequest, EntryMapper)}
+     */
     public abstract <T> T searchFirst( Dn baseDn, String filter, SearchScope scope,
         EntryMapper<T> entryMapper );
 
@@ -414,10 +509,44 @@ public interface LdapConnectionOperation
      * @return The mapped entries
      * @see {@link #searchFirst(SearchRequest, EntryMapper)}
      */
+    public abstract <T> T searchFirst( String baseDn, FilterBuilder filter, SearchScope scope,
+        String[] attributes, EntryMapper<T> entryMapper );
+
+
+    /**
+     * Searches for the first entry matching the supplied criteria, feeding the 
+     * result into the <code>entryMapper</code>, querying only the requested 
+     * attributes.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param attributes
+     * @param entryMapper
+     * @return The mapped entries
+     * @see {@link #searchFirst(SearchRequest, EntryMapper)}
+     */
     public abstract <T> T searchFirst( String baseDn, String filter, SearchScope scope,
         String[] attributes, EntryMapper<T> entryMapper );
 
 
+    /**
+     * Searches for the first entry matching the supplied criteria, feeding the 
+     * result into the <code>entryMapper</code>, querying only the requested 
+     * attributes.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param attributes
+     * @param entryMapper
+     * @return The mapped entries
+     * @see {@link #searchFirst(SearchRequest, EntryMapper)}
+     */
+    public abstract <T> T searchFirst( Dn baseDn, FilterBuilder filter, SearchScope scope,
+        String[] attributes, EntryMapper<T> entryMapper );
+
+
     /**
      * Searches for the first entry matching the supplied criteria, feeding the 
      * result into the <code>entryMapper</code>, querying only the requested 

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/LdapConnectionTemplate.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/LdapConnectionTemplate.java?rev=1659819&r1=1659818&r2=1659819&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/LdapConnectionTemplate.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/LdapConnectionTemplate.java Sat Feb 14 17:28:34 2015
@@ -45,6 +45,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.ldap.client.api.EntryCursorImpl;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapConnectionPool;
+import org.apache.directory.ldap.client.api.search.FilterBuilder;
 import org.apache.directory.ldap.client.template.exception.LdapRequestUnsuccessfulException;
 import org.apache.directory.ldap.client.template.exception.LdapRuntimeException;
 import org.apache.directory.ldap.client.template.exception.PasswordException;
@@ -500,6 +501,13 @@ public class LdapConnectionTemplate impl
 
 
     @Override
+    public SearchRequest newSearchRequest( String baseDn, FilterBuilder filter, SearchScope scope )
+    {
+        return modelFactory.newSearchRequest( baseDn, filter, scope );
+    }
+
+
+    @Override
     public SearchRequest newSearchRequest( String baseDn, String filter, SearchScope scope )
     {
         return modelFactory.newSearchRequest( baseDn, filter, scope );
@@ -507,6 +515,13 @@ public class LdapConnectionTemplate impl
 
 
     @Override
+    public SearchRequest newSearchRequest( Dn baseDn, FilterBuilder filter, SearchScope scope )
+    {
+        return modelFactory.newSearchRequest( baseDn, filter, scope );
+    }
+
+
+    @Override
     public SearchRequest newSearchRequest( Dn baseDn, String filter, SearchScope scope )
     {
         return modelFactory.newSearchRequest( baseDn, filter, scope );
@@ -514,6 +529,13 @@ public class LdapConnectionTemplate impl
 
 
     @Override
+    public SearchRequest newSearchRequest( String baseDn, FilterBuilder filter, SearchScope scope, String... attributes )
+    {
+        return modelFactory.newSearchRequest( baseDn, filter, scope, attributes );
+    }
+
+
+    @Override
     public SearchRequest newSearchRequest( String baseDn, String filter, SearchScope scope, String... attributes )
     {
         return modelFactory.newSearchRequest( baseDn, filter, scope, attributes );
@@ -521,6 +543,13 @@ public class LdapConnectionTemplate impl
 
 
     @Override
+    public SearchRequest newSearchRequest( Dn baseDn, FilterBuilder filter, SearchScope scope, String... attributes )
+    {
+        return modelFactory.newSearchRequest( baseDn, filter, scope, attributes );
+    }
+
+
+    @Override
     public SearchRequest newSearchRequest( Dn baseDn, String filter, SearchScope scope, String... attributes )
     {
         return modelFactory.newSearchRequest( baseDn, filter, scope, attributes );
@@ -555,87 +584,67 @@ public class LdapConnectionTemplate impl
 
 
     @Override
-    public <T> T searchFirst( String baseDn, String filter, SearchScope scope,
+    public <T> List<T> search( String baseDn, FilterBuilder filter, SearchScope scope,
         EntryMapper<T> entryMapper )
     {
-        return searchFirst(
+        return search(
             modelFactory.newSearchRequest( baseDn, filter, scope ),
             entryMapper );
     }
 
 
     @Override
-    public <T> T searchFirst( Dn baseDn, String filter, SearchScope scope,
+    public <T> List<T> search( String baseDn, String filter, SearchScope scope,
         EntryMapper<T> entryMapper )
     {
-        return searchFirst(
+        return search(
             modelFactory.newSearchRequest( baseDn, filter, scope ),
             entryMapper );
     }
 
 
     @Override
-    public <T> T searchFirst( String baseDn, String filter, SearchScope scope,
-        String[] attributes, EntryMapper<T> entryMapper )
-    {
-        return searchFirst(
-            modelFactory.newSearchRequest( baseDn, filter, scope, attributes ),
-            entryMapper );
-    }
-
-
-    @Override
-    public <T> T searchFirst( Dn baseDn, String filter, SearchScope scope,
-        String[] attributes, EntryMapper<T> entryMapper )
+    public <T> List<T> search( Dn baseDn, FilterBuilder filter, SearchScope scope,
+        EntryMapper<T> entryMapper )
     {
-        return searchFirst(
-            modelFactory.newSearchRequest( baseDn, filter, scope, attributes ),
+        return search(
+            modelFactory.newSearchRequest( baseDn, filter, scope ),
             entryMapper );
     }
 
 
     @Override
-    public <T> T searchFirst( SearchRequest searchRequest,
+    public <T> List<T> search( Dn baseDn, String filter, SearchScope scope,
         EntryMapper<T> entryMapper )
     {
-        // in case the caller did not set size limit, we cache original value,
-        // set to 1, then set back to original value before returning...
-        long originalSizeLimit = searchRequest.getSizeLimit();
-        try
-        {
-            searchRequest.setSizeLimit( 1 );
-            List<T> entries = search( searchRequest, entryMapper );
-            return entries.isEmpty() ? null : entries.get( 0 );
-        }
-        finally
-        {
-            searchRequest.setSizeLimit( originalSizeLimit );
-        }
+        return search(
+            modelFactory.newSearchRequest( baseDn, filter, scope ),
+            entryMapper );
     }
 
 
     @Override
-    public <T> List<T> search( String baseDn, String filter, SearchScope scope,
-        EntryMapper<T> entryMapper )
+    public <T> List<T> search( String baseDn, FilterBuilder filter, SearchScope scope,
+        String[] attributes, EntryMapper<T> entryMapper )
     {
         return search(
-            modelFactory.newSearchRequest( baseDn, filter, scope ),
+            modelFactory.newSearchRequest( baseDn, filter, scope, attributes ),
             entryMapper );
     }
 
 
     @Override
-    public <T> List<T> search( Dn baseDn, String filter, SearchScope scope,
-        EntryMapper<T> entryMapper )
+    public <T> List<T> search( String baseDn, String filter, SearchScope scope,
+        String[] attributes, EntryMapper<T> entryMapper )
     {
         return search(
-            modelFactory.newSearchRequest( baseDn, filter, scope ),
+            modelFactory.newSearchRequest( baseDn, filter, scope, attributes ),
             entryMapper );
     }
 
 
     @Override
-    public <T> List<T> search( String baseDn, String filter, SearchScope scope,
+    public <T> List<T> search( Dn baseDn, FilterBuilder filter, SearchScope scope,
         String[] attributes, EntryMapper<T> entryMapper )
     {
         return search(
@@ -683,6 +692,106 @@ public class LdapConnectionTemplate impl
     }
 
 
+    @Override
+    public <T> T searchFirst( String baseDn, FilterBuilder filter, SearchScope scope,
+        EntryMapper<T> entryMapper )
+    {
+        return searchFirst(
+            modelFactory.newSearchRequest( baseDn, filter, scope ),
+            entryMapper );
+    }
+
+
+    @Override
+    public <T> T searchFirst( String baseDn, String filter, SearchScope scope,
+        EntryMapper<T> entryMapper )
+    {
+        return searchFirst(
+            modelFactory.newSearchRequest( baseDn, filter, scope ),
+            entryMapper );
+    }
+
+
+    @Override
+    public <T> T searchFirst( Dn baseDn, FilterBuilder filter, SearchScope scope,
+        EntryMapper<T> entryMapper )
+    {
+        return searchFirst(
+            modelFactory.newSearchRequest( baseDn, filter, scope ),
+            entryMapper );
+    }
+
+
+    @Override
+    public <T> T searchFirst( Dn baseDn, String filter, SearchScope scope,
+        EntryMapper<T> entryMapper )
+    {
+        return searchFirst(
+            modelFactory.newSearchRequest( baseDn, filter, scope ),
+            entryMapper );
+    }
+
+
+    @Override
+    public <T> T searchFirst( String baseDn, FilterBuilder filter, SearchScope scope,
+        String[] attributes, EntryMapper<T> entryMapper )
+    {
+        return searchFirst(
+            modelFactory.newSearchRequest( baseDn, filter, scope, attributes ),
+            entryMapper );
+    }
+
+
+    @Override
+    public <T> T searchFirst( String baseDn, String filter, SearchScope scope,
+        String[] attributes, EntryMapper<T> entryMapper )
+    {
+        return searchFirst(
+            modelFactory.newSearchRequest( baseDn, filter, scope, attributes ),
+            entryMapper );
+    }
+
+
+    @Override
+    public <T> T searchFirst( Dn baseDn, FilterBuilder filter, SearchScope scope,
+        String[] attributes, EntryMapper<T> entryMapper )
+    {
+        return searchFirst(
+            modelFactory.newSearchRequest( baseDn, filter, scope, attributes ),
+            entryMapper );
+    }
+
+
+    @Override
+    public <T> T searchFirst( Dn baseDn, String filter, SearchScope scope,
+        String[] attributes, EntryMapper<T> entryMapper )
+    {
+        return searchFirst(
+            modelFactory.newSearchRequest( baseDn, filter, scope, attributes ),
+            entryMapper );
+    }
+
+
+    @Override
+    public <T> T searchFirst( SearchRequest searchRequest,
+        EntryMapper<T> entryMapper )
+    {
+        // in case the caller did not set size limit, we cache original value,
+        // set to 1, then set back to original value before returning...
+        long originalSizeLimit = searchRequest.getSizeLimit();
+        try
+        {
+            searchRequest.setSizeLimit( 1 );
+            List<T> entries = search( searchRequest, entryMapper );
+            return entries.isEmpty() ? null : entries.get( 0 );
+        }
+        finally
+        {
+            searchRequest.setSizeLimit( originalSizeLimit );
+        }
+    }
+
+
     /**
      * Sets the <code>modelFactory</code> implementation for this facade.
      *

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/ModelFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/ModelFactory.java?rev=1659819&r1=1659818&r2=1659819&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/ModelFactory.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/ModelFactory.java Sat Feb 14 17:28:34 2015
@@ -29,6 +29,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.message.SearchRequest;
 import org.apache.directory.api.ldap.model.message.SearchScope;
 import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.ldap.client.api.search.FilterBuilder;
 
 
 /**
@@ -38,48 +39,214 @@ import org.apache.directory.api.ldap.mod
  */
 public interface ModelFactory
 {
+    /**
+     * Returns a new <code>AddRequest</code> for the <code>entry</code>.
+     *
+     * @param entry
+     * @return
+     */
     public AddRequest newAddRequest( Entry entry );
 
 
+    /**
+     * Returns a new Attribute for with the provided <code>name</code> and
+     * <code>value(s)</code>.
+     *
+     * @param name
+     * @param values
+     * @return
+     */
     public Attribute newAttribute( String name, byte[]... values );
     
     
+    /**
+     * Returns a new Attribute for with the provided <code>name</code> and
+     * <code>value(s)</code>.
+     *
+     * @param name
+     * @param values
+     * @return
+     */
     public Attribute newAttribute( String name, String... values );
     
     
+    /**
+     * Returns a new Attribute for with the provided <code>name</code> and
+     * <code>value(s)</code>.
+     *
+     * @param name
+     * @param values
+     * @return
+     */
     public Attribute newAttribute( String name, Value<?>... values );
 
 
+    /**
+     * Returns a new <code>DeleteRequest</code> for the <code>dn</code>.
+     *
+     * @param dn
+     * @return
+     */
     public DeleteRequest newDeleteRequest( Dn dn );
 
 
+    /**
+     * Returns a <code>Dn</code> that represents <code>dn</code>.
+     *
+     * @param dn
+     * @return
+     */
     public Dn newDn( String dn );
 
 
+    /**
+     * Returns a <code>Entry</code> with the specified <code>dn</code>.
+     *
+     * @param dn
+     * @return
+     */
     public Entry newEntry( String dn );
 
 
+    /**
+     * Returns a <code>Entry</code> with the specified <code>dn</code>.
+     *
+     * @param dn
+     * @return
+     */
     public Entry newEntry( Dn dn );
 
 
+    /**
+     * Returns a new <code>ModifyRequest</code> for the <code>dn</code>.
+     *
+     * @param dn 
+     * @return
+     */
     public ModifyRequest newModifyRequest( String dn );
 
 
+    /**
+     * Returns a new <code>ModifyRequest</code> for the <code>dn</code>.
+     *
+     * @param dn
+     * @return
+     */
     public ModifyRequest newModifyRequest( Dn dn );
 
 
+    /**
+     * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in
+     * <code>scope</code> matching <code>filter</code> returning 
+     * all normal attributes for each matching entry.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @return
+     */
+    public SearchRequest newSearchRequest( String baseDn, FilterBuilder filter,
+        SearchScope scope );
+
+
+    /**
+     * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in
+     * <code>scope</code> matching <code>filter</code> returning 
+     * all normal attributes for each matching entry.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @return
+     */
     public SearchRequest newSearchRequest( String baseDn, String filter,
         SearchScope scope );
 
 
+    /**
+     * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in
+     * <code>scope</code> matching <code>filter</code> returning 
+     * all normal attributes for each matching entry.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @return
+     */
     public SearchRequest newSearchRequest( Dn baseDn, String filter,
         SearchScope scope );
 
 
+    /**
+     * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in
+     * <code>scope</code> matching <code>filter</code> returning 
+     * all normal attributes for each matching entry.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @return
+     */
+    public SearchRequest newSearchRequest( Dn baseDn, FilterBuilder filter,
+        SearchScope scope );
+
+
+    /**
+     * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in
+     * <code>scope</code> matching <code>filter</code> returning 
+     * <code>attributes</code> for each matching entry.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param attributes
+     * @return
+     */
     public SearchRequest newSearchRequest( String baseDn, String filter,
         SearchScope scope, String... attributes );
 
 
+    /**
+     * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in
+     * <code>scope</code> matching <code>filter</code> returning 
+     * <code>attributes</code> for each matching entry.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param attributes
+     * @return
+     */
+    public SearchRequest newSearchRequest( String baseDn, FilterBuilder filter,
+        SearchScope scope, String... attributes );
+
+
+    /**
+     * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in
+     * <code>scope</code> matching <code>filter</code> returning 
+     * <code>attributes</code> for each matching entry.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param attributes
+     * @return
+     */
     public SearchRequest newSearchRequest( Dn baseDn, String filter,
         SearchScope scope, String... attributes );
+
+
+    /**
+     * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in
+     * <code>scope</code> matching <code>filter</code> returning 
+     * <code>attributes</code> for each matching entry.
+     *
+     * @param baseDn
+     * @param filter
+     * @param scope
+     * @param attributes
+     * @return
+     */
+    public SearchRequest newSearchRequest( Dn baseDn, FilterBuilder filter,
+        SearchScope scope, String... attributes );
 }

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/ModelFactoryImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/ModelFactoryImpl.java?rev=1659819&r1=1659818&r2=1659819&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/ModelFactoryImpl.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/template/ModelFactoryImpl.java Sat Feb 14 17:28:34 2015
@@ -36,6 +36,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.message.SearchRequestImpl;
 import org.apache.directory.api.ldap.model.message.SearchScope;
 import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.ldap.client.api.search.FilterBuilder;
 import org.apache.directory.ldap.client.template.exception.LdapRuntimeException;
 
 
@@ -125,6 +126,14 @@ class ModelFactoryImpl implements ModelF
 
 
     @Override
+    public SearchRequest newSearchRequest( String baseDn, FilterBuilder filter,
+        SearchScope scope )
+    {
+        return newSearchRequest( newDn( baseDn ), filter.toString(), scope );
+    }
+
+
+    @Override
     public SearchRequest newSearchRequest( String baseDn, String filter,
         SearchScope scope )
     {
@@ -133,6 +142,14 @@ class ModelFactoryImpl implements ModelF
 
 
     @Override
+    public SearchRequest newSearchRequest( Dn baseDn, FilterBuilder filter,
+        SearchScope scope )
+    {
+        return newSearchRequest( baseDn, filter.toString(), scope, ( String[] ) null );
+    }
+
+
+    @Override
     public SearchRequest newSearchRequest( Dn baseDn, String filter,
         SearchScope scope )
     {
@@ -141,6 +158,14 @@ class ModelFactoryImpl implements ModelF
 
 
     @Override
+    public SearchRequest newSearchRequest( String baseDn, FilterBuilder filter,
+        SearchScope scope, String... attributes )
+    {
+        return newSearchRequest( newDn( baseDn ), filter.toString(), scope, attributes );
+    }
+
+
+    @Override
     public SearchRequest newSearchRequest( String baseDn, String filter,
         SearchScope scope, String... attributes )
     {
@@ -148,6 +173,14 @@ class ModelFactoryImpl implements ModelF
     }
 
 
+    @Override
+    public SearchRequest newSearchRequest( Dn baseDn, FilterBuilder filter,
+        SearchScope scope, String... attributes )
+    {
+        return newSearchRequest( baseDn, filter.toString(), scope, attributes );
+    }
+
+
     @Override
     public SearchRequest newSearchRequest( Dn baseDn, String filter,
         SearchScope scope, String... attributes )