From 77036d93a1242e88249e528999d47bc6a7e4c091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Sun, 28 Apr 2024 22:17:19 +0200 Subject: [PATCH] NOTICKET: Cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dominik Säume --- src/main/java/de/hitec/nhplus/datastorage/DaoImp.java | 2 +- src/main/java/de/hitec/nhplus/fixtures/TreatmentFixture.java | 2 +- .../java/de/hitec/nhplus/patient/AllPatientController.java | 4 +--- src/main/java/de/hitec/nhplus/patient/Patient.java | 1 - .../de/hitec/nhplus/treatment/AllTreatmentController.java | 4 +--- src/main/java/de/hitec/nhplus/treatment/Treatment.java | 4 ++-- .../java/de/hitec/nhplus/treatment/TreatmentController.java | 2 +- src/main/java/de/hitec/nhplus/treatment/TreatmentDao.java | 4 ++-- src/main/java/module-info.java | 1 - 9 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/main/java/de/hitec/nhplus/datastorage/DaoImp.java b/src/main/java/de/hitec/nhplus/datastorage/DaoImp.java index 4ba5fb4..59e001c 100644 --- a/src/main/java/de/hitec/nhplus/datastorage/DaoImp.java +++ b/src/main/java/de/hitec/nhplus/datastorage/DaoImp.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import java.util.List; public abstract class DaoImp implements Dao { - protected Connection connection; + protected final Connection connection; public DaoImp(Connection connection) { this.connection = connection; diff --git a/src/main/java/de/hitec/nhplus/fixtures/TreatmentFixture.java b/src/main/java/de/hitec/nhplus/fixtures/TreatmentFixture.java index 8611aaa..78eeab7 100644 --- a/src/main/java/de/hitec/nhplus/fixtures/TreatmentFixture.java +++ b/src/main/java/de/hitec/nhplus/fixtures/TreatmentFixture.java @@ -18,7 +18,7 @@ import static de.hitec.nhplus.utils.DateConverter.convertStringToLocalTime; public class TreatmentFixture implements Fixture { - private Map patientsByName; + private final Map patientsByName; public TreatmentFixture(Map patientsByName) { diff --git a/src/main/java/de/hitec/nhplus/patient/AllPatientController.java b/src/main/java/de/hitec/nhplus/patient/AllPatientController.java index 5eb4f18..7055619 100644 --- a/src/main/java/de/hitec/nhplus/patient/AllPatientController.java +++ b/src/main/java/de/hitec/nhplus/patient/AllPatientController.java @@ -80,9 +80,7 @@ public class AllPatientController { .getSelectionModel() .selectedItemProperty() .addListener((observableValue, oldPatient, newPatient) -> - { - AllPatientController.this.buttonDelete.setDisable(newPatient == null); - } + AllPatientController.this.buttonDelete.setDisable(newPatient == null) ); this.buttonAdd.setDisable(true); diff --git a/src/main/java/de/hitec/nhplus/patient/Patient.java b/src/main/java/de/hitec/nhplus/patient/Patient.java index 6ac3326..accabc5 100644 --- a/src/main/java/de/hitec/nhplus/patient/Patient.java +++ b/src/main/java/de/hitec/nhplus/patient/Patient.java @@ -4,7 +4,6 @@ import de.hitec.nhplus.main.Person; import de.hitec.nhplus.treatment.Treatment; import de.hitec.nhplus.utils.DateConverter; import javafx.beans.property.SimpleIntegerProperty; -import javafx.beans.property.SimpleLongProperty; import javafx.beans.property.SimpleStringProperty; import java.time.LocalDate; diff --git a/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java b/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java index ee217ad..1e4f8a9 100644 --- a/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java +++ b/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java @@ -70,9 +70,7 @@ public class AllTreatmentController { .getSelectionModel() .selectedItemProperty() .addListener((observableValue, oldTreatment, newTreatment) -> - { - AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null); - } + AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null) ); this.createComboBoxData(); diff --git a/src/main/java/de/hitec/nhplus/treatment/Treatment.java b/src/main/java/de/hitec/nhplus/treatment/Treatment.java index 7fb5991..57d73b6 100644 --- a/src/main/java/de/hitec/nhplus/treatment/Treatment.java +++ b/src/main/java/de/hitec/nhplus/treatment/Treatment.java @@ -60,11 +60,11 @@ public class Treatment { } public void setBegin(String begin) { - this.begin = DateConverter.convertStringToLocalTime(begin);; + this.begin = DateConverter.convertStringToLocalTime(begin); } public void setEnd(String end) { - this.end = DateConverter.convertStringToLocalTime(end);; + this.end = DateConverter.convertStringToLocalTime(end); } public String getDescription() { diff --git a/src/main/java/de/hitec/nhplus/treatment/TreatmentController.java b/src/main/java/de/hitec/nhplus/treatment/TreatmentController.java index f166412..08e88cf 100644 --- a/src/main/java/de/hitec/nhplus/treatment/TreatmentController.java +++ b/src/main/java/de/hitec/nhplus/treatment/TreatmentController.java @@ -47,7 +47,7 @@ public class TreatmentController { PatientDao pDao = DaoFactory.getDaoFactory().createPatientDAO(); try { - this.patient = pDao.read((int) treatment.getPatientId()); + this.patient = pDao.read(treatment.getPatientId()); this.treatment = treatment; showData(); } catch (SQLException exception) { diff --git a/src/main/java/de/hitec/nhplus/treatment/TreatmentDao.java b/src/main/java/de/hitec/nhplus/treatment/TreatmentDao.java index 6b2b995..6d5d5b7 100644 --- a/src/main/java/de/hitec/nhplus/treatment/TreatmentDao.java +++ b/src/main/java/de/hitec/nhplus/treatment/TreatmentDao.java @@ -23,7 +23,7 @@ public class TreatmentDao extends DaoImp { final String SQL = "INSERT INTO treatment (patientId, treatment_date, begin, end, description, remark) " + "VALUES (?, ?, ?, ?, ?, ?)"; preparedStatement = this.connection.prepareStatement(SQL); - preparedStatement.setLong(1, treatment.getPatientId()); + preparedStatement.setInt(1, treatment.getPatientId()); preparedStatement.setString(2, treatment.getDate()); preparedStatement.setString(3, treatment.getBegin()); preparedStatement.setString(4, treatment.getEnd()); @@ -128,7 +128,7 @@ public class TreatmentDao extends DaoImp { preparedStatement.setString(4, treatment.getEnd()); preparedStatement.setString(5, treatment.getDescription()); preparedStatement.setString(6, treatment.getRemarks()); - preparedStatement.setLong(7, treatment.getId()); + preparedStatement.setInt(7, treatment.getId()); } catch (SQLException exception) { exception.printStackTrace(); } diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 6435187..7daa9d8 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,7 +1,6 @@ module de.hitec.nhplus { requires javafx.controls; requires javafx.fxml; - requires org.controlsfx.controls; requires java.sql; requires org.xerial.sqlitejdbc;