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

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


        if (n > this.pageSize) {
            numPages = n / this.pageSize + (n % this.pageSize == 0 ? 0 : 1);
        }

        List<Product> products = new Vector<Product>(n);
        Query query = new Query();

        for (int pageNum = 1; pageNum < numPages + 1; pageNum++) {
            List<Product> pageProducts = paginateQuery(query, type, pageNum);
            products.addAll(pageProducts);
        }
View Full Code Here


     * (non-Javadoc)
     *
     * @see org.apache.oodt.cas.filemgr.catalog.Catalog#getNumProducts(org.apache.oodt.cas.filemgr.structs.ProductType)
     */
    public int getNumProducts(ProductType type) throws CatalogException {
        Query query = new Query();
        return getNumHits(query, type);
    }
View Full Code Here

     * @see org.apache.oodt.cas.filemgr.util.Pagination#getFirstPage(org.apache.oodt.cas.filemgr.structs.ProductType)
     */
    public ProductPage getFirstPage(ProductType type) {
        ProductPage firstPage = null;
        List<Product> products = null;
        Query query = new Query();

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

     */
    public ProductPage getLastProductPage(ProductType type) {
        ProductPage lastPage = null;
        ProductPage firstPage = getFirstPage(type);
        List<Product> products = null;
        Query query = new Query();

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

            return currentPage;
        }

        List<Product> products = null;
        ProductPage nextPage = null;
        Query query = new Query();

        try {
            products = paginateQuery(query, type, currentPage.getPageNum() + 1);
        } catch (CatalogException e) {
            LOG.log(Level.WARNING,
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,
View Full Code Here

        List profs = new Vector();

        if (productTypeFilter != null && productTypeFilter.size() > 0) {
            for (Iterator i = productTypeFilter.iterator(); i.hasNext();) {
                ProductType type = (ProductType) i.next();
                Query cQuery = convertQuery(query);

                profs.addAll(queryAndBuildProfiles(type, cQuery));
            }
        }
View Full Code Here

        // iterate over the whereSet
        // when you find a elemName, grab the next query element
        // ensure it's a literal, if so, there's your term query

        // that's all we'll support for now
        Query query = new Query();

        if (xmlQuery.getWhereElementSet() != null
                && xmlQuery.getWhereElementSet().size() > 0) {
            for (Iterator i = xmlQuery.getWhereElementSet().iterator(); i
                    .hasNext();) {
                QueryElement elem = (QueryElement) i.next();
                if (elem.getRole().equals("elemName")) {
                    String elemName = elem.getValue();

                    // to get the elem value, we need to grab the next elem
                    // ensure it's a literal, and then grab it
                    QueryElement litElem = (QueryElement) i.next();
                    if (!litElem.getRole().equals("LITERAL")) {
                        LOG.log(Level.WARNING,
                                "next element not literal: element: ["
                                        + litElem + "]: malformed xml query!");
                        break;
                    }
                    String elemValue = litElem.getValue();
                    TermQueryCriteria crit = new TermQueryCriteria();
                    crit.setElementName(elemName);
                    crit.setValue(elemValue);
                    query.addCriterion(crit);
                }
            }
        }

        return query;
View Full Code Here

        prodMet.replaceMetadata("CAS.ProductName", "TestFile3");
        prodMet.replaceMetadata("DataVersion", "4.6");
        myCat.addMetadata(prodMet, testProduct);

        // perform first query
        Query query = new Query();
        query
                .addCriterion(SqlParser
                        .parseSqlWhereClause("CAS.ProductName != 'TestFile3' AND (Filename == 'test-file-1.txt' OR Filename == 'test-file-2.txt') AND CAS.ProductName != 'TestFile2'"));
        System.out.println(query);
        List<String> productIds = myCat.query(query, testProduct
                .getProductType());
        System.out.println(productIds);
        assertEquals("[23]", productIds.toString());

        // perform second query
        query = new Query();
        query
                .addCriterion(SqlParser
                        .parseSqlWhereClause("Filename == 'test-file-1.txt' OR (Filename == 'test-file-2.txt' AND CAS.ProductName != 'TestFile2')"));
        System.out.println(query);
        productIds = myCat.query(query, testProduct.getProductType());
        System.out.println(productIds);
        assertEquals("[25, 23]", productIds.toString());

        // perform second query
        query = new Query();
        query
                .addCriterion(SqlParser
                        .parseSqlWhereClause("NominalDate == '2008-01-20' AND DataVersion >= '3.6' AND DataVersion <= '4.0'"));
        System.out.println(query);
        productIds = myCat.query(query, testProduct.getProductType());
        System.out.println(productIds);
View Full Code Here

                fail(e.getMessage());
            }
      }
     
      // Formulate a test query
      Query query = new Query();
      BooleanQueryCriteria bqc = new BooleanQueryCriteria();
      try{
        bqc.setOperator(BooleanQueryCriteria.AND);
      }catch (Exception e){
        e.printStackTrace();
            fail(e.getMessage());
      }
      TermQueryCriteria tqc = new TermQueryCriteria();
      tqc.setElementName("ProductStructure");
      tqc.setValue("Flat");
      try{
        bqc.addTerm(tqc);
      }catch (Exception e){
        e.printStackTrace();
            fail(e.getMessage());
      }
      tqc = new TermQueryCriteria();
      tqc.setElementName("Filename");
      tqc.setValue("tempProduct1");
      try{
        bqc.addTerm(tqc);
      }catch (Exception e){
        e.printStackTrace();
            fail(e.getMessage());
      }
      query.addCriterion(bqc);
     
      // Perform the query and validate results
      ProductPage page = null;
      try{
        page = myCat.pagedQuery(query, testProduct.getProductType(), 1);
View Full Code Here

TOP

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

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.