org.springframework.ldap.control.PagedResultsDirContextProcessor Java Examples

The following examples show how to use org.springframework.ldap.control.PagedResultsDirContextProcessor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LdapUserGroupProvider.java    From nifi-registry with Apache License 2.0 4 votes vote down vote up
private boolean hasMorePages(final DirContextProcessor processor ) {
    return processor instanceof PagedResultsDirContextProcessor && ((PagedResultsDirContextProcessor) processor).hasMore();
}
 
Example #2
Source File: LdapUserGroupProvider.java    From nifi with Apache License 2.0 4 votes vote down vote up
private boolean hasMorePages(final DirContextProcessor processor ) {
    return processor instanceof PagedResultsDirContextProcessor && ((PagedResultsDirContextProcessor) processor).hasMore();
}
 
Example #3
Source File: PagedSearchITest.java    From spring-ldap with Apache License 2.0 4 votes vote down vote up
@Test
public void testPaged() {
    final SearchControls searchControls = new SearchControls();
    searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);

    // There  should be three pages of three entries, and one final page with one entry
    final PagedResultsDirContextProcessor processor = new PagedResultsDirContextProcessor(3);

    SingleContextSource.doWithSingleContext(contextSource, new LdapOperationsCallback<Object>() {
        @Override
        public Object doWithLdapOperations(LdapOperations operations) {
            List<String> result = operations.search(
                    "ou=People",
                    "(&(objectclass=person))",
                    searchControls,
                    CN_ATTRIBUTES_MAPPER,
                    processor);
            assertThat(result).hasSize(3);

            result = operations.search(
                    "ou=People",
                    "(&(objectclass=person))",
                    searchControls,
                    CN_ATTRIBUTES_MAPPER,
                    processor);
            assertThat(result).hasSize(3);

            result = operations.search(
                    "ou=People",
                    "(&(objectclass=person))",
                    searchControls,
                    CN_ATTRIBUTES_MAPPER,
                    processor);
            assertThat(result).hasSize(3);

            result = operations.search(
                    "ou=People",
                    "(&(objectclass=person))",
                    searchControls,
                    CN_ATTRIBUTES_MAPPER,
                    processor);
            assertThat(result).hasSize(1);

            assertThat(processor.hasMore()).isFalse();
            return null;
        }
    });

}