use of org.forgerock.opendj.ldap.SortKey in project OpenAM by OpenRock.
the class SMSLdapObject method getSearchRequest.
private SearchRequest getSearchRequest(String dn, String filter, SearchScope scope, int numOfEntries, int timeLimit, boolean sortResults, boolean ascendingOrder, String sortAttribute, String... attributes) {
SearchRequest request = LDAPRequests.newSearchRequest(dn, scope, filter, attributes).setDereferenceAliasesPolicy(DereferenceAliasesPolicy.NEVER).setTimeLimit(timeLimit);
if (numOfEntries > 0) {
request.setSizeLimit(numOfEntries);
}
if (sortResults) {
SortKey sortKey = new SortKey(sortAttribute, !ascendingOrder);
request.addControl(ServerSideSortRequestControl.newControl(true, sortKey));
}
return request;
}
Aggregations