Package com.ehealthsystem.reminder
Class ReminderScheduler
java.lang.Object
com.ehealthsystem.reminder.ReminderScheduler
Manager for ReminderTasks (using java.util.TimerTask)
Sets up reminders on application start.
Gets notified by the UI controllers whenever a reminder time changes.
Checks the reminder time for validity by itself. Does not schedule reminders that should have already been sent.
Application's process keeps running in the background even though UI was closed, if there are still reminders scheduled.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
createReminder
(Appointment appointment) Create a reminder for a given appointment.static void
deleteReminder
(Appointment appointment) Remove a reminder for an appointment.private static void
Display messages to the console for verbosity purposes.static void
Set up (schedule) all reminders on application start.static void
updateReminder
(Appointment appointment) Update the reminder time when an appointment's time was changed (appointment shifted) AppointmentShiftController is responsible for triggering this method to keep the reminder time in sync with the appointment's time Works by deleting a potentially existing reminder and then creating a new reminder for that appointment.
-
Field Details
-
map
-
logging
private static final boolean logging- See Also:
-
-
Constructor Details
-
ReminderScheduler
public ReminderScheduler()
-
-
Method Details
-
log
Display messages to the console for verbosity purposes.- Parameters:
message
- The message to display to the console.
-
setupReminders
public static void setupReminders() throws SQLException, javax.activation.UnsupportedDataTypeExceptionSet up (schedule) all reminders on application start. Do not call from Main before the database file is created on initial setup.- Throws:
SQLException
javax.activation.UnsupportedDataTypeException
-
createReminder
Create a reminder for a given appointment. Called on application load and creation of a new appointment.- Parameters:
appointment
- the appointment in question to create a reminder for
-
deleteReminder
Remove a reminder for an appointment. To be called before an appointment gets cancelled/deleted (e.g. patient cancels appointment). Also used as helper method for updateReminder.- Parameters:
appointment
- the appointment to delete the reminder for
-
updateReminder
Update the reminder time when an appointment's time was changed (appointment shifted) AppointmentShiftController is responsible for triggering this method to keep the reminder time in sync with the appointment's time Works by deleting a potentially existing reminder and then creating a new reminder for that appointment. Has effectively no own code because it only calls the according functions.- Parameters:
appointment
- the appointment to update the reminder for
-