Package org.objectweb.medor.expression.api

Examples of org.objectweb.medor.expression.api.Expression


  public void testA() {
    FilterManager parser = new FilterManager(logger);
    for(int i=0; i<filters.length; i++) {
      logger.log(BasicLevel.DEBUG, "Parsing of filter: " + filters[i]);
      try {
        Expression exp = parser.getParser().parse(filters[i]);
        TestExpressionHelper.equals("", expressions[i], exp, logger);
      } catch (Error e) {
        fail(e.getMessage());
      } catch (Exception e) {
        Exception ie = ExceptionHelper.getNested(e);
View Full Code Here


                           RdbFilter rdbFilter,
                           SpeedoClass sc,
                           String projectName,
                           String mapperName) throws SpeedoException {
    debug = logger != null && logger.isLoggable(BasicLevel.DEBUG);
    Expression medorExpression = parser.parse(filter);
    if (!isJormPredicate(medorExpression)) {
      throw new SpeedoException(
          "The specified filter is not supported, \n\tclass"
          + sc.getFQName() + "\n\tfilter=" + filter);
    }
View Full Code Here

            Object child1 = stack.pop();
            if (debug) {
              logger.log(BasicLevel.DEBUG, "pop child1: " + child1);
              logger.log(BasicLevel.DEBUG, "pop child2: " + child2);
            }
            Expression ret = null;
            switch (op) {
            case SpeedoQLConstants.OR:
              ret = new ConditionalOr((Expression) child1, (Expression) child2);
              break;
            case SpeedoQLConstants.AND:
View Full Code Here

      tab += '\t';
      visit((SimpleNode) node, data);
      tab = tab.substring(1);
      Stack stack = (Stack) data;
      if (stack.size() > 0) {
        Expression ret = (Expression) stack.pop();
        for (int i = 0; i < node.jjtGetNumChildren() - 1; i++) {
          logger.log(BasicLevel.DEBUG, "Visit AdditiveExpression... children...[" + i + "]");

          switch (((Integer) node.ops.get(node.jjtGetNumChildren() - 2 - i)).intValue()) {
View Full Code Here

    nr.addProjection(getLongIdLid(), lid.getName());
    if (sc.jormclass.getSuperClasses().isEmpty()) {
      // define the inheritance filter permiting to determine the class
      // since an identifier (some bits are reserved for class
      // identification)
      Expression expr = new Round(new DivideBy(
        new BasicParameterOperand(getFieldType(), getLongIdLid()),
        getBasicOperand()));
      try {
        expr.compileExpression();
      } catch (ExpressionException e) {
        throw new SpeedoException("Impossible to compile the filter of longid naming", e);
      }
      sc.jormclass.setInheritanceFilter(nd, expr);
        // assign a default value to each sub classes. The real value
View Full Code Here

            String fieldName = (String) aliases.get(i);
            if (o instanceof Expression) {
                if (fieldName == null || fieldName.length() == 0) {
                    fieldName = "field_" + i;
                }
                Expression e = (Expression) o;
                e.compileExpression();
                fieldOnTop = top.addCalculatedField(fieldName, e.getType(), e);
            } else if (o instanceof Field) {
                Field f = (Field) o;
                if (fieldName == null || fieldName.length() == 0) {
                    fieldName = f.getName();
                }
View Full Code Here

                }
                // fetch the function identifier
                functionIdx = (Integer) stack.pop();
            }
        } while (isOperand);
        Expression e;
        //Verify the operand number
        if (functionIdx.intValue() > 0 && functionIdx.intValue() < 10) {
            if (operands.size() != 1) {
                throw new SpeedoException(
                        "Bad number of operand for the function "
View Full Code Here

    protected boolean getFieldComparaison(Expression e, Map field2value) {
        if (e instanceof And || e instanceof ConditionalAnd) {
            return getFieldComparaison(((Operator) e).getExpression(0), field2value)
              && getFieldComparaison(((Operator) e).getExpression(1), field2value);
        } else if (e instanceof Equal){
            Expression tmpe = ((Operator) e).getExpression(0);
            if (!(tmpe instanceof Operand)) {
                return false;
            }
            Operand op0 = (Operand) tmpe;
            tmpe = ((Operator) e).getExpression(1);
View Full Code Here

            }
            throw new SpeedoException(
                    "Impossible to built the queryTree during the filter visit", e);
        }
        // this expression is the filter of the SelectProject
        Expression exprFilter = getQueryFilter();
        if (exprFilter != null) {
          ME me = replaceNullNode(exprFilter);
          if (me != null && me.modified) {
              qf = me.e;
              exprFilter = getQueryFilter();
          }
            if (debug) {
                logger.log(BasicLevel.DEBUG, "filter = " + exprFilter.getClass().getName());
            }
            root.setQueryFilter(exprFilter);
        }
       
    }
View Full Code Here

        Operator op = (Operator) exprFilter;
        for (int i = 0; i < op.getOperandNumber(); i++) {
          if (op.getExpression(i) instanceof DummyOperand) {
            //get the other child operand
            int j = (i+1) % 2;
            Expression other = op.getExpression(j);
            PType ptype = other.getType();
            if (ptype.getTypeCode() == PType.TYPECODE_REFERENCE) {
              PName val = null;
              try {
                val = jf.getPClassMapping(ptype.getJormName(), clazz.getClassLoader()).getPBinder().getNull();
              } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.objectweb.medor.expression.api.Expression

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.