use of org.hisp.dhis.validation.comparator.ValidationResultComparator in project dhis2-core by dhis2.
the class RunValidationAction method execute.
// -------------------------------------------------------------------------
// Execute
// -------------------------------------------------------------------------
@Override
public String execute() {
organisationUnit = organisationUnitService.getOrganisationUnit(organisationUnitId);
List<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitWithChildren(organisationUnit.getId());
ValidationRuleGroup group = validationRuleGroupId == -1 ? null : validationRuleService.getValidationRuleGroup(validationRuleGroupId);
DataElementCategoryOptionCombo attributeOptionCombo = attributeOptionComboId == null || attributeOptionComboId == -1 ? null : dataElementCategoryService.getDataElementCategoryOptionCombo(attributeOptionComboId);
log.info("Validating data for " + (group == null ? "all rules" : "group: " + group.getName()));
validationResults = new ArrayList<>(validationService.startInteractiveValidationAnalysis(format.parseDate(startDate), format.parseDate(endDate), organisationUnits, attributeOptionCombo, group, sendNotifications, format));
maxExceeded = validationResults.size() > ValidationService.MAX_INTERACTIVE_ALERTS;
Collections.sort(validationResults, new ValidationResultComparator());
SessionUtils.setSessionVar(KEY_VALIDATIONRESULT, validationResults);
computeShowAttributeCombos();
log.info("Validation done");
return SUCCESS;
}
Aggregations