Пример #1
0
 private String getAnnouncementBody(Thesis thesis, String key, Language language) {
   return getMessage(
       key,
       new Locale(language.toString()),
       thesis.getStudent().getPerson().getName(),
       getDate(thesis.getProposedDiscussed()),
       hasPlace(thesis),
       thesis.getProposedPlace(),
       hasTime(thesis.getProposedDiscussed()),
       getTime(thesis.getProposedDiscussed()),
       getString(thesis.getTitle(), language));
 }
Пример #2
0
  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);
  }