NOTICKET: CLeanup ToString
All checks were successful
Quality Check / Qualty Check (push) Successful in 12s
Quality Check / Qualty Check (pull_request) Successful in 12s

Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
This commit is contained in:
Dominik Säume 2024-04-29 17:28:58 +02:00
parent ce8561c60f
commit e5d32a3eb6
Signed by: SZUT-Dominik
GPG key ID: 67D15BB250B41E7C
4 changed files with 31 additions and 21 deletions

View file

@ -4,6 +4,8 @@ import de.hitec.nhplus.main.Person;
import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import java.util.StringJoiner;
public class Nurse extends Person { public class Nurse extends Person {
private SimpleIntegerProperty id; private SimpleIntegerProperty id;
private final SimpleStringProperty phoneNumber; private final SimpleStringProperty phoneNumber;
@ -50,11 +52,12 @@ public class Nurse extends Person {
@Override @Override
public String toString() { public String toString() {
return new StringBuilder() return new StringJoiner(System.lineSeparator())
.append("Nurse").append(System.lineSeparator()) .add("NURSE")
.append("Firstname: ").append(this.getFirstName()).append(System.lineSeparator()) .add("ID: " + this.getId())
.append("Surname: ").append(this.getSurname()).append(System.lineSeparator()) .add("Firstname: " + this.getFirstName())
.append("PhoneNumber: ").append(this.getPhoneNumber()).append(System.lineSeparator()) .add("Surname: " + this.getSurname())
.add("PhoneNumber: " + this.getPhoneNumber())
.toString(); .toString();
} }

View file

@ -9,6 +9,7 @@ import javafx.beans.property.SimpleStringProperty;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.StringJoiner;
public class Patient extends Person { public class Patient extends Person {
private SimpleIntegerProperty id; private SimpleIntegerProperty id;
@ -99,12 +100,14 @@ public class Patient extends Person {
} }
public String toString() { public String toString() {
return "Patient" + "\nMNID: " + this.id + return new StringJoiner(System.lineSeparator())
"\nFirstname: " + this.getFirstName() + .add("PATIENT")
"\nSurname: " + this.getSurname() + .add("ID: " + this.getId())
"\nBirthday: " + this.dateOfBirth + .add("Firstname: " + this.getFirstName())
"\nCarelevel: " + this.careLevel + .add("Surname: " + this.getSurname())
"\nRoomnumber: " + this.roomNumber + .add("Birthday: " + this.getDateOfBirth())
"\n"; .add("Carelevel: " + this.getCareLevel())
.add("RoomNumber: " + this.getRoomNumber())
.toString();
} }
} }

View file

@ -4,6 +4,7 @@ import de.hitec.nhplus.utils.DateConverter;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.StringJoiner;
public class Treatment { public class Treatment {
private int id; private int id;
@ -84,12 +85,15 @@ public class Treatment {
} }
public String toString() { public String toString() {
return "\nBehandlung" + "\nID: " + this.id + return new StringJoiner(System.lineSeparator())
"\nPatient ID: " + this.patientId + .add("TREATMENT")
"\nDate: " + this.date + .add("ID: " + this.getId())
"\nBegin: " + this.begin + .add("PatientID: " + this.getPatientId())
"\nEnd: " + this.end + .add("Date: " + this.getDate())
"\nDescription: " + this.description + .add("Begin: " + this.getBegin())
"\nRemarks: " + this.remarks + "\n"; .add("End: " + this.getEnd())
.add("Description: " + this.getDescription())
.add("Remarks: " + this.getRemarks())
.toString();
} }
} }

View file

@ -120,7 +120,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
"end = ?, " + "end = ?, " +
"description = ?, " + "description = ?, " +
"remark = ? " + "remark = ? " +
"WHERE tid = ?"; "WHERE id = ?";
preparedStatement = this.connection.prepareStatement(SQL); preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setInt(1, treatment.getPatientId()); preparedStatement.setInt(1, treatment.getPatientId());
preparedStatement.setString(2, treatment.getDate()); preparedStatement.setString(2, treatment.getDate());
@ -140,7 +140,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
try { try {
final String SQL = final String SQL =
"DELETE FROM treatment WHERE tid = ?"; "DELETE FROM treatment WHERE id = ?";
preparedStatement = this.connection.prepareStatement(SQL); preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setInt(1, id); preparedStatement.setInt(1, id);
} catch (SQLException exception) { } catch (SQLException exception) {