public static Map<String, Object> getXmlRpcProductPage(ProductPage page) { Hashtable<String, Object> productPageHash = new Hashtable<String, Object>(); productPageHash.put("totalPages", page.getTotalPages()); productPageHash.put("pageNum", page.getPageNum()); productPageHash.put("pageSize", page.getPageSize()); productPageHash.put("pageProducts", getXmlRpcProductList(page .getPageProducts())); return productPageHash; }
public static Map<String, Object> getXmlRpcProductPage(ProductPage page) { Hashtable<String, Object> productPageHash = new Hashtable<String, Object>(); productPageHash.put("totalPages", page.getTotalPages()); productPageHash.put("pageNum", page.getPageNum()); productPageHash.put("pageSize", page.getPageSize()); productPageHash.put("pageProducts", getXmlRpcProductList(page .getPageProducts())); return productPageHash; }
public ProductPage getNextPage(ProductType type , ProductPage currPage) { LOG.fine("Getting next page for : " + type.toString()); ProductPage page = catalog.getNextPage(type, currPage); try { setProductType(page.getPageProducts()); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to set product types for product page list: [" + page + "]"); } return page; }
public ProductPage getLastPage(ProductType type) { LOG.fine("Getting last page for : " + type.toString()); logger.debug("Getting last page for : {}", type); ProductPage page = catalog.getLastProductPage(type); try { setProductType(page.getPageProducts()); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to set product types for product page list: [" + page + "]"); } return page; }
public ProductPage getFirstPage(ProductType type) { logger.debug("Getting first page for product type : {}", type.toString()); ProductPage page = catalog.getFirstPage(type); try { setProductType(page.getPageProducts()); } catch (Exception e) { logger.error("Unable to set product type for product page: {}", page, e); } return page; }
public ProductPage getPrevPage(ProductType type, ProductPage currPage) { LOG.fine("Getting previous page for : " + type.toString()); ProductPage page = catalog.getPrevPage(type, currPage); try { setProductType(page.getPageProducts()); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to set product types for product page list: [" + page + "]"); } return page; }
public Map<String, Object> getFirstPageCore( Map<String, Object> productTypeHash) { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); ProductPage page = catalog.getFirstPage(type); try { setProductType(page.getPageProducts()); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to set product types for product page list: [" + page + "]"); } return XmlRpcStructFactory.getXmlRpcProductPage(page); }
public Map<String, Object> getFirstPageCore( Map<String, Object> productTypeHash) { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); ProductPage page = catalog.getFirstPage(type); try { setProductType(page.getPageProducts()); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to set product types for product page list: [" + page + "]"); } return XmlRpcStructFactory.getXmlRpcProductPage(page); }
public Map<String, Object> getLastPageCore( Map<String, Object> productTypeHash) { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); ProductPage page = catalog.getLastProductPage(type); try { setProductType(page.getPageProducts()); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to set product types for product page list: [" + page + "]"); } return XmlRpcStructFactory.getXmlRpcProductPage(page); }
public static AvroProductPage getAvroProductPage(ProductPage productPage){ List<AvroProduct> avroProducts = new ArrayList<AvroProduct>(); for (Product ap : productPage.getPageProducts()){ avroProducts.add(getAvroProduct(ap)); } return new AvroProductPage(productPage.getPageNum(), productPage.getTotalPages(), productPage.getPageSize(), avroProducts, productPage.getNumOfHits()); }
public Map<String, Object> getLastPageCore( Map<String, Object> productTypeHash) { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); ProductPage page = catalog.getLastProductPage(type); try { setProductType(page.getPageProducts()); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to set product types for product page list: [" + page + "]"); } return XmlRpcStructFactory.getXmlRpcProductPage(page); }
private void computeStartEndIdx() { if (this.productPage.getTotalPages() == 1) { this.totalProducts = this.productPage.getPageProducts().size(); this.pageNum = 1; } else if (productPage.getTotalPages() == 0) { this.totalProducts = 0; this.pageNum = 1; } else { this.totalProducts = (productPage.getTotalPages() - 1) * PAGE_SIZE; this.pageNum = this.productPage.getPageNum(); // get the last page ProductPage lastPage; Query query = new Query(); query.getCriteria().addAll(this.criteria); try { lastPage = fm.getFm().pagedQuery(query, this.type, this.productPage.getTotalPages()); this.totalProducts += lastPage.getPageProducts().size(); } catch (Exception ignore) { } } this.endIdx = this.totalProducts != 0 ? Math.min(this.totalProducts, (PAGE_SIZE) * (this.pageNum)) : 0; this.startIdx = this.totalProducts != 0 ? ((this.pageNum - 1) * PAGE_SIZE) + 1 : 0; }
private void computeStartEndIdx() { if (this.productPage.getTotalPages() == 1) { this.totalProducts = this.productPage.getPageProducts().size(); this.pageNum = 1; } else if (productPage.getTotalPages() == 0) { this.totalProducts = 0; this.pageNum = 1; } else { this.totalProducts = (productPage.getTotalPages() - 1) * PAGE_SIZE; this.pageNum = this.productPage.getPageNum(); // get the last page ProductPage lastPage; Query query = new Query(); query.getCriteria().addAll(this.criteria); try { lastPage = fm.getFm().pagedQuery(query, this.type, this.productPage.getTotalPages()); this.totalProducts += lastPage.getPageProducts().size(); } catch (Exception ignore) { } } this.endIdx = this.totalProducts != 0 ? Math.min(this.totalProducts, (PAGE_SIZE) * (this.pageNum)) : 0; this.startIdx = this.totalProducts != 0 ? ((this.pageNum - 1) * PAGE_SIZE) + 1 : 0; }
public ProductPage getFirstPage(ProductType type) { logger.debug("Getting first page for product type: {}", type); ProductPage firstPage = new ProductPage(); List<Product> products; Query query = new Query(); // now construct the page firstPage.setPageNum(1); firstPage.setPageSize(pageSize); try { products = paginateQuery(query, type, 1, firstPage); } catch (CatalogException e) { LOG.log(Level.WARNING, "CatalogException getting first page for product type: [" + type.getProductTypeId() + "] from catalog: Message: " + e.getMessage()); logger.error("Unable to get first page for product type: {} - {}", type, e.getMessage()); return null; } // There are no products and thus no first page if (products == null || (products.size() == 0)) { logger.warn("No product found for first page for product type: {}", type); return null; } firstPage.setPageProducts(products); logger.debug("Found first page with products: {}", firstPage.getPageProducts()); return firstPage; }
public Map<String, Object> getNextPageCore( Map<String, Object> productTypeHash, Map<String, Object> currentPageHash) { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); ProductPage currPage = XmlRpcStructFactory .getProductPageFromXmlRpc(currentPageHash); ProductPage page = catalog.getNextPage(type, currPage); try { setProductType(page.getPageProducts()); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to set product types for product page list: [" + page + "]"); } return XmlRpcStructFactory.getXmlRpcProductPage(page); }
public Map<String, Object> getPrevPageCore( Map<String, Object> productTypeHash, Map<String, Object> currentPageHash) { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); ProductPage currPage = XmlRpcStructFactory .getProductPageFromXmlRpc(currentPageHash); ProductPage page = catalog.getPrevPage(type, currPage); try { setProductType(page.getPageProducts()); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to set product types for product page list: [" + page + "]"); } return XmlRpcStructFactory.getXmlRpcProductPage(page); }
public Map<String, Object> getNextPageCore( Map<String, Object> productTypeHash, Map<String, Object> currentPageHash) { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); ProductPage currPage = XmlRpcStructFactory .getProductPageFromXmlRpc(currentPageHash); ProductPage page = catalog.getNextPage(type, currPage); try { setProductType(page.getPageProducts()); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to set product types for product page list: [" + page + "]"); } return XmlRpcStructFactory.getXmlRpcProductPage(page); }
public Map<String, Object> getPrevPageCore( Map<String, Object> productTypeHash, Map<String, Object> currentPageHash) { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); ProductPage currPage = XmlRpcStructFactory .getProductPageFromXmlRpc(currentPageHash); ProductPage page = catalog.getPrevPage(type, currPage); try { setProductType(page.getPageProducts()); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to set product types for product page list: [" + page + "]"); } return XmlRpcStructFactory.getXmlRpcProductPage(page); }
private void exportTypeToDest(ProductType type) throws CatalogException, RepositoryManagerException { ProductPage page; if (this.srcCatalog != null) { page = srcCatalog.getFirstPage(type); } else { page = sourceClient.getFirstPage(type); } if (page == null) { return; } exportProductsToDest(page.getPageProducts(), type); while (!page.isLastPage()) { if (this.srcCatalog != null) { page = srcCatalog.getNextPage(type, page); } else { page = sourceClient.getNextPage(type, page); } if (page == null) { break; } exportProductsToDest(page.getPageProducts(), type); } }
private void exportTypeToDest(ProductType type) throws CatalogException, RepositoryManagerException { ProductPage page; if (this.srcCatalog != null) { page = srcCatalog.getFirstPage(type); } else { page = sourceClient.getFirstPage(type); } if (page == null) { return; } exportProductsToDest(page.getPageProducts(), type); while (!page.isLastPage()) { if (this.srcCatalog != null) { page = srcCatalog.getNextPage(type, page); } else { page = sourceClient.getNextPage(type, page); } if (page == null) { break; } exportProductsToDest(page.getPageProducts(), type); } }