Package com.ehealthsystem.appointment
Class Appointment
java.lang.Object
com.ehealthsystem.appointment.Appointment
Represents an appointment with all the attributes.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAppointment
(boolean insertIntoDb, int id, String user, int doctor, String healthProblemDescription, LocalDate date, LocalTime time, int minutesBeforeReminder, int duration) -
Method Summary
Modifier and TypeMethodDescriptionboolean
delete()
Deletes an appointment from the database.getDate()
get the set date of the appointmentget the set date and time of the appointmentreturn the doctor selected for the appointmentint
For future use: Get the appointment's durationget the health problem description that was setint
getId()
Get the appointment id returnedint
get the time of the reminder set in minutesgetTime()
get the set time of the appointmentgetUser()
get the username of the that made the appointmentprivate void
Inserts this appointment into the database.boolean
get the appointment lies in the past.void
Set the date appointment when shifting it.void
Set the time appointment when shifting it.private void
Updates the entry for this appointment in the database
-
Field Details
-
tableName
- See Also:
-
id
private int id -
doctor
private int doctor -
minutesBeforeReminder
private int minutesBeforeReminder -
duration
private int duration -
user
-
healthProblemDescription
-
date
-
time
-
-
Constructor Details
-
Appointment
public Appointment(boolean insertIntoDb, int id, String user, int doctor, String healthProblemDescription, LocalDate date, LocalTime time, int minutesBeforeReminder, int duration) throws SQLException, javax.activation.UnsupportedDataTypeException - Parameters:
insertIntoDb
- true if this is a new appointment that is inserted to the database, false if the object shall solely represent an appointment that is already saved in the databaseid
- ignored when insertToDb is true (to be precise, it is saved but overwritten after successful insert)- Throws:
SQLException
javax.activation.UnsupportedDataTypeException
-
-
Method Details
-
insertIntoDb
Inserts this appointment into the database. Only to be used if a new appointment is created.- Throws:
SQLException
javax.activation.UnsupportedDataTypeException
-
getId
public int getId()Get the appointment id returned- Returns:
- return id as integer
-
getDoctor
return the doctor selected for the appointment- Returns:
- return doctor as object of the class Doctor
- Throws:
SQLException
- if the sql query wouldn't find a doctor in the database it throws an exception
-
getDate
get the set date of the appointment- Returns:
- return the date as an object of the type LocalDate
-
getTime
get the set time of the appointment- Returns:
- return the time as an object of the type LocalTime
-
getDateTime
get the set date and time of the appointment- Returns:
- return the date and time as an object of the type LocalDateTime
-
isInThePast
public boolean isInThePast()get the appointment lies in the past. Used for the sorting in upcoming and past appointments- Returns:
- return true or false depending on the date
-
getMinutesBeforeReminder
public int getMinutesBeforeReminder()get the time of the reminder set in minutes- Returns:
- return time as int
-
getDuration
public int getDuration()For future use: Get the appointment's duration- Returns:
- the duration of the appointment in minutes
-
getUser
get the username of the that made the appointment- Returns:
- return the username as a string
-
getHealthProblemDescription
get the health problem description that was set- Returns:
- return the description as a String
-
update
private void update(Object[][] newValues) throws SQLException, javax.activation.UnsupportedDataTypeException Updates the entry for this appointment in the database- Parameters:
newValues
-- Throws:
SQLException
javax.activation.UnsupportedDataTypeException
-
delete
Deletes an appointment from the database. Use to cancel an appointment.- Returns:
- whether deletion succeeded
- Throws:
SQLException
-
setDate
public void setDate(LocalDate date) throws SQLException, javax.activation.UnsupportedDataTypeException Set the date appointment when shifting it.- Parameters:
date
- the new selected date- Throws:
SQLException
- if the datebase class throws a exceptionjavax.activation.UnsupportedDataTypeException
-
setTime
public void setTime(LocalTime time) throws SQLException, javax.activation.UnsupportedDataTypeException Set the time appointment when shifting it.- Parameters:
time
- the new selected time- Throws:
SQLException
- if the datebase class throws a exceptionjavax.activation.UnsupportedDataTypeException
-