- java.lang.Object
-
- stores.DataStore
-
public class DataStore extends java.lang.ObjectTheDataStoreclass 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 IFileDataServicefileDataServiceTheIFileDataServiceinstance used for data operations.private static java.util.Map<java.lang.String,java.lang.String>filePathsMapAMapcontaining file paths for various data types.private static java.util.Map<java.lang.String,FYPCoordinator>fypcoordinatorsDataAMapcontaining FYP coordinator ID as the key andFYPCoordinatorobjects as the value.private static java.util.Map<java.lang.Integer,Project>projectsDataAMapcontaining project ID as the key andProjectobjects as the value.private static java.util.Map<java.lang.Integer,Request>requestDataAMapcontaining request ID as the key andRequestobjects as the value.private static java.util.Map<java.lang.String,Student>studentsDataAMapcontaining student ID as the key andStudentobjects as the value.private static java.util.Map<java.lang.String,Supervisor>supervisorsDataAMapcontaining supervisor ID as the key andSupervisorobjects as the value.
-
Constructor Summary
Constructors Modifier Constructor Description privateDataStore()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 booleaninitDataStore(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 booleansaveData()Saves the data from the DataStore to the file system.static voidsetFYPCoordinatorsData(java.util.Map<java.lang.String,FYPCoordinator> fypcoordinatorsData)Sets the FYP coordinators data map and saves the data to the file system.static voidsetProjectsData(java.util.Map<java.lang.Integer,Project> projectsData)Sets the projects data map and saves the data to the file system.static voidsetRequestsData(java.util.Map<java.lang.Integer,Request> requestData)Sets the requests data map and saves the data to the file system.static voidsetStudentsData(java.util.Map<java.lang.String,Student> studentsData)Sets the students data map and saves the data to the file system.static voidsetSupervisorsData(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
TheIFileDataServiceinstance used for data operations.
-
filePathsMap
private static java.util.Map<java.lang.String,java.lang.String> filePathsMap
AMapcontaining file paths for various data types.
-
studentsData
private static java.util.Map<java.lang.String,Student> studentsData
AMapcontaining student ID as the key andStudentobjects as the value.
-
supervisorsData
private static java.util.Map<java.lang.String,Supervisor> supervisorsData
AMapcontaining supervisor ID as the key andSupervisorobjects as the value.
-
fypcoordinatorsData
private static java.util.Map<java.lang.String,FYPCoordinator> fypcoordinatorsData
AMapcontaining FYP coordinator ID as the key andFYPCoordinatorobjects as the value.
-
projectsData
private static java.util.Map<java.lang.Integer,Project> projectsData
AMapcontaining project ID as the key andProjectobjects 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- theIFileDataServiceinstance to use for data operationsfilePathsMap- theMapcontaining file paths for various data types- Returns:
trueif the initialization is successful,falseotherwise
-
saveData
public static boolean saveData()
Saves the data from the DataStore to the file system.- Returns:
trueif the data is saved successfully,falseotherwise
-
getStudentsData
public static java.util.Map<java.lang.String,Student> getStudentsData()
Gets the students data map.- Returns:
- a
Mapcontaining student ID as the key andStudentobjects 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- aMapcontaining student ID as the key andStudentobjects as the value
-
getSupervisorsData
public static java.util.Map<java.lang.String,Supervisor> getSupervisorsData()
Gets the supervisors data map.- Returns:
- a
Mapcontaining supervisor ID as the key andSupervisorobjects 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- aMapcontaining supervisor ID as the key andSupervisorobjects as the value
-
getFYPCoordinatorsData
public static java.util.Map<java.lang.String,FYPCoordinator> getFYPCoordinatorsData()
Gets the FYP coordinators data map.- Returns:
- a
Mapcontaining FYP coordinator ID as the key andFYPCoordinatorobjects 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- aMapcontaining FYP coordinator ID as the key andFYPCoordinatorobjects as the value
-
getProjectsData
public static java.util.Map<java.lang.Integer,Project> getProjectsData()
Gets the projects data map.- Returns:
- a
Mapcontaining project ID as the key andProjectobjects 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- aMapcontaining project ID as the key andProjectobjects as the value
-
getRequestsData
public static java.util.Map<java.lang.Integer,Request> getRequestsData()
Gets the requests data map.- Returns:
- a
Mapcontaining requestID as the key andRequestobjects as the value
-
-