Search in sources :

Example 1 with StudyIsLockedError

use of uk.ac.ebi.spot.goci.curation.model.errors.StudyIsLockedError in project goci by EBISPOT.

the class StudyOperationsService method addStudyNote.

public ErrorNotification addStudyNote(Study study, StudyNote studyNote, SecureUser user) {
    ErrorNotification notification = new ErrorNotification();
    //xintodo need to refactor after removing curator table
    Curator curator = curatorService.getCuratorIdByEmail(user.getEmail());
    studyNote.setCurator(curator);
    //user cannot touch system notes
    if (studyNoteOperationsService.isSystemNote(studyNote)) {
        notification.addError(new NoteIsLockedError());
    }
    //check if study is published
    if (isPublished(study)) {
        notification.addError(new StudyIsLockedError());
    }
    if (!notification.hasErrors()) {
        studyNoteService.saveStudyNote(studyNote);
    }
    return notification;
}
Also used : NoteIsLockedError(uk.ac.ebi.spot.goci.curation.model.errors.NoteIsLockedError) Curator(uk.ac.ebi.spot.goci.model.Curator) StudyIsLockedError(uk.ac.ebi.spot.goci.curation.model.errors.StudyIsLockedError) ErrorNotification(uk.ac.ebi.spot.goci.curation.model.errors.ErrorNotification)

Aggregations

ErrorNotification (uk.ac.ebi.spot.goci.curation.model.errors.ErrorNotification)1 NoteIsLockedError (uk.ac.ebi.spot.goci.curation.model.errors.NoteIsLockedError)1 StudyIsLockedError (uk.ac.ebi.spot.goci.curation.model.errors.StudyIsLockedError)1 Curator (uk.ac.ebi.spot.goci.model.Curator)1