/**
  * Method "getDataFilter".
  *
  * @param analysis
  * @return the list of domains or null
  */
 public static EList<Domain> getDataFilter(Analysis analysis) {
   AnalysisParameters parameters = analysis.getParameters();
   if (parameters == null) {
     return null;
   }
   return parameters.getDataFilter();
 }
  /**
   * DOC xqliu Comment method "getStringDataFilter".
   *
   * @param analysis
   * @param index 0 for DataFilterA, 1 for DataFilterB
   * @return
   */
  public static String getStringDataFilter(Analysis analysis, int index) {
    AnalysisParameters parameters = analysis.getParameters();
    if (parameters == null) {
      return null;
    }
    EList<Domain> dataFilters = parameters.getDataFilter();
    // remove existing filters
    if (dataFilters == null || dataFilters.isEmpty()) {
      return null;
    }

    int i = 0;
    for (Domain domain : dataFilters) {
      if (domain == null) {
        continue;
      }
      EList<RangeRestriction> ranges = domain.getRanges();
      for (RangeRestriction rangeRestriction : ranges) {
        BooleanExpressionNode expressions = rangeRestriction.getExpressions();
        if (expressions == null) {
          continue;
        }
        Expression expression = expressions.getExpression();
        if (expression == null) {
          continue;
        }
        if (i == index) {
          // MOD klliu 2011-07-14 bug 23150 solve an NPE
          String body = expression.getBody();
          if (body == null) {
            continue;
          }
          // ~
          return body.trim();
        } else if (i > index) {
          return null;
        }
      }
      i++;
    }
    return null;
  }