Package org.araneaframework.backend.list.helper.builder.expression

Examples of org.araneaframework.backend.list.helper.builder.expression.StandardExpressionToSqlExprBuilder$ConcatenationTranslator


      }
    });
    assertEquals(value, Boolean.FALSE);

    // build sql expression
    StandardExpressionToSqlExprBuilder builder = new StandardExpressionToSqlExprBuilder();
    builder.setMapper(new VariableResolver() {
      public Object resolve(Variable variable) {
        if ("name".equals(variable.getName())) {
          return "AGENT.NAME";
        }
        if ("age".equals(variable.getName())) {
          return "AGENT.AGE";
        }
        if ("licenseToKill".equals(variable.getName())) {
          return "AGENT.KILLER";
        }
        return null;
      }
    });
    builder.setConverter(new ValueConverter() {
      public Object convert(Value value) {
        if ("licenseToKill".equals(value.getName())) {
          return new BooleanToStringConverter("Y", "N")
              .convert(value.getValue());
        }
        return value.getValue();
      }
    });
    SqlExpression sqlExpr = builder.buildSqlExpression(expr);
    String sqlString = sqlExpr.toSqlString();
    Object[] values = sqlExpr.getValues();
    log.info("SQL string: " + sqlString);
    log.info("SQL values: " + Arrays.asList(values));
  }
View Full Code Here


  private StandardExpressionToSqlExprBuilder builder;
 
  private Object testValue = "test_value";

  public void setUp() {
    this.builder = new StandardExpressionToSqlExprBuilder();
    this.builder.setMapper(new MockVariableResolver());
    this.builder.setConverter(new MockValueConverter());
  }
View Full Code Here

      }
    });
    assertEquals(value, Boolean.FALSE);

    // build sql expression
    StandardExpressionToSqlExprBuilder builder = new StandardExpressionToSqlExprBuilder();
    builder.setMapper(new VariableResolver() {
      public Object resolve(Variable variable) {
        if ("name".equals(variable.getName())) {
          return "AGENT.NAME";
        }
        if ("age".equals(variable.getName())) {
          return "AGENT.AGE";
        }
        if ("licenseToKill".equals(variable.getName())) {
          return "AGENT.KILLER";
        }
        return null;
      }
    });
    builder.setConverter(new ValueConverter() {
      public Object convert(Value value) {
        if ("licenseToKill".equals(value.getName())) {
          return new BooleanToStringConverter("Y", "N")
              .convert(value.getValue());
        }
        return value.getValue();
      }
    });
    SqlExpression sqlExpr = builder.buildSqlExpression(expr);
    String sqlString = sqlExpr.toSqlString();
    Object[] values = sqlExpr.getValues();
    log.info("SQL string: " + sqlString);
    log.info("SQL values: " + Arrays.asList(values));
  }
View Full Code Here

    }
   
    if (this.filterExpr == null) {
      return null;
    }
    StandardExpressionToSqlExprBuilder builder = new StandardExpressionToSqlExprBuilder();
    builder.setMapper(createExpressionBuilderResolver());
    builder.setConverter(createExpressionBuilderConverter());
    this.filterSqlExpr = builder.buildSqlExpression(this.filterExpr);
    return this.filterSqlExpr;
  }
View Full Code Here

TOP

Related Classes of org.araneaframework.backend.list.helper.builder.expression.StandardExpressionToSqlExprBuilder$ConcatenationTranslator

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.