return getFreemarker().build(JSON_DIR + "exchanges.ftl", out);
}
private FlexiBean createSearchResultData(PagingRequest pr, ExchangeSearchSortOrder so, String name,
List<String> exchangeIdStrs, UriInfo uriInfo) {
FlexiBean out = createRootData();
ExchangeSearchRequest searchRequest = new ExchangeSearchRequest();
searchRequest.setPagingRequest(pr);
searchRequest.setSortOrder(so);
searchRequest.setName(StringUtils.trimToNull(name));
MultivaluedMap<String, String> query = uriInfo.getQueryParameters();
for (int i = 0; query.containsKey("idscheme." + i) && query.containsKey("idvalue." + i); i++) {
ExternalId id = ExternalId.of(query.getFirst("idscheme." + i), query.getFirst("idvalue." + i));
searchRequest.addExternalId(id);
}
for (String exchangeIdStr : exchangeIdStrs) {
searchRequest.addObjectId(ObjectId.parse(exchangeIdStr));
}
out.put("searchRequest", searchRequest);
if (data().getUriInfo().getQueryParameters().size() > 0) {
ExchangeSearchResult searchResult = data().getExchangeMaster().search(searchRequest);
out.put("searchResult", searchResult);
out.put("paging", new WebPaging(searchResult.getPaging(), uriInfo));
}
return out;
}