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); }
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); }