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

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


    public Hashtable<String, Object> getPrevPage(
            Hashtable<String, Object> productTypeHash,
            Hashtable<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 + "]");
        }
View Full Code Here


         ProductType type = client.getProductTypeByName(productTypeName);
         if (type == null) {
            throw new Exception("FileManager returned null ProductType");
         }
         ProductPage lastPage = client.getLastPage(type);
         if (lastPage == null) {
            throw new Exception("FileManager returned null ProductPage");
         }
         printer.println("Page: [num=" + lastPage.getPageNum()
               + ", totalPages=" + lastPage.getTotalPages() + ", pageSize="
               + lastPage.getPageSize() + "]");
         printer.println("Products:");

         if (lastPage.getPageProducts() == null) {
            throw new NullPointerException(
                  "FileManager returned null page Products");
         }
         for (Product p : lastPage.getPageProducts()) {
            printer.println("Product: [id=" + p.getProductId() + ",name="
                  + p.getProductName() + ",type="
                  + p.getProductType().getName() + ",structure="
                  + p.getProductStructure() + ", transferStatus="
                  + p.getTransferStatus() + "]");
View Full Code Here

  private String getProductsForProductType(String policy,
      String productTypeName,
      String format, int pageNum) {
   
    ProductType productType;
    ProductPage page;
    try {
      productType = this.config.getFileManagerClient().getProductTypeByName(
          productTypeName);
      page = this.config.getFileManagerClient().pagedQuery(new Query(),
          productType, pageNum);
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

    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

    } else {
      this.totalProducts = (productPage.getTotalPages() - 1) * PAGE_SIZE;
      this.pageNum = this.productPage.getPageNum();

      // get the last page
      ProductPage lastPage = null;
      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;
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

    public ProductPage getFirstPage(ProductType type) throws CatalogException {
        Vector<Object> argList = new Vector<Object>();
        argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));

        ProductPage page = null;
        Hashtable<String, Object> pageHash = null;

        try {
            pageHash = (Hashtable<String, Object>) client.execute(
                    "filemgr.getFirstPage", argList);
View Full Code Here

   * 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,
View Full Code Here

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

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.