Search in sources :

Example 6 with Curator

use of uk.ac.ebi.spot.goci.model.Curator 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

Curator (uk.ac.ebi.spot.goci.model.Curator)6 CurationStatus (uk.ac.ebi.spot.goci.model.CurationStatus)3 Housekeeping (uk.ac.ebi.spot.goci.model.Housekeeping)3 Date (java.util.Date)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Before (org.junit.Before)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1 Matchers (org.mockito.Matchers)1 Mock (org.mockito.Mock)1 Mockito.times (org.mockito.Mockito.times)1 Mockito.verify (org.mockito.Mockito.verify)1 Mockito.verifyZeroInteractions (org.mockito.Mockito.verifyZeroInteractions)1 Mockito.when (org.mockito.Mockito.when)1 MockitoJUnitRunner (org.mockito.runners.MockitoJUnitRunner)1 CurationStatusBuilder (uk.ac.ebi.spot.goci.builder.CurationStatusBuilder)1 CuratorBuilder (uk.ac.ebi.spot.goci.builder.CuratorBuilder)1 HousekeepingBuilder (uk.ac.ebi.spot.goci.builder.HousekeepingBuilder)1 StudyBuilder (uk.ac.ebi.spot.goci.builder.StudyBuilder)1 ErrorNotification (uk.ac.ebi.spot.goci.curation.model.errors.ErrorNotification)1