@Override public void deleteCategoryOptionCombo( CategoryOptionCombo dataElementCategoryOptionCombo ) { validationResultService.getAllValidationResults().forEach( validationResult -> { if ( validationResult.getAttributeOptionCombo().equals( dataElementCategoryOptionCombo ) ) { validationResultService.deleteValidationResult( validationResult ); } } ); }
public boolean skipValidationOfTuple( OrganisationUnit organisationUnit, ValidationRule validationRule, Period period, String attributeOptionCombo, int dayInPeriod ) { List<ValidationResult> validationResultList = initialValidationResults .getValue( organisationUnit, validationRule, period ); if ( validationResultList != null ) { for ( ValidationResult vr : validationResultList ) { if ( vr.getAttributeOptionCombo().getUid().equals( attributeOptionCombo ) && vr.getDayInPeriod() == dayInPeriod ) { return true; } } } return false; }
/** * Reload attribute category option combos into this Hibernate context. * * @param results * @param dataElementCategoryService */ private static void reloadAttributeOptionCombos( Collection<ValidationResult> results, CategoryService dataElementCategoryService ) { for ( ValidationResult result : results ) { result.setAttributeOptionCombo( dataElementCategoryService .getCategoryOptionCombo( result.getAttributeOptionCombo().getId() ) ); } } }
@Override public List<Object> getUniqueValues( ValidationResult validationResult ) { return getObjectList( validationResult.getValidationRule().getId(), validationResult.getPeriod().getId(), validationResult.getOrganisationUnit().getId(), validationResult.getAttributeOptionCombo().getId(), validationResult.getDayInPeriod() ); }
@Override public List<Object> getValues( ValidationResult validationResult ) { return getObjectList( validationResult.getLeftsideValue(), validationResult.getRightsideValue(), validationResult.getValidationRule().getId(), validationResult.getPeriod().getId(), validationResult.getOrganisationUnit().getId(), validationResult.getAttributeOptionCombo().getId(), validationResult.getDayInPeriod() ); }
/** * Compare ValidationResults so they will be listed in the desired * order: by validationRule, period, attributeOptionCombo and orgUnit. * * @param other The other ValidationResult to compare with. * @return a negative integer, zero, or a positive integer as this object * is less than, equal to, or greater than the specified object. */ @Override public int compareTo( ValidationResult other ) { return new CompareToBuilder() .append( this.validationRule, other.getValidationRule() ) .append( this.period, other.getPeriod() ) .append( this.attributeOptionCombo, other.getAttributeOptionCombo() ) .append( this.organisationUnit, other.getOrganisationUnit() ) .append( this.id, other.getId() ) .toComparison(); }