// - 0 to n SearchResultEntry
// - O to n SearchResultReference
// - 1 (only) SearchResultDone
// So we have to include those individual reponses in a "General" SearchResponse
// Element searchResponse = xmlResponse.getRootElement().addElement( "searchResponse" );
SearchResponseDsml searchResponseDsml = new SearchResponseDsml();
// RequestID
int requestID = response.getMessageId();
if ( requestID != 0 )
{
searchResponseDsml.setMessageId( requestID );
}
while ( LdapConstants.SEARCH_RESULT_DONE != response.getMessageType() )
{
if ( LdapConstants.SEARCH_RESULT_ENTRY == response.getMessageType() )
{
SearchResultEntry sre = response.getSearchResultEntry();
copyMessageIdAndControls( response, sre );
SearchResultEntryDsml searchResultEntryDsml = new SearchResultEntryDsml( sre );
searchResponseDsml.addResponse( searchResultEntryDsml );
}
else if ( LdapConstants.SEARCH_RESULT_REFERENCE == response.getMessageType() )
{
SearchResultReference srr = response.getSearchResultReference();
copyMessageIdAndControls( response, srr );
SearchResultReferenceDsml searchResultReferenceDsml = new SearchResultReferenceDsml( srr );
searchResponseDsml.addResponse( searchResultReferenceDsml );
}
response = readResponse( bb );
}
SearchResultDone srd = response.getSearchResultDone();
copyMessageIdAndControls( response, srd );
SearchResultDoneDsml searchResultDoneDsml = new SearchResultDoneDsml( response );
searchResponseDsml.addResponse( searchResultDoneDsml );
}
LdapResponse realResponse = response.getLdapResponse();
if ( !continueOnError )