#10 story/pfleger-modul-sperren-und-loschen-von-pflegern #37
4 changed files with 15 additions and 46 deletions
|
@ -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;
|
||||
|
||||
/**
|
||||
SZUT-Dominik marked this conversation as resolved
|
||||
* 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 {
|
||||
|
|
|
@ -20,6 +20,10 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Armin Ribic
|
||||
* @author Dorian Nemec
|
||||
*/
|
||||
SZUT-Dominik marked this conversation as resolved
SZUT-Dominik
commented
- [x] Author alleine reicht Heidemann hier nicht, kurze Beschreibung wie bei den anderen Controllern hier hin, muss nix Langes sein.
|
||||
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();
|
||||
|
|
|
@ -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<Treatment> 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();
|
||||
|
||||
}
|
||||
|
|
|
@ -18,16 +18,10 @@ import java.util.List;
|
|||
*/
|
||||
public class NurseDao extends DaoImp<Nurse> {
|
||||
|
||||
/**
|
||||
* This takes the same connection value from its parent class.
|
||||
*/
|
||||
public NurseDao(Connection connection) {
|
||||
super(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.
|
||||
/**
|
||||
* 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<Nurse> {
|
|||
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<Nurse> {
|
|||
return statement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Nurse instance from the given ResultSet.
|
||||
*/
|
||||
@Override
|
||||
protected Nurse getInstanceFromResultSet(ResultSet result) throws SQLException {
|
||||
SZUT-Dominik marked this conversation as resolved
SZUT-Dominik
commented
- [ ] Javadoc ist bereits im `DaoImp<T>` und wird vererbt, bitte hier weglassen
|
||||
return new Nurse(
|
||||
|
@ -68,18 +56,11 @@ public class NurseDao extends DaoImp<Nurse> {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<Nurse> getListFromResultSet(ResultSet result) throws SQLException {
|
||||
ArrayList<Nurse> list = new ArrayList<>();
|
||||
|
@ -98,17 +79,13 @@ public class NurseDao extends DaoImp<Nurse> {
|
|||
}
|
||||
|
||||
/**
|
||||
SZUT-Dominik marked this conversation as resolved
SZUT-Dominik
commented
- [ ] Javadoc ist bereits im `DaoImp<T>` und wird vererbt, bitte hier weglassen
|
||||
* 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<Nurse> 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<Nurse> {
|
|||
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 = ?";
|
||||
|
|
Loading…
Reference in a new issue
Ist technisch falsch, technisch korrekt wäre:
Weil Initalize & Instanciate nicht dasselbe sind.
Initalize ist eine Methode, die im Hintergrund von JavaFx, nach dem Instaciating & Binding aufgerufen wird.