Package Databases
Class AppointmentOutcomeDatabase
java.lang.Object
Common.Database
Databases.AppointmentOutcomeDatabase
The
AppointmentOutcomeDatabase
class manages a collection of
AppointmentOutcome
objects, providing functionalities to
extract, search, remove, and create appointment outcomes from a CSV file.-
Field Summary
Fields inherited from class Common.Database
csvPath, headerFormat, records
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs anAppointmentOutcomeDatabase
with a default CSV path for storing appointment outcome records.AppointmentOutcomeDatabase
(String csvpath) Constructs anAppointmentOutcomeDatabase
with a specified CSV path for storing appointment outcome records. -
Method Summary
Modifier and TypeMethodDescriptioncreateDatabaseItem
(String[] values) Creates a newAppointmentOutcome
object from an array of values.void
Prints all items in the appointment outcome database with a specified title.boolean
removeItem
(String appointment_id) Removes an appointment outcome from the database using its unique identifier.searchItem
(String id) Searches for an appointment outcome by its unique identifier.Methods inherited from class Common.Database
addItem, extractFromCSV, getRecords, printItems, setcsvPath, setHeaderFormat, storeToCSV
-
Constructor Details
-
AppointmentOutcomeDatabase
public AppointmentOutcomeDatabase()Constructs anAppointmentOutcomeDatabase
with a default CSV path for storing appointment outcome records. -
AppointmentOutcomeDatabase
Constructs anAppointmentOutcomeDatabase
with a specified CSV path for storing appointment outcome records.- Parameters:
csvpath
- the path to the CSV file containing appointment outcomes
-
-
Method Details
-
searchItem
Searches for an appointment outcome by its unique identifier.- Specified by:
searchItem
in classDatabase
- Parameters:
id
- the unique identifier of the appointment outcome to search for- Returns:
- the
AppointmentOutcome
object if found; otherwise, returns null
-
removeItem
Removes an appointment outcome from the database using its unique identifier.- Specified by:
removeItem
in classDatabase
- Parameters:
appointment_id
- the unique identifier of the appointment outcome to be removed- Returns:
- true if the item was successfully removed; false otherwise
-
createDatabaseItem
Creates a newAppointmentOutcome
object from an array of values.- Specified by:
createDatabaseItem
in classDatabase
- Parameters:
values
- an array of strings containing appointment details in order: appointment_id, patient_id, doctor_id, date, type_of_service, medication, consultation_notes, status- Returns:
- a new instance of
AppointmentOutcome
-
printItems
public void printItems()Prints all items in the appointment outcome database with a specified title.- Specified by:
printItems
in classDatabase
-