use of org.talend.dataquality.expressions.BooleanExpressionNode in project tdq-studio-se by Talend.
the class AnalysisHelper method setStringDataFilter.
public static boolean setStringDataFilter(Analysis analysis, String datafilterString) {
EList<Domain> dataFilters = analysis.getParameters().getDataFilter();
// update existing filters
if (!dataFilters.isEmpty()) {
Domain domain = dataFilters.get(0);
EList<RangeRestriction> ranges = domain.getRanges();
RangeRestriction rangeRestriction = (ranges.isEmpty()) ? DomainHelper.addRangeRestriction(domain) : ranges.get(0);
BooleanExpressionNode expressions = rangeRestriction.getExpressions();
if (expressions == null) {
expressions = BooleanExpressionHelper.createBooleanExpressionNode(datafilterString);
rangeRestriction.setExpressions(expressions);
} else {
Expression expression = expressions.getExpression();
if (expression == null) {
expression = BooleanExpressionHelper.createTdExpression(BooleanExpressionHelper.DEFAULT_LANGUAGE, datafilterString);
expressions.setExpression(expression);
} else {
expression.setBody(datafilterString);
}
}
return false;
}
// else
return dataFilters.add(createDomain(analysis, datafilterString));
}
Aggregations