Search in sources :

Example 1 with MergeResultHandler

use of org.ldaptive.handler.MergeResultHandler 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;
}
Also used : lombok.val(lombok.val) ArrayList(java.util.ArrayList) PrimaryGroupIdHandler(org.ldaptive.ad.handler.PrimaryGroupIdHandler) RangeEntryHandler(org.ldaptive.ad.handler.RangeEntryHandler) MergeResultHandler(org.ldaptive.handler.MergeResultHandler) RecursiveResultHandler(org.ldaptive.handler.RecursiveResultHandler)

Aggregations

ArrayList (java.util.ArrayList)1 lombok.val (lombok.val)1 PrimaryGroupIdHandler (org.ldaptive.ad.handler.PrimaryGroupIdHandler)1 RangeEntryHandler (org.ldaptive.ad.handler.RangeEntryHandler)1 MergeResultHandler (org.ldaptive.handler.MergeResultHandler)1 RecursiveResultHandler (org.ldaptive.handler.RecursiveResultHandler)1