Search in sources :

Example 1 with AssociationValidationReport

use of uk.ac.ebi.spot.goci.model.AssociationValidationReport in project goci by EBISPOT.

the class AssociationValidationReportService method createAssociationValidationReport.

/**
     * Create association validation reports and add to association
     *
     * @param errors List of errors
     * @param id     Association ID
     */
public void createAssociationValidationReport(Collection<ValidationError> errors, Long id) {
    // Get list of existing reports and create list of existing warnings
    Association association = associationRepository.findOne(id);
    Collection<AssociationValidationReport> existingReports = associationValidationReportRepository.findByAssociationId(id);
    existingReports.forEach(associationValidationReport -> associationValidationReportRepository.delete(associationValidationReport));
    // Create association validation reports
    errors.forEach(validationError -> {
        AssociationValidationReport associationValidationReport = new AssociationValidationReport(validationError.getError(), validationError.getField(), association);
        associationValidationReportRepository.save(associationValidationReport);
    });
}
Also used : Association(uk.ac.ebi.spot.goci.model.Association) AssociationValidationReport(uk.ac.ebi.spot.goci.model.AssociationValidationReport)

Aggregations

Association (uk.ac.ebi.spot.goci.model.Association)1 AssociationValidationReport (uk.ac.ebi.spot.goci.model.AssociationValidationReport)1