Package org.apache.oodt.cas.filemgr.structs

Examples of org.apache.oodt.cas.filemgr.structs.ProductPage


     * (non-Javadoc)
     *
     * @see org.apache.oodt.cas.filemgr.util.Pagination#getLastProductPage(org.apache.oodt.cas.filemgr.structs.ProductType)
     */
    public ProductPage getLastProductPage(ProductType type) {
        ProductPage lastPage = null;
        ProductPage firstPage = getFirstPage(type);
        Query query = new Query();
        try {
            lastPage = pagedQuery(query, type, firstPage.getTotalPages());
        } catch (CatalogException e) {
            LOG.log(Level.WARNING, "Exception getting last page: Message: "
                    + e.getMessage());
        }

View Full Code Here


        if (currentPage.isLastPage()) {
            return currentPage;
        }

        ProductPage nextPage = null;
        Query query = new Query();

        try {
            nextPage = pagedQuery(query, type, currentPage.getPageNum() + 1);
        } catch (CatalogException e) {
View Full Code Here

        }

        if (currentPage.isFirstPage()) {
            return currentPage;
        }
        ProductPage prevPage = null;
        Query query = new Query();

        try {
            prevPage = pagedQuery(query, type, currentPage.getPageNum() - 1);
        } catch (CatalogException e) {
View Full Code Here

         */
        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 (Iterator<String> i = productIds.iterator(); i.hasNext();) {
                String productId = i.next();
                Product p = getProductById(productId);
                products.add(p);
            }

            retPage.setPageProducts(products);
        }

        return retPage;
    }
View Full Code Here

 
  /**
   * Suppresses exception that occurred with older file managers.
   */
  private ProductPage safeFirstPage(XmlRpcFileManagerClient fmClient, ProductType type) {
    ProductPage page = null;
    try {
      page = fmClient.getFirstPage(type);
    } catch (Exception e) {
      LOG.info("No products found for: " + type.getName());
    }
View Full Code Here

             */
            if (totalPages == 0) {
                return ProductPage.blankPage();
            }

            ProductPage retPage = new ProductPage();
            retPage.setPageNum(pageNum);
            retPage.setPageSize(this.pageSize);
            retPage.setTotalPages(totalPages);

            List productIds = paginateQuery(query, type, pageNum);

            if (productIds != null && productIds.size() > 0) {
                List products = new Vector(productIds.size());

                for (Iterator i = productIds.iterator(); i.hasNext();) {
                    String productId = (String) i.next();
                    Product p = getProductById(productId);
                    products.add(p);
                }

                retPage.setPageProducts(products);
            }

            return retPage;
        }
View Full Code Here

         *
         * @see org.apache.oodt.cas.filemgr.catalog.DataSourceCatalog#getFirstPage(org.apache.oodt.cas.filemgr.structs.ProductType)
         */
        public ProductPage getFirstPage(ProductType type) {
            Query query = new Query();
            ProductPage firstPage = null;

            try {
                firstPage = pagedQuery(query, type, 1);
            } catch (CatalogException e) {
                LOG.log(Level.WARNING,
View Full Code Here

            if (currentPage.isLastPage()) {
                return currentPage;
            }

            ProductPage nextPage = null;
            Query query = new Query();

            try {
                nextPage = pagedQuery(query, type, currentPage.getPageNum() + 1);
            } catch (CatalogException e) {
View Full Code Here

        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;
    }
View Full Code Here

     *      org.apache.oodt.cas.filemgr.structs.ProductType, int)
     */
    public ProductPage pagedQuery(Query query, ProductType type, int pageNum)
            throws CatalogException {
        try {
            ProductPage retPage = new ProductPage();
            retPage.setPageNum(pageNum);
            retPage.setPageSize(pageSize);
            retPage.setTotalPages(PaginationUtils.getTotalPage(getNumHits(
                    query, type), pageSize));
            retPage.setPageProducts(paginateQuery(query, type, pageNum));
            return retPage;
        } catch (Exception e) {
            e.printStackTrace();
            LOG.log(Level.WARNING,
                    "CatalogException when doing paged product query: Message: "
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.filemgr.structs.ProductPage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.