- java.lang.Object
-
- stores.DataStore
-
public class DataStore extends java.lang.Object
TheDataStore
class provides utility methods for managing data storage within the application. It offers methods to initialize the data store, import and export data to and from the file system, and interact with data maps for various data types.
-
-
Field Summary
Fields Modifier and Type Field Description private static IFileDataService
fileDataService
TheIFileDataService
instance used for data operations.private static java.util.Map<java.lang.String,java.lang.String>
filePathsMap
AMap
containing file paths for various data types.private static java.util.Map<java.lang.String,FYPCoordinator>
fypcoordinatorsData
AMap
containing FYP coordinator ID as the key andFYPCoordinator
objects as the value.private static java.util.Map<java.lang.Integer,Project>
projectsData
AMap
containing project ID as the key andProject
objects as the value.private static java.util.Map<java.lang.Integer,Request>
requestData
AMap
containing request ID as the key andRequest
objects as the value.private static java.util.Map<java.lang.String,Student>
studentsData
AMap
containing student ID as the key andStudent
objects as the value.private static java.util.Map<java.lang.String,Supervisor>
supervisorsData
AMap
containing supervisor ID as the key andSupervisor
objects as the value.
-
Constructor Summary
Constructors Modifier Constructor Description private
DataStore()
Private constructor to prevent instantiation of the class.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,FYPCoordinator>
getFYPCoordinatorsData()
Gets the FYP coordinators data map.static java.util.Map<java.lang.Integer,Project>
getProjectsData()
Gets the projects data map.static java.util.Map<java.lang.Integer,Request>
getRequestsData()
Gets the requests data map.static java.util.Map<java.lang.String,Student>
getStudentsData()
Gets the students data map.static java.util.Map<java.lang.String,Supervisor>
getSupervisorsData()
Gets the supervisors data map.static boolean
initDataStore(IFileDataService fileDataService, java.util.Map<java.lang.String,java.lang.String> filePathsMap)
Initializes the DataStore by setting up the file data service, file paths map, and importing data from the file system.static boolean
saveData()
Saves the data from the DataStore to the file system.static void
setFYPCoordinatorsData(java.util.Map<java.lang.String,FYPCoordinator> fypcoordinatorsData)
Sets the FYP coordinators data map and saves the data to the file system.static void
setProjectsData(java.util.Map<java.lang.Integer,Project> projectsData)
Sets the projects data map and saves the data to the file system.static void
setRequestsData(java.util.Map<java.lang.Integer,Request> requestData)
Sets the requests data map and saves the data to the file system.static void
setStudentsData(java.util.Map<java.lang.String,Student> studentsData)
Sets the students data map and saves the data to the file system.static void
setSupervisorsData(java.util.Map<java.lang.String,Supervisor> supervisorsData)
Sets the supervisors data map and saves the data to the file system.
-
-
-
Field Detail
-
fileDataService
private static IFileDataService fileDataService
TheIFileDataService
instance used for data operations.
-
filePathsMap
private static java.util.Map<java.lang.String,java.lang.String> filePathsMap
AMap
containing file paths for various data types.
-
studentsData
private static java.util.Map<java.lang.String,Student> studentsData
AMap
containing student ID as the key andStudent
objects as the value.
-
supervisorsData
private static java.util.Map<java.lang.String,Supervisor> supervisorsData
AMap
containing supervisor ID as the key andSupervisor
objects as the value.
-
fypcoordinatorsData
private static java.util.Map<java.lang.String,FYPCoordinator> fypcoordinatorsData
AMap
containing FYP coordinator ID as the key andFYPCoordinator
objects as the value.
-
projectsData
private static java.util.Map<java.lang.Integer,Project> projectsData
AMap
containing project ID as the key andProject
objects as the value.
-
-
Method Detail
-
initDataStore
public static boolean initDataStore(IFileDataService fileDataService, java.util.Map<java.lang.String,java.lang.String> filePathsMap)
Initializes the DataStore by setting up the file data service, file paths map, and importing data from the file system.- Parameters:
fileDataService
- theIFileDataService
instance to use for data operationsfilePathsMap
- theMap
containing file paths for various data types- Returns:
true
if the initialization is successful,false
otherwise
-
saveData
public static boolean saveData()
Saves the data from the DataStore to the file system.- Returns:
true
if the data is saved successfully,false
otherwise
-
getStudentsData
public static java.util.Map<java.lang.String,Student> getStudentsData()
Gets the students data map.- Returns:
- a
Map
containing student ID as the key andStudent
objects as the value
-
setStudentsData
public static void setStudentsData(java.util.Map<java.lang.String,Student> studentsData)
Sets the students data map and saves the data to the file system.- Parameters:
studentsData
- aMap
containing student ID as the key andStudent
objects as the value
-
getSupervisorsData
public static java.util.Map<java.lang.String,Supervisor> getSupervisorsData()
Gets the supervisors data map.- Returns:
- a
Map
containing supervisor ID as the key andSupervisor
objects as the value
-
setSupervisorsData
public static void setSupervisorsData(java.util.Map<java.lang.String,Supervisor> supervisorsData)
Sets the supervisors data map and saves the data to the file system.- Parameters:
supervisorsData
- aMap
containing supervisor ID as the key andSupervisor
objects as the value
-
getFYPCoordinatorsData
public static java.util.Map<java.lang.String,FYPCoordinator> getFYPCoordinatorsData()
Gets the FYP coordinators data map.- Returns:
- a
Map
containing FYP coordinator ID as the key andFYPCoordinator
objects as the value
-
setFYPCoordinatorsData
public static void setFYPCoordinatorsData(java.util.Map<java.lang.String,FYPCoordinator> fypcoordinatorsData)
Sets the FYP coordinators data map and saves the data to the file system.- Parameters:
fypcoordinatorsData
- aMap
containing FYP coordinator ID as the key andFYPCoordinator
objects as the value
-
getProjectsData
public static java.util.Map<java.lang.Integer,Project> getProjectsData()
Gets the projects data map.- Returns:
- a
Map
containing project ID as the key andProject
objects as the value
-
setProjectsData
public static void setProjectsData(java.util.Map<java.lang.Integer,Project> projectsData)
Sets the projects data map and saves the data to the file system.- Parameters:
projectsData
- aMap
containing project ID as the key andProject
objects as the value
-
getRequestsData
public static java.util.Map<java.lang.Integer,Request> getRequestsData()
Gets the requests data map.- Returns:
- a
Map
containing requestID as the key andRequest
objects as the value
-
-