use of org.ldaptive.handler.RecursiveResultHandler in project cas by apereo.
the class LdapUtils method newLdaptiveSearchResultHandlers.
/**
* New list of ldap search result handlers derived from the supplied properties.
*
* @param properties to inspect
* @return the list of search result handlers
*/
public static List<SearchResultHandler> newLdaptiveSearchResultHandlers(final List<LdapSearchEntryHandlersProperties> properties) {
val searchResultHandlers = new ArrayList<SearchResultHandler>();
properties.forEach(h -> {
switch(h.getType()) {
case PRIMARY_GROUP:
val ehp = new PrimaryGroupIdHandler();
val primaryGroupId = h.getPrimaryGroupId();
ehp.setBaseDn(primaryGroupId.getBaseDn());
ehp.setGroupFilter(primaryGroupId.getGroupFilter());
searchResultHandlers.add(ehp);
break;
case RANGE_ENTRY:
searchResultHandlers.add(new RangeEntryHandler());
break;
case RECURSIVE_ENTRY:
val recursive = h.getRecursive();
searchResultHandlers.add(new RecursiveResultHandler(recursive.getSearchAttribute(), recursive.getMergeAttributes().toArray(ArrayUtils.EMPTY_STRING_ARRAY)));
break;
case MERGE_ENTRIES:
default:
searchResultHandlers.add(new MergeResultHandler());
break;
}
});
return searchResultHandlers;
}
Aggregations