Examples of TermQueryCriteria


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

        if (luceneQuery instanceof TermQuery) {
            Term t = ((TermQuery) luceneQuery).getTerm();
            if (t.field().equals(freeTextBlock)) {
                // nothing for now
            } else {
                casQuery.addCriterion(new TermQueryCriteria(t.field(),
                        t.text()));
            }
        } else if (luceneQuery instanceof PhraseQuery) {
            Term[] t = ((PhraseQuery) luceneQuery).getTerms();
            if (t[0].field().equals(freeTextBlock)) {
                // nothing for now
            } else {
                for (int i = 0; i < t.length; i++)
                    casQuery.addCriterion(new TermQueryCriteria(
                            t[i].field(), t[i].text()));
            }
        } else if (luceneQuery instanceof RangeQuery) {
            Term startT = ((RangeQuery) luceneQuery).getLowerTerm();
            Term endT = ((RangeQuery) luceneQuery).getUpperTerm();
View Full Code Here

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

                // if(casQuery.getCriteria().isEmpty())
                // casQuery.addCriterion(new FreeTextQueryCriteria());
                // ((FreeTextQueryCriteria)casQuery.getCriteria().get(0)).addValue(t.text());
            } else {
                casQuery
                        .addCriterion(new TermQueryCriteria(t.field(), t.text()));
            }
        } else if (luceneQuery instanceof PhraseQuery) {
            Term[] t = ((PhraseQuery) luceneQuery).getTerms();
            if (t[0].field().equals(freeTextBlock)) {
                // if(casQuery.getCriteria().isEmpty())
                // casQuery.addCriterion(new FreeTextQueryCriteria());
                // for(int i=0;i<t.length;i++)
                // ((FreeTextQueryCriteria)casQuery.getCriteria().get(0)).addValue(t[i].text());
            } else {
                for (int i = 0; i < t.length; i++)
                    casQuery.addCriterion(new TermQueryCriteria(t[i].field(),
                            t[i].text()));
            }
        } else if (luceneQuery instanceof RangeQuery) {
            Term startT = ((RangeQuery) luceneQuery).getLowerTerm();
            Term endT = ((RangeQuery) luceneQuery).getUpperTerm();
View Full Code Here

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

                returnString += ")";
                break;
            case 2:
                QueryCriteria qc = bqc.getTerms().get(0);
                if (qc instanceof TermQueryCriteria) {
                    TermQueryCriteria tqc = (TermQueryCriteria) qc;
                    returnString = tqc.getElementName() + " != '" + tqc.getValue() + "'";
                }else {
                    returnString = "NOT(" + getInfixCriteriaString(qc) + ")";
                }
                break;
            }
        }else if (criteria instanceof RangeQueryCriteria) {
            RangeQueryCriteria rqc = (RangeQueryCriteria) criteria;
            String opString = rqc.getInclusive() ? "=" : "";
            if (rqc.getStartValue() != null) {
                opString = ">" + opString + " '" + rqc.getStartValue() + "'";
            }else
                opString = "<" + opString + " '" + rqc.getEndValue() + "'";
            returnString = rqc.getElementName() + " " + opString;
        }else if (criteria instanceof TermQueryCriteria) {
            TermQueryCriteria tqc = (TermQueryCriteria) criteria;
            returnString = tqc.getElementName() + " == '" + tqc.getValue() + "'";
        }
        return returnString;
    }
View Full Code Here

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

            case GREATER_THAN:
                return new RangeQueryCriteria(this.key, this.val, null, false);
            case LESS_THAN:
                return new RangeQueryCriteria(this.key, null, this.val, false);
            case EQUAL_TO:
                return new TermQueryCriteria(this.key, this.val);
            case NOT_EQUAL_TO:
                BooleanQueryCriteria notEqBQC = new BooleanQueryCriteria();
                notEqBQC.setOperator(BooleanQueryCriteria.NOT);
                notEqBQC.addTerm(new TermQueryCriteria(this.key, this.val));
                return notEqBQC;
            case GREATER_THAN_OR_EQUAL_TO:
                return new RangeQueryCriteria(this.key, this.val, null, true);
            case LESS_THAN_OR_EQUAL_TO:
                return new RangeQueryCriteria(this.key, null, this.val, true);
View Full Code Here

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

    }
   
    public static QueryCriteria getQueryCriteriaFromXmlRpc(Hashtable<String, Object> criteriaHash) {
        QueryCriteria criteria = null;
        if(((String)criteriaHash.get("class")).equals(TermQueryCriteria.class.getCanonicalName())){
            criteria = new TermQueryCriteria();
            criteria.setElementName((String) criteriaHash.get("elementName"));
            ((TermQueryCriteria)criteria).setValue((String) criteriaHash.get("elementValue"));
        } else if(((String)criteriaHash.get("class")).equals(RangeQueryCriteria.class.getCanonicalName())){
            criteria = new RangeQueryCriteria();
            criteria.setElementName((String) criteriaHash.get("elementName"));
View Full Code Here

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

     */
    public boolean liveHasProduct(String uniqueElementName,
            String uniqueElementValue, String productTypeName)
            throws CacheException {
        Query query = new Query();
        query.addCriterion(new TermQueryCriteria(uniqueElementName,
                uniqueElementValue));
        try {
            return !(fm.query(query, fm.getProductTypeByName(productTypeName))
                    .isEmpty());
        } catch (Exception e) {
View Full Code Here

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

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

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

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

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

            e.printStackTrace();
            fail(e.getMessage());
        }
       
        Query query = new Query();
        TermQueryCriteria termQuery = new TermQueryCriteria();
        termQuery.setElementName("DataVersion");
        termQuery.setValue("4.0");
        query.addCriterion(termQuery);
       
        List<Product> products = fmClient.query(query, genericFile);
        assertEquals(products.get(0).getProductId(), testProduct.getProductId());
    }
View Full Code Here

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

        ProductType genericFile = fmClient.getProductTypeByName("GenericFile");
        assertEquals("04.00", (met = fmClient.getCatalogValues(met, genericFile)).getMetadata("DataVersion"));
        assertEquals("4.0", fmClient.getOrigValues(met, genericFile).getMetadata("DataVersion"));
       
        Query query = new Query();
        TermQueryCriteria termQuery = new TermQueryCriteria();
        termQuery.setElementName("DataVersion");
        termQuery.setValue("4.0");
        query.addCriterion(termQuery);
        query = fmClient.getCatalogQuery(query, genericFile);
        assertEquals("04.00", ((TermQueryCriteria) query.getCriteria().get(0)).getValue());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.