NOTICKET: Setup Linting

This commit is contained in:
Dominik Säume 2024-04-10 17:02:55 +02:00
parent 9842f06d70
commit 2a79f5977b
Signed by: SZUT-Dominik
GPG key ID: 67D15BB250B41E7C
9 changed files with 196 additions and 26 deletions

View file

@ -23,8 +23,8 @@ stan: ## Runs Static Code Analysis
test: ## Runs all tests test: ## Runs all tests
@echo TODO @echo TODO
lint: ## Runs all Linting lint: ## Checks if the Code follows the Styling Conventions
@echo TODO @mvn checkstyle:check
##|——[ linting ]———————————————————————————————————————————————————————————————————| ##|——[ linting ]———————————————————————————————————————————————————————————————————|
java-lint: ## Corrects Code Linting in Java java-lint: ## Corrects Code Linting in Java

19
checkstyle.xml Normal file
View file

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="severity" value="error"/>
<property name="tabWidth" value="4"/>
<module name="LineLength">
<property name="max" value="120"/>
</module>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="NewlineAtEndOfFile"/>
</module>

12
pom.xml
View file

@ -95,6 +95,18 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- Checkstyle Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<failOnViolation>true</failOnViolation>
<consoleOutput>true</consoleOutput>
<sourceDirectories>src</sourceDirectories>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View file

@ -14,7 +14,6 @@ import java.io.IOException;
public class Main extends Application { public class Main extends Application {
private Stage primaryStage; private Stage primaryStage;
@Override @Override
public void start(Stage primaryStage) { public void start(Stage primaryStage) {
this.primaryStage = primaryStage; this.primaryStage = primaryStage;
@ -45,4 +44,4 @@ public class Main extends Application {
public static void main(String[] args) { public static void main(String[] args) {
launch(args); launch(args);
} }
} }

View file

@ -119,4 +119,4 @@ public class TreatmentController {
public void handleCancel(){ public void handleCancel(){
stage.close(); stage.close();
} }
} }

View file

@ -206,4 +206,4 @@ public class TreatmentDao extends DaoImp<Treatment> {
} }
return preparedStatement; return preparedStatement;
} }
} }

View file

@ -30,7 +30,14 @@ public class Patient extends Person {
* @param roomNumber Room number of the patient. * @param roomNumber Room number of the patient.
* @param assets Assets of the patient. * @param assets Assets of the patient.
*/ */
public Patient(String firstName, String surname, LocalDate dateOfBirth, String careLevel, String roomNumber, String assets) { public Patient(
String firstName,
String surname,
LocalDate dateOfBirth,
String careLevel,
String roomNumber,
String assets
) {
super(firstName, surname); super(firstName, surname);
this.dateOfBirth = new SimpleStringProperty(DateConverter.convertLocalDateToString(dateOfBirth)); this.dateOfBirth = new SimpleStringProperty(DateConverter.convertLocalDateToString(dateOfBirth));
this.careLevel = new SimpleStringProperty(careLevel); this.careLevel = new SimpleStringProperty(careLevel);
@ -50,7 +57,15 @@ public class Patient extends Person {
* @param roomNumber Room number of the patient. * @param roomNumber Room number of the patient.
* @param assets Assets of the patient. * @param assets Assets of the patient.
*/ */
public Patient(long pid, String firstName, String surname, LocalDate dateOfBirth, String careLevel, String roomNumber, String assets) { public Patient(
long pid,
String firstName,
String surname,
LocalDate dateOfBirth,
String careLevel,
String roomNumber,
String assets
) {
super(firstName, surname); super(firstName, surname);
this.pid = new SimpleLongProperty(pid); this.pid = new SimpleLongProperty(pid);
this.dateOfBirth = new SimpleStringProperty(DateConverter.convertLocalDateToString(dateOfBirth)); this.dateOfBirth = new SimpleStringProperty(DateConverter.convertLocalDateToString(dateOfBirth));
@ -145,4 +160,4 @@ public class Patient extends Person {
"\nAssets: " + this.assets + "\nAssets: " + this.assets +
"\n"; "\n";
} }
} }

View file

@ -87,12 +87,54 @@ public class SetUpDB {
private static void setUpPatients() { private static void setUpPatients() {
try { try {
PatientDao dao = DaoFactory.getDaoFactory().createPatientDAO(); PatientDao dao = DaoFactory.getDaoFactory().createPatientDAO();
dao.create(new Patient("Seppl", "Herberger", convertStringToLocalDate("1945-12-01"), "4", "202", "vermögend")); dao.create(new Patient(
dao.create(new Patient("Martina", "Gerdsen", convertStringToLocalDate("1954-08-12"), "5", "010", "arm")); "Seppl",
dao.create(new Patient("Gertrud", "Franzen", convertStringToLocalDate("1949-04-16"), "3", "002", "normal")); "Herberger",
dao.create(new Patient("Ahmet", "Yilmaz", convertStringToLocalDate("1941-02-22"), "3", "013", "normal")); convertStringToLocalDate("1945-12-01"),
dao.create(new Patient("Hans", "Neumann", convertStringToLocalDate("1955-12-12"), "2", "001", "sehr vermögend")); "4",
dao.create(new Patient("Elisabeth", "Müller", convertStringToLocalDate("1958-03-07"), "5", "110", "arm")); "202",
"vermögend"
));
dao.create(new Patient(
"Martina",
"Gerdsen",
convertStringToLocalDate("1954-08-12"),
"5",
"010",
"arm"
));
dao.create(new Patient(
"Gertrud",
"Franzen",
convertStringToLocalDate("1949-04-16"),
"3",
"002",
"normal"
));
dao.create(new Patient(
"Ahmet",
"Yilmaz",
convertStringToLocalDate("1941-02-22"),
"3",
"013",
"normal"
));
dao.create(new Patient(
"Hans",
"Neumann",
convertStringToLocalDate("1955-12-12"),
"2",
"001",
"sehr vermögend"
));
dao.create(new Patient(
"Elisabeth",
"Müller",
convertStringToLocalDate("1958-03-07"),
"5",
"110",
"arm"
));
} catch (SQLException exception) { } catch (SQLException exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
@ -101,16 +143,99 @@ public class SetUpDB {
private static void setUpTreatments() { private static void setUpTreatments() {
try { try {
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao(); TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
dao.create(new Treatment(1, 1, convertStringToLocalDate("2023-06-03"), convertStringToLocalTime("11:00"), convertStringToLocalTime("15:00"), "Gespräch", "Der Patient hat enorme Angstgefühle und glaubt, er sei überfallen worden. Ihm seien alle Wertsachen gestohlen worden.\nPatient beruhigt sich erst, als alle Wertsachen im Zimmer gefunden worden sind.")); dao.create(new Treatment(
dao.create(new Treatment(2, 1, convertStringToLocalDate("2023-06-05"), convertStringToLocalTime("11:00"), convertStringToLocalTime("12:30"), "Gespräch", "Patient irrt auf der Suche nach gestohlenen Wertsachen durch die Etage und bezichtigt andere Bewohner des Diebstahls.\nPatient wird in seinen Raum zurückbegleitet und erhält Beruhigungsmittel.")); 1,
dao.create(new Treatment(3, 2, convertStringToLocalDate("2023-06-04"), convertStringToLocalTime("07:30"), convertStringToLocalTime("08:00"), "Waschen", "Patient mit Waschlappen gewaschen und frisch angezogen. Patient gewendet.")); 1,
dao.create(new Treatment(4, 1, convertStringToLocalDate("2023-06-06"), convertStringToLocalTime("15:10"), convertStringToLocalTime("16:00"), "Spaziergang", "Spaziergang im Park, Patient döst im Rollstuhl ein")); convertStringToLocalDate("2023-06-03"),
dao.create(new Treatment(8, 1, convertStringToLocalDate("2023-06-08"), convertStringToLocalTime("15:00"), convertStringToLocalTime("16:00"), "Spaziergang", "Parkspaziergang; Patient ist heute lebhafter und hat klare Momente; erzählt von seiner Tochter")); convertStringToLocalTime("11:00"),
dao.create(new Treatment(9, 2, convertStringToLocalDate("2023-06-07"), convertStringToLocalTime("11:00"), convertStringToLocalTime("11:30"), "Waschen", "Waschen per Dusche auf einem Stuhl; Patientin gewendet;")); convertStringToLocalTime("15:00"),
dao.create(new Treatment(12, 5, convertStringToLocalDate("2023-06-08"), convertStringToLocalTime("15:00"), convertStringToLocalTime("15:30"), "Physiotherapie", "Übungen zur Stabilisation und Mobilisierung der Rückenmuskulatur")); "Gespräch",
dao.create(new Treatment(14, 4, convertStringToLocalDate("2023-08-24"), convertStringToLocalTime("09:30"), convertStringToLocalTime("10:15"), "KG", "Lympfdrainage")); "Der Patient hat enorme Angstgefühle und glaubt, er sei überfallen worden."
dao.create(new Treatment(16, 6, convertStringToLocalDate("2023-08-31"), convertStringToLocalTime("13:30"), convertStringToLocalTime("13:45"), "Toilettengang", "Hilfe beim Toilettengang; Patientin klagt über Schmerzen beim Stuhlgang. Gabe von Iberogast")); + "Ihm seien alle Wertsachen gestohlen worden."
dao.create(new Treatment(17, 6, convertStringToLocalDate("2023-09-01"), convertStringToLocalTime("16:00"), convertStringToLocalTime("17:00"), "KG", "Massage der Extremitäten zur Verbesserung der Durchblutung")); + "Patient beruhigt sich erst, als alle Wertsachen im Zimmer gefunden worden sind."
));
dao.create(new Treatment(
2,
1,
convertStringToLocalDate("2023-06-05"),
convertStringToLocalTime("11:00"),
convertStringToLocalTime("12:30"),
"Gespräch",
"Patient irrt auf der Suche nach gestohlenen Wertsachen durch die Etage "
+ "und bezichtigt andere Bewohner des Diebstahls."
+ "Patient wird in seinen Raum zurückbegleitet und erhält Beruhigungsmittel."
));
dao.create(new Treatment(
3,
2,
convertStringToLocalDate("2023-06-04"),
convertStringToLocalTime("07:30"),
convertStringToLocalTime("08:00"),
"Waschen",
"Patient mit Waschlappen gewaschen und frisch angezogen. Patient gewendet."
));
dao.create(new Treatment(
4,
1,
convertStringToLocalDate("2023-06-06"),
convertStringToLocalTime("15:10"),
convertStringToLocalTime("16:00"),
"Spaziergang",
"Spaziergang im Park, Patient döst im Rollstuhl ein")
);
dao.create(new Treatment(
8,
1,
convertStringToLocalDate("2023-06-08"),
convertStringToLocalTime("15:00"),
convertStringToLocalTime("16:00"),
"Spaziergang",
"Parkspaziergang; Patient ist heute lebhafter und hat klare Momente; erzählt von seiner Tochter")
);
dao.create(new Treatment(
9,
2,
convertStringToLocalDate("2023-06-07"),
convertStringToLocalTime("11:00"),
convertStringToLocalTime("11:30"),
"Waschen",
"Waschen per Dusche auf einem Stuhl; Patientin gewendet;")
);
dao.create(new Treatment(
12,
5,
convertStringToLocalDate("2023-06-08"),
convertStringToLocalTime("15:00"),
convertStringToLocalTime("15:30"),
"Physiotherapie",
"Übungen zur Stabilisation und Mobilisierung der Rückenmuskulatur")
);
dao.create(new Treatment(
14,
4,
convertStringToLocalDate("2023-08-24"),
convertStringToLocalTime("09:30"),
convertStringToLocalTime("10:15"),
"KG",
"Lympfdrainage"));
dao.create(new Treatment(
16,
6,
convertStringToLocalDate("2023-08-31"),
convertStringToLocalTime("13:30"),
convertStringToLocalTime("13:45"),
"Toilettengang",
"Hilfe beim Toilettengang; Patientin klagt über Schmerzen beim Stuhlgang. Gabe von Iberogast")
);
dao.create(new Treatment(
17,
6,
convertStringToLocalDate("2023-09-01"),
convertStringToLocalTime("16:00"),
convertStringToLocalTime("17:00"),
"KG",
"Massage der Extremitäten zur Verbesserung der Durchblutung")
);
} catch (SQLException exception) { } catch (SQLException exception) {
exception.printStackTrace(); exception.printStackTrace();
} }

View file

@ -13,4 +13,4 @@ module de.hitec.nhplus {
exports de.hitec.nhplus; exports de.hitec.nhplus;
exports de.hitec.nhplus.controller; exports de.hitec.nhplus.controller;
exports de.hitec.nhplus.model; exports de.hitec.nhplus.model;
} }