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

Examples of org.apache.oodt.cas.filemgr.structs.exceptions.QueryFormulationException


    }
   
    public static ComplexQuery parseSqlQueryMethod(String sqlStringQueryMethod)
            throws QueryFormulationException {
        if (!Pattern.matches("((?:SQL)|(?:sql))\\s*(.*)\\s*\\{\\s*SELECT.*FROM.*(?:WHERE.*){0,1}\\}", sqlStringQueryMethod))
            throw new QueryFormulationException("Malformed SQL method");
       
        try {
            ComplexQuery complexQuery = parseSqlQuery(stripOutSqlDefinition(sqlStringQueryMethod));
           
            for (Expression expr : getSqlStatementArgs(sqlStringQueryMethod)) {
                if (expr.getKey().toUpperCase().equals("FORMAT"))
                    complexQuery.setToStringResultFormat(expr.getValue());
                else if (expr.getKey().toUpperCase().equals("SORT_BY"))
                    complexQuery.setSortByMetKey(expr.getValue());
                else if (expr.getKey().toUpperCase().equals("FILTER"))
                    complexQuery.setQueryFilter(createFilter(expr));
            }
           
            return complexQuery;
        }catch (Exception e) {
            e.printStackTrace();
            throw new QueryFormulationException("Failed to parse SQL method : " + e.getMessage());
        }
    }
View Full Code Here


            case '\'':
                inExpr = !inExpr;
                break;
            }
        }
        throw new QueryFormulationException("Failed to read in args");
    }
View Full Code Here

            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);
            }
            throw new QueryFormulationException(
                    "Was not able to form query . . . probably an invalid operator -- "
                            + this.toString());
        }
View Full Code Here

     */
    public BooleanQueryCriteria(List<QueryCriteria> terms, int op)
            throws QueryFormulationException {
        operator = op;
        if (op == NOT && terms.size() > 1) {
            throw new QueryFormulationException(
                    "BooleanQueryCriteria: NOT operator "
                            + "cannot be applied to multiple terms");
        } else {
            this.terms = terms;
        }
View Full Code Here

     * @param t
     *            Term to be added to the query
     */
    public void addTerm(QueryCriteria t) throws QueryFormulationException {
        if (operator == NOT && !terms.isEmpty()) {
            throw new QueryFormulationException(
                    "BooleanQueryCriteria: NOT operator "
                            + "cannot be applied to multiple terms");
        } else {
            terms.add(t);
        }
View Full Code Here

     * @param op
     *            Boolean operator
     */
    public void setOperator(int op) throws QueryFormulationException {
        if (op == NOT && terms.size() > 1) {
            throw new QueryFormulationException(
                    "BooleanQueryCriteria: NOT operator "
                            + "cannot be applied to multiple terms");
        } else {
            operator = op;
        }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.filemgr.structs.exceptions.QueryFormulationException

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.