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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanMethod to initialize the initial cinema staff data into databasestatic CinemainitializeCinemaData(int choice) Method to load inital cinema data into databasestatic booleanMethod to load initial cineplex data into databasestatic booleanMethod to initialize the initial movie data into databasestatic booleanMethod to initialize the initial movie schedule data into databasestatic voidMethod to initialize the default pricesinitializeSeatData(CinemaClass cinemaClass) Method to initialize the initial seat data into databasestatic voidHelper function to reload the database.static voidHelper 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:
trueif initialization is successful,falseotherwise
-
initializeCinemaData
Method to load inital cinema data into database- Parameters:
choice- is the choice ofCinemaClassto be initialized- Returns:
Cinemainstance created
-
initializeSeatData
Method to initialize the initial seat data into database- Parameters:
cinemaClass- is theCinemaClassof the cinema the seats belong to- Returns:
- ArrayList of
Seatinstances created
-
initializeMovieScheduleData
public static boolean initializeMovieScheduleData()Method to initialize the initial movie schedule data into database- Returns:
trueif initialization is successful,falseotherwise
-
initializeMovie
public static boolean initializeMovie()Method to initialize the initial movie data into database- Returns:
trueif initialization is successful,falseotherwise
-
initalizeCinemaStaff
public static boolean initalizeCinemaStaff()Method to initialize the initial cinema staff data into database- Returns:
trueif initialization is successful,falseotherwise
-
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
-