if (currentPage.isFirstPage()) {
return currentPage;
}
List<Product> products = null;
ProductPage prevPage = null;
Query query = new Query();
try {
products = paginateQuery(query, type, currentPage.getPageNum() - 1);
} catch (CatalogException e) {
LOG.log(Level.WARNING,
"CatalogException getting prev page for product type: ["
+ type.getProductTypeId()
+ "] from catalog: Message: " + e.getMessage());
return null;
}
if (products == null || (products != null && products.size() == 0)) {
return prevPage;
} else {
// now construct the page
prevPage = new ProductPage();
prevPage.setPageNum(currentPage.getPageNum() - 1);
prevPage.setPageSize(pageSize);
prevPage.setTotalPages(currentPage.getTotalPages());
prevPage.setPageProducts(products);
}
return prevPage;
}