From 72412b3b47c36bb51798e2c934e597a017a28c92 Mon Sep 17 00:00:00 2001 From: Samuel Wolff Date: Fri, 26 Jan 2024 09:59:23 +0100 Subject: [PATCH 1/2] Merge --- .idea/.name | 2 +- pom.xml | 20 ++++ .../RestAPISchnittstelle/RestApiClient.java | 98 +++++++++---------- .../EssensverwaltungMitarbeiterView.java | 2 +- .../java/de/subway_surfers/vpr_app/Main.java | 8 ++ .../de/subway_surfers/vpr_app/logik/Kind.java | 44 --------- 6 files changed, 79 insertions(+), 95 deletions(-) create mode 100644 src/main/java/de/subway_surfers/vpr_app/Main.java delete mode 100644 src/main/java/de/subway_surfers/vpr_app/logik/Kind.java diff --git a/.idea/.name b/.idea/.name index 2fbb6cf..2ae1717 100644 --- a/.idea/.name +++ b/.idea/.name @@ -1 +1 @@ -HelloController.java \ No newline at end of file +Essensverwaltung.java \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9e4eaf5..50c27e1 100644 --- a/pom.xml +++ b/pom.xml @@ -76,6 +76,26 @@ + + org.apache.maven.plugins + maven-shade-plugin + 3.2.1 + + + package + + shade + + + + + de.subway_surfers.vpr_app.Main + + + + + + \ No newline at end of file diff --git a/src/main/java/RestAPISchnittstelle/RestApiClient.java b/src/main/java/RestAPISchnittstelle/RestApiClient.java index 6115f1b..50825e7 100644 --- a/src/main/java/RestAPISchnittstelle/RestApiClient.java +++ b/src/main/java/RestAPISchnittstelle/RestApiClient.java @@ -34,18 +34,18 @@ public class RestApiClient implements IRestAPI{ gson = new Gson(); } - public static void main(String[] args){ - - RestApiClient client1 = new RestApiClient(); - - client1.delete("Kind", 15); - - - Tagesplan t = client1.getGerichteOnTag("2023-12-17"); - - for(Mahlzeit m : t.getGerichte()) - System.out.println(m); - } +// public static void main(String[] args){ +// +// RestApiClient client1 = new RestApiClient(); +// +// client1.delete("Kind", 15); +// +// +// Tagesplan t = client1.getGerichteOnTag("2023-12-17"); +// +// for(Mahlzeit m : t.getGerichte()) +// System.out.println(m); +// } /** * Methode für einen Get-Aufruf. Ruft alle Elemente einer Tabelle auf. @@ -68,8 +68,8 @@ public class RestApiClient implements IRestAPI{ HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode()); - System.out.println("Response Body: " + httpResponse.body()); +// System.out.println("Status Code: " + httpResponse.statusCode()); +// System.out.println("Response Body: " + httpResponse.body()); return httpResponse.body(); } catch(ConnectException conex){ @@ -106,7 +106,7 @@ public class RestApiClient implements IRestAPI{ HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body()); +// System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body()); return httpResponse.body(); @@ -149,8 +149,8 @@ public class RestApiClient implements IRestAPI{ HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode()); - System.out.println("Response Body: " + httpResponse.body()); +// System.out.println("Status Code: " + httpResponse.statusCode()); +// System.out.println("Response Body: " + httpResponse.body()); return httpResponse.body(); } catch(ConnectException conex){ @@ -191,8 +191,8 @@ public class RestApiClient implements IRestAPI{ // Send the request and get the response HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); - // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body()); +// // Print the response status code and body +// System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body()); return httpResponse.body(); @@ -234,9 +234,9 @@ public class RestApiClient implements IRestAPI{ // Send the request and get the response HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); - // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode()); - System.out.println("Response Body: " + httpResponse.body()); +// // Print the response status code and body +// System.out.println("Status Code: " + httpResponse.statusCode()); +// System.out.println("Response Body: " + httpResponse.body()); } catch(ConnectException conex){ Alert alert = new Alert(Alert.AlertType.INFORMATION); @@ -259,7 +259,7 @@ public class RestApiClient implements IRestAPI{ public void post(String controllerName, String jsonData) { URI apiUri = URI.create(String.format("%s/%s", urlBase,controllerName)); - System.out.println(apiUri); + //System.out.println(apiUri); HttpRequest httpRequest = HttpRequest.newBuilder() .timeout(Duration.ofSeconds(timeout)) @@ -272,9 +272,9 @@ public class RestApiClient implements IRestAPI{ // Send the request and get the response HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); - // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode()); - System.out.println("Response Body: " + httpResponse.body()); +// // Print the response status code and body +// System.out.println("Status Code: " + httpResponse.statusCode()); +// System.out.println("Response Body: " + httpResponse.body()); } catch(ConnectException conex){ Alert alert = new Alert(Alert.AlertType.INFORMATION); @@ -297,7 +297,7 @@ public class RestApiClient implements IRestAPI{ public void delete(String controllerName, int id) { URI apiUri = URI.create(String.format("%s/%s/%d", urlBase,controllerName, id)); - System.out.println(apiUri); + //System.out.println(apiUri); HttpRequest httpRequest = HttpRequest.newBuilder() .timeout(Duration.ofSeconds(timeout)) @@ -310,9 +310,9 @@ public class RestApiClient implements IRestAPI{ // Send the request and get the response HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); - // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode()); - System.out.println("Response Body: " + httpResponse.body()); +// // Print the response status code and body +// System.out.println("Status Code: " + httpResponse.statusCode()); +// System.out.println("Response Body: " + httpResponse.body()); } catch(ConnectException conex){ Alert alert = new Alert(Alert.AlertType.INFORMATION); @@ -343,9 +343,9 @@ public class RestApiClient implements IRestAPI{ // Send the request and get the response HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); - // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode()); - System.out.println("Response Body: " + httpResponse.body()); +// // Print the response status code and body +// System.out.println("Status Code: " + httpResponse.statusCode()); +// System.out.println("Response Body: " + httpResponse.body()); JsonElement jsonElement = JsonParser.parseString(httpResponse.body()); JsonArray jsonArray = jsonElement.getAsJsonArray(); @@ -384,7 +384,7 @@ public class RestApiClient implements IRestAPI{ passwort = passwort.substring(1, passwort.length()-1); URI apiUri = URI.create(String.format("%s/Benutzer/anmeldeVersuch?Benutzername=%s&passwort=%s", urlBase, benutzer, passwort)); - System.out.println(apiUri); + //System.out.println(apiUri); HttpRequest httpRequest = HttpRequest.newBuilder() .timeout(Duration.ofSeconds(timeout)) .uri(apiUri) @@ -396,9 +396,9 @@ public class RestApiClient implements IRestAPI{ // Send the request and get the response HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); - // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode()); - System.out.println("Response Body: " + httpResponse.body()); +// // Print the response status code and body +// System.out.println("Status Code: " + httpResponse.statusCode()); +// System.out.println("Response Body: " + httpResponse.body()); if(httpResponse.body().equals("true")) return true; else{ @@ -434,7 +434,7 @@ public class RestApiClient implements IRestAPI{ public Tagesplan getGerichteOnTag(String datum){ URI apiUri = URI.create(String.format("%s/Tagesplan/getGerichteOnTag?datum=%s", urlBase, datum)); - System.out.println(apiUri); + //System.out.println(apiUri); HttpRequest httpRequest = HttpRequest.newBuilder() .timeout(Duration.ofSeconds(timeout)) .uri(apiUri) @@ -446,9 +446,9 @@ public class RestApiClient implements IRestAPI{ // Send the request and get the response HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); - // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode()); - System.out.println("Response Body: " + httpResponse.body()); +// // Print the response status code and body +// System.out.println("Status Code: " + httpResponse.statusCode()); +// System.out.println("Response Body: " + httpResponse.body()); Tagesplan t = new Tagesplan(datum); @@ -492,7 +492,7 @@ public class RestApiClient implements IRestAPI{ public int getGerichtIdOnTag(String name, String datum){ URI apiUri = URI.create(String.format("%s/Tagesplan/getGerichtIdOnTag?name=%s&datum=%s", urlBase, name, datum)); - System.out.println(apiUri); + //System.out.println(apiUri); HttpRequest httpRequest = HttpRequest.newBuilder() .uri(apiUri) .header("Content-Type", "application/json") @@ -503,9 +503,9 @@ public class RestApiClient implements IRestAPI{ // Send the request and get the response HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); - // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode()); - System.out.println("Response Body: " + httpResponse.body()); +// // Print the response status code and body +// System.out.println("Status Code: " + httpResponse.statusCode()); +// System.out.println("Response Body: " + httpResponse.body()); JsonElement jsonElement = JsonParser.parseString(httpResponse.body()); @@ -528,7 +528,7 @@ public class RestApiClient implements IRestAPI{ */ public void deleteGericht(int id){ URI apiUri = URI.create(String.format("%s/Tagesplan/%d", urlBase, id)); - System.out.println(apiUri); + //System.out.println(apiUri); HttpRequest httpRequest = HttpRequest.newBuilder() .uri(apiUri) .header("Content-Type", "application/json") @@ -539,9 +539,9 @@ public class RestApiClient implements IRestAPI{ // Send the request and get the response HttpResponse httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); - // Print the response status code and body - System.out.println("Status Code: " + httpResponse.statusCode()); - System.out.println("Delete Gericht: Response Body: " + httpResponse.body()); +// // Print the response status code and body +// System.out.println("Status Code: " + httpResponse.statusCode()); +// System.out.println("Delete Gericht: Response Body: " + httpResponse.body()); } catch (Exception e) { diff --git a/src/main/java/de/subway_surfers/vpr_app/EssensverwaltungMitarbeiterView.java b/src/main/java/de/subway_surfers/vpr_app/EssensverwaltungMitarbeiterView.java index 4bb2055..1e38764 100644 --- a/src/main/java/de/subway_surfers/vpr_app/EssensverwaltungMitarbeiterView.java +++ b/src/main/java/de/subway_surfers/vpr_app/EssensverwaltungMitarbeiterView.java @@ -231,7 +231,7 @@ public class EssensverwaltungMitarbeiterView { t.getGerichte().remove(col); - System.out.println("Die Id lautet: " + id + col); + //System.out.println("Die Id lautet: " + id + col); cl.delete("GibtsAm", id); initGerichte(); diff --git a/src/main/java/de/subway_surfers/vpr_app/Main.java b/src/main/java/de/subway_surfers/vpr_app/Main.java new file mode 100644 index 0000000..f53de97 --- /dev/null +++ b/src/main/java/de/subway_surfers/vpr_app/Main.java @@ -0,0 +1,8 @@ +package de.subway_surfers.vpr_app; + +public class Main { + + public static void main(String[] args) { + VerwaltungApplication.main(args); + } +} diff --git a/src/main/java/de/subway_surfers/vpr_app/logik/Kind.java b/src/main/java/de/subway_surfers/vpr_app/logik/Kind.java deleted file mode 100644 index d84acb3..0000000 --- a/src/main/java/de/subway_surfers/vpr_app/logik/Kind.java +++ /dev/null @@ -1,44 +0,0 @@ -package de.subway_surfers.vpr_app.logik; - -import Logik.Zutat; - -import java.util.ArrayList; - -public class Kind { - - private String name; - private String vorname; - private int id; - private ArrayList filter; - - public Kind(String name, String vorname, int id) { - ArrayList filter = new ArrayList<>(); - this.name = name; - this.vorname = vorname; - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getVorname() { - return vorname; - } - - public void setVorname(String vorname) { - this.vorname = vorname; - } - - public int getId() { - return id; - } - - public ArrayList getFilter() { - return filter; - } -} \ No newline at end of file From 8ed1085e405765f18cdb36a8113f4393e995a6b2 Mon Sep 17 00:00:00 2001 From: Samuel Wolff Date: Fri, 26 Jan 2024 10:32:27 +0100 Subject: [PATCH 2/2] Mehr Kommis --- src/main/java/Logik/Account.java | 4 ++++ src/main/java/Logik/ElternAccount.java | 6 ++++++ src/main/java/Logik/Kind.java | 3 +++ src/main/java/Logik/Mahlzeit.java | 3 +++ src/main/java/Logik/MitarbeiterAccount.java | 13 ++++++++----- src/main/java/Logik/Tagesplan.java | 3 +++ src/main/java/Logik/Zutat.java | 3 +++ src/main/java/RestAPISchnittstelle/IRestAPI.java | 3 +++ .../java/RestAPISchnittstelle/RestApiClient.java | 13 ------------- 9 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/main/java/Logik/Account.java b/src/main/java/Logik/Account.java index 0f9be93..570e95d 100644 --- a/src/main/java/Logik/Account.java +++ b/src/main/java/Logik/Account.java @@ -5,6 +5,10 @@ package Logik; import RestAPISchnittstelle.RestApiClient; +/** + * @author Sven Alteköster und Samuel Wolff + */ + public class Account { // region Felder diff --git a/src/main/java/Logik/ElternAccount.java b/src/main/java/Logik/ElternAccount.java index ddb033b..3fdd613 100644 --- a/src/main/java/Logik/ElternAccount.java +++ b/src/main/java/Logik/ElternAccount.java @@ -9,6 +9,9 @@ package Logik; import java.util.ArrayList; +/** + * @author Samuel Wolff + */ public class ElternAccount extends Account { // region Felder @@ -37,6 +40,7 @@ public class ElternAccount extends Account { /** * Lädt eine Rechnung herunter + * @deprecated */ public void rechnungHerunterladen() { @@ -44,6 +48,7 @@ public class ElternAccount extends Account { /** * Bestellt eine Mahlzeit + * @deprecated */ public void mahlzeitBestellen() { @@ -52,6 +57,7 @@ public class ElternAccount extends Account { /** * Zeigt Rechnungen gefiltert an * @param params Die Filter Argumente + * @deprecated */ public void rechnungAnzeigen(String params) { diff --git a/src/main/java/Logik/Kind.java b/src/main/java/Logik/Kind.java index 0d9e035..aa161d7 100644 --- a/src/main/java/Logik/Kind.java +++ b/src/main/java/Logik/Kind.java @@ -2,6 +2,9 @@ package Logik; import java.util.ArrayList; +/** + * @author Samuel Wolff und Sven Alteköster + */ public class Kind { // region Felder diff --git a/src/main/java/Logik/Mahlzeit.java b/src/main/java/Logik/Mahlzeit.java index 1aebfea..2710f94 100644 --- a/src/main/java/Logik/Mahlzeit.java +++ b/src/main/java/Logik/Mahlzeit.java @@ -2,6 +2,9 @@ package Logik; import java.util.ArrayList; +/** + * @author Sven Alteköster + */ public class Mahlzeit { private int id; diff --git a/src/main/java/Logik/MitarbeiterAccount.java b/src/main/java/Logik/MitarbeiterAccount.java index deb6b17..496e579 100644 --- a/src/main/java/Logik/MitarbeiterAccount.java +++ b/src/main/java/Logik/MitarbeiterAccount.java @@ -9,6 +9,9 @@ package Logik; import java.util.ArrayList; +/** + * @author Samuel Wolff + */ public class MitarbeiterAccount extends Account { // region Konstrukoren @@ -25,12 +28,12 @@ public class MitarbeiterAccount extends Account { * @param passwort Das neue Passwort */ public void passwortZurzecksetzen(Account other, String passwort) { - // Soll das so? other.setPasswort(passwort); } /** * Bestellt eine Mahlzeit + * @deprecated */ public void mahlzeitBestellen() { @@ -38,6 +41,7 @@ public class MitarbeiterAccount extends Account { /** * Ändert einen Tagesplan + * @deprecated */ public void tagesplanAendern() { @@ -59,25 +63,24 @@ public class MitarbeiterAccount extends Account { /** * Zeigt Rechnungen gefilter nach params an * @param params Die Filter Arguemente + * @deprecated */ public void rechnungAnzeigen(String[] params) { } - // TODO sollte hier nicht noch ein User mitgegeben werden? - /** * Weist ein Kind einem Account zu * @param kind Das zuzuweisende Kind + * @deprecated */ public void kinderZuweisen(Kind kind) { } - // TODO hier auch? - /** * Zeigt einen Benutzer an + * @deprecated */ public void zeigeBenutzer() { diff --git a/src/main/java/Logik/Tagesplan.java b/src/main/java/Logik/Tagesplan.java index 6b96ee1..919890c 100644 --- a/src/main/java/Logik/Tagesplan.java +++ b/src/main/java/Logik/Tagesplan.java @@ -2,6 +2,9 @@ package Logik; import java.util.ArrayList; +/** + * @author Sven Alteköster + */ public class Tagesplan { private ArrayList gerichte; diff --git a/src/main/java/Logik/Zutat.java b/src/main/java/Logik/Zutat.java index d303676..adb4624 100644 --- a/src/main/java/Logik/Zutat.java +++ b/src/main/java/Logik/Zutat.java @@ -1,5 +1,8 @@ package Logik; +/** + * @author Sven Alteköster + */ public class Zutat { private String name; public Zutat (String name) { diff --git a/src/main/java/RestAPISchnittstelle/IRestAPI.java b/src/main/java/RestAPISchnittstelle/IRestAPI.java index d805829..f48b2d9 100644 --- a/src/main/java/RestAPISchnittstelle/IRestAPI.java +++ b/src/main/java/RestAPISchnittstelle/IRestAPI.java @@ -7,6 +7,9 @@ package RestAPISchnittstelle; +/** + * @author Samuel Wolff + */ public interface IRestAPI { // region Get diff --git a/src/main/java/RestAPISchnittstelle/RestApiClient.java b/src/main/java/RestAPISchnittstelle/RestApiClient.java index 50825e7..643fd45 100644 --- a/src/main/java/RestAPISchnittstelle/RestApiClient.java +++ b/src/main/java/RestAPISchnittstelle/RestApiClient.java @@ -34,19 +34,6 @@ public class RestApiClient implements IRestAPI{ gson = new Gson(); } -// public static void main(String[] args){ -// -// RestApiClient client1 = new RestApiClient(); -// -// client1.delete("Kind", 15); -// -// -// Tagesplan t = client1.getGerichteOnTag("2023-12-17"); -// -// for(Mahlzeit m : t.getGerichte()) -// System.out.println(m); -// } - /** * Methode für einen Get-Aufruf. Ruft alle Elemente einer Tabelle auf. *