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);
});
}
Aggregations