Esempio n. 1
0
  protected List<ElementText> toStringList(QueryParameter param) {

    List<ElementText> list = new ArrayList<>();

    Boolean previousCondition = null;

    for (SqlElement element : children) {

      if (isElseSeries(element)) {
        if (previousCondition != null && previousCondition != true) {
          list.add(new ElementText(element.getClass(), element.toString(param)));
        }
      } else {
        list.add(new ElementText(element.getClass(), element.toString(param)));
      }

      if (isIf(element)) {
        previousCondition = getIfSeriesResult(element, param);

      } else if (isElseIf(element)) {
        if (previousCondition == null || previousCondition == false) {
          previousCondition = getIfSeriesResult(element, param);
        }

      } else if (isElse(element)) {
        previousCondition = null;
      }
    }

    return list;
  }
Esempio n. 2
0
  private boolean isElseSeries(SqlElement element) {

    Class klass = element.getClass();

    if (klass == ElseIfSqlElement.class) return true;
    if (klass == WhenSqlElement.class) return true;
    return klass == ElseSqlElement.class;
  }
Esempio n. 3
0
 private boolean isElse(SqlElement element) {
   return element.getClass() == ElseSqlElement.class;
 }
Esempio n. 4
0
 private boolean isIf(SqlElement element) {
   return element.getClass() == IfSqlElement.class;
 }