org.ldaptive.handler
Class RecursiveEntryHandler

java.lang.Object
  extended by org.ldaptive.handler.AbstractSearchEntryHandler
      extended by org.ldaptive.handler.RecursiveEntryHandler
All Implemented Interfaces:
Handler<SearchRequest,SearchEntry>, SearchEntryHandler

public class RecursiveEntryHandler
extends AbstractSearchEntryHandler

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:

   RecursiveEntryHandler reh = new RecursiveEntryHandler("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
 

Version:
$Revision: 3189 $ $Date: 2016-11-01 17:21:43 -0400 (Tue, 01 Nov 2016) $
Author:
Middleware Services

Field Summary
 
Fields inherited from class org.ldaptive.handler.AbstractSearchEntryHandler
logger
 
Constructor Summary
RecursiveEntryHandler()
          Default constructor.
RecursiveEntryHandler(String searchAttr, String... mergeAttrs)
          Creates a new recursive entry handler.
 
Method Summary
 boolean equals(Object o)
          
 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.
 HandlerResult<SearchEntry> handle(Connection conn, SearchRequest request, SearchEntry entry)
          Handle the supplied result.
 int hashCode()
          
protected  void initalizeReturnAttributes()
          Initializes the return attributes array.
 void setMergeAttributes(String... mergeAttrs)
          Sets the attribute name that will be merged by the recursive search.
 void setSearchAttribute(String name)
          Sets the attribute name that will be recursively searched on.
 String toString()
          
 
Methods inherited from class org.ldaptive.handler.AbstractSearchEntryHandler
handleAttribute, handleAttributeName, handleAttributes, handleAttributeValue, handleAttributeValue, handleDn, initializeRequest
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RecursiveEntryHandler

public RecursiveEntryHandler()
Default constructor.


RecursiveEntryHandler

public RecursiveEntryHandler(String searchAttr,
                             String... mergeAttrs)
Creates a new recursive entry handler.

Parameters:
searchAttr - attribute to search on
mergeAttrs - attribute names to merge
Method Detail

getSearchAttribute

public String getSearchAttribute()
Returns the attribute name that will be recursively searched on.

Returns:
attribute name

setSearchAttribute

public void setSearchAttribute(String name)
Sets the attribute name that will be recursively searched on.

Parameters:
name - of the search attribute

getMergeAttributes

public String[] getMergeAttributes()
Returns the attribute names that will be merged by the recursive search.

Returns:
attribute names

setMergeAttributes

public void setMergeAttributes(String... mergeAttrs)
Sets the attribute name that will be merged by the recursive search.

Parameters:
mergeAttrs - attribute names to merge

initalizeReturnAttributes

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


handle

public HandlerResult<SearchEntry> handle(Connection conn,
                                         SearchRequest request,
                                         SearchEntry entry)
                                  throws LdapException
Handle the supplied result.

Specified by:
handle in interface Handler<SearchRequest,SearchEntry>
Specified by:
handle in interface SearchEntryHandler
Overrides:
handle in class AbstractSearchEntryHandler
Parameters:
conn - connection the operation was executed on
request - executed by the operation
entry - produced from the operation
Returns:
handler result
Throws:
LdapException - if handling fails

equals

public boolean equals(Object o)

Overrides:
equals in class AbstractSearchEntryHandler

hashCode

public int hashCode()
Description copied from class: AbstractSearchEntryHandler

Specified by:
hashCode in class AbstractSearchEntryHandler

toString

public String toString()

Overrides:
toString in class Object


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