#7 Javadoc und calculateDeleteDate ergänzt #1
Some checks failed
Quality Check / Linting Check (push) Failing after 12s
Quality Check / Javadoc Check (push) Successful in 20s
Quality Check / Linting Check (pull_request) Failing after 12s
Quality Check / Javadoc Check (pull_request) Successful in 20s

This commit is contained in:
Dorian Nemec 2024-05-17 12:51:02 +02:00
parent 15f4c1f3b0
commit 8219e24670
2 changed files with 14 additions and 3 deletions

View file

@ -19,6 +19,8 @@ import java.util.StringJoiner;
* *
* @author Bernd Heidemann * @author Bernd Heidemann
* @author Dominik Säume * @author Dominik Säume
* @author Armin Ribic
* @author Dorian Nemec
*/ */
public class Treatment { public class Treatment {
private SimpleIntegerProperty id; private SimpleIntegerProperty id;
@ -30,6 +32,7 @@ public class Treatment {
private final SimpleStringProperty description; private final SimpleStringProperty description;
private final SimpleStringProperty remarks; private final SimpleStringProperty remarks;
private final SimpleBooleanProperty locked; private final SimpleBooleanProperty locked;
private int sperrfrist;
/** /**
* This constructor allows instantiating a {@link Treatment} object, * This constructor allows instantiating a {@link Treatment} object,
@ -55,6 +58,8 @@ public class Treatment {
this.description = new SimpleStringProperty(description); this.description = new SimpleStringProperty(description);
this.remarks = new SimpleStringProperty(remarks); this.remarks = new SimpleStringProperty(remarks);
this.locked = new SimpleBooleanProperty(false); this.locked = new SimpleBooleanProperty(false);
sperrfrist = 10;
} }
/** /**
@ -188,7 +193,10 @@ public class Treatment {
.toString(); .toString();
} }
/**
* Calculates delete date of treatment.
*/
public LocalDate calculateDeleteDate() { public LocalDate calculateDeleteDate() {
return DateConverter.convertStringToLocalDate(getDate()).plusYears(10); return DateConverter.convertStringToLocalDate(getDate()).plusYears(sperrfrist);
} }
} }

View file

@ -21,6 +21,8 @@ import java.util.List;
* *
* @author Bernd Heidemannn * @author Bernd Heidemannn
* @author Dominik Säume * @author Dominik Säume
* @author Armin Ribic
* @author Dorian Nemec
*/ */
public class TreatmentDao extends DaoImp<Treatment> { public class TreatmentDao extends DaoImp<Treatment> {
@ -147,10 +149,11 @@ public class TreatmentDao extends DaoImp<Treatment> {
return statement; return statement;
} }
/**
* Returns all locked treatments.
*/
public List<Treatment> readAllLocked() throws SQLException { public List<Treatment> readAllLocked() throws SQLException {
final String SQL = "SELECT * FROM treatment WHERE isLocked = true"; final String SQL = "SELECT * FROM treatment WHERE isLocked = true";
return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery()); return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery());
} }
} }