/** * Helper to create a repeating schedulable job from an appointment * * @param appointment The appointment object to create the schedulable job for * @return a repeating period job for the scheduler */ private RepeatingPeriodSchedulableJob buildJob(Appointment appointment) { String eventTitle = String.format(SUBJECT, appointment.getExternalId(), appointment.getApptId()); MotechEvent event = new MotechEvent(eventTitle); return new RepeatingPeriodSchedulableJob( event, appointment.getReminderStartTime().toDate(), appointment.getAppointmentDate().toDate(), appointment.getReminderInterval(), true); }
/** * Remove reminders for a specific appointment * * @param appointment Appointment object with the necessary fields populated */ @Override public void removeReminders(Appointment appointment) { this.schedulerService.safeUnscheduleAllJobs( String.format(SUBJECT, appointment.getExternalId(), appointment.getApptId())); }