예제 #1
0
  public void delete(Announcement announcement) {
    assert announcement != null;
    assert announcement.getId() != 0;

    Assert.isTrue(announcementRepository.exists(announcement.getId()));
    Assert.isTrue(!registrationService.existsRegistrationForAnnouncement(announcement));

    announcementRepository.delete(announcement);
  }
예제 #2
0
  public void save(Announcement announcement) {
    assert announcement != null;

    Date currentMoment;

    currentMoment = new Date();
    Assert.isTrue(announcement.getCertification().getExtinctionDate().after(currentMoment));
    Assert.isTrue(announcement.getCertification().getExams().contains(announcement.getExam()));

    announcementRepository.save(announcement);
  }