@SuppressWarnings("unchecked")
private FlexiBean search(PagingRequest request, ConfigSearchSortOrder so, String name,
String typeName, List<String> configIdStrs, UriInfo uriInfo) {
FlexiBean out = createRootData();
@SuppressWarnings("rawtypes")
ConfigSearchRequest searchRequest = new ConfigSearchRequest();
typeName = StringUtils.trimToNull(typeName);
if (typeName != null) {
Class<?> typeClazz = data().getTypeMap().get(typeName);
searchRequest.setType(typeClazz);
} else {
searchRequest.setType(Object.class);
}
searchRequest.setPagingRequest(request);
searchRequest.setSortOrder(so);
searchRequest.setName(StringUtils.trimToNull(name));
out.put("searchRequest", searchRequest);
out.put("type", typeName);
for (String configIdStr : configIdStrs) {
searchRequest.addConfigId(ObjectId.parse(configIdStr));
}
if (data().getUriInfo().getQueryParameters().size() > 0) {
ConfigSearchResult<Object> searchResult = null;
if (searchRequest.getType() != null) {
searchResult = data().getConfigMaster().search(searchRequest);
} else {
searchResult = new ConfigSearchResult<Object>();
searchResult.setPaging(Paging.of(searchRequest.getPagingRequest(), searchResult.getDocuments()));
}
out.put("searchResult", searchResult);
out.put("paging", new WebPaging(searchResult.getPaging(), uriInfo));
}
return out;