#7: Automatisches Löschen nach 10Jahre implementiert und für
#10: Nachtrag: Locked Nurses können nicht mehr zu neuen Treatments hinzugefügt werden
This commit is contained in:
parent
5d92bb9b45
commit
c852265649
4 changed files with 8 additions and 10 deletions
Binary file not shown.
|
@ -138,7 +138,7 @@ public class AllTreatmentController {
|
||||||
this.patientSelection.add(patient.getSurName());
|
this.patientSelection.add(patient.getSurName());
|
||||||
}
|
}
|
||||||
|
|
||||||
nurseList = (ArrayList<Nurse>) nurseDao.readAll();
|
nurseList = (ArrayList<Nurse>) nurseDao.readAllActive();
|
||||||
for (Nurse nurse : nurseList) {
|
for (Nurse nurse : nurseList) {
|
||||||
this.nurseSelection.add(nurse.getSurName());
|
this.nurseSelection.add(nurse.getSurName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@ public class LockedTreatmentController {
|
||||||
* that is called after the binding of all the fields.
|
* that is called after the binding of all the fields.
|
||||||
*/
|
*/
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
handleDelete();
|
|
||||||
this.readAllAndShowInTableView();
|
this.readAllAndShowInTableView();
|
||||||
|
|
||||||
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||||
|
@ -73,6 +72,7 @@ public class LockedTreatmentController {
|
||||||
|
|
||||||
|
|
||||||
this.tableView.setItems(this.treatments);
|
this.tableView.setItems(this.treatments);
|
||||||
|
handleDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readAllAndShowInTableView() {
|
private void readAllAndShowInTableView() {
|
||||||
|
@ -105,13 +105,13 @@ public class LockedTreatmentController {
|
||||||
@FXML
|
@FXML
|
||||||
public void handleDelete() {
|
public void handleDelete() {
|
||||||
Treatment selecteditem;
|
Treatment selecteditem;
|
||||||
LocalDate today = LocalDate.now();//Ändern!!!!!
|
LocalDate today = LocalDate.now();
|
||||||
LocalDate deleteDate;
|
LocalDate deleteDate;
|
||||||
|
|
||||||
for (int i = 0; i < treatments.size(); i++) {
|
for (Treatment treatment : treatments) {
|
||||||
selecteditem = treatments.get(i);
|
selecteditem = treatment;
|
||||||
deleteDate = selecteditem.calculateDeleteDate();
|
deleteDate = selecteditem.calculateDeleteDate();
|
||||||
if (today.isEqual(deleteDate) || today.isBefore(deleteDate)) {
|
if (today.isEqual(deleteDate) || today.isAfter(deleteDate)) {
|
||||||
try {
|
try {
|
||||||
treatmentDao.delete(selecteditem.getId());
|
treatmentDao.delete(selecteditem.getId());
|
||||||
System.out.println("Wird gelöscht");
|
System.out.println("Wird gelöscht");
|
||||||
|
@ -119,9 +119,8 @@ public class LockedTreatmentController {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
readAllAndShowInTableView();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,6 @@ public class Treatment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalDate calculateDeleteDate() {
|
public LocalDate calculateDeleteDate() {
|
||||||
LocalDate delteDate = DateConverter.convertStringToLocalDate(getDate()).plusYears(10);
|
return DateConverter.convertStringToLocalDate(getDate()).plusYears(10);
|
||||||
return delteDate;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue