From 505d9e3f5c16684274031521f90d967eacdecebe Mon Sep 17 00:00:00 2001 From: Dorian Nemec Date: Thu, 16 May 2024 13:14:56 +0200 Subject: [PATCH] =?UTF-8?q?#10=20Javadoc=20=C3=84nderungen=20erg=C3=A4nzt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nhplus/main/MainWindowController.java | 6 ++-- .../nhplus/nurse/LockedNurseController.java | 14 +++------- .../java/de/hitec/nhplus/nurse/Nurse.java | 13 ++++----- .../hitec/nhplus/nurse/database/NurseDao.java | 28 +------------------ 4 files changed, 15 insertions(+), 46 deletions(-) diff --git a/src/main/java/de/hitec/nhplus/main/MainWindowController.java b/src/main/java/de/hitec/nhplus/main/MainWindowController.java index 40d3cce..7c334a3 100644 --- a/src/main/java/de/hitec/nhplus/main/MainWindowController.java +++ b/src/main/java/de/hitec/nhplus/main/MainWindowController.java @@ -18,6 +18,8 @@ import java.util.Objects; * * @author Bernd Heidemann * @author Dominik Säume + * @author Armin Ribic + * @author Dorian Nemec */ public class MainWindowController { @FXML @@ -48,7 +50,7 @@ public class MainWindowController { private Tab medicationTab; /** - * This method allows instantiating a {@link MainWindowController} object. + * Initialization method that is called after the binding of all the fields. */ @FXML public void initialize() { @@ -118,7 +120,7 @@ public class MainWindowController { } /** - * Loads the Active Nurse page into its tab. + * Loads the active Nurse page into its tab. */ private void loadActiveNursePage() { try { diff --git a/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java b/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java index c8c0778..1c22a5e 100644 --- a/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java +++ b/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java @@ -20,6 +20,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +/** + * @author Armin Ribic + * @author Dorian Nemec + */ public class LockedNurseController { @FXML public Button buttonDelete; @@ -89,9 +93,6 @@ public class LockedNurseController { } } - /** - * Deletes a locked nurse. - */ @FXML public void handleDelete() { Nurse selectedItem = this.tableView.getSelectionModel().getSelectedItem(); @@ -108,10 +109,6 @@ public class LockedNurseController { } - /** - * On clicking a locked nurse, updates the delete button based on if they - * can be deleted. - */ @FXML public void handleMouseClick() { Nurse nurse = tableView.getSelectionModel().getSelectedItem(); @@ -119,9 +116,6 @@ public class LockedNurseController { buttonDelete.setDisable(!canBeDeleted); } - /** - * Unlocks a locked nurse. - */ @FXML public void unlockNurse() { Nurse selectedItem = this.tableView.getSelectionModel().getSelectedItem(); diff --git a/src/main/java/de/hitec/nhplus/nurse/Nurse.java b/src/main/java/de/hitec/nhplus/nurse/Nurse.java index fb5a878..b0dba07 100644 --- a/src/main/java/de/hitec/nhplus/nurse/Nurse.java +++ b/src/main/java/de/hitec/nhplus/nurse/Nurse.java @@ -18,6 +18,8 @@ import java.util.StringJoiner; * The model for a {@link Nurse}. * * @author Dominik Säume + * @author Armin Ribic + * @author Dorian Nemec */ public class Nurse extends Person { private SimpleIntegerProperty id; @@ -27,9 +29,8 @@ public class Nurse extends Person { /** * This constructor allows instantiating a {@link Nurse} object, * before it is stored in the database, by omitting the {@link Nurse#id ID} value. - * - * @implSpec Instances created with this constructor can be directly passed to - * {@link de.hitec.nhplus.nurse.database.NurseDao#create NurseDao.create}. + * It includes the locked Property. + * @implSpec This was added for usage in the {@link de.hitec.nhplus.fixtures.NurseFixture NurseFixture}. */ public Nurse( String firstName, @@ -73,7 +74,7 @@ public class Nurse extends Person { } /** - * Calculates the date when the nurse can be deleted. + * Calculates the date when the {@link Nurse} can be deleted. */ public LocalDate calculateDeleteDate() { List treatments; @@ -130,9 +131,6 @@ public class Nurse extends Person { this.locked.set(locked); } - /** - * Returns a string representation of the nurse with each field on a new line. - */ @Override public String toString() { return new StringJoiner(System.lineSeparator()) @@ -141,6 +139,7 @@ public class Nurse extends Person { .add("FirstName: " + this.getFirstName()) .add("SurName: " + this.getSurName()) .add("PhoneNumber: " + this.getPhoneNumber()) + .add("IsLocked: ") + this.isLocked() .toString(); } diff --git a/src/main/java/de/hitec/nhplus/nurse/database/NurseDao.java b/src/main/java/de/hitec/nhplus/nurse/database/NurseDao.java index 49feb42..3245484 100644 --- a/src/main/java/de/hitec/nhplus/nurse/database/NurseDao.java +++ b/src/main/java/de/hitec/nhplus/nurse/database/NurseDao.java @@ -18,16 +18,10 @@ import java.util.List; */ public class NurseDao extends DaoImp { - /** - * This takes the same connection value from its parent class. - */ public NurseDao(Connection connection) { super(connection); } - /** - * Insert values into nurse SQL table. - */ @Override protected PreparedStatement getCreateStatement(Nurse nurse) throws SQLException { final String SQL = """ @@ -43,9 +37,6 @@ public class NurseDao extends DaoImp { return statement; } - /** - * Show data of nurse with given id. - */ @Override protected PreparedStatement getReadByIDStatement(int id) throws SQLException { final String SQL = "SELECT * FROM nurse WHERE id = ?"; @@ -54,9 +45,6 @@ public class NurseDao extends DaoImp { return statement; } - /** - * Creates a Nurse instance from the given ResultSet. - */ @Override protected Nurse getInstanceFromResultSet(ResultSet result) throws SQLException { return new Nurse( @@ -68,18 +56,11 @@ public class NurseDao extends DaoImp { ); } - /** - * Prepares a SQL statement to select all rows from the nurse table. - */ @Override protected PreparedStatement getReadAllStatement() throws SQLException { final String SQL = "SELECT * FROM nurse"; return this.connection.prepareStatement(SQL); } - - /** - * Extracts a list of Nurse instances from the given ResultSet. - */ @Override protected List getListFromResultSet(ResultSet result) throws SQLException { ArrayList list = new ArrayList<>(); @@ -98,17 +79,13 @@ public class NurseDao extends DaoImp { } /** - * Retrieves a list of locked Nurse instances from the database. + * Read all database entries of locked {@link Nurse}s into a {@link List} of model instances. */ public List readAllLocked() throws SQLException { final String SQL = "SELECT * FROM nurse WHERE isLocked=true"; return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery()); } -/** - * Prepares a SQL statement to update a Nurse instance in the database. - * - */ @Override protected PreparedStatement getUpdateStatement(Nurse nurse) throws SQLException { final String SQL = """ @@ -128,9 +105,6 @@ public class NurseDao extends DaoImp { return statement; } - /** - * Prepares a SQL statement to delete a Nurse instance from the database by its ID. - */ @Override protected PreparedStatement getDeleteStatement(int id) throws SQLException { final String SQL = "DELETE FROM nurse WHERE id = ?";