#10 story/pfleger-modul-sperren-und-loschen-von-pflegern #37
6 changed files with 72 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
<data-source source="LOCAL" name="Database" uuid="5a5b8be1-080b-4129-b89d-42f1ea832b90">
|
<data-source source="LOCAL" name="nursingHome.db" uuid="5a5b8be1-080b-4129-b89d-42f1ea832b90">
|
||||||
SZUT-Dorian marked this conversation as resolved
Outdated
|
|||||||
<driver-ref>sqlite.xerial</driver-ref>
|
<driver-ref>sqlite.xerial</driver-ref>
|
||||||
<synchronize>true</synchronize>
|
<synchronize>true</synchronize>
|
||||||
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package de.hitec.nhplus.main;
|
package de.hitec.nhplus.main;
|
||||||
|
|
||||||
import de.hitec.nhplus.Main;
|
import de.hitec.nhplus.Main;
|
||||||
|
import de.hitec.nhplus.nurse.Nurse;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.control.SelectionModel;
|
import javafx.scene.control.SelectionModel;
|
||||||
|
@ -46,6 +47,9 @@ public class MainWindowController {
|
||||||
@FXML
|
@FXML
|
||||||
private Tab medicationTab;
|
private Tab medicationTab;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method allows instantiating a {@link MainWindowController} object.
|
||||||
|
*/
|
||||||
SZUT-Dominik marked this conversation as resolved
SZUT-Dominik
commented
- [ ] Ist technisch falsch, technisch korrekt wäre:
> Initialization method that is called after the binding of all the fields.
Weil **Initalize** & **Instanciate** nicht dasselbe sind.
**Initalize** ist eine Methode, die im Hintergrund von **JavaFx**, nach dem **Instaciating** & **Binding** aufgerufen wird.
|
|||||||
@FXML
|
@FXML
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
loadPatientPage();
|
loadPatientPage();
|
||||||
|
@ -113,6 +117,9 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the Active Nurse page into its tab.
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Typo: **active** wird kleingeschrieben.
|
|||||||
|
*/
|
||||||
private void loadActiveNursePage() {
|
private void loadActiveNursePage() {
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Nurse wird klein geschrieben, oder eine Refernz
|
|||||||
try {
|
try {
|
||||||
BorderPane activeNursePane = FXMLLoader.load(
|
BorderPane activeNursePane = FXMLLoader.load(
|
||||||
|
@ -128,6 +135,9 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the locked nurse page into its tab.
|
||||||
|
*/
|
||||||
private void loadLockedNursePage() {
|
private void loadLockedNursePage() {
|
||||||
try {
|
try {
|
||||||
BorderPane lockedNursePane = FXMLLoader.load(
|
BorderPane lockedNursePane = FXMLLoader.load(
|
||||||
|
|
|
@ -43,6 +43,9 @@ public class LockedNurseController {
|
||||||
private NurseDao dao;
|
private NurseDao dao;
|
||||||
private TreatmentDao treatmentDao;
|
private TreatmentDao treatmentDao;
|
||||||
|
|
||||||
|
/**
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Missing Javadoc
SZUT-Dominik
commented
- [x] Ist technisch falsch, technisch korrekt wäre:
> Initialization method that is called after the binding of all the fields.
Weil **Initalize** & **Instanciate** nicht dasselbe sind.
**Initalize** ist eine Methode, die im Hintergrund von **JavaFx**, nach dem **Instaciating** & **Binding** aufgerufen wird.
|
|||||||
|
* This method allows instantiating a {@link LockedNurseController} object.
|
||||||
|
*/
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
this.readAllAndShowInTableView();
|
this.readAllAndShowInTableView();
|
||||||
|
|
||||||
|
@ -60,6 +63,9 @@ public class LockedNurseController {
|
||||||
|
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Missing Javadoc
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads all locked nurse data and shows it in the table.
|
||||||
|
*/
|
||||||
private void readAllAndShowInTableView() {
|
private void readAllAndShowInTableView() {
|
||||||
this.nurses.clear();
|
this.nurses.clear();
|
||||||
this.treatmentsPerNurse.clear();
|
this.treatmentsPerNurse.clear();
|
||||||
|
@ -82,6 +88,9 @@ public class LockedNurseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Methoden mit @FXML benötigen keine Javadoc, weil sie durch ihr Linking bereits deklarativ genug sind
|
|||||||
|
* Deletes a locked nurse.
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
public void handleDelete() {
|
public void handleDelete() {
|
||||||
Nurse selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
Nurse selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
||||||
|
@ -98,6 +107,10 @@ public class LockedNurseController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On clicking a locked nurse, updates the delete button based on if they
|
||||||
|
* can be deleted.
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Methoden mit @FXML benötigen keine Javadoc, weil sie durch ihr Linking bereits deklarativ genug sind
|
|||||||
public void handleMouseClick() {
|
public void handleMouseClick() {
|
||||||
Nurse nurse = tableView.getSelectionModel().getSelectedItem();
|
Nurse nurse = tableView.getSelectionModel().getSelectedItem();
|
||||||
|
@ -105,8 +118,11 @@ public class LockedNurseController {
|
||||||
buttonDelete.setDisable(!canBeDeleted);
|
buttonDelete.setDisable(!canBeDeleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unlocks a locked nurse.
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
public void changeUnlock() {
|
public void unlockNurse() {
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Methoden mit @FXML benötigen keine Javadoc, weil sie durch ihr Linking bereits deklarativ genug sind
|
|||||||
Nurse selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
Nurse selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
||||||
if (selectedItem == null) {
|
if (selectedItem == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -41,6 +41,10 @@ public class Nurse extends Person {
|
||||||
this.locked = new SimpleBooleanProperty(false);
|
this.locked = new SimpleBooleanProperty(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This constructor allows instantiating a {@link Nurse} object with
|
||||||
|
* specifying if the nurse is locked or not.
|
||||||
|
*/
|
||||||
SZUT-Dominik marked this conversation as resolved
SZUT-Dominik
commented
- [ ] zu ungenau, mein Vorschlag:
```java
/**
* This constructor allows instantiating a {@link Nurse} object,
* before it is stored in the database, by omitting the {@link Nurse#id ID} value.
*It includes the locked Property.
* @implSpec This was added for usage in the {@link de.hitec.nhplus.fixtures.NurseFixture NurseFixture}.
*/
```
|
|||||||
public Nurse(
|
public Nurse(
|
||||||
String firstName,
|
String firstName,
|
||||||
String surName,
|
String surName,
|
||||||
|
@ -68,6 +72,9 @@ public class Nurse extends Person {
|
||||||
this.locked = new SimpleBooleanProperty(isLocked);
|
this.locked = new SimpleBooleanProperty(isLocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates the date when the nurse can be deleted.
|
||||||
|
*/
|
||||||
public LocalDate calculateDeleteDate() {
|
public LocalDate calculateDeleteDate() {
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Nutzt Link Tags, auch wenn es selbst Referenzen sind, um die Generierte Javadoc besser lesbar zu machen.
```diff
- nurse
+ {@link Nurse}`
```
|
|||||||
List<Treatment> treatments;
|
List<Treatment> treatments;
|
||||||
try {
|
try {
|
||||||
|
@ -123,6 +130,9 @@ public class Nurse extends Person {
|
||||||
this.locked.set(locked);
|
this.locked.set(locked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string representation of the nurse with each field on a new line.
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Die toString braucht keine Javadoc. Hatte Heidemann gefragt.
|
|||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new StringJoiner(System.lineSeparator())
|
return new StringJoiner(System.lineSeparator())
|
||||||
SZUT-Dominik marked this conversation as resolved
SZUT-Dominik
commented
- [x] Fügt die `locked` property hier mit hinzu
|
|||||||
|
|
|
@ -17,10 +17,17 @@ import java.util.List;
|
||||||
* @author Dominik Säume
|
* @author Dominik Säume
|
||||||
*/
|
*/
|
||||||
public class NurseDao extends DaoImp<Nurse> {
|
public class NurseDao extends DaoImp<Nurse> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This takes the same connection value from its parent class.
|
||||||
|
*/
|
||||||
public NurseDao(Connection connection) {
|
public NurseDao(Connection connection) {
|
||||||
SZUT-Dominik marked this conversation as resolved
SZUT-Dominik
commented
- [ ] Wenn es nur einen Grundkonstruktor gibt, welcher nichts Besonderes macht, braucht der laut heidemann auch keine Javadoc.
|
|||||||
super(connection);
|
super(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert values into nurse SQL table.
|
||||||
|
*/
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Javadoc ist bereits im `DaoImp<T>` und wird vererbt, bitte hier weglassen
|
|||||||
@Override
|
@Override
|
||||||
protected PreparedStatement getCreateStatement(Nurse nurse) throws SQLException {
|
protected PreparedStatement getCreateStatement(Nurse nurse) throws SQLException {
|
||||||
final String SQL = """
|
final String SQL = """
|
||||||
|
@ -36,6 +43,9 @@ public class NurseDao extends DaoImp<Nurse> {
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show data of nurse with given id.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
SZUT-Dominik marked this conversation as resolved
SZUT-Dominik
commented
- [ ] Javadoc ist bereits im `DaoImp<T>` und wird vererbt, bitte hier weglassen
|
|||||||
protected PreparedStatement getReadByIDStatement(int id) throws SQLException {
|
protected PreparedStatement getReadByIDStatement(int id) throws SQLException {
|
||||||
final String SQL = "SELECT * FROM nurse WHERE id = ?";
|
final String SQL = "SELECT * FROM nurse WHERE id = ?";
|
||||||
|
@ -44,6 +54,9 @@ public class NurseDao extends DaoImp<Nurse> {
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Nurse instance from the given ResultSet.
|
||||||
|
*/
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [ ] Javadoc ist bereits im `DaoImp<T>` und wird vererbt, bitte hier weglassen
|
|||||||
@Override
|
@Override
|
||||||
protected Nurse getInstanceFromResultSet(ResultSet result) throws SQLException {
|
protected Nurse getInstanceFromResultSet(ResultSet result) throws SQLException {
|
||||||
return new Nurse(
|
return new Nurse(
|
||||||
|
@ -55,12 +68,18 @@ public class NurseDao extends DaoImp<Nurse> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Javadoc ist bereits im `DaoImp<T>` und wird vererbt, bitte hier weglassen
|
|||||||
|
* Prepares a SQL statement to select all rows from the nurse table.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] `Read all database entries of active {@link Nurse}s into a {@link List} of model instances.`
|
|||||||
protected PreparedStatement getReadAllStatement() throws SQLException {
|
protected PreparedStatement getReadAllStatement() throws SQLException {
|
||||||
final String SQL = "SELECT * FROM nurse";
|
final String SQL = "SELECT * FROM nurse";
|
||||||
return this.connection.prepareStatement(SQL);
|
return this.connection.prepareStatement(SQL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts a list of Nurse instances from the given ResultSet.
|
||||||
SZUT-Dominik marked this conversation as resolved
SZUT-Dominik
commented
- [ ] Javadoc ist bereits im `DaoImp<T>` und wird vererbt, bitte hier weglassen
|
|||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected List<Nurse> getListFromResultSet(ResultSet result) throws SQLException {
|
protected List<Nurse> getListFromResultSet(ResultSet result) throws SQLException {
|
||||||
ArrayList<Nurse> list = new ArrayList<>();
|
ArrayList<Nurse> list = new ArrayList<>();
|
||||||
|
@ -70,17 +89,27 @@ public class NurseDao extends DaoImp<Nurse> {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads all active nurses.
|
||||||
|
*/
|
||||||
public List<Nurse> readAllActive() throws SQLException {
|
public List<Nurse> readAllActive() throws SQLException {
|
||||||
final String SQL = "SELECT * FROM nurse WHERE isLocked=false";
|
final String SQL = "SELECT * FROM nurse WHERE isLocked=false";
|
||||||
return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery());
|
return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of locked Nurse instances from the database.
|
||||||
|
*/
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [x] Nutz Refernzen & etwas spezifischer:
```java
/**
* Read all database entries of locked {@link Nurse}s into a {@link List} of model instances.
*/
```
|
|||||||
public List<Nurse> readAllLocked() throws SQLException {
|
public List<Nurse> readAllLocked() throws SQLException {
|
||||||
final String SQL = "SELECT * FROM nurse WHERE isLocked=true";
|
final String SQL = "SELECT * FROM nurse WHERE isLocked=true";
|
||||||
return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery());
|
return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
|
* Prepares a SQL statement to update a Nurse instance in the database.
|
||||||
|
*
|
||||||
|
*/
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [ ] Javadoc ist bereits im `DaoImp<T>` und wird vererbt, bitte hier weglassen
|
|||||||
|
@Override
|
||||||
protected PreparedStatement getUpdateStatement(Nurse nurse) throws SQLException {
|
protected PreparedStatement getUpdateStatement(Nurse nurse) throws SQLException {
|
||||||
final String SQL = """
|
final String SQL = """
|
||||||
UPDATE nurse SET
|
UPDATE nurse SET
|
||||||
|
@ -99,6 +128,9 @@ public class NurseDao extends DaoImp<Nurse> {
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares a SQL statement to delete a Nurse instance from the database by its ID.
|
||||||
SZUT-Dominik marked this conversation as resolved
Outdated
SZUT-Dominik
commented
- [ ] Javadoc ist bereits im `DaoImp<T>` und wird vererbt, bitte hier weglassen
|
|||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected PreparedStatement getDeleteStatement(int id) throws SQLException {
|
protected PreparedStatement getDeleteStatement(int id) throws SQLException {
|
||||||
final String SQL = "DELETE FROM nurse WHERE id = ?";
|
final String SQL = "DELETE FROM nurse WHERE id = ?";
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
<Button
|
<Button
|
||||||
fx:id="buttonUnlock"
|
fx:id="buttonUnlock"
|
||||||
mnemonicParsing="false"
|
mnemonicParsing="false"
|
||||||
onAction="#changeUnlock"
|
onAction="#unlockNurse"
|
||||||
prefWidth="90.0"
|
prefWidth="90.0"
|
||||||
text="Entsperren"
|
text="Entsperren"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue
Die Contents vom 07.05. sind identisch zu dieser momentanen Änderung