Merge pull request 'diverses' (#11) from samu_masken into master
Reviewed-on: #11
This commit is contained in:
commit
3c501d9cdb
@ -8,9 +8,11 @@ public class Account {
|
||||
// region Felder
|
||||
private String passwort;
|
||||
|
||||
private int id;
|
||||
private transient int id;
|
||||
|
||||
private String benutzername;
|
||||
private String name;
|
||||
|
||||
private int rid;
|
||||
// endregion
|
||||
|
||||
// region Getter & Setter
|
||||
@ -32,18 +34,23 @@ public class Account {
|
||||
|
||||
|
||||
public String getBenutzername() {
|
||||
return benutzername;
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setBenutzername(String benutzername) {
|
||||
this.benutzername = benutzername;
|
||||
this.name = benutzername;
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Konstruktoren
|
||||
public Account(String passwort, String benutzername) {
|
||||
public Account(String passwort, String name) {
|
||||
this.passwort = passwort;
|
||||
this.benutzername = benutzername;
|
||||
this.name = name;
|
||||
|
||||
if(this instanceof MitarbeiterAccount)
|
||||
rid = 0;
|
||||
else if (this instanceof ElternAccount)
|
||||
rid = 1;
|
||||
}
|
||||
// endregion
|
||||
|
||||
|
@ -7,15 +7,14 @@
|
||||
|
||||
package Logik;
|
||||
|
||||
import java.nio.file.WatchEvent;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Benutzer extends Account {
|
||||
public class ElternAccount extends Account {
|
||||
|
||||
// region Felder
|
||||
private String email;
|
||||
|
||||
private ArrayList<Kind> kinder;
|
||||
private transient ArrayList<Kind> kinder;
|
||||
// endregion
|
||||
|
||||
// region Getter & Setter
|
||||
@ -37,7 +36,7 @@ public class Benutzer extends Account {
|
||||
// endregion
|
||||
|
||||
// region Konstruktoren
|
||||
public Benutzer(String passwort, String benutzername, String email) {
|
||||
public ElternAccount(String passwort, String benutzername, String email) {
|
||||
super(passwort, benutzername);
|
||||
this.email = email;
|
||||
kinder = new ArrayList<>();
|
@ -51,7 +51,7 @@ public class MitarbeiterAccount extends Account {
|
||||
* @param kinder Eine Liste mit allen zugehörigen Kindern des Accounts
|
||||
*/
|
||||
public void accountErstellen(String passwort, String benutzername, String email, ArrayList<Kind> kinder) {
|
||||
Benutzer newAccount = new Benutzer(passwort, benutzername, email);
|
||||
ElternAccount newAccount = new ElternAccount(passwort, benutzername, email);
|
||||
newAccount.setKinder(kinder);
|
||||
// Id muss aus der Datenbank geholt werden und dann gesetzt werden
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import Logik.ElternAccount;
|
||||
import Logik.Kind;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@ -27,6 +28,18 @@ public class RestApiClient implements IRestAPI{
|
||||
gson = new Gson();
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
|
||||
RestApiClient client1 = new RestApiClient();
|
||||
|
||||
ElternAccount elternAccount = new ElternAccount("hiiiiiiii", "124", "pimmel@pimmel.com");
|
||||
|
||||
String json = client1.gson.toJson(elternAccount);
|
||||
|
||||
client1.put("Benutzer",6, json);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode für einen Get-Aufruf. Ruft alle Elemente einer Tabelle auf.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user