Compare commits
No commits in common. "c5f7391631f8fe883d683563377d0c85716f4217" and "92d62509de04da3f076ec0e3a4ee38112c25ee9c" have entirely different histories.
c5f7391631
...
92d62509de
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
package Logik;
|
package Logik;
|
||||||
|
|
||||||
import RestAPISchnittstelle.RestApiClient;
|
|
||||||
|
|
||||||
public class Account {
|
public class Account {
|
||||||
|
|
||||||
// region Felder
|
// region Felder
|
||||||
@ -16,6 +14,7 @@ public class Account {
|
|||||||
|
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
|
||||||
private int rid;
|
private int rid;
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
@ -58,7 +57,6 @@ public class Account {
|
|||||||
public Account(String passwort, String name, String email) {
|
public Account(String passwort, String name, String email) {
|
||||||
this.passwort = passwort;
|
this.passwort = passwort;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.email = email;
|
|
||||||
|
|
||||||
if(this instanceof MitarbeiterAccount)
|
if(this instanceof MitarbeiterAccount)
|
||||||
rid = 0;
|
rid = 0;
|
||||||
@ -66,4 +64,5 @@ public class Account {
|
|||||||
rid = 1;
|
rid = 1;
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class RestApiClient implements IRestAPI{
|
|||||||
* @param controllerName Name des aufzurufenden Controllers
|
* @param controllerName Name des aufzurufenden Controllers
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String get(String controllerName) {
|
public void get(String controllerName) {
|
||||||
URI apiUri = URI.create(String.format("%s/%s", urlBase, controllerName));
|
URI apiUri = URI.create(String.format("%s/%s", urlBase, controllerName));
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
@ -57,10 +57,8 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Print the response status code and body
|
// Print the response status code and body
|
||||||
System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
System.out.println("Response Body: " + httpResponse.body());
|
System.out.println("Response Body: " + httpResponse.body());
|
||||||
return httpResponse.body();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +69,7 @@ public class RestApiClient implements IRestAPI{
|
|||||||
* @param id Id der Aufzurufenden Zeile
|
* @param id Id der Aufzurufenden Zeile
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String get(String controllerName, int id) {
|
public void get(String controllerName, int id) {
|
||||||
URI apiUri = URI.create(String.format("%s/%s/%s", urlBase, controllerName, id));
|
URI apiUri = URI.create(String.format("%s/%s/%s", urlBase, controllerName, id));
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
@ -86,12 +84,9 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Print the response status code and body
|
// 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();
|
|
||||||
|
|
||||||
//System.out.println("Response Body: " + test);
|
//System.out.println("Response Body: " + test);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +98,7 @@ public class RestApiClient implements IRestAPI{
|
|||||||
* @param bezahlt TODO Warum ist das hier?
|
* @param bezahlt TODO Warum ist das hier?
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String get(String controllerName, int id, boolean bezahlt) {
|
public void get(String controllerName, int id, boolean bezahlt) {
|
||||||
URI apiUri = URI.create(String.format("%s/%s?%s&%s", urlBase, controllerName, id, bezahlt));
|
URI apiUri = URI.create(String.format("%s/%s?%s&%s", urlBase, controllerName, id, bezahlt));
|
||||||
|
|
||||||
HttpRequest httpRequest = HttpRequest.newBuilder()
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
||||||
@ -118,10 +113,8 @@ public class RestApiClient implements IRestAPI{
|
|||||||
// Print the response status code and body
|
// Print the response status code and body
|
||||||
System.out.println("Status Code: " + httpResponse.statusCode());
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
||||||
System.out.println("Response Body: " + httpResponse.body());
|
System.out.println("Response Body: " + httpResponse.body());
|
||||||
return httpResponse.body();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,9 +138,6 @@ public class AccounterstellungMitarbeiter {
|
|||||||
status.setText("Daten Erfolgreich gespeichert");
|
status.setText("Daten Erfolgreich gespeichert");
|
||||||
einmalpw.setText(einmalPwGenerieren());
|
einmalpw.setText(einmalPwGenerieren());
|
||||||
|
|
||||||
RestApiClient api = new RestApiClient();
|
|
||||||
int id = api.nextId("Benutzer");
|
|
||||||
|
|
||||||
|
|
||||||
//String json = String.format("{\"name\":\"%s\", \"email\":\"%s\", \"passwort\":\"%d\", \"rid\":\"%d\"}",
|
//String json = String.format("{\"name\":\"%s\", \"email\":\"%s\", \"passwort\":\"%d\", \"rid\":\"%d\"}",
|
||||||
// accountname.getText(), email.getText(), einmalpw.getText().hashCode(), (typMitarbeiter.isSelected() ? 0:1));
|
// accountname.getText(), email.getText(), einmalpw.getText().hashCode(), (typMitarbeiter.isSelected() ? 0:1));
|
||||||
@ -148,7 +145,6 @@ public class AccounterstellungMitarbeiter {
|
|||||||
Account neuer;
|
Account neuer;
|
||||||
if (typEltern.isSelected()) {
|
if (typEltern.isSelected()) {
|
||||||
neuer = new ElternAccount(String.format("%d",einmalpw.getText().hashCode()), accountname.getText(), email.getText());
|
neuer = new ElternAccount(String.format("%d",einmalpw.getText().hashCode()), accountname.getText(), email.getText());
|
||||||
System.out.println(neuer.getEmail());
|
|
||||||
for (Kind k : kinder) {
|
for (Kind k : kinder) {
|
||||||
((ElternAccount)neuer).getKinder().add(k);
|
((ElternAccount)neuer).getKinder().add(k);
|
||||||
}
|
}
|
||||||
@ -165,10 +161,10 @@ public class AccounterstellungMitarbeiter {
|
|||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
|
|
||||||
System.out.println(gson.toJson(neuer));
|
System.out.println(gson.toJson(neuer));
|
||||||
|
RestApiClient api = new RestApiClient();
|
||||||
api.post("Benutzer", gson.toJson(neuer));
|
api.post("Benutzer", gson.toJson(neuer));
|
||||||
if (neuer instanceof ElternAccount) {
|
if (neuer instanceof ElternAccount) {
|
||||||
for (Kind k : ((ElternAccount)neuer).getKinder()) {
|
for (Kind k : ((ElternAccount)neuer).getKinder()) {
|
||||||
k.setBid(id);
|
|
||||||
api.post("Kind", gson.toJson(k));
|
api.post("Kind", gson.toJson(k));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,5 +172,7 @@ public class AccounterstellungMitarbeiter {
|
|||||||
else {
|
else {
|
||||||
status.setText("Accounterstellung Fehlgeschlagen");
|
status.setText("Accounterstellung Fehlgeschlagen");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
package de.subway_surfers.vpr_app;
|
||||||
|
|
||||||
import Logik.Account;
|
|
||||||
import RestAPISchnittstelle.RestApiClient;
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
|
Loading…
Reference in New Issue
Block a user