Search in sources :

Example 1 with ValidationResultComparator

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;
}
Also used : OrganisationUnit(org.hisp.dhis.organisationunit.OrganisationUnit) ValidationRuleGroup(org.hisp.dhis.validation.ValidationRuleGroup) ValidationResultComparator(org.hisp.dhis.validation.comparator.ValidationResultComparator) DataElementCategoryOptionCombo(org.hisp.dhis.dataelement.DataElementCategoryOptionCombo)

Aggregations

DataElementCategoryOptionCombo (org.hisp.dhis.dataelement.DataElementCategoryOptionCombo)1 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)1 ValidationRuleGroup (org.hisp.dhis.validation.ValidationRuleGroup)1 ValidationResultComparator (org.hisp.dhis.validation.comparator.ValidationResultComparator)1