Can any body help me on how I can find some record from LDAP using springldap.
My problem is, I have created a rest service and it accepts some parameter. One is offset and another is limit. Offset parameter escape some record like if my ldap server have 500 record. Now if I give offset value 1 and LIMIT is 100. then it should give first 100 record from ldap. If I give offset value 100 and LIMIT is 100, then it should give 100 record after first 100 record from ldap. If I give offset value 50 and LIMIT is 10, then it should give 10 record after first 50 record from ldap.
I am stuck on how to set offset value in spring ldap template. I have set limit value and it is working fine.
I am sharing peace of code.
public OrganisationGroups getOrganisationGroup()
{
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
controls.setCountLimit(MAXIMUM_SEARCH_GROUP_COUNT);
AndFilter filter = new AndFilter();
filter.and(new EqualsFilter("objectclass", "groupOfUniqueNames"));
List<OrganisationGroup> organisationGroup = ldapTemplate.search("", filter.toString(), controls, new GroupSearchMapper());
OrganisationGroups groups = new OrganisationGroups();
groups.setOrganisationGroup(organisationGroup);
groups.setCount(organisationGroup.size());
return groups;
}
In this code I have set MAXIMUM_SEARCH_GROUP_COUNT variable to find out maximum record from ldap. But I am not able to set parameter or any other way to escape some records from beginning.