Compare commits
No commits in common. "0326d80a218cc12e8db89b4adb43d39241cdfcdf" and "3832d5a3262f6c9f6b25182469fc10d6847584c9" have entirely different histories.
0326d80a21
...
3832d5a326
3
.idea/misc.xml
generated
3
.idea/misc.xml
generated
@ -7,9 +7,8 @@
|
|||||||
<option value="$PROJECT_DIR$/pom.xml" />
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -8,11 +8,9 @@ public class Account {
|
|||||||
// region Felder
|
// region Felder
|
||||||
private String passwort;
|
private String passwort;
|
||||||
|
|
||||||
private transient int id;
|
private int id;
|
||||||
|
|
||||||
private String name;
|
private String benutzername;
|
||||||
|
|
||||||
private int rid;
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Getter & Setter
|
// region Getter & Setter
|
||||||
@ -34,23 +32,18 @@ public class Account {
|
|||||||
|
|
||||||
|
|
||||||
public String getBenutzername() {
|
public String getBenutzername() {
|
||||||
return name;
|
return benutzername;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBenutzername(String benutzername) {
|
public void setBenutzername(String benutzername) {
|
||||||
this.name = benutzername;
|
this.benutzername = benutzername;
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Konstruktoren
|
// region Konstruktoren
|
||||||
public Account(String passwort, String name) {
|
public Account(String passwort, String benutzername) {
|
||||||
this.passwort = passwort;
|
this.passwort = passwort;
|
||||||
this.name = name;
|
this.benutzername = benutzername;
|
||||||
|
|
||||||
if(this instanceof MitarbeiterAccount)
|
|
||||||
rid = 0;
|
|
||||||
else if (this instanceof ElternAccount)
|
|
||||||
rid = 1;
|
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
@ -7,14 +7,15 @@
|
|||||||
|
|
||||||
package Logik;
|
package Logik;
|
||||||
|
|
||||||
|
import java.nio.file.WatchEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ElternAccount extends Account {
|
public class Benutzer extends Account {
|
||||||
|
|
||||||
// region Felder
|
// region Felder
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
private transient ArrayList<Kind> kinder;
|
private ArrayList<Kind> kinder;
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Getter & Setter
|
// region Getter & Setter
|
||||||
@ -36,7 +37,7 @@ public class ElternAccount extends Account {
|
|||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Konstruktoren
|
// region Konstruktoren
|
||||||
public ElternAccount(String passwort, String benutzername, String email) {
|
public Benutzer(String passwort, String benutzername, String email) {
|
||||||
super(passwort, benutzername);
|
super(passwort, benutzername);
|
||||||
this.email = email;
|
this.email = email;
|
||||||
kinder = new ArrayList<>();
|
kinder = new ArrayList<>();
|
@ -11,6 +11,7 @@ public class Kind {
|
|||||||
private String vorname;
|
private String vorname;
|
||||||
private int bid;
|
private int bid;
|
||||||
|
|
||||||
|
// TODO Zutat implementieren!
|
||||||
private ArrayList<Zutat> filter;
|
private ArrayList<Zutat> filter;
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
@ -47,6 +48,8 @@ public class Kind {
|
|||||||
this.bid = bid;
|
this.bid = bid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Zutat implementieren!
|
||||||
|
|
||||||
public ArrayList<Zutat> getFilter() {
|
public ArrayList<Zutat> getFilter() {
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class MitarbeiterAccount extends Account {
|
|||||||
* @param kinder Eine Liste mit allen zugehörigen Kindern des Accounts
|
* @param kinder Eine Liste mit allen zugehörigen Kindern des Accounts
|
||||||
*/
|
*/
|
||||||
public void accountErstellen(String passwort, String benutzername, String email, ArrayList<Kind> kinder) {
|
public void accountErstellen(String passwort, String benutzername, String email, ArrayList<Kind> kinder) {
|
||||||
ElternAccount newAccount = new ElternAccount(passwort, benutzername, email);
|
Benutzer newAccount = new Benutzer(passwort, benutzername, email);
|
||||||
newAccount.setKinder(kinder);
|
newAccount.setKinder(kinder);
|
||||||
// Id muss aus der Datenbank geholt werden und dann gesetzt werden
|
// Id muss aus der Datenbank geholt werden und dann gesetzt werden
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import java.net.http.HttpClient;
|
|||||||
import java.net.http.HttpRequest;
|
import java.net.http.HttpRequest;
|
||||||
import java.net.http.HttpResponse;
|
import java.net.http.HttpResponse;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.WatchEvent;
|
||||||
|
|
||||||
import Logik.ElternAccount;
|
|
||||||
import Logik.Kind;
|
import Logik.Kind;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
@ -28,18 +28,20 @@ public class RestApiClient implements IRestAPI{
|
|||||||
gson = new Gson();
|
gson = new Gson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args){
|
public static void main(String[] args){
|
||||||
|
|
||||||
RestApiClient client1 = new RestApiClient();
|
Kind kind = new Kind("Klein", "Kevin", 2);
|
||||||
|
|
||||||
client1.post("Gericht", "{\"name\" : \"Svens Beine\", \"69.69\", \"beschreibung\" : \"Muss net schmegge, muss wirge\"}");
|
String json = new Gson().toJson(kind);
|
||||||
|
|
||||||
|
new RestApiClient().post("Kind", json);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methode für einen Get-Aufruf. Ruft alle Elemente einer Tabelle auf.
|
* @param controllerName
|
||||||
*
|
|
||||||
* @param controllerName Name des aufzurufenden Controllers
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void get(String controllerName) {
|
public void get(String controllerName) {
|
||||||
@ -65,10 +67,8 @@ public class RestApiClient implements IRestAPI{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methode für einen Get-Aufruf. Ruft ein spezifisches Element auf.
|
* @param controllerName
|
||||||
*
|
* @param id
|
||||||
* @param controllerName Name des aufzurufenden Controllers
|
|
||||||
* @param id Id der Aufzurufenden Zeile
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void get(String controllerName, int id) {
|
public void get(String controllerName, int id) {
|
||||||
@ -83,9 +83,13 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Send the request and get the response
|
// Send the request and get the response
|
||||||
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
// Print the response status code and body
|
Kind[] test = gson.fromJson(httpResponse.body(), Kind[].class);
|
||||||
System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body());
|
|
||||||
|
|
||||||
|
// Print the response status code and body
|
||||||
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
|
for(Kind i : test){
|
||||||
|
System.out.println(i.getVorname());
|
||||||
|
}
|
||||||
//System.out.println("Response Body: " + test);
|
//System.out.println("Response Body: " + test);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -93,11 +97,9 @@ public class RestApiClient implements IRestAPI{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methode für einen Get-Aufruf. Ruft ein spezielles Element auf.
|
* @param controllerName
|
||||||
*
|
* @param id
|
||||||
* @param controllerName Name des aufzurufenden Controllers
|
* @param bezahlt
|
||||||
* @param id Id der Aufzurufenden Zeile
|
|
||||||
* @param bezahlt TODO Warum ist das hier?
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void get(String controllerName, int id, boolean bezahlt) {
|
public void get(String controllerName, int id, boolean bezahlt) {
|
||||||
@ -121,11 +123,8 @@ public class RestApiClient implements IRestAPI{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methode für einen Put-Aufruf. Aktualisiert einen Eintrag.
|
* @param controllerName
|
||||||
*
|
* @param id
|
||||||
* @param controllerName Name des aufzurufenden Controllers.
|
|
||||||
* @param id Id des zu änderenden Eintrags.
|
|
||||||
* @param jsonData JsonString mit den neuen Daten.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void put(String controllerName, int id, String jsonData) {
|
public void put(String controllerName, int id, String jsonData) {
|
||||||
@ -151,10 +150,7 @@ public class RestApiClient implements IRestAPI{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methode für einen Post-Aufruf. Fügt einen Eintrag in eine Datenbank hinzu.
|
* @param controllerName
|
||||||
*
|
|
||||||
* @param controllerName Name des aufzurufenden Controllers.
|
|
||||||
* @param jsonData JsonString mit den Daten des Eintrags.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void post(String controllerName, String jsonData) {
|
public void post(String controllerName, String jsonData) {
|
||||||
@ -181,33 +177,12 @@ public class RestApiClient implements IRestAPI{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methode für einen Delete-Aufruf. Löscht einen Eintrag mit einer Id.
|
* @param controllerName
|
||||||
*
|
* @param id
|
||||||
* @param controllerName Name des aufzurufenden Controllers
|
|
||||||
* @param id Id des zu löschenden Eintrags.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void delete(String controllerName, int id) {
|
public void delete(String controllerName, int id) {
|
||||||
URI apiUri = URI.create(String.format("%s/%s/%d", urlBase,controllerName, id));
|
|
||||||
|
|
||||||
System.out.println(apiUri);
|
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
|
||||||
.uri(apiUri)
|
|
||||||
.header("Content-Type", "application/json")
|
|
||||||
.DELETE()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 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());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class AccounterstellungMitarbeiter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onAbmelden(ActionEvent actionEvent) {
|
public void onAbmelden(ActionEvent actionEvent) {
|
||||||
//VerwaltungApplication.abmelden();
|
VerwaltungApplication.abmelden();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTypMitarbeiter(ActionEvent actionEvent) {
|
public void onTypMitarbeiter(ActionEvent actionEvent) {
|
||||||
|
@ -9,6 +9,8 @@ import javafx.scene.layout.ColumnConstraints;
|
|||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.Priority;
|
import javafx.scene.layout.Priority;
|
||||||
import javafx.scene.layout.RowConstraints;
|
import javafx.scene.layout.RowConstraints;
|
||||||
|
import javafx.stage.Modality;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
|
||||||
public class EssensverwaltungMitarbeiterView {
|
public class EssensverwaltungMitarbeiterView {
|
||||||
@ -39,15 +41,22 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onFilter(ActionEvent actionEvent) {
|
public void onFilter(ActionEvent actionEvent) {
|
||||||
|
VerwaltungApplication.sceneWechseln(new Stage(), 600, 400, "inhaltsstoffe_filtern-view.fxml");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onHinzufuegen(ActionEvent actionEvent) {
|
public void onHinzufuegen(ActionEvent actionEvent) {
|
||||||
|
Stage gerichterstellung = new Stage();
|
||||||
|
|
||||||
|
//solange das neu geöffnete Fenster offen ist, wird das Hauptfenster gesperrt
|
||||||
|
gerichterstellung.initModality(Modality.APPLICATION_MODAL);
|
||||||
|
|
||||||
|
VerwaltungApplication.sceneWechseln(gerichterstellung, 400, 530, "gerichterstellung_mitarbeiter-view.fxml");
|
||||||
|
|
||||||
|
gerichterstellung.minWidthProperty().set(400);
|
||||||
|
gerichterstellung.minHeightProperty().set(530);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onZurueck(ActionEvent actionEvent) {
|
public void onZurueck(ActionEvent actionEvent) {
|
||||||
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
|
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import javafx.event.ActionEvent;
|
|||||||
public class HauptmenueMitarbeiterView {
|
public class HauptmenueMitarbeiterView {
|
||||||
|
|
||||||
public void onAbmelden(ActionEvent actionEvent) {
|
public void onAbmelden(ActionEvent actionEvent) {
|
||||||
//VerwaltungApplication.abmelden();
|
VerwaltungApplication.abmelden();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAccountAnlegenClick(ActionEvent actionEvent) {
|
public void onAccountAnlegenClick(ActionEvent actionEvent) {
|
||||||
|
@ -110,7 +110,10 @@ public class VerwaltungApplication extends Application {
|
|||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void abmelden() {
|
||||||
|
sceneWechseln("login-view.fxml");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
-fx-padding: 20;
|
-fx-padding: 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hauptmenue_buttons_links{
|
.hauptmenue_buttons_links, .gerichterstellung_felder, .filter, .main, .filter_unten{
|
||||||
-fx-spacing: 20;
|
-fx-spacing: 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,6 +73,13 @@
|
|||||||
-fx-vgap: 10;
|
-fx-vgap: 10;
|
||||||
-fx-hgap: 10;
|
-fx-hgap: 10;
|
||||||
}
|
}
|
||||||
|
.test {
|
||||||
|
-fx-padding: 10 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
.essensuebersicht_gridlines {
|
||||||
|
-fx-grid-lines-visible: true;
|
||||||
|
}
|
||||||
|
|
||||||
.accounterstellung_links {
|
.accounterstellung_links {
|
||||||
-fx-spacing: 20;
|
-fx-spacing: 20;
|
||||||
@ -81,4 +88,25 @@
|
|||||||
.falscheEingabe {
|
.falscheEingabe {
|
||||||
-fx-background-color: #FFDCDC;
|
-fx-background-color: #FFDCDC;
|
||||||
-fx-text-fill: #FFDCDC;
|
-fx-text-fill: #FFDCDC;
|
||||||
|
}
|
||||||
|
.essensuebersicht_gridlines > * {
|
||||||
|
-fx-alignment: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pfeil{
|
||||||
|
-fx-background-color: -fx-mark-highlight-color, -fx-mark-color;
|
||||||
|
-fx-background-insets: 0 0 -1 0, 0;
|
||||||
|
-fx-padding: 0.25em;
|
||||||
|
-fx-shape: "M 0 -3.5 v 7 l 4 -3.5 z";
|
||||||
|
-fx-pref-width: 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.links {
|
||||||
|
-fx-rotate: 180;
|
||||||
|
}
|
||||||
|
.titledPaneUeberschrift > .title {
|
||||||
|
-fx-pref-height: 50;
|
||||||
|
-fx-padding: 10 10 16 10;
|
||||||
|
-fx-font-size: 15;
|
||||||
|
-fx-font-weight: bold;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user