Class RecursiveResultHandler

  • All Implemented Interfaces:
    java.util.function.Function<SearchResponse,​SearchResponse>, SearchResultHandler

    public class RecursiveResultHandler
    extends AbstractEntryHandler<SearchResponse>
    implements SearchResultHandler
    This recursively searches based on a supplied attribute and merges those results into the original entry. For the following LDIF:
       dn: uugid=group1,ou=groups,dc=ldaptive,dc=org
       uugid: group1
       member: uugid=group2,ou=groups,dc=ldaptive,dc=org
    
       dn: uugid=group2,ou=groups,dc=ldaptive,dc=org
       uugid: group2
     

    With the following code:

       RecursiveResultHandler reh = new RecursiveResultHandler("member", "uugid");
     

    Will produce this result for the query (uugid=group1):

       dn: uugid=group1,ou=groups,dc=ldaptive,dc=org
       uugid: group1
       uugid: group2
       member: uugid=group2,ou=groups,dc=ldaptive,dc=org
     
    This handler should only be used with the SearchOperation.execute() method since it leverages the connection to make further searches.
    Author:
    Middleware Services
    • Constructor Detail

      • RecursiveResultHandler

        public RecursiveResultHandler()
        Default constructor.
      • RecursiveResultHandler

        public RecursiveResultHandler​(java.lang.String searchAttr,
                                      java.lang.String... mergeAttrs)
        Creates a new recursive entry handler.
        Parameters:
        searchAttr - attribute to search on
        mergeAttrs - attribute names to merge
    • Method Detail

      • getSearchAttribute

        public java.lang.String getSearchAttribute()
        Returns the attribute name that will be recursively searched on.
        Returns:
        attribute name
      • setSearchAttribute

        public void setSearchAttribute​(java.lang.String name)
        Sets the attribute name that will be recursively searched on.
        Parameters:
        name - of the search attribute
      • getMergeAttributes

        public java.lang.String[] getMergeAttributes()
        Returns the attribute names that will be merged by the recursive search.
        Returns:
        attribute names
      • setMergeAttributes

        public void setMergeAttributes​(java.lang.String... mergeAttrs)
        Sets the attribute name that will be merged by the recursive search.
        Parameters:
        mergeAttrs - attribute names to merge
      • initializeReturnAttributes

        protected void initializeReturnAttributes()
        Initializes the return attributes array. Must be called after both searchAttribute and mergeAttributes have been set.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object