if (organizationObjectIds != null && organizationObjectIds.size() == 0) {
result.setPaging(Paging.of(request.getPagingRequest(), 0));
return result;
}
final DbMapSqlParameterSource args = new DbMapSqlParameterSource()
.addTimestamp("version_as_of_instant", vc.getVersionAsOf())
.addTimestamp("corrected_to_instant", vc.getCorrectedTo())
.addValueNullIgnored("obligor_short_name", getDialect().sqlWildcardAdjustValue(request.getObligorShortName()))
.addValueNullIgnored("obligor_red_code", getDialect().sqlWildcardAdjustValue(request.getObligorREDCode()))
.addValueNullIgnored("obligor_ticker", getDialect().sqlWildcardAdjustValue(request.getObligorTicker()));
args.addValue("paging_offset", request.getPagingRequest().getFirstItem());
args.addValue("paging_fetch", request.getPagingRequest().getPagingSize());
if (organizationObjectIds != null) {
StringBuilder buf = new StringBuilder(organizationObjectIds.size() * 10);
for (ObjectId objectId : organizationObjectIds) {
checkScheme(objectId);
buf.append(extractOid(objectId)).append(", ");
}
buf.setLength(buf.length() - 2);
args.addValue("sql_search_object_ids", buf.toString());
}
String[] sql = {getElSqlBundle().getSql("Search", args), getElSqlBundle().getSql("SearchCount", args)};
doSearch(request.getPagingRequest(), sql, args, new OrganizationDocumentExtractor(), result);
return result;