public int compare(TransactionReceipt o1,
TransactionReceipt o2) {
return o2.getTransactionDate().compareTo(o1.getTransactionDate());
}
});
QueryPager queryPager = new QueryPager(transactionReceipts);
queryPager.setPageInfo(pageInfo);
return this.getPage(queryExpression, catalogIds, queryPager);
}else {
int currentIndex = 0;
int desiredStartingIndex = pageInfo.getPageNum() * pageInfo.getPageSize();
List<CatalogReceipt> pageOfReceipts = new Vector<CatalogReceipt>();
for (Entry<String, Integer> entry : catalogToSizeOfMap.entrySet()) {
if (desiredStartingIndex - currentIndex <= entry.getValue()) {
Catalog catalog = this.getCatalog(entry.getKey());
QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
if (qe != null) {
List<CatalogReceipt> receipts = catalog.query(qe, desiredStartingIndex - currentIndex, Math.min((desiredStartingIndex - currentIndex) + pageInfo.getPageSize(), entry.getValue()));
pageOfReceipts.addAll(receipts);
if (pageOfReceipts.size() >= pageInfo.getPageSize())
break;
}
}else {
currentIndex += entry.getValue();
}
}
return new Page(new ProcessedPageInfo(pageInfo.getPageSize(), pageInfo.getPageNum(), totalResults), queryExpression, catalogIds, this.indexReceipts(this.getPossiblyUnindexedTransactionReceipts(pageOfReceipts)));
}
}catch (Exception e) {
throw new CatalogServiceException(e.getMessage(), e);
}
}else {
QueryPager queryPager = new QueryPager(this._query(queryExpression, catalogIds));
queryPager.setPageInfo(pageInfo);
return this.getPage(queryExpression, catalogIds, queryPager);
}
}