Package src.controller
Class DatabaseManager
Object
DatabaseManager
Controller class for handling all logics related to the
Database
- Version:
- 1.0
- Author:
- Lee Juin
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Method to initialize the initial cinema staff data into databasestatic Cinema
initializeCinemaData
(int choice) Method to load inital cinema data into databasestatic boolean
Method to load initial cineplex data into databasestatic boolean
Method to initialize the initial movie data into databasestatic boolean
Method to initialize the initial movie schedule data into databasestatic void
Method to initialize the default pricesinitializeSeatData
(CinemaClass cinemaClass) Method to initialize the initial seat data into databasestatic void
Helper function to reload the database.static void
Helper function to reset the databasestatic <K,
V> void saveUpdateToBuffer
(K UUID, V object, HashMap<K, V> data) Similar to saveUpdateToDatabase, except save to buffer instead.static <K,
V> void saveUpdateToDatabase
(K UUID, V object, HashMap<K, V> data) Generic helper function to save written changes into the database
-
Constructor Details
-
DatabaseManager
public DatabaseManager()Constructor
-
-
Method Details
-
initializeCineplexData
public static boolean initializeCineplexData()Method to load initial cineplex data into database- Returns:
true
if initialization is successful,false
otherwise
-
initializeCinemaData
Method to load inital cinema data into database- Parameters:
choice
- is the choice ofCinemaClass
to be initialized- Returns:
Cinema
instance created
-
initializeSeatData
Method to initialize the initial seat data into database- Parameters:
cinemaClass
- is theCinemaClass
of the cinema the seats belong to- Returns:
- ArrayList of
Seat
instances created
-
initializeMovieScheduleData
public static boolean initializeMovieScheduleData()Method to initialize the initial movie schedule data into database- Returns:
true
if initialization is successful,false
otherwise
-
initializeMovie
public static boolean initializeMovie()Method to initialize the initial movie data into database- Returns:
true
if initialization is successful,false
otherwise
-
initalizeCinemaStaff
public static boolean initalizeCinemaStaff()Method to initialize the initial cinema staff data into database- Returns:
true
if initialization is successful,false
otherwise
-
initializePrices
public static void initializePrices()Method to initialize the default prices -
saveUpdateToDatabase
Generic helper function to save written changes into the database- Type Parameters:
K
- is the generic form for keyV
- is the generic form for value- Parameters:
UUID
- is the unique ID of the object to be updatedobject
- is the object to be updateddata
- is the HashMap database to be updated
-
resetDatabase
public static void resetDatabase()Helper function to reset the database -
reloadDatabase
public static void reloadDatabase()Helper function to reload the database. Useful upon saved changes -
saveUpdateToBuffer
Similar to saveUpdateToDatabase, except save to buffer instead. Useful for updating large data- Type Parameters:
K
- is the generic form for keyV
- is the generic form for value- Parameters:
UUID
- is the unique ID of the object to be updatedobject
- is the object to be updateddata
- is the HashMap database to be updated
-