/** * Updates the provided list with an LDIF representation of the provided * search result entry to the given list, preceded by comments about any * controls that may be included with the entry. * * @param lines The list to which the formatted representation will be * added. * @param entry The entry to be formatted. * @param maxWidth The maximum length of each line in characters, including * any comment prefix and indent. */ public static void formatSearchResultEntry(final List<String> lines, final SearchResultEntry entry, final int maxWidth) { for (final Control c : entry.getControls()) { formatResponseControl(lines, c, true, 0, maxWidth); } lines.addAll(Arrays.asList(entry.toLDIF(maxWidth))); }
/** * Ensures that the provided search result entry does not includes any control * with the specified OID. * * @param entry The search result entry to examine. * @param oid The OID of the control which is not expected to be present * in the search result entry. * * @throws AssertionError If the provided search result entry includes any * control with the specified OID. */ public static void assertMissingControl(final SearchResultEntry entry, final String oid) throws AssertionError { for (final Control c : entry.getControls()) { if (c.getOID().equals(oid)) { throw new AssertionError(ERR_TEST_ENTRY_HAS_CONTROL.get( String.valueOf(entry), oid)); } } }
/** * {@inheritDoc} */ public void searchEntryReturned(final SearchResultEntry searchEntry) { try { clientConnection.sendSearchResultEntry(messageID, searchEntry, searchEntry.getControls()); } catch (final Exception e) { Debug.debugException(e); } }
/** * Ensures that the provided search result entry includes at least one control * with the specified OID. * * @param entry The search result entry to examine. * @param oid The OID of the control which is expected to be present in * the search result entry. * * @return The first control found with the specified OID. * * @throws AssertionError If the provided search result entry does not * include any control with the specified OID. */ public static Control assertHasControl(final SearchResultEntry entry, final String oid) throws AssertionError { for (final Control c : entry.getControls()) { if (c.getOID().equals(oid)) { return c; } } throw new AssertionError(ERR_TEST_ENTRY_MISSING_CONTROL.get( String.valueOf(entry), oid)); }
/** * {@inheritDoc} */ public void sendSearchEntry(final Entry entry) throws LDAPException { final Control[] controls; if (entry instanceof SearchResultEntry) { controls = ((SearchResultEntry) entry).getControls(); } else { controls = null; } getClientConnection().sendSearchResultEntry(getMessageID(), new SearchResultEntryProtocolOp(entry), controls); }
lastControls.set(e.getControls()); return new LDAPEntry(e);
/** * {@inheritDoc} */ public void searchEntryReturned(final SearchResultEntry searchEntry) { SearchResultEntry sre; if (entryTransformations == null) { sre = searchEntry; } else { Entry e = searchEntry; for (final EntryTransformation t : entryTransformations) { e = t.transformEntry(e); } sre = new SearchResultEntry(searchEntry.getMessageID(), e, searchEntry.getControls()); } outputHandler.formatSearchResultEntry(sre); }
e.getSearchEntry().getControls());
connection.sendSearchResultEntry(messageID, e, e.getControls());
/** * {@inheritDoc} */ @Override() public void formatSearchResultEntry(final SearchResultEntry entry) { jsonBuffer.clear(); jsonBuffer.beginObject(); jsonBuffer.appendString("result-type", "entry"); jsonBuffer.appendString("dn", entry.getDN()); jsonBuffer.beginArray("attributes"); for (final Attribute a : entry.getAttributes()) { jsonBuffer.beginObject(); jsonBuffer.appendString("name", a.getName()); jsonBuffer.beginArray("values"); for (final String value : a.getValues()) { jsonBuffer.appendString(value); } jsonBuffer.endArray(); jsonBuffer.endObject(); } jsonBuffer.endArray(); handleControls(entry.getControls()); jsonBuffer.endObject(); ldapSearch.writeOut(jsonBuffer.toString()); }