Package org.araneaframework.backend.list.memorybased.expression.compare

Examples of org.araneaframework.backend.list.memorybased.expression.compare.LikeExpression


    }   
    public Like() {
      super();
    }
    protected Expression buildAction(Map filterInfo, Expression leftOperand, Expression rightOperand) {
      return new LikeExpression(leftOperand, (ValueExpression) rightOperand, isIgnoreCase());
    }
View Full Code Here


  }
 
  public static class Like extends SimpleProcedureFilter {
    private static final long serialVersionUID = 1L;
    protected Expression buildAction(Map filterInfo, Expression leftOperand, Expression rightOperand) {
      return new LikeExpression(leftOperand, (ValueExpression) rightOperand, isIgnoreCase());
    }
View Full Code Here

    }   
    public Like(Object value) {
      super(value);
    }
    protected Expression buildAction(Map filterInfo, Expression leftOperand, Expression rightOperand) {
      return new LikeExpression(leftOperand, (ValueExpression) rightOperand, isIgnoreCase());
    }
View Full Code Here

  public void testLikeExpression() throws ExpressionEvaluationException {
    log.debug("Testing LikeExpression");
    boolean ignoreCase = false;
    try {
      new LikeExpression(null, null, ignoreCase).evaluate(this.resolver);
      fail("LikeExpression operands can not be nulls");
    } catch (Exception e) {
      // normal
    }
    try {
      new LikeExpression(this.tom, null, ignoreCase)
          .evaluate(this.resolver);
      fail("LikeExpression operands can not be nulls");
    } catch (Exception e) {
      // normal
    }
    try {
      new LikeExpression(null, this.om, ignoreCase)
          .evaluate(this.resolver);
      fail("LikeExpression operands can not be nulls");
    } catch (Exception e) {
      // normal
    }

    // evaluating
    assertEquals("LikeExpression must return true", Boolean.TRUE,
        new LikeExpression(this.tom, this.om, false)
            .evaluate(this.resolver));
    assertEquals("LikeExpression must return true", Boolean.TRUE,
        new LikeExpression(this.tom, this.tm, true)
            .evaluate(this.resolver));
    assertEquals("LikeExpression must return false", Boolean.FALSE,
        new LikeExpression(this.tom, this.tm, false)
            .evaluate(this.resolver));
    assertEquals("LikeExpression must return false", Boolean.FALSE,
        new LikeExpression(this.jerry, this.om, false)
            .evaluate(this.resolver));
  }
View Full Code Here

 
  // String 
 
  class LikeTranslator extends CompositeExprToSqlExprTranslator {
    protected SqlExpression translateParent(Expression expr, SqlExpression[] sqlChildren) {
      LikeExpression like = (LikeExpression) expr;     
      SqlExpression var = sqlChildren[0];
      SqlExpression mask = new SqlValueExpression(
          "%" + convertValue(like.getMask()) + "%");
      if (like.getIgnoreCase()) {
        var = new SqlUpperExpression(var);
        mask = new SqlUpperExpression(mask);
      }
      return new SqlLikeExpression(var, mask);
    }
View Full Code Here

TOP

Related Classes of org.araneaframework.backend.list.memorybased.expression.compare.LikeExpression

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.