public class RecursiveSearchResultHandler extends CopySearchResultHandler implements ExtendedSearchResultHandler
RecursiveSearchResultHandler recursively searches based on a
supplied attribute and merges those results into the original result set. For
the following LDIF:
dn: uugid=group1,ou=groups,dc=vt,dc=edu uugid: group1 member: uugid=group2,ou=groups,dc=vt,dc=edu dn: uugid=group2,ou=groups,dc=vt,dc=edu uugid: group2
With the following code:
RecursiveSearchResultHandler rsh = new RecurseSearchResultHandler(
ldap, "member", new String[]{"uugid"});
Will produce this result for the query (uugid=group1):
dn: uugid=group1,ou=groups,dc=vt,dc=edu uugid: group1 uugid: group2 member: uugid=group2,ou=groups,dc=vt,dc=edu
logger| Constructor and Description |
|---|
RecursiveSearchResultHandler()
Default constructor.
|
RecursiveSearchResultHandler(Ldap l,
String searchAttr,
String[] mergeAttrs)
Creates a new
RecursiveAttributeHandler with the supplied
ldap, search attribute, and merge attributes. |
RecursiveSearchResultHandler(String searchAttr,
String[] mergeAttrs)
Creates a new
RecursiveAttributeHandler with the supplied
search attribute and merge attributes. |
| Modifier and Type | Method and Description |
|---|---|
String[] |
getMergeAttributes()
Returns the attribute names that will be merged by the recursive search.
|
String |
getSearchAttribute()
Returns the attribute name that will be recursively searched on.
|
Ldap |
getSearchResultLdap()
Gets the
Ldap used by the search operation invoking this
handler. |
protected void |
initalizeReturnAttributes()
Initializes the return attributes array.
|
List<SearchResult> |
process(SearchCriteria sc,
List<? extends SearchResult> l)
This will enumerate through the supplied
List and return a
List of those results. |
List<SearchResult> |
process(SearchCriteria sc,
NamingEnumeration<? extends SearchResult> en,
Class<?>[] ignore)
This will enumerate through the supplied
NamingEnumeration and
return a List of those results. |
void |
setMergeAttributes(String[] s)
Sets the attribute name that will be merged by the recursive search.
|
void |
setSearchAttribute(String s)
Sets the attribute name that will be recursively searched on.
|
void |
setSearchResultLdap(Ldap l)
Sets the
Ldap used by the search operation invoking this
handler. |
getAttributeHandler, processAttributes, processDn, processResult, setAttributeHandlerprocessclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAttributeHandler, setAttributeHandlerprocesspublic RecursiveSearchResultHandler()
public RecursiveSearchResultHandler(String searchAttr, String[] mergeAttrs)
RecursiveAttributeHandler with the supplied
search attribute and merge attributes.searchAttr - StringmergeAttrs - String[]public Ldap getSearchResultLdap()
Ldap used by the search operation invoking this
handler.getSearchResultLdap in interface ExtendedSearchResultHandlerLdappublic void setSearchResultLdap(Ldap l)
Ldap used by the search operation invoking this
handler.setSearchResultLdap in interface ExtendedSearchResultHandlerl - Ldappublic String getSearchAttribute()
String attribute namepublic void setSearchAttribute(String s)
s - Stringpublic String[] getMergeAttributes()
String[] attribute namespublic void setMergeAttributes(String[] s)
s - String[]protected void initalizeReturnAttributes()
public List<SearchResult> process(SearchCriteria sc, NamingEnumeration<? extends SearchResult> en, Class<?>[] ignore) throws NamingException
NamingEnumeration and
return a List of those results. The results are unaltered and the dn is
ignored. Any exceptions passed into this method will be ignored and results
will be returned as if no exception occurred.process in interface ResultHandler<SearchResult,SearchResult>process in class AbstractResultHandler<SearchResult,SearchResult>sc - SearchCriteria used to find enumerationen - NamingEnumeration LDAP resultsignore - Class[] of exception types to ignoreList - LDAP resultsNamingException - if the LDAP returns an errorpublic List<SearchResult> process(SearchCriteria sc, List<? extends SearchResult> l) throws NamingException
List and return a
List of those results. The results are unaltered and the dn is ignored.process in interface ResultHandler<SearchResult,SearchResult>process in class AbstractResultHandler<SearchResult,SearchResult>sc - SearchCriteria used to find enumerationl - List LDAP resultsList - LDAP resultsNamingException - if the LDAP returns an errorCopyright © 2014. All rights reserved.