edu.vt.middleware.ldap.handler
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,
java.lang.String searchAttr,
java.lang.String[] mergeAttrs)
Creates a new
RecursiveAttributeHandler with the supplied
ldap, search attribute, and merge attributes. |
RecursiveSearchResultHandler(java.lang.String searchAttr,
java.lang.String[] mergeAttrs)
Creates a new
RecursiveAttributeHandler with the supplied
search attribute and merge attributes. |
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getMergeAttributes()
Returns the attribute names that will be merged by the recursive search.
|
java.lang.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.
|
java.util.List<javax.naming.directory.SearchResult> |
process(SearchCriteria sc,
java.util.List<? extends javax.naming.directory.SearchResult> l)
This will enumerate through the supplied
List and return a
List of those results. |
java.util.List<javax.naming.directory.SearchResult> |
process(SearchCriteria sc,
javax.naming.NamingEnumeration<? extends javax.naming.directory.SearchResult> en,
java.lang.Class<?>[] ignore)
This will enumerate through the supplied
NamingEnumeration and
return a List of those results. |
void |
setMergeAttributes(java.lang.String[] s)
Sets the attribute name that will be merged by the recursive search.
|
void |
setSearchAttribute(java.lang.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, setAttributeHandler
process
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAttributeHandler, setAttributeHandler
process
public RecursiveSearchResultHandler()
public RecursiveSearchResultHandler(java.lang.String searchAttr, java.lang.String[] mergeAttrs)
RecursiveAttributeHandler
with the supplied
search attribute and merge attributes.searchAttr
- String
mergeAttrs
- String[]
public RecursiveSearchResultHandler(Ldap l, java.lang.String searchAttr, java.lang.String[] mergeAttrs)
RecursiveAttributeHandler
with the supplied
ldap, search attribute, and merge attributes.l
- Ldap
searchAttr
- String
mergeAttrs
- String[]
public Ldap getSearchResultLdap()
Ldap
used by the search operation invoking this
handler.getSearchResultLdap
in interface ExtendedSearchResultHandler
Ldap
public void setSearchResultLdap(Ldap l)
Ldap
used by the search operation invoking this
handler.setSearchResultLdap
in interface ExtendedSearchResultHandler
l
- Ldap
public java.lang.String getSearchAttribute()
String
attribute namepublic void setSearchAttribute(java.lang.String s)
s
- String
public java.lang.String[] getMergeAttributes()
String[]
attribute namespublic void setMergeAttributes(java.lang.String[] s)
s
- String[]
protected void initalizeReturnAttributes()
public java.util.List<javax.naming.directory.SearchResult> process(SearchCriteria sc, javax.naming.NamingEnumeration<? extends javax.naming.directory.SearchResult> en, java.lang.Class<?>[] ignore) throws javax.naming.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<javax.naming.directory.SearchResult,javax.naming.directory.SearchResult>
process
in class AbstractResultHandler<javax.naming.directory.SearchResult,javax.naming.directory.SearchResult>
sc
- SearchCriteria
used to find enumerationen
- NamingEnumeration
LDAP resultsignore
- Class[]
of exception types to ignoreList
- LDAP resultsjavax.naming.NamingException
- if the LDAP returns an errorpublic java.util.List<javax.naming.directory.SearchResult> process(SearchCriteria sc, java.util.List<? extends javax.naming.directory.SearchResult> l) throws javax.naming.NamingException
List
and return a
List of those results. The results are unaltered and the dn is ignored.process
in interface ResultHandler<javax.naming.directory.SearchResult,javax.naming.directory.SearchResult>
process
in class AbstractResultHandler<javax.naming.directory.SearchResult,javax.naming.directory.SearchResult>
sc
- SearchCriteria
used to find enumerationl
- List
LDAP resultsList
- LDAP resultsjavax.naming.NamingException
- if the LDAP returns an errorCopyright © 2014. All Rights Reserved.