use of org.ldaptive.control.util.PagedResultsClient in project cas by apereo.
the class LdapUtils method executeSearchOperation.
/**
* Execute search operation.
*
* @param connectionFactory the connection factory
* @param baseDn the base dn
* @param filter the filter
* @param pageSize the page size
* @param binaryAttributes the binary attributes
* @param returnAttributes the return attributes
* @return the response
* @throws LdapException the ldap exception
*/
public static SearchResponse executeSearchOperation(final ConnectionFactory connectionFactory, final String baseDn, final FilterTemplate filter, final int pageSize, final String[] binaryAttributes, final String[] returnAttributes) throws LdapException {
val request = LdapUtils.newLdaptiveSearchRequest(baseDn, filter, binaryAttributes, returnAttributes);
if (pageSize <= 0) {
val searchOperation = new SearchOperation(connectionFactory);
searchOperation.setSearchResultHandlers(new FollowSearchReferralHandler());
return searchOperation.execute(request);
}
val client = new PagedResultsClient(connectionFactory, pageSize);
return client.executeToCompletion(request);
}
Aggregations