Compare commits

..

No commits in common. "master" and "stefan" have entirely different histories.

16 changed files with 112 additions and 123 deletions

View File

@ -1 +1 @@
Essensverwaltung.java
HelloController.java

20
pom.xml
View File

@ -76,26 +76,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>de.subway_surfers.vpr_app.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -5,10 +5,6 @@ package Logik;
import RestAPISchnittstelle.RestApiClient;
/**
* @author Sven Alteköster und Samuel Wolff
*/
public class Account {
// region Felder

View File

@ -9,9 +9,6 @@ package Logik;
import java.util.ArrayList;
/**
* @author Samuel Wolff
*/
public class ElternAccount extends Account {
// region Felder
@ -40,7 +37,6 @@ public class ElternAccount extends Account {
/**
* Lädt eine Rechnung herunter
* @deprecated
*/
public void rechnungHerunterladen() {
@ -48,7 +44,6 @@ public class ElternAccount extends Account {
/**
* Bestellt eine Mahlzeit
* @deprecated
*/
public void mahlzeitBestellen() {
@ -57,7 +52,6 @@ public class ElternAccount extends Account {
/**
* Zeigt Rechnungen gefiltert an
* @param params Die Filter Argumente
* @deprecated
*/
public void rechnungAnzeigen(String params) {

View File

@ -2,9 +2,6 @@ package Logik;
import java.util.ArrayList;
/**
* @author Samuel Wolff und Sven Alteköster
*/
public class Kind {
// region Felder

View File

@ -2,9 +2,6 @@ package Logik;
import java.util.ArrayList;
/**
* @author Sven Alteköster
*/
public class Mahlzeit {
private int id;

View File

@ -9,9 +9,6 @@ package Logik;
import java.util.ArrayList;
/**
* @author Samuel Wolff
*/
public class MitarbeiterAccount extends Account {
// region Konstrukoren
@ -28,12 +25,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() {
@ -41,7 +38,6 @@ public class MitarbeiterAccount extends Account {
/**
* Ändert einen Tagesplan
* @deprecated
*/
public void tagesplanAendern() {
@ -63,24 +59,25 @@ 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() {

View File

@ -2,9 +2,6 @@ package Logik;
import java.util.ArrayList;
/**
* @author Sven Alteköster
*/
public class Tagesplan {
private ArrayList<Mahlzeit> gerichte;

View File

@ -1,8 +1,5 @@
package Logik;
/**
* @author Sven Alteköster
*/
public class Zutat {
private String name;
public Zutat (String name) {

View File

@ -7,9 +7,6 @@
package RestAPISchnittstelle;
/**
* @author Samuel Wolff
*/
public interface IRestAPI {
// region Get

View File

@ -34,6 +34,19 @@ 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.
*
@ -55,8 +68,8 @@ public class RestApiClient implements IRestAPI{
HttpResponse<String> 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){
@ -93,7 +106,7 @@ public class RestApiClient implements IRestAPI{
HttpResponse<String> 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();
@ -136,8 +149,8 @@ public class RestApiClient implements IRestAPI{
HttpResponse<String> 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){
@ -178,8 +191,8 @@ public class RestApiClient implements IRestAPI{
// Send the request and get the response
HttpResponse<String> 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();
@ -221,9 +234,9 @@ public class RestApiClient implements IRestAPI{
// Send the request and get the response
HttpResponse<String> 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);
@ -246,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))
@ -259,9 +272,9 @@ public class RestApiClient implements IRestAPI{
// Send the request and get the response
HttpResponse<String> 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);
@ -284,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))
@ -297,9 +310,9 @@ public class RestApiClient implements IRestAPI{
// Send the request and get the response
HttpResponse<String> 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);
@ -330,9 +343,9 @@ public class RestApiClient implements IRestAPI{
// Send the request and get the response
HttpResponse<String> 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();
@ -371,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)
@ -383,9 +396,9 @@ public class RestApiClient implements IRestAPI{
// Send the request and get the response
HttpResponse<String> 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{
@ -421,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)
@ -433,9 +446,9 @@ public class RestApiClient implements IRestAPI{
// Send the request and get the response
HttpResponse<String> 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);
@ -479,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")
@ -490,9 +503,9 @@ public class RestApiClient implements IRestAPI{
// Send the request and get the response
HttpResponse<String> 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());
@ -515,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")
@ -526,9 +539,9 @@ public class RestApiClient implements IRestAPI{
// Send the request and get the response
HttpResponse<String> 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) {

View File

@ -195,6 +195,7 @@ public class AccounterstellungMitarbeiter {
*/
public void onSpeichern(ActionEvent actionEvent) {
if (eingabenGueltig()) {
//speichert das aktuelle Passwort zwischen
String passwort = einmalpw.getText();
@ -235,6 +236,9 @@ public class AccounterstellungMitarbeiter {
return;
}
//Die Liste, zum Speichern der gespeicherten Liste wird zurückgesetzt, da die Kinder jetzt im Elternobjekt gespeichert werden
kinder.clear();
//Das Elternelement wird in der DB gespeichert, wenn es keinen gleichnamigen Account gibt.
if (!kontoVorhanden) {
api.post("Benutzer", gson.toJson(neuer));
@ -246,19 +250,7 @@ public class AccounterstellungMitarbeiter {
for (Kind k : ((ElternAccount)neuer).getKinder()) {
//setzen des Fremdschlüssels bid
k.setBid(id);
String neues = gson.toJson(k);
//region hässlich
neues = neues.replaceAll("ä", "ae");
neues = neues.replaceAll("ö", "oe");
neues = neues.replaceAll("ü", "ue");
neues = neues.replaceAll("Ä", "Ae");
neues = neues.replaceAll("Ö", "Oe");
neues = neues.replaceAll("Ü", "Ue");
neues = neues.replaceAll("ß", "ss");
//endregion
api.post("Kind", neues);
api.post("Kind", gson.toJson(k));
}
}
status.setText("Daten Erfolgreich gespeichert");

View File

@ -92,10 +92,10 @@ public class EssensverwaltungMitarbeiterView {
//solange das neu geöffnete Fenster offen ist, wird das Hauptfenster gesperrt
gerichterstellung.initModality(Modality.APPLICATION_MODAL);
VerwaltungApplication.sceneWechseln(gerichterstellung, 500, 700, "gerichterstellung_mitarbeiter-view.fxml");
VerwaltungApplication.sceneWechseln(gerichterstellung, 450, 600, "gerichterstellung_mitarbeiter-view.fxml");
gerichterstellung.minWidthProperty().set(500);
gerichterstellung.minHeightProperty().set(700);
gerichterstellung.minWidthProperty().set(450);
gerichterstellung.minHeightProperty().set(600);
}
/**
@ -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();

View File

@ -36,7 +36,7 @@ public class GerichterstellungMitarbeiterView {
public void initialize() {
zutaten = new ArrayList<>();
mahlzeiten = new ArrayList<>();
datePicker.setEditable(false);
//Liste mit Daten füllen
mahlzeiten = getMahlzeiten();
for (Mahlzeit m : mahlzeiten) {
@ -200,15 +200,13 @@ public class GerichterstellungMitarbeiterView {
Mahlzeit mahlzeit = new Mahlzeit(eingabe, preis, beschreibung);
mahlzeiten.add(mahlzeit);
status.setText("Mahlzeit hinzugefügt");
resetEingabeFelder();
int datumId = datumBearbeiten(datum);
int gerichtId = gerichteAbfragen(mahlzeit);
inhaltsstoff(gerichtId);
gibtsAm(gerichtId, datumId);
mahlzeiten.clear();
mahlzeiten = getMahlzeiten();
aktualisiereListView("");
resetEingabeFelder();
}
/**
@ -235,8 +233,6 @@ public class GerichterstellungMitarbeiterView {
eingabeBeschreibung.setText("");
eingabePreis.setText("");
eingabeInhaltsstoffe.setText("");
zutaten.clear();
anzeigeInhaltsstoffe.getChildren().clear();
datePicker.setValue(null);
}

View File

@ -1,8 +0,0 @@
package de.subway_surfers.vpr_app;
public class Main {
public static void main(String[] args) {
VerwaltungApplication.main(args);
}
}

View File

@ -0,0 +1,44 @@
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<Zutat> filter;
public Kind(String name, String vorname, int id) {
ArrayList<Zutat> 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<Zutat> getFilter() {
return filter;
}
}