NOTICKET: Add Nurse Module Javadoc
This commit is contained in:
parent
797dd69f63
commit
eeb3630229
3 changed files with 44 additions and 6 deletions
|
@ -17,6 +17,12 @@ import javafx.scene.control.cell.TextFieldTableCell;
|
|||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* The controller for viewing all {@link Nurse}s.
|
||||
*
|
||||
* @author Dominik Säume
|
||||
* @author Ole Kück
|
||||
*/
|
||||
public class AllNurseController {
|
||||
@FXML
|
||||
public TextField textFieldSurName;
|
||||
|
@ -40,6 +46,10 @@ public class AllNurseController {
|
|||
private final ObservableList<Nurse> nurses = FXCollections.observableArrayList();
|
||||
private NurseDao dao;
|
||||
|
||||
/**
|
||||
* Initialization method that is called after the binding of all the fields.
|
||||
*/
|
||||
@FXML
|
||||
public void initialize() {
|
||||
this.readAllAndShowInTableView();
|
||||
|
||||
|
@ -72,15 +82,28 @@ public class AllNurseController {
|
|||
this.textFieldPhoneNumber.textProperty().addListener(inputNewNurseValidationListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal method to read all data and set it to the table view.
|
||||
*/
|
||||
private void readAllAndShowInTableView(){
|
||||
this.nurses.clear();
|
||||
this.dao = DaoFactory.getInstance().createNurseDAO();
|
||||
try {
|
||||
this.nurses.addAll(this.dao.readAll());
|
||||
this.nurses.setAll(this.dao.readAll());
|
||||
}catch (SQLException exception){
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal method that clears the text fields used for creating a new {@link Nurse}.
|
||||
*/
|
||||
private void clearTextfields() {
|
||||
this.textFieldFirstName.clear();
|
||||
this.textFieldSurName.clear();
|
||||
this.textFieldPhoneNumber.clear();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleAdd(){
|
||||
String surname=this.textFieldSurName.getText();
|
||||
|
@ -96,10 +119,5 @@ public class AllNurseController {
|
|||
clearTextfields();
|
||||
}
|
||||
|
||||
private void clearTextfields() {
|
||||
this.textFieldFirstName.clear();
|
||||
this.textFieldSurName.clear();
|
||||
this.textFieldPhoneNumber.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,10 +6,22 @@ import javafx.beans.property.SimpleStringProperty;
|
|||
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* The model for a {@link Nurse}.
|
||||
*
|
||||
* @author Dominik Säume
|
||||
*/
|
||||
public class Nurse extends Person {
|
||||
private SimpleIntegerProperty id;
|
||||
private final SimpleStringProperty phoneNumber;
|
||||
|
||||
/**
|
||||
* 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}.
|
||||
*/
|
||||
public Nurse(
|
||||
String firstName,
|
||||
String surName,
|
||||
|
@ -19,6 +31,9 @@ public class Nurse extends Person {
|
|||
this.phoneNumber = new SimpleStringProperty(phoneNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor allows instantiating a {@link Nurse} object with all existing fields.
|
||||
*/
|
||||
public Nurse(
|
||||
int id,
|
||||
String firstName,
|
||||
|
|
|
@ -10,6 +10,11 @@ import java.sql.SQLException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The {@link NurseDao} is an implementation of the {@link de.hitec.nhplus.datastorage.Dao Dao} for the {@link Nurse} model.
|
||||
*
|
||||
* @author Dominik Säume
|
||||
*/
|
||||
public class NurseDao extends DaoImp<Nurse> {
|
||||
public NurseDao(Connection connection) {
|
||||
super(connection);
|
||||
|
|
Loading…
Reference in a new issue