diff --git a/src/DAOs/FacultyDAO.java b/src/DAOs/FacultyDAO.java index 6667289..824ecc7 100644 --- a/src/DAOs/FacultyDAO.java +++ b/src/DAOs/FacultyDAO.java @@ -11,8 +11,21 @@ import Models.Faculty; import javafx.scene.control.Alert; +/** + * Data Access Object (DAO) for interacting with the Faculty table in the + * database. + * + * @author Daniel Silva + */ public class FacultyDAO { + /** + * Retrieves a faculty member by their ID from the database. + * + * @param id the ID of the faculty member + * @return the Faculty object representing the faculty member, or null if not + * found + */ public static Faculty getFacultyById(String id) { String user = System.getenv("USER"); String password = System.getenv("PASSWORD"); @@ -48,9 +61,13 @@ public static Faculty getFacultyById(String id) { alert.showAndWait(); } return null; - } + /** + * Retrieves all faculty members from the database. + * + * @return an ArrayList of Faculty objects representing all faculty members + */ public static ArrayList getAllFaculties() { String user = System.getenv("USER"); String password = System.getenv("PASSWORD"); @@ -89,6 +106,12 @@ public static ArrayList getAllFaculties() { return null; } + /** + * Inserts a new faculty member into the database. + * + * @param faculty the faculty member to be inserted + * @return true if the faculty member is successfully inserted, false otherwise + */ public static boolean insertFaculty(Faculty faculty) { String user = System.getenv("USER"); String password = System.getenv("PASSWORD"); @@ -122,6 +145,12 @@ public static boolean insertFaculty(Faculty faculty) { } } + /** + * Retrieves the full name of a faculty member with the given ID. + * + * @param id the ID of the faculty member + * @return the full name of the faculty member, or null if not found + */ public static String getFacultyName(String id) { String user = System.getenv("USER"); String password = System.getenv("PASSWORD"); diff --git a/src/Utils/dataUtilities.java b/src/Utils/dataUtilities.java index 24b55d2..0ebd466 100644 --- a/src/Utils/dataUtilities.java +++ b/src/Utils/dataUtilities.java @@ -10,6 +10,13 @@ import javafx.scene.control.Alert.AlertType; public class DataUtilities { + /** + * Converts a grade string to a double value. + * + * @param grade the grade string to be converted + * @return the converted double value. Returns -1.0 if the grade string does not + * start with "A", "B", "C", "D", or "F". + */ public static double convertGradeToDouble(String grade) { if (grade.startsWith("A")) { return 4.0; @@ -26,6 +33,12 @@ public static double convertGradeToDouble(String grade) { } } + /** + * Retrieves the course name associated with the given CRN from the database. + * + * @param crn the CRN (Course Reference Number) of the course + * @return the course name if found, null otherwise + */ public static String getCourseName(String crn) { String user = System.getenv("USER"); String password = System.getenv("PASSWORD"); @@ -48,14 +61,4 @@ public static String getCourseName(String crn) { } return null; } - - public static String formatDateFromYYMMDDToMMDDYY(String date) { - String [] parts = date.split("-"); - return parts[1] + "-" + parts[2] + "-" + parts[0]; - } - - public static String formatDateFromMMDDYYToYYMMDD(String date) { - String[] parts = date.split("-"); - return parts[2] + "-" + parts[0] + "-" + parts[1]; - } }