edu.vt.middleware.ldap.handler
Class MergeSearchResultHandler

java.lang.Object
  extended by edu.vt.middleware.ldap.handler.AbstractResultHandler<T,T>
      extended by edu.vt.middleware.ldap.handler.CopyResultHandler<SearchResult>
          extended by edu.vt.middleware.ldap.handler.CopySearchResultHandler
              extended by edu.vt.middleware.ldap.handler.MergeSearchResultHandler
All Implemented Interfaces:
ResultHandler<SearchResult,SearchResult>, SearchResultHandler

public class MergeSearchResultHandler
extends CopySearchResultHandler

MergeSearchResultHandler merges the attributes found in each search result into the first search result.

Version:
$Revision: 1330 $ $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
Author:
Middleware Services

Field Summary
 
Fields inherited from class edu.vt.middleware.ldap.handler.AbstractResultHandler
logger
 
Constructor Summary
MergeSearchResultHandler()
           
 
Method Summary
 boolean getAllowDuplicates()
          Returns whether to allow duplicate attribute values.
protected  List<SearchResult> mergeResults(List<SearchResult> results)
          Merges the search results in the supplied list into a single search result.
 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 setAllowDuplicates(boolean b)
          Sets whether to allow duplicate attribute values.
 
Methods inherited from class edu.vt.middleware.ldap.handler.CopySearchResultHandler
getAttributeHandler, processAttributes, processDn, processResult, setAttributeHandler
 
Methods inherited from class edu.vt.middleware.ldap.handler.AbstractResultHandler
process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.vt.middleware.ldap.handler.ResultHandler
process
 

Constructor Detail

MergeSearchResultHandler

public MergeSearchResultHandler()
Method Detail

getAllowDuplicates

public boolean getAllowDuplicates()
Returns whether to allow duplicate attribute values.

Returns:
boolean

setAllowDuplicates

public void setAllowDuplicates(boolean b)
Sets whether to allow duplicate attribute values.

Parameters:
b - boolean

process

public List<SearchResult> process(SearchCriteria sc,
                                  NamingEnumeration<? extends SearchResult> en,
                                  Class<?>[] ignore)
                           throws NamingException
This will enumerate through the supplied 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.

Specified by:
process in interface ResultHandler<SearchResult,SearchResult>
Overrides:
process in class AbstractResultHandler<SearchResult,SearchResult>
Parameters:
sc - SearchCriteria used to find enumeration
en - NamingEnumeration LDAP results
ignore - Class[] of exception types to ignore
Returns:
List - LDAP results
Throws:
NamingException - if the LDAP returns an error

process

public List<SearchResult> process(SearchCriteria sc,
                                  List<? extends SearchResult> l)
                           throws NamingException
This will enumerate through the supplied List and return a List of those results. The results are unaltered and the dn is ignored.

Specified by:
process in interface ResultHandler<SearchResult,SearchResult>
Overrides:
process in class AbstractResultHandler<SearchResult,SearchResult>
Parameters:
sc - SearchCriteria used to find enumeration
l - List LDAP results
Returns:
List - LDAP results
Throws:
NamingException - if the LDAP returns an error

mergeResults

protected List<SearchResult> mergeResults(List<SearchResult> results)
                                   throws NamingException
Merges the search results in the supplied list into a single search result. This method always returns a list of size zero or one.

Parameters:
results - List of search results to merge
Returns:
List of merged search results
Throws:
NamingException - if an error occurs reading attribute values


Copyright © 2003-2010 Virginia Tech. All Rights Reserved.