Package scheduler.model
Class TimeManagement
- java.lang.Object
-
- scheduler.model.TimeManagement
-
public abstract class TimeManagement extends java.lang.Object
Provides functionality to implement time related functions.
-
-
Field Summary
Fields Modifier and Type Field Description private static javafx.collections.ObservableList<java.time.LocalTime>
hour_picker
-
Constructor Summary
Constructors Constructor Description TimeManagement()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
appointmentWithinFifteen()
Checks to see if there is an appointment in the next fifteen minutes (as of customer's local time).static java.sql.Timestamp
calculateNow()
Calculates what "now" is from the perspective of the local machine.static Appointment
checkAppointmentTimeOverlap(int CustomerID, java.time.LocalDateTime start, java.time.LocalDateTime end)
Checks whether new appointment time conflicts with an already scheduled appointment with the same customer.static void
populateDateTimes()
Populates an Observable list with valid Appointment times for display.static javafx.collections.ObservableList<java.time.LocalTime>
returnLocalTime()
Returns the list of times.static java.util.TimeZone
returnTimeZone()
Get the timezone of the user's system.static java.lang.String
returnTimeZoneID()
Get the TimeZone ID of the user's system.static java.lang.String
returnZoneIDString()
Get a human readable string that indicates what timezone is set on the user's system.static boolean
validateBusinessHours(java.time.LocalDateTime start, java.time.LocalDateTime end)
Checks the following: Whether appointment occurs within allowable business hours.
-
-
-
Method Detail
-
returnTimeZone
public static java.util.TimeZone returnTimeZone()
Get the timezone of the user's system.- Returns:
- a timezone object
-
returnTimeZoneID
public static java.lang.String returnTimeZoneID()
Get the TimeZone ID of the user's system.- Returns:
- the Timezone ID as a string
-
returnZoneIDString
public static java.lang.String returnZoneIDString()
Get a human readable string that indicates what timezone is set on the user's system. This does account for daylight saving time if that is applicable.- Returns:
- A string in Long format representing the user systems' timezone
-
populateDateTimes
public static void populateDateTimes()
Populates an Observable list with valid Appointment times for display.
-
returnLocalTime
public static javafx.collections.ObservableList<java.time.LocalTime> returnLocalTime()
Returns the list of times.- Returns:
- an Observable list of LocalTime objects
-
validateBusinessHours
public static boolean validateBusinessHours(java.time.LocalDateTime start, java.time.LocalDateTime end)
Checks the following: Whether appointment occurs within allowable business hours. Business hours are currently defined as 8:00 AM EST - 10 PM EST Monday - Sunday. Also checks to see if the end date is before the start date in LocalTime. Displays an error dialogue if errors are present.- Parameters:
start
- Local Date, Requested Start date / timeend
- Local Date, Requested end time /date- Returns:
- true, if times pass validation. false if they do not.
-
checkAppointmentTimeOverlap
public static Appointment checkAppointmentTimeOverlap(int CustomerID, java.time.LocalDateTime start, java.time.LocalDateTime end)
Checks whether new appointment time conflicts with an already scheduled appointment with the same customer.- Parameters:
CustomerID
- Integer, Customer IDstart
- LocalDateTime, the start time proposed for the new appointmentend
- LocalDateTime, the end time proposed for the new appointment- Returns:
- The appointment which has a conflict. If there is no conflict the Appointment Object that is returned is populated with null values, and a appointment id # of 0.
-
appointmentWithinFifteen
public static void appointmentWithinFifteen()
Checks to see if there is an appointment in the next fifteen minutes (as of customer's local time). If there is a dialogue is displayed to the user when this function is ran, Detailing Appointment ID, Date and time of upcoming appointment.
-
calculateNow
public static java.sql.Timestamp calculateNow()
Calculates what "now" is from the perspective of the local machine. This is used instead of now() in sql for testing purposes, as this application is tested outside of business hours. Returns a Timestamp that represents the current user's system time, translated into UTC and returned as a timestamp.- Returns:
- a Timestamp that reflects current system time in UTC.
-
-