return getFreemarker().build(JSON_DIR + "portfolios.ftl", out);
}
private FlexiBean createSearchResultData(PagingRequest pr, PortfolioSearchSortOrder sort, String name,
List<String> portfolioIdStrs, List<String> nodeIdStrs, Boolean includeHidden) {
FlexiBean out = createRootData();
PortfolioSearchRequest searchRequest = new PortfolioSearchRequest();
searchRequest.setPagingRequest(pr);
searchRequest.setSortOrder(sort);
searchRequest.setName(StringUtils.trimToNull(name));
searchRequest.setDepth(1); // see PLAT-1733, also, depth is set to 1 for knowing # of childNodes for UI tree
searchRequest.setIncludePositions(true); // initially false because of PLAT-2012, now true for portfolio tree
if (BooleanUtils.isTrue(includeHidden)) {
searchRequest.setVisibility(DocumentVisibility.HIDDEN);
}
for (String portfolioIdStr : portfolioIdStrs) {
searchRequest.addPortfolioObjectId(ObjectId.parse(portfolioIdStr));
}
for (String nodeIdStr : nodeIdStrs) {
searchRequest.addNodeObjectId(ObjectId.parse(nodeIdStr));
}
out.put("searchRequest", searchRequest);
if (data().getUriInfo().getQueryParameters().size() > 0) {
PortfolioSearchResult searchResult = data().getPortfolioMaster().search(searchRequest);
out.put("searchResult", searchResult);
out.put("paging", new WebPaging(searchResult.getPaging(), data().getUriInfo()));
}
return out;
}