コード例 #1
0
 /**
  * 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();
 }
コード例 #2
0
 /**
  * Method "setAnalysisType".
  *
  * @param analysis an analysis
  * @param analysisType the type to set to the analysis
  */
 public static void setAnalysisType(Analysis analysis, AnalysisType analysisType) {
   AnalysisParameters parameters = analysis.getParameters();
   if (parameters == null) {
     parameters = AnalysisFactory.eINSTANCE.createAnalysisParameters();
     analysis.setParameters(parameters);
   }
   parameters.setAnalysisType(analysisType);
 }
コード例 #3
0
 /**
  * Method "getExecutionEngine".
  *
  * @param analysis the analysis
  * @return the execution language (SQL by default)
  */
 public static ExecutionLanguage getExecutionEngine(Analysis analysis) {
   AnalysisParameters parameters = analysis.getParameters();
   if (parameters == null) {
     return ExecutionLanguage.SQL;
   }
   // else
   return parameters.getExecutionLanguage();
 }
コード例 #4
0
 /**
  * Method "getAnalysisType".
  *
  * @param analysis
  * @return the analysis type or null if not set
  */
 public static AnalysisType getAnalysisType(Analysis analysis) {
   AnalysisParameters parameters = analysis.getParameters();
   if (parameters == null) {
     return null;
   }
   // else
   return parameters.getAnalysisType();
 }
コード例 #5
0
  /**
   * Current analysis whether is java engin
   *
   * @param analysis the analysis
   * @return true if is java engin else false
   */
  public static boolean isJavaExecutionEngine(Analysis analysis) {
    AnalysisParameters parameters = analysis.getParameters();

    if (parameters == null) {
      return false;
    }
    ExecutionLanguage executionLanguage = parameters.getExecutionLanguage();
    return ExecutionLanguage.JAVA == executionLanguage;
  }
コード例 #6
0
  /**
   * 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;
  }