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

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


     *
     * @see org.apache.oodt.cas.filemgr.util.Pagination#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, "Exception getting first page: Message: "
View Full Code Here


     * (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

                .getPageProducts()));
        return productPageHash;
    }

    public static ProductPage getProductPageFromXmlRpc(Hashtable<String, Object> productPageHash) {
        ProductPage page = new ProductPage();
        page.setPageNum(((Integer) productPageHash.get("pageNum")).intValue());
        page
                .setPageSize(((Integer) productPageHash.get("pageSize"))
                        .intValue());
        page.setTotalPages(((Integer) productPageHash.get("totalPages"))
                .intValue());
        page.setPageProducts(getProductListFromXmlRpc((Vector<Hashtable<String, Object>>) productPageHash
                .get("pageProducts")));
        return page;
    }
View Full Code Here

        List sourceProductTypes = sourceClient.getProductTypes();
        doExpImport(sourceProductTypes);
    }

    private void exportTypeToDest(ProductType type) throws Exception {
        ProductPage page = null;

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

    @Override
    public ProductPage pagedQuery(Query query, ProductType type, int pageNum)
            throws CatalogException {
        String origProductTypeName = type.getName();
        type.setName(getProductTypeTableName(origProductTypeName));
        ProductPage page = super.pagedQuery(query, type, pageNum);
        type.setName(origProductTypeName);
        return page;
    }
View Full Code Here

    if (types != null && types.size() > 0) {
      products = new Vector<Product>();
      for (Iterator<ProductType> i = types.iterator(); i.hasNext();) {
        ProductType type = i.next();

        ProductPage page = null;

        try {
          page = fClient.getFirstPage(type);

          if (page != null) {

            while (true) {
              products.addAll(page.getPageProducts());
              if (!page.isLastPage()) {
                page = fClient.getNextPage(type, page);
              } else
                break;
            }
          }
View Full Code Here

    // use the pagination API to iterate over each product
    // for each product, zip it up
    // after you zip up all products then create the dataset zip

    ProductPage page = null;

    try {
      page = client.getFirstPage(type);
      if (page == null
          || (page != null && page.getPageProducts() == null)
          || (page != null && page.getPageProducts() != null && page
              .getPageProducts().size() == 0)) {
        throw new ServletException("No products for dataset: ["
            + type.getName() + "]");
      }

      Map productHash = new HashMap();

      do {
        for (Iterator i = page.getPageProducts().iterator(); i.hasNext();) {
          Product product = (Product) i.next();
          if (alreadyZipped(product, productHash)) {
            continue;
          }

          Metadata metadata = null;
          product.setProductReferences(client.getProductReferences(product));
          metadata = client.getMetadata(product);
          DataUtils.createProductZipFile(product, metadata, productDirPath);
          productHash.put(product.getProductName(), ALREADY_ZIPPED);
        }

        page = client.getNextPage(type, page);

      } while ((page != null && !page.isLastPage())
          && (page.getPageProducts() != null && page.getPageProducts().size() > 0));
    } catch (Exception e) {
      e.printStackTrace();
      throw new ServletException(e.getMessage());
    }
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.