public LDAPEntry read( final String dn, final String[] attrs, final LDAPSearchConstraints constraints) throws LDAPException { final Filter filter = Filter.createORFilter( Filter.createPresenceFilter("objectClass"), Filter.createEqualityFilter("objectClass", "ldapSubentry")); final SearchRequest searchRequest = new SearchRequest(dn, SearchScope.BASE, filter, attrs); update(searchRequest, constraints); try { final SearchResult searchResult = conn.search(searchRequest); setResponseControls(searchResult); if (searchResult.getEntryCount() != 1) { throw new LDAPException(null, LDAPException.NO_RESULTS_RETURNED); } return new LDAPEntry(searchResult.getSearchEntries().get(0)); } catch (com.hwlcn.ldap.ldap.sdk.LDAPException le) { debugException(le); setResponseControls(le); throw new LDAPException(le); } }
public static SimplePagedResultsControl get(final SearchResult result) throws LDAPException { final Control c = result.getResponseControl(PAGED_RESULTS_OID); if (c == null) { return null; } if (c instanceof SimplePagedResultsControl) { return (SimplePagedResultsControl) c; } else { return new SimplePagedResultsControl(c.getOID(), c.isCritical(), c.getValue()); } }