use of uk.ac.ebi.spot.goci.curation.exception.ResourceNotFoundException in project goci by EBISPOT.
the class StudyDataService method updateStudyDiseaseTraitByAccessionId.
public Study updateStudyDiseaseTraitByAccessionId(String trait, String accessionId) {
Study study = this.getStudyByAccessionId(accessionId).orElseThrow(() -> new ResourceNotFoundException("Study", accessionId));
DiseaseTrait diseaseTrait = Optional.ofNullable(diseaseTraitRepository.findByTraitIgnoreCase(trait)).orElseThrow(() -> new ResourceNotFoundException("Disease Trait", trait));
study.setDiseaseTrait(diseaseTrait);
studyRepository.save(study);
log.info("Study with accession Id: {} found and updated", accessionId);
return study;
}
Aggregations