Package org.objectweb.medor.query.jorm.lib

Examples of org.objectweb.medor.query.jorm.lib.QueryBuilder


                treatIdValue(dependency, toTreat);
            }
        }
        toTreat.remove(iv);

        QueryBuilder theqb = qb;
        if (iv.nameType == MEMBEROF) {
            //a.b.cs.contains(x)  ==> a.b.PNAME IN cs.id
            String rest = mergePath(iv.name, 1, iv.name.length - 1);
            theqb = new QueryBuilder(qb);
            try {
                theqb.define("", qb.navigate(iv.name[0]));
            } catch (MedorException e) {
                throw new SpeedoException(e);
            }
        }

        try {
            String n = iv.alias + "." + Field.PNAMENAME;
            fields.put(n, theqb.project(iv.alias, define(theqb, iv.alias, iv.alias)));
            for (int i = 0; i < iv.getDeclaredPathLength(); i++) {
                String path = iv.getMergedPath(i);
                if (!testcontains.contains(path) && !isEmptys.contains(path)) {
                    fields.put(path, theqb.project(path, define(theqb, path, null)));
                }
          }
        } catch (Exception e) {
            throw new SpeedoException("Error during the parsing of JDOQL:", e);
        }
View Full Code Here


                node, miManager, varParserlogger, hparams, hvars, qd.order,
                qd.candidateClass.getName(), qd.includeSubClasses);
        // start the variable visitor to catch all variables and build a
        // first tree of them without collection navigation
        Map fields = sqvv.getFields();
        QueryBuilder qb = sqvv.getQueryBuilder();
        QueryTree qt = sqvv.getQueryTree();

        SelectProject sp = new SelectProject("");
        if (!filter.equals("(true)") && !filter.equals("true")) {
            //Ther is a filter and potentialy collection navigation
View Full Code Here

                node, miManager, varParserlogger, hparams, hvars, qd.order,
                qd.candidateClass.getName(), qd.includeSubClasses);
        // start the variable visitor to catch all variables and build a
        // first tree of them without collection navigation
        Map fields = sqvv.getFields();
        QueryBuilder qb = sqvv.getQueryBuilder();
        QueryTree qt = sqvv.getQueryTree();

        SelectProject sp = new SelectProject("");
        if (!filter.equals("(true)") && !filter.equals("true")) {
            //Ther is a filter and potentialy collection navigation
View Full Code Here

                logger.log(BasicLevel.DEBUG, tab
                        + "parameter(" + name + ") MemberOf " + pathset);
            }
            String[] spli = splitPath(pathset);
            String rest = mergePath(spli, 1, spli.length - 1);
            QueryBuilder subquery = new QueryBuilder(qb);
            subquery.define("", qb.navigate(spli[0]));
            QueryTreeField setField = subquery.project(subquery.navigate(rest));
            Expression e = new MemberOf(
                    Collections.singletonList(((Object[]) params.get(name))[1]),
                    Collections.singletonList(new BasicFieldOperand(setField)));
            if (debug) {
                logger.log(BasicLevel.DEBUG, tab + "push(" + ExpressionPrinter.e2str(e) + ")");
View Full Code Here

                      stack.push(new Not(new IsEmpty(new BasicFieldOperand(f))));
                    }
                } else {
                    //x.y.bs.contains(u.v.b)
                    String rest = mergePath(spli, 1, spli.length - 2);
                    QueryBuilder subquery = new QueryBuilder(qb);
                    subquery.define("", qb.navigate(spli[0]));
                    QueryTreeField setField = subquery.project(subquery.navigate(rest));
                    QueryTreeField f = (QueryTreeField) fields.get(name);

                    stack.push(new MemberOf(
                            Collections.singletonList(
                                    new BasicFieldOperand(f)),
                            Collections.singletonList(
                                    new BasicFieldOperand(setField))
                          ));
                }
            } else {
                if (debug) {
                    logger.log(BasicLevel.DEBUG, tab + "Do not use the pathset of the contain operator");
                }
                stack.push(REMOVER);
            }
            return;
        }

        //maybe there is an operator
        String last = splitted[splitted.length - 1];
        operatorId = isMethodOperator(last);
        if (operatorId == -1) {
            //No operator found ==> default case
            if (debug) {
                logger.log(BasicLevel.DEBUG, tab + "create a fieldOperand with:" + name);
            }
        Field f = (Field) fields.get(name);
        if (f == null) {
            throw new SpeedoException("Internal error: No field '" + name + "' found during filter parsing");
        }
        stack.push(new BasicFieldOperand(f));
            return;
        }
        //There is an operator
        String begin = buildStringwithout(splitted, splitted.length-1, ".");
        if (operatorId == CONTAINS_OPERATOR) {
            //The contains contraint is managed during the QueryTree creation
        //see the variable vistor
          //However push some stuff in the stack in order to known that
          // the next qualifiedName is used in a contain constraint.
            if (debug) {
                logger.log(BasicLevel.DEBUG, tab + "contains operator: set=" + begin);
            }
            stack.push(begin);
            stack.push(CONTAINS_PATH_SET);
            return;
        } else if (operatorId == IS_EMPTY_OPERATOR) {
            if (debug) {
               logger.log(BasicLevel.DEBUG, tab + "Visit IsEmpty: " + begin);
            }
            String rest = mergePath(splitted, 1, splitted.length - 2);
            QueryBuilder subquery = new QueryBuilder(qb);
            subquery.define("", qb.navigate(splitted[0]));
            Field f = subquery.project(subquery.navigate(rest));
            stack.push(new IsEmpty(new BasicFieldOperand(f)));
            return;
        }
               
        if (debug) {
View Full Code Here

TOP

Related Classes of org.objectweb.medor.query.jorm.lib.QueryBuilder

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.