コード例 #1
0
  /**
   * 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);
  }
コード例 #2
0
 /**
  * Add reminders for a specific appointment
  *
  * @param appointment Appointment object with the necessary fields populated
  */
 @Override
 public void addReminders(Appointment appointment) {
   if (appointment.getReminderInterval() != null) {
     RepeatingPeriodSchedulableJob reminder = buildJob(appointment);
     this.schedulerService.safeScheduleRepeatingPeriodJob(reminder);
   }
 }
コード例 #3
0
 /**
  * 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()));
 }