Package org.apache.oodt.cas.catalog.query

Examples of org.apache.oodt.cas.catalog.query.ComparisonQueryExpression


            String op = qlg.getOperator() == QueryLogicalGroup.Operator.AND ? "INTERSECT" : "UNION";
            for (int i = 1; i < qlg.getExpressions().size(); i++)
                sqlQuery += ") " + op + " (" + this.getSqlQuery(qlg.getExpressions().get(i));
            sqlQuery += ")";
        }else if (queryExpression instanceof ComparisonQueryExpression){
          ComparisonQueryExpression cqe = (ComparisonQueryExpression) queryExpression;
          String operator = null;
            if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.EQUAL_TO)) {
              operator = "=";
            } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.GREATER_THAN)) {
              operator = ">";
            } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.GREATER_THAN_EQUAL_TO)) {
              operator = ">=";
            } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.LESS_THAN)) {
              operator = "<";
            } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.LESS_THAN_EQUAL_TO)) {
              operator = "<=";
            } else {
                throw new QueryServiceException("Invalid ComparisonQueryExpression Operator '" + cqe.getOperator() + "'");
            }
           
            sqlQuery = "SELECT DISTINCT transaction_id FROM transaction_terms WHERE " + bucketNameFilter + " term_name = '" + cqe.getTerm().getName() + "' AND (";
          for (int i = 0; i < cqe.getTerm().getValues().size(); i++) {
            String value = cqe.getTerm().getValues().get(i);
                sqlQuery += "term_value " + operator + " '" + (this.useUTF8 ? URLEncoder.encode(value, "UTF-8") : value) + "'";
              if ((i + 1) < cqe.getTerm().getValues().size())
                sqlQuery += " OR ";
          }
          sqlQuery += ")";
        }else if (queryExpression instanceof NotQueryExpression) {
          NotQueryExpression nqe = (NotQueryExpression) queryExpression;
View Full Code Here


      getValues(values);
      jjtree.closeNodeScope(jjtn000, true);
      jjtc000 = false;
        Term term = new Term(termName.image);
        term.setValues(values); //Arrays.asList(termValues.image.split(",")));
        ComparisonQueryExpression comparisonQueryExpression = new ComparisonQueryExpression();
        if (bucketNames != null)
                comparisonQueryExpression.setBucketNames(new HashSet<String>(bucketNames));
        comparisonQueryExpression.setTerm(term);
        comparisonQueryExpression.setOperator(ComparisonQueryExpression.Operator.getOperatorBySign(operator.image));
        {if (true) return comparisonQueryExpression;}
    } catch (Throwable jjte000) {
      if (jjtc000) {
        jjtree.clearNodeScope(jjtn000);
        jjtc000 = false;
View Full Code Here

            String op = qlg.getOperator() == QueryLogicalGroup.Operator.AND ? "INTERSECT" : "UNION";
            for (int i = 1; i < qlg.getExpressions().size(); i++)
                sqlQuery += ") " + op + " (" + this.getSqlQuery(qlg.getExpressions().get(i));
            sqlQuery += ")";
        }else if (queryExpression instanceof ComparisonQueryExpression){
          ComparisonQueryExpression cqe = (ComparisonQueryExpression) queryExpression;
          String operator = null;
            if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.EQUAL_TO)) {
              operator = "=";
            } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.GREATER_THAN)) {
              operator = ">";
            } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.GREATER_THAN_EQUAL_TO)) {
              operator = ">=";
            } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.LESS_THAN)) {
              operator = "<";
            } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.LESS_THAN_EQUAL_TO)) {
              operator = "<=";
            } else {
                throw new QueryServiceException("Invalid ComparisonQueryExpression Operator '" + cqe.getOperator() + "'");
            }
           
            sqlQuery = "SELECT DISTINCT workflow_instance_id FROM workflow_instance_metadata WHERE workflow_met_key = '" + cqe.getTerm().getName() + "' AND (";
          for (int i = 0; i < cqe.getTerm().getValues().size(); i++) {
            String value = cqe.getTerm().getValues().get(i);
                sqlQuery += "workflow_met_val " + operator + " '" + URLEncoder.encode(value, "UTF-8") + "'";
              if ((i + 1) < cqe.getTerm().getValues().size())
                sqlQuery += "OR";
          }
          sqlQuery += ")";
        }else if (queryExpression instanceof NotQueryExpression) {
          NotQueryExpression nqe = (NotQueryExpression) queryExpression;
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.catalog.query.ComparisonQueryExpression

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.