/** * Get a first page of Products using the pagination API. * * @param type * Gets the first page of products for this type. * @return The first page of products for this type. */ public ProductPage safeFirstPage(ProductType type) { if (!isConnected()) return ProductPage.blankPage(); ProductPage page = null; try { page = this.fmgrClient.getFirstPage(type); } catch (Exception e) { LOG.info("No products found for: " + type.getName()); } return page; }
/** * Get a first page of Products using the pagination API. * * @param type * Gets the first page of products for this type. * @return The first page of products for this type. */ public ProductPage safeFirstPage(ProductType type) { if (!isConnected()) return ProductPage.blankPage(); ProductPage page = null; try { page = this.fmgrClient.getFirstPage(type); } catch (Exception e) { LOG.info("No products found for: " + type.getName()); } return page; }
public ProductPage pagedQuery( Query query, ProductType type, int pageNum) throws CatalogException { ProductPage prodPage = null; try { prodPage = catalog.pagedQuery(this.getCatalogQuery(query, type), type, pageNum); if (prodPage == null) { prodPage = ProductPage.blankPage(); } else { // it is possible here that the underlying catalog did not // set the ProductType // to obey the contract of the File Manager, we need to make // sure its set here setProductType(prodPage.getPageProducts()); } } catch (Exception e) { e.printStackTrace(); LOG.log(Level.WARNING, "Catalog exception performing paged query for product type: [" + type.getProductTypeId() + "] query: [" + query + "]: Message: " + e.getMessage()); throw new CatalogException(e.getMessage()); } return prodPage; }
public ProductPage getNextPage(ProductType type, ProductPage currentPage) { if(type==null){ LOG.warning("getNextPage: Provided type was null: Returning blank page."); return ProductPage.blankPage(); + type.getProductTypeId() + "] from catalog: Message: " + e.getMessage()); return ProductPage.blankPage(); return ProductPage.blankPage();
public Map<String, Object> pagedQueryCore( Map<String, Object> queryHash, Map<String, Object> productTypeHash, int pageNum) throws CatalogException { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); Query query = XmlRpcStructFactory.getQueryFromXmlRpc(queryHash); ProductPage prodPage; try { prodPage = catalog.pagedQuery(this.getCatalogQuery(query, type), type, pageNum); if (prodPage == null) { prodPage = ProductPage.blankPage(); } else { // it is possible here that the underlying catalog did not // set the ProductType // to obey the contract of the File Manager, we need to make // sure its set here setProductType(prodPage.getPageProducts()); } } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Catalog exception performing paged query for product type: [" + type.getProductTypeId() + "] query: [" + query + "]: Message: " + e.getMessage()); throw new CatalogException(e.getMessage(), e); } return XmlRpcStructFactory.getXmlRpcProductPage(prodPage); }
public ProductPage getNextPage(ProductType type, ProductPage currentPage) { if(type==null){ LOG.warning("getNextPage: Provided type was null: Returning blank page."); return ProductPage.blankPage(); + type.getProductTypeId() + "] from catalog: Message: " + e.getMessage()); return ProductPage.blankPage(); return ProductPage.blankPage();
public ProductPage pagedQuery(Query query, ProductType type, int pageNum) throws CatalogException { int totalPages = PaginationUtils.getTotalPage(getResultListSize(query, type), this.pageSize); /* * if there are 0 total pages in the result list size then don't bother * returning a valid product page instead, return blank ProductPage */ if (totalPages == 0) { return ProductPage.blankPage(); } ProductPage retPage = new ProductPage(); retPage.setPageNum(pageNum); retPage.setPageSize(this.pageSize); retPage.setTotalPages(totalPages); List<String> productIds = paginateQuery(query, type, pageNum); if (productIds != null && productIds.size() > 0) { List<Product> products = new Vector<Product>(productIds.size()); for (String productId : productIds) { Product p = getProductById(productId); products.add(p); } retPage.setPageProducts(products); } return retPage; }
public ProductPage pagedQuery(Query query, ProductType type, int pageNum) throws CatalogException { int totalPages = PaginationUtils.getTotalPage( getResultListSize(query, type), this.pageSize); /* * if there are 0 total pages in the result list size then don't bother * returning a valid product page instead, return blank ProductPage */ if (totalPages == 0) { return ProductPage.blankPage(); } ProductPage retPage = new ProductPage(); retPage.setPageNum(pageNum); retPage.setPageSize(this.pageSize); retPage.setTotalPages(totalPages); List<String> productIds = paginateQuery(query, type, pageNum); if (productIds != null && productIds.size() > 0) { List<Product> products = new Vector<Product>(productIds.size()); for (String productId : productIds) { Product p = getProductById(productId); products.add(p); } retPage.setPageProducts(products); } return retPage; }
public Map<String, Object> pagedQueryCore( Map<String, Object> queryHash, Map<String, Object> productTypeHash, int pageNum) throws CatalogException { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); Query query = XmlRpcStructFactory.getQueryFromXmlRpc(queryHash); ProductPage prodPage; try { prodPage = catalog.pagedQuery(this.getCatalogQuery(query, type), type, pageNum); if (prodPage == null) { prodPage = ProductPage.blankPage(); } else { // it is possible here that the underlying catalog did not // set the ProductType // to obey the contract of the File Manager, we need to make // sure its set here setProductType(prodPage.getPageProducts()); } } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.WARNING, "Catalog exception performing paged query for product type: [" + type.getProductTypeId() + "] query: [" + query + "]: Message: " + e.getMessage()); throw new CatalogException(e.getMessage(), e); } return XmlRpcStructFactory.getXmlRpcProductPage(prodPage); }
public ProductPage pagedQuery(Query query, ProductType type, int pageNum) throws CatalogException { int totalPages = PaginationUtils.getTotalPage( getResultListSize(query, type), this.pageSize); /* * if there are 0 total pages in the result list size then don't bother * returning a valid product page instead, return blank ProductPage */ if (totalPages == 0) { return ProductPage.blankPage(); } ProductPage retPage = new ProductPage(); retPage.setPageNum(pageNum); retPage.setPageSize(this.pageSize); retPage.setTotalPages(totalPages); List<String> productIds = paginateQuery(query, type, pageNum); if (productIds != null && productIds.size() > 0) { List<Product> products = new Vector<Product>(productIds.size()); for (String productId : productIds) { Product p = getProductById(productId); products.add(p); } retPage.setPageProducts(products); } return retPage; }
public ProductPage pagedQuery(Query query, ProductType type, int pageNum) throws CatalogException { int totalPages = PaginationUtils.getTotalPage(getResultListSize(query, type), this.pageSize); /* * if there are 0 total pages in the result list size then don't bother * returning a valid product page instead, return blank ProductPage */ if (totalPages == 0) { return ProductPage.blankPage(); } ProductPage retPage = new ProductPage(); retPage.setPageNum(pageNum); retPage.setPageSize(this.pageSize); retPage.setTotalPages(totalPages); List<String> productIds = paginateQuery(query, type, pageNum); if (productIds != null && productIds.size() > 0) { List<Product> products = new Vector<Product>(productIds.size()); for (String productId : productIds) { Product p = getProductById(productId); products.add(p); } retPage.setPageProducts(products); } return retPage; }
public ProductPage getPrevPage(ProductType type, ProductPage currentPage) { if(type==null){ LOG.warning("getPrevPage: Provided type was null: Returning blank page."); return ProductPage.blankPage();
public ProductPage getPrevPage(ProductType type, ProductPage currentPage) { if(type==null){ LOG.warning("getPrevPage: Provided type was null: Returning blank page."); return ProductPage.blankPage();