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

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


    public static List<QueryCriteria> getQueryCriteriaListFromXmlRpc(Vector<Hashtable<String, Object>> criteriaVector) {

        List<QueryCriteria> criteriaList = new Vector<QueryCriteria>(criteriaVector.size());
        for (Iterator<Hashtable<String, Object>> i = criteriaVector.iterator(); i.hasNext();) {
            Hashtable<String, Object> criteriaHash = i.next();
            QueryCriteria criteria = getQueryCriteriaFromXmlRpc(criteriaHash);
            criteriaList.add(criteria);
        }
        return criteriaList;
    }
View Full Code Here


            criteriaHash.put("operator", new Integer(boolQuery.getOperator()));
            Vector<Hashtable<String, Object>> termsHash = new Vector<Hashtable<String, Object>>();
            List<QueryCriteria> terms = boolQuery.getTerms();
           
            for(int i=0;i<terms.size();i++){
                QueryCriteria term = terms.get(i);
                Hashtable<String, Object> termHash = getXmlRpcQueryCriteria(term);
                termsHash.add(termHash);
            }
            criteriaHash.put("terms", termsHash);
           
View Full Code Here

        }
        return criteriaHash;
    }
   
    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"));
            String startVal = criteriaHash.get("elementStartValue").equals("") ?
                    null : (String)criteriaHash.get("elementStartValue");
            String endVal = criteriaHash.get("elementEndValue").equals("") ?
                    null : (String)criteriaHash.get("elementEndValue");
            ((RangeQueryCriteria)criteria).setStartValue(startVal);
            ((RangeQueryCriteria)criteria).setEndValue(endVal);
            ((RangeQueryCriteria)criteria).setInclusive(Boolean.parseBoolean((String) criteriaHash.get("inclusive")));
        } else if(((String)criteriaHash.get("class")).equals(BooleanQueryCriteria.class.getCanonicalName())){
            criteria = new BooleanQueryCriteria();
            try{
              ((BooleanQueryCriteria)criteria).setOperator( ((Integer)criteriaHash.get("operator")).intValue() );
            } catch (QueryFormulationException e){
                System.out.println("Error generating Boolean Query.");
            }
            List<Hashtable<String, Object>> terms = (List<Hashtable<String, Object>>) criteriaHash.get("terms");
            for(int i=0;i<terms.size();i++){
                Hashtable<String, Object> term = terms.get(i);
                QueryCriteria termCriteria = getQueryCriteriaFromXmlRpc(term);
                try{
                    ((BooleanQueryCriteria)criteria).addTerm(termCriteria);
                } catch (QueryFormulationException e){
                    System.out.println("Error generating Boolean Query.");
                }
View Full Code Here

            boolean gotFirstClause = false;
            int clauseNum = 0;

            if (query.getCriteria() != null && query.getCriteria().size() > 0) {
                for (Iterator<QueryCriteria> i = query.getCriteria().iterator(); i.hasNext();) {
                    QueryCriteria criteria = i.next();
                    clauseNum++;

                    String elementIdStr = null;

                    if (fieldIdStringFlag) {
                        elementIdStr = "'" + this.validationLayer.getElementByName(criteria.getElementName()).getElementId() + "'";
                    } else {
                        elementIdStr = this.validationLayer.getElementByName(criteria.getElementName()).getElementId();
                    }

                    String clause = null;

                    if (!gotFirstClause) {
View Full Code Here

                if (query.getCriteria() != null
                        && query.getCriteria().size() > 0) {
                    for (Iterator i = query.getCriteria().iterator(); i
                            .hasNext();) {
                        QueryCriteria criteria = (QueryCriteria) i.next();
                        clauseNum++;

                        String elementIdStr = null;

                        if (fieldIdStringFlag) {
                            elementIdStr = "'" + this.getValidationLayer().getElementByName(criteria.getElementName()).getElementId() + "'";
                        } else {
                            elementIdStr = this.getValidationLayer().getElementByName(criteria.getElementName()).getElementId();
                        }

                        String clause = null;

                        if (!gotFirstClause) {
View Full Code Here

                if (query.getCriteria() != null
                        && query.getCriteria().size() > 0) {
                    for (Iterator i = query.getCriteria().iterator(); i
                            .hasNext();) {
                        QueryCriteria criteria = (QueryCriteria) i.next();
                        clauseNum++;

                        String elementIdStr = null;

                        if (fieldIdStringFlag) {
                            elementIdStr = "'" + this.getValidationLayer().getElementByName(criteria.getElementName()).getElementId() + "'";
                        } else {
                            elementIdStr = this.getValidationLayer().getElementByName(criteria.getElementName()).getElementId();
                        }

                        String clause = null;

                        if (!gotFirstClause) {
View Full Code Here

                if (query.getCriteria() != null
                        && query.getCriteria().size() > 0) {
                    for (Iterator i = query.getCriteria().iterator(); i
                            .hasNext();) {
                        QueryCriteria criteria = (QueryCriteria) i.next();
                        clauseNum++;

                        String elementIdStr = null;

                        if (fieldIdStringFlag) {
                            elementIdStr = "'" + this.getValidationLayer().getElementByName(criteria.getElementName()).getElementId() + "'";
                        } else {
                            elementIdStr = this.getValidationLayer().getElementByName(criteria.getElementName()).getElementId();
                        }

                        String clause = null;

                        if (!gotFirstClause) {
View Full Code Here

                if (query.getCriteria() != null
                        && query.getCriteria().size() > 0) {
                    for (Iterator i = query.getCriteria().iterator(); i
                            .hasNext();) {
                        QueryCriteria criteria = (QueryCriteria) i.next();
                        clauseNum++;

                        String elementIdStr = null;

                        if (fieldIdStringFlag) {
                            elementIdStr = "'" + this.getValidationLayer().getElementByName(criteria.getElementName()).getElementId() + "'";
                        } else {
                            elementIdStr = this.getValidationLayer().getElementByName(criteria.getElementName()).getElementId();
                        }

                        String clause = null;

                        if (!gotFirstClause) {
View Full Code Here

      booleanQuery.add(prodTypeTermQuery, BooleanClause.Occur.MUST);

      for (Iterator<QueryCriteria> i = query.getCriteria().iterator(); i
          .hasNext();) {
        // add a new query for each of the query criteria
        QueryCriteria crit = i.next();
        Element termElem = null;

        try {
          termElem = valLayer.getElementByName(crit.getElementName());
        } catch (ValidationLayerException e) {
          LOG.log(Level.WARNING,
              "ValidationLayer exception when looking up element definition for: ["
                  + crit.getElementName() + "]: Message: " + e.getMessage());
          continue;
        }

        if (crit instanceof TermQueryCriteria) {
          String val = ((TermQueryCriteria) crit).getValue();
View Full Code Here

                if (query.getCriteria() != null
                        && query.getCriteria().size() > 0) {
                    for (Iterator i = query.getCriteria().iterator(); i
                            .hasNext();) {
                        QueryCriteria criteria = (QueryCriteria) i.next();
                        clauseNum++;

                        String elementIdStr = null;

                        if (fieldIdStringFlag) {
                            elementIdStr = "'"
                                    + this.getValidationLayer()
                                            .getElementByName(
                                                    criteria.getElementName())
                                            .getElementId() + "'";
                        } else {
                            elementIdStr = this
                                    .getValidationLayer()
                                    .getElementByName(criteria.getElementName())
                                    .getElementId();
                        }

                        String clause = null;
View Full Code Here

TOP

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

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.