use of org.hisp.dhis.validation.ValidationResult in project dhis2-core by dhis2.
the class FormUtilsImpl method getValidationRuleViolations.
@Override
public List<String> getValidationRuleViolations(OrganisationUnit organisationUnit, DataSet dataSet, Period period) {
List<ValidationResult> validationRuleResults = new ArrayList<>(validationService.startInteractiveValidationAnalysis(dataSet, period, organisationUnit, null));
List<String> validationRuleViolations = new ArrayList<>(validationRuleResults.size());
for (ValidationResult result : validationRuleResults) {
ValidationRule rule = result.getValidationRule();
StringBuilder sb = new StringBuilder();
sb.append(expressionService.getExpressionDescription(rule.getLeftSide().getExpression()));
sb.append(" ").append(rule.getOperator().getMathematicalOperator()).append(" ");
sb.append(expressionService.getExpressionDescription(rule.getRightSide().getExpression()));
validationRuleViolations.add(sb.toString());
}
return validationRuleViolations;
}
Aggregations