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

        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

         ProductType type = client.getProductTypeByName(productTypeName);
         if (type == null) {
            throw new Exception("FileManager returned null ProductType");
         }
         ProductPage firstPage = client.getFirstPage(type);
         if (firstPage == null) {
            throw new Exception("FileManager returned null first ProductPage");
         }
         ProductPage currentPage = new ProductPage();
         currentPage.setPageNum(currentPageNum);
         currentPage.setPageSize(firstPage.getPageSize());
         currentPage.setTotalPages(firstPage.getTotalPages());
         ProductPage nextPage = client.getNextPage(type, currentPage);
         if (nextPage == null) {
            throw new Exception("FileManager returned null next ProductPage");
         }
         printer.println("Page: [num=" + nextPage.getPageNum()
               + ", totalPages=" + nextPage.getTotalPages() + ", pageSize="
               + nextPage.getPageSize() + "]");
         printer.println("Products:");

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

         ProductType type = client.getProductTypeByName(productTypeName);
         if (type == null) {
            throw new Exception("FileManager returned null ProductType");
         }
         ProductPage firstPage = client.getFirstPage(type);
         if (firstPage == null) {
            throw new Exception("FileManager returned null first ProductPage");
         }
         ProductPage currentPage = new ProductPage();
         currentPage.setPageNum(currentPageNum);
         currentPage.setPageSize(firstPage.getPageSize());
         currentPage.setTotalPages(firstPage.getTotalPages());
         ProductPage prevPage = client.getPrevPage(type, currentPage);
         if (prevPage == null) {
            throw new Exception("FileManager returned null previous ProductPage");
         }
         printer.println("Page: [num=" + prevPage.getPageNum()
               + ", totalPages=" + prevPage.getTotalPages() + ", pageSize="
               + prevPage.getPageSize() + "]");
         printer.println("Products:");

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

            int pageNum) throws CatalogException {
        ProductType type = XmlRpcStructFactory
                .getProductTypeFromXmlRpc(productTypeHash);
        Query query = XmlRpcStructFactory.getQueryFromXmlRpc(queryHash);

        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: ["
View Full Code Here

    public Hashtable<String, Object> getFirstPage(
            Hashtable<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 + "]");
        }
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.