NOTICKET: Cleanup
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
This commit is contained in:
parent
1cbe39b481
commit
8cb52b4162
9 changed files with 9 additions and 15 deletions
|
@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class DaoImp<T> implements Dao<T> {
|
public abstract class DaoImp<T> implements Dao<T> {
|
||||||
protected Connection connection;
|
protected final Connection connection;
|
||||||
|
|
||||||
public DaoImp(Connection connection) {
|
public DaoImp(Connection connection) {
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static de.hitec.nhplus.utils.DateConverter.convertStringToLocalTime;
|
||||||
|
|
||||||
public class TreatmentFixture implements Fixture<Treatment>
|
public class TreatmentFixture implements Fixture<Treatment>
|
||||||
{
|
{
|
||||||
private Map<String, Patient> patientsByName;
|
private final Map<String, Patient> patientsByName;
|
||||||
|
|
||||||
public TreatmentFixture(Map<String, Patient> patientsByName)
|
public TreatmentFixture(Map<String, Patient> patientsByName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,9 +80,7 @@ public class AllPatientController {
|
||||||
.getSelectionModel()
|
.getSelectionModel()
|
||||||
.selectedItemProperty()
|
.selectedItemProperty()
|
||||||
.addListener((observableValue, oldPatient, newPatient) ->
|
.addListener((observableValue, oldPatient, newPatient) ->
|
||||||
{
|
AllPatientController.this.buttonDelete.setDisable(newPatient == null)
|
||||||
AllPatientController.this.buttonDelete.setDisable(newPatient == null);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.buttonAdd.setDisable(true);
|
this.buttonAdd.setDisable(true);
|
||||||
|
|
|
@ -4,7 +4,6 @@ import de.hitec.nhplus.main.Person;
|
||||||
import de.hitec.nhplus.treatment.Treatment;
|
import de.hitec.nhplus.treatment.Treatment;
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
import javafx.beans.property.SimpleLongProperty;
|
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
|
@ -70,9 +70,7 @@ public class AllTreatmentController {
|
||||||
.getSelectionModel()
|
.getSelectionModel()
|
||||||
.selectedItemProperty()
|
.selectedItemProperty()
|
||||||
.addListener((observableValue, oldTreatment, newTreatment) ->
|
.addListener((observableValue, oldTreatment, newTreatment) ->
|
||||||
{
|
AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null)
|
||||||
AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.createComboBoxData();
|
this.createComboBoxData();
|
||||||
|
|
|
@ -60,11 +60,11 @@ public class Treatment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBegin(String begin) {
|
public void setBegin(String begin) {
|
||||||
this.begin = DateConverter.convertStringToLocalTime(begin);;
|
this.begin = DateConverter.convertStringToLocalTime(begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnd(String end) {
|
public void setEnd(String end) {
|
||||||
this.end = DateConverter.convertStringToLocalTime(end);;
|
this.end = DateConverter.convertStringToLocalTime(end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class TreatmentController {
|
||||||
|
|
||||||
PatientDao pDao = DaoFactory.getDaoFactory().createPatientDAO();
|
PatientDao pDao = DaoFactory.getDaoFactory().createPatientDAO();
|
||||||
try {
|
try {
|
||||||
this.patient = pDao.read((int) treatment.getPatientId());
|
this.patient = pDao.read(treatment.getPatientId());
|
||||||
this.treatment = treatment;
|
this.treatment = treatment;
|
||||||
showData();
|
showData();
|
||||||
} catch (SQLException exception) {
|
} catch (SQLException exception) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
||||||
final String SQL = "INSERT INTO treatment (patientId, treatment_date, begin, end, description, remark) " +
|
final String SQL = "INSERT INTO treatment (patientId, treatment_date, begin, end, description, remark) " +
|
||||||
"VALUES (?, ?, ?, ?, ?, ?)";
|
"VALUES (?, ?, ?, ?, ?, ?)";
|
||||||
preparedStatement = this.connection.prepareStatement(SQL);
|
preparedStatement = this.connection.prepareStatement(SQL);
|
||||||
preparedStatement.setLong(1, treatment.getPatientId());
|
preparedStatement.setInt(1, treatment.getPatientId());
|
||||||
preparedStatement.setString(2, treatment.getDate());
|
preparedStatement.setString(2, treatment.getDate());
|
||||||
preparedStatement.setString(3, treatment.getBegin());
|
preparedStatement.setString(3, treatment.getBegin());
|
||||||
preparedStatement.setString(4, treatment.getEnd());
|
preparedStatement.setString(4, treatment.getEnd());
|
||||||
|
@ -128,7 +128,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
||||||
preparedStatement.setString(4, treatment.getEnd());
|
preparedStatement.setString(4, treatment.getEnd());
|
||||||
preparedStatement.setString(5, treatment.getDescription());
|
preparedStatement.setString(5, treatment.getDescription());
|
||||||
preparedStatement.setString(6, treatment.getRemarks());
|
preparedStatement.setString(6, treatment.getRemarks());
|
||||||
preparedStatement.setLong(7, treatment.getId());
|
preparedStatement.setInt(7, treatment.getId());
|
||||||
} catch (SQLException exception) {
|
} catch (SQLException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
module de.hitec.nhplus {
|
module de.hitec.nhplus {
|
||||||
requires javafx.controls;
|
requires javafx.controls;
|
||||||
requires javafx.fxml;
|
requires javafx.fxml;
|
||||||
requires org.controlsfx.controls;
|
|
||||||
requires java.sql;
|
requires java.sql;
|
||||||
requires org.xerial.sqlitejdbc;
|
requires org.xerial.sqlitejdbc;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue