Search in sources :

Example 1 with DeletedStudy

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

the class StudyDeletionService method deleteStudy.

/**
     * Delete a study
     *
     * @param study Study to delete
     * @param user  User
     */
public void deleteStudy(Study study, SecureUser user) {
    getLog().warn("Deleting study: ".concat(String.valueOf(study.getId())));
    // Before we delete the study get its associated ancestry
    Collection<Ancestry> ancestriesAttachedToStudy = ancestryRepository.findByStudyId(study.getId());
    // Delete ancestry information linked to this study
    for (Ancestry ancestry : ancestriesAttachedToStudy) {
        ancestryRepository.delete(ancestry);
    }
    // WeeklyTracking, CuratorTracking and Note. Please use this method!
    // Shared with === DataDeletionService ===
    studyService.deleteRelatedInfoByStudy(study);
    // Add deletion event
    trackingOperationService.delete(study, user);
    DeletedStudy deletedStudy = createDeletedStudy(study);
    // Delete study
    studyRepository.delete(study);
    // Save deleted study details
    getLog().info("Saving details of deleted study: ".concat(String.valueOf(deletedStudy.getId())));
    deletedStudyRepository.save(deletedStudy);
}
Also used : DeletedStudy(uk.ac.ebi.spot.goci.model.DeletedStudy) Ancestry(uk.ac.ebi.spot.goci.model.Ancestry)

Aggregations

Ancestry (uk.ac.ebi.spot.goci.model.Ancestry)1 DeletedStudy (uk.ac.ebi.spot.goci.model.DeletedStudy)1