use of uk.ac.ebi.spot.goci.model.StudyNote in project goci by EBISPOT.
the class StudyNoteOperationsService method createEmptyStudyNote.
/**
* Creat empty study note and set its subject base on the publish status of the study
* @param study
* @param user
* @return
*/
public StudyNote createEmptyStudyNote(Study study, SecureUser user) {
StudyNote note = new StudyNote();
note.setStudy(study);
// defult curator will be the one who is currently adding the note
// #xintodo this needs to be change when a forgin key is added the curator table from the user table
Curator curator = curatorService.getCuratorIdByEmail(user.getEmail());
note.setCurator(curator);
note.setStatus(false);
note.setGenericId(study.getId());
if (study.getHousekeeping().getIsPublished()) {
// general note subject
note.setNoteSubject(noteSubjectService.findBySubject("Post-publishing review"));
} else {
note.setNoteSubject(noteSubjectService.findGeneralNote());
}
return note;
}
use of uk.ac.ebi.spot.goci.model.StudyNote in project goci by EBISPOT.
the class StudyNoteOperationsService method createAutomaticNote.
public StudyNote createAutomaticNote(String textNote, Study study, SecureUser user) {
StudyNote note = createEmptyStudyNote(study, user);
// System note subject
note.setTextNote(textNote);
NoteSubject subject = noteSubjectService.findAutomaticNote();
note.setNoteSubject(subject);
return note;
}
use of uk.ac.ebi.spot.goci.model.StudyNote in project goci by EBISPOT.
the class StudyNoteOperationsService method createGeneralNote.
public StudyNote createGeneralNote(Study study, SecureUser user) {
StudyNote note = createEmptyStudyNote(study, user);
// general note subject
NoteSubject subject = noteSubjectService.findGeneralNote();
note.setNoteSubject(subject);
return note;
}
use of uk.ac.ebi.spot.goci.model.StudyNote in project goci by EBISPOT.
the class StudyNoteOperationsService method duplicateNote.
public StudyNote duplicateNote(Study targetStudy, StudyNote noteToDuplicate, SecureUser user) {
Study sourceStudy = noteToDuplicate.getStudy();
StudyNote note = createEmptyStudyNote(targetStudy, user);
note.setCurator(noteToDuplicate.getCurator());
note.setNoteSubject(noteToDuplicate.getNoteSubject());
Curator curator = curatorService.getCuratorIdByEmail(user.getEmail());
note.setCurator(curator);
// we added some text to indicate that this is a duplicated note.
// This is just a hack to distinguish dulicated note since we have study-note one to many as out note model atm
note.setTextNote("Duplicated from study: ".concat(sourceStudy.getId().toString()).concat(" by ").concat(curator.getLastName()).concat("\n").concat(noteToDuplicate.getTextNote()));
note.setStatus(noteToDuplicate.getStatus());
return note;
}
use of uk.ac.ebi.spot.goci.model.StudyNote in project goci by EBISPOT.
the class CurationSystemEmailToCurator method createBody.
public void createBody(Study study, String status) {
// Set up some of the values used in mail body
Publication publication = study.getPublicationId();
String studyTitle = publication.getTitle();
String pubmedLink = "http://europepmc.org/abstract/MED/" + publication.getPubmedId();
String currentCurator = study.getHousekeeping().getCurator().getLastName();
// These could be null so catch this case
String studyTrait = null;
if (study.getDiseaseTrait() != null && !study.getDiseaseTrait().getTrait().isEmpty()) {
studyTrait = study.getDiseaseTrait().getTrait();
}
StringBuilder notes = new StringBuilder();
Collection<StudyNote> studyNotes = study.getNotes();
if (!studyNotes.isEmpty()) {
studyNotes.forEach(studyNote -> {
notes.append(studyNote.toStringForEamil()).append("\n");
notes.append("-------------------------------------------------------------\n\n");
});
}
// Format dates
Date studyDate = publication.getPublicationDate();
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
String bodyStudyDate = dateFormat.format(studyDate);
Date publishDate = study.getHousekeeping().getCatalogPublishDate();
String bodyPublishDate = null;
if (publishDate != null) {
bodyPublishDate = dateFormat.format(publishDate);
}
String editStudyLink = getLink() + "studies/" + study.getId();
this.setSubject(publication.getFirstAuthor().getFullnameShort(50) + " - " + status);
this.setBody("The GWAS paper by " + publication.getFirstAuthor().getFullname() + " with study date " + bodyStudyDate + " now has status " + status + "\n" + "Title: " + studyTitle + "\n" + "Trait: " + studyTrait + "\n" + "Pubmed link: " + pubmedLink + "\n" + "Edit link: " + editStudyLink + "\n" + "Current curator: " + currentCurator + "\n" + "Publish Date: " + bodyPublishDate + "\n" + "Notes: \n" + notes + "\n\n");
}
Aggregations