Class MergeSearchResultHandler

  • All Implemented Interfaces:
    ResultHandler<javax.naming.directory.SearchResult,​javax.naming.directory.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-24 00:10:53 +0200 (Mon, 24 May 2010) $
    Author:
    Middleware Services
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean getAllowDuplicates()
      Returns whether to allow duplicate attribute values.
      protected java.util.List<javax.naming.directory.SearchResult> mergeResults​(java.util.List<javax.naming.directory.SearchResult> results)
      Merges the search results in the supplied list into a single search result.
      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 setAllowDuplicates​(boolean b)
      Sets whether to allow duplicate attribute values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 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
        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<javax.naming.directory.SearchResult,​javax.naming.directory.SearchResult>
        Overrides:
        process in class AbstractResultHandler<javax.naming.directory.SearchResult,​javax.naming.directory.SearchResult>
        Parameters:
        sc - SearchCriteria used to find enumeration
        en - NamingEnumeration LDAP results
        ignore - Class[] of exception types to ignore
        Returns:
        List - LDAP results
        Throws:
        javax.naming.NamingException - if the LDAP returns an error
      • process

        public java.util.List<javax.naming.directory.SearchResult> process​(SearchCriteria sc,
                                                                           java.util.List<? extends javax.naming.directory.SearchResult> l)
                                                                    throws javax.naming.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<javax.naming.directory.SearchResult,​javax.naming.directory.SearchResult>
        Overrides:
        process in class AbstractResultHandler<javax.naming.directory.SearchResult,​javax.naming.directory.SearchResult>
        Parameters:
        sc - SearchCriteria used to find enumeration
        l - List LDAP results
        Returns:
        List - LDAP results
        Throws:
        javax.naming.NamingException - if the LDAP returns an error
      • mergeResults

        protected java.util.List<javax.naming.directory.SearchResult> mergeResults​(java.util.List<javax.naming.directory.SearchResult> results)
                                                                            throws javax.naming.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:
        javax.naming.NamingException - if an error occurs reading attribute values