private void createAnnouncement(Thesis thesis) { if (thesis.getProposedDiscussed() == null) { return; } AnnouncementBoard board = getBoard(DEGREE_ANNOUNCEMENTS_BOARD_NAME, thesis.getDegree().getUnit()); if (board == null) { return; } DateTime now = new DateTime(); Announcement announcement = new Announcement(); announcement.setAnnouncementBoard(board); announcement.setCreator(AccessControl.getPerson()); announcement.setCreationDate(now); announcement.setPlace(thesis.getProposedPlace()); announcement.setVisible(true); announcement.setAuthor(getMessage("system.public.name")); announcement.setAuthorEmail(getMessage("system.public.email")); announcement.setPublicationBegin(now); announcement.setReferedSubjectBegin(thesis.getProposedDiscussed()); MultiLanguageString subject = new MultiLanguageString() .with( Language.pt, getAnnouncementSubject(thesis, "thesis.announcement.subject", Language.pt)) .with( Language.en, getAnnouncementSubject(thesis, "thesis.announcement.subject", Language.en)); MultiLanguageString body = new MultiLanguageString() .with(Language.pt, getAnnouncementBody(thesis, "thesis.announcement.body", Language.pt)) .with( Language.en, getAnnouncementBody(thesis, "thesis.announcement.body", Language.en)); announcement.setSubject(subject); announcement.setBody(body); }
@Service public static void run(Thesis thesis) { final ThesisFile thesisFile = thesis.getDissertation(); RoleTypeGroup scientificCouncil = new RoleTypeGroup(RoleType.SCIENTIFIC_COUNCIL); CurrentDegreeScientificCommissionMembersGroup commissionMembers = new CurrentDegreeScientificCommissionMembersGroup(thesis.getDegree()); PersonGroup student = thesis.getStudent().getPerson().getPersonGroup(); ThesisFileReadersGroup thesisGroup = new ThesisFileReadersGroup(thesis); thesisFile.setPermittedGroup( new GroupUnion(scientificCouncil, commissionMembers, student, thesisGroup)); final net.sourceforge.fenixedu.domain.research.result.publication.Thesis publication = thesis.getPublication(); if (publication != null) { for (final File file : publication.getResultDocumentFilesSet()) { file.setPermittedGroup(thesisFile.getPermittedGroup()); } } }
@Override protected Collection<Person> getReceivers(Thesis thesis) { Person student = thesis.getStudent().getPerson(); Person orientator = thesis.getOrientator().getPerson(); Person coorientator = getPerson(thesis.getCoorientator()); Person president = getPerson(thesis.getPresident()); Set<Person> persons = personSet(student, orientator, coorientator, president); for (ThesisEvaluationParticipant participant : thesis.getVowels()) { persons.add(participant.getPerson()); } // also send proposal approval to the contact team ExecutionYear executionYear = thesis.getEnrolment().getExecutionYear(); for (ScientificCommission member : thesis.getDegree().getScientificCommissionMembers(executionYear)) { if (member.isContact()) { persons.add(member.getPerson()); } } return persons; }
@Override protected String getMessage(Thesis thesis) { Person currentPerson = AccessControl.getPerson(); ExecutionYear executionYear = ExecutionYear.readCurrentExecutionYear(); String title = thesis.getTitle().getContent(); String year = executionYear.getYear(); String degreeName = thesis.getDegree().getNameFor(executionYear).getContent(); String studentName = thesis.getStudent().getPerson().getName(); String studentNumber = thesis.getStudent().getNumber().toString(); String presidentName = name(thesis.getPresident()); String presidentAffiliation = affiliation(thesis.getPresident()); String orientatorName = name(thesis.getOrientator()); String orientatorAffiliation = affiliation(thesis.getOrientator()); String coorientatorName = name(thesis.getCoorientator()); String coorientatorAffiliation = affiliation(thesis.getCoorientator()); String vowel1Name = name(thesis.getVowels(), 0); String vowel1Affiliation = affiliation(thesis.getVowels(), 0); String vowel2Name = name(thesis.getVowels(), 1); String vowel2Affiliation = affiliation(thesis.getVowels(), 1); String vowel3Name = name(thesis.getVowels(), 2); String vowel3Affiliation = affiliation(thesis.getVowels(), 2); String date = String.format(new Locale("pt"), "%1$td de %1$tB de %1$tY", new Date()); String currentPersonName = currentPerson.getNickname(); if (thesis.isCoordinator()) { return getMessage( COORDINATOR_BODY_KEY, year, degreeName, studentName, studentNumber, presidentName, presidentAffiliation, orientatorName, orientatorAffiliation, includeFlag(coorientatorName), coorientatorName, coorientatorAffiliation, includeFlag(vowel1Name), vowel1Name, vowel1Affiliation, includeFlag(vowel2Name), vowel2Name, vowel2Affiliation, includeFlag(vowel3Name), vowel3Name, vowel3Affiliation, date, currentPersonName); } else { return getMessage( BODY_KEY, year, degreeName, studentName, studentNumber, presidentName, presidentAffiliation, orientatorName, orientatorAffiliation, includeFlag(coorientatorName), coorientatorName, coorientatorAffiliation, includeFlag(vowel1Name), vowel1Name, vowel1Affiliation, includeFlag(vowel2Name), vowel2Name, vowel2Affiliation, includeFlag(vowel3Name), vowel3Name, vowel3Affiliation, date, currentPersonName); } }