Refactor
This commit is contained in:
parent
30e0afb86c
commit
dc78d69a00
@ -20,23 +20,23 @@ import java.util.Locale;
|
||||
public class CreateEventController {
|
||||
|
||||
@FXML
|
||||
public GridPane mainGrid;
|
||||
private GridPane mainGrid;
|
||||
@FXML
|
||||
public JFXDatePicker datePickerDate;
|
||||
protected JFXDatePicker datePickerDate;
|
||||
@FXML
|
||||
public JFXTextField textName;
|
||||
protected JFXTextField textName;
|
||||
@FXML
|
||||
public JFXComboBox<String> ComboBoxPriotity;
|
||||
protected JFXComboBox<String> comboBoxPriority;
|
||||
@FXML
|
||||
public JFXToggleButton toggleBtnIsFullDay;
|
||||
private JFXToggleButton toggleBtnIsFullDay;
|
||||
@FXML
|
||||
public JFXToggleButton toggleBtnIsPrivate;
|
||||
private JFXToggleButton toggleBtnIsPrivate;
|
||||
@FXML
|
||||
public Label labelError;
|
||||
private Label labelError;
|
||||
@FXML
|
||||
public JFXTimePicker timeStart;
|
||||
private JFXTimePicker timeStart;
|
||||
@FXML
|
||||
public JFXTimePicker timeEnd;
|
||||
private JFXTimePicker timeEnd;
|
||||
|
||||
|
||||
public CreateEventController() {
|
||||
@ -64,7 +64,7 @@ public class CreateEventController {
|
||||
|
||||
Event event = new Event(
|
||||
textName.getText(),
|
||||
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
||||
comboBoxPriority.getSelectionModel().getSelectedIndex(),
|
||||
toggleBtnIsFullDay.isSelected(),
|
||||
toggleBtnIsPrivate.isSelected(),
|
||||
timeStart.getValue(),
|
||||
|
@ -17,7 +17,7 @@ public class EditEventController extends CreateEventController{
|
||||
|
||||
textName.setText(currentEvent.getName());
|
||||
datePickerDate.setValue(currentEvent.getDate().toLocalDate());
|
||||
ComboBoxPriotity.getSelectionModel().select(currentEvent.getPriority());
|
||||
comboBoxPriority.getSelectionModel().select(currentEvent.getPriority());
|
||||
|
||||
//timeEnd.setValue(currentEvent.getEnd());
|
||||
}
|
||||
|
@ -2,16 +2,13 @@ package main;
|
||||
|
||||
import config.Config;
|
||||
import config.ConfigLoader;
|
||||
import helper.Tuple;
|
||||
import container.DataController;
|
||||
import container.HttpRequest;
|
||||
import javafx.application.Application;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
import container.DataController;
|
||||
import container.HttpRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
@ -41,6 +38,9 @@ public class MainApplication extends Application {
|
||||
config.setToken(HttpRequest.TOKEN);
|
||||
ConfigLoader.save(config);
|
||||
}
|
||||
|
||||
DataController.SERVER_URL = config.toServerUrl();
|
||||
|
||||
// Load main-scene
|
||||
loadMainScene(stage);
|
||||
|
||||
@ -60,22 +60,30 @@ public class MainApplication extends Application {
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void loadLoginScene() throws IOException {
|
||||
FXMLLoader fxmlLoaderLogin = new FXMLLoader(MainApplication.class.getResource("../users/login.fxml"));
|
||||
Scene sceneLogin = new Scene(fxmlLoaderLogin.load(), 650, 500);
|
||||
sceneLogin.getStylesheets().add(Objects.requireNonNull(
|
||||
MainApplication.class.getResource("../users/login.css")).toExternalForm()
|
||||
private void loadLoginScene() {
|
||||
loadScene(
|
||||
"Anmelden",
|
||||
"../users/login.fxml",
|
||||
"../users/login.css",
|
||||
650,
|
||||
500
|
||||
);
|
||||
Stage stageLogin = new Stage();
|
||||
stageLogin.setTitle("Anmelden");
|
||||
stageLogin.setScene(sceneLogin);
|
||||
stageLogin.showAndWait();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch();
|
||||
}
|
||||
|
||||
public static void loadScene(
|
||||
String title,
|
||||
String fxml,
|
||||
String css,
|
||||
int width,
|
||||
int height
|
||||
) {
|
||||
loadScene(title, fxml, css, width, height, null);
|
||||
}
|
||||
|
||||
public static void loadScene(
|
||||
String title,
|
||||
String fxml,
|
||||
|
@ -2,45 +2,40 @@ package main;
|
||||
|
||||
import config.Config;
|
||||
import config.ConfigLoader;
|
||||
import container.DataController;
|
||||
import container.Event;
|
||||
import container.HttpRequest;
|
||||
import events.EditEventController;
|
||||
import ui.DayPane;
|
||||
import ui.EventPane;
|
||||
import ui.SvgBtnCreator;
|
||||
import helper.HttpRequestException;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
import container.DataController;
|
||||
import container.Event;
|
||||
import ui.DayPane;
|
||||
import ui.EventPane;
|
||||
import ui.SvgBtnCreator;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import container.HttpRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
public class MainController {
|
||||
|
||||
@FXML
|
||||
public VBox leftNav;
|
||||
private VBox leftNav;
|
||||
@FXML
|
||||
public GridPane mainGridPane;
|
||||
private GridPane mainGridPane;
|
||||
@FXML
|
||||
public HBox buttonBox;
|
||||
private HBox buttonBox;
|
||||
@FXML
|
||||
private GridPane calendarGrid;
|
||||
|
||||
@FXML
|
||||
private javafx.scene.control.Label LabelMonth;
|
||||
|
||||
@ -110,8 +105,7 @@ public class MainController {
|
||||
"create-event.fxml",
|
||||
"create-event.css",
|
||||
650,
|
||||
650,
|
||||
null
|
||||
650
|
||||
);
|
||||
updateEvents();
|
||||
}
|
||||
@ -122,8 +116,7 @@ public class MainController {
|
||||
"option-view.fxml",
|
||||
"option-view.css",
|
||||
650,
|
||||
600,
|
||||
null
|
||||
600
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -27,17 +27,17 @@ import java.util.Optional;
|
||||
public class OptionController {
|
||||
|
||||
@FXML
|
||||
public JFXButton updateUserBtn;
|
||||
private JFXButton updateUserBtn;
|
||||
@FXML
|
||||
public JFXButton deleteUserBtn;
|
||||
private JFXButton deleteUserBtn;
|
||||
@FXML
|
||||
public JFXButton createUserBtn;
|
||||
private JFXButton createUserBtn;
|
||||
@FXML
|
||||
public JFXToggleButton saveLoginTBtn;
|
||||
private JFXToggleButton saveLoginTBtn;
|
||||
@FXML
|
||||
public Label labelError;
|
||||
private Label labelError;
|
||||
@FXML
|
||||
public GridPane mainGrid;
|
||||
private GridPane mainGrid;
|
||||
|
||||
private JFXComboBox<String> comboBox;
|
||||
private DataController dataController;
|
||||
@ -79,8 +79,7 @@ public class OptionController {
|
||||
"../users/create-user.fxml",
|
||||
"../users/create-user.css",
|
||||
800,
|
||||
650,
|
||||
null
|
||||
650
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,12 @@
|
||||
package ui;
|
||||
|
||||
import container.DataController;
|
||||
import container.Event;
|
||||
import events.EditEventController;
|
||||
import helper.HttpRequestException;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
import main.MainApplication;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
public class EventPane extends VBox {
|
||||
|
||||
|
@ -16,40 +16,24 @@ import java.util.Objects;
|
||||
|
||||
public class CreateUserController {
|
||||
|
||||
public TextField textName;
|
||||
public PasswordField textPassword;
|
||||
public PasswordField textPasswordSecond;
|
||||
public ToggleButton checkButtonIsAdmin;
|
||||
public TextField textLogin;
|
||||
public TextField textForename;
|
||||
public Label labelError;
|
||||
@FXML
|
||||
protected TextField textName;
|
||||
@FXML
|
||||
protected PasswordField textPassword;
|
||||
@FXML
|
||||
protected PasswordField textPasswordSecond;
|
||||
@FXML
|
||||
protected ToggleButton checkButtonIsAdmin;
|
||||
@FXML
|
||||
protected TextField textLogin;
|
||||
@FXML
|
||||
protected TextField textForename;
|
||||
@FXML
|
||||
protected Label labelError;
|
||||
|
||||
@FXML
|
||||
protected void createUser(ActionEvent event) {
|
||||
if (textLogin.getText().trim().isEmpty()){
|
||||
labelError.setText("Bitte Login Namen angeben");
|
||||
return;
|
||||
}
|
||||
if (textForename.getText().trim().isEmpty()) {
|
||||
labelError.setText("Bitte Vornamen eingeben!");
|
||||
return;
|
||||
}
|
||||
if (textName.getText().trim().isEmpty()) {
|
||||
labelError.setText("Bitte Nachnamen eingeben!");
|
||||
return;
|
||||
}
|
||||
if (textPassword.getText().trim().isEmpty()) {
|
||||
labelError.setText("Bitte Passwort eingeben!");
|
||||
return;
|
||||
}
|
||||
if (textPassword.getText().trim().length() < 8) {
|
||||
labelError.setText("Das Passwort muss mindestens 8 Zeichen lang sein!");
|
||||
return;
|
||||
}
|
||||
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
||||
labelError.setText("Passwörter stimmen nicht überein!");
|
||||
return;
|
||||
}
|
||||
if (validateNameAndLogin() || validatePassword()) return;
|
||||
|
||||
User user = new User();
|
||||
user.setLogin(textLogin.getText().trim());
|
||||
@ -69,6 +53,38 @@ public class CreateUserController {
|
||||
stage.close();
|
||||
}
|
||||
|
||||
protected boolean validatePassword() {
|
||||
if (textPassword.getText().trim().isEmpty()) {
|
||||
labelError.setText("Bitte Passwort eingeben!");
|
||||
return true;
|
||||
}
|
||||
if (textPassword.getText().trim().length() < 8) {
|
||||
labelError.setText("Das Passwort muss mindestens 8 Zeichen lang sein!");
|
||||
return true;
|
||||
}
|
||||
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
||||
labelError.setText("Passwörter stimmen nicht überein!");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean validateNameAndLogin() {
|
||||
if (textLogin.getText().trim().isEmpty()){
|
||||
labelError.setText("Bitte Login Namen angeben");
|
||||
return true;
|
||||
}
|
||||
if (textForename.getText().trim().isEmpty()) {
|
||||
labelError.setText("Bitte Vornamen eingeben!");
|
||||
return true;
|
||||
}
|
||||
if (textName.getText().trim().isEmpty()) {
|
||||
labelError.setText("Bitte Nachnamen eingeben!");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void sendHttpRequest(User user) throws HttpRequestException {
|
||||
DataController dataController = new DataController();
|
||||
dataController.createUser(user);
|
||||
|
@ -8,8 +8,6 @@ import javafx.scene.Node;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class EditUserController extends CreateUserController{
|
||||
private User currentUser;
|
||||
|
||||
@ -28,34 +26,12 @@ public class EditUserController extends CreateUserController{
|
||||
|
||||
@Override
|
||||
protected void createUser(ActionEvent event){
|
||||
if (textLogin.getText().trim().isEmpty()){
|
||||
labelError.setText("Bitte Login Namen angeben");
|
||||
return;
|
||||
}
|
||||
if (textForename.getText().trim().isEmpty()) {
|
||||
labelError.setText("Bitte Vornamen eingeben!");
|
||||
return;
|
||||
}
|
||||
if (textName.getText().trim().isEmpty()) {
|
||||
labelError.setText("Bitte Nachnamen eingeben!");
|
||||
return;
|
||||
}
|
||||
if (validateNameAndLogin()) return;
|
||||
|
||||
User user = new User();
|
||||
|
||||
if(!textPassword.getText().trim().isEmpty() || !textPasswordSecond.getText().trim().isEmpty()){
|
||||
if (textPassword.getText().trim().isEmpty()) {
|
||||
labelError.setText("Bitte Passwort eingeben!");
|
||||
return;
|
||||
}
|
||||
if (textPassword.getText().trim().length() < 8) {
|
||||
labelError.setText("Das Passwort muss mindestens 8 Zeichen lang sein!");
|
||||
return;
|
||||
}
|
||||
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
||||
labelError.setText("Passwörter stimmen nicht überein!");
|
||||
return;
|
||||
}
|
||||
if (validatePassword()) return;
|
||||
user.setPassword(textPassword.getText().trim());
|
||||
}
|
||||
|
||||
|
@ -10,13 +10,13 @@ import container.DataController;
|
||||
|
||||
public class LoginController {
|
||||
@FXML
|
||||
public JFXTextField userField;
|
||||
private JFXTextField userField;
|
||||
@FXML
|
||||
public JFXPasswordField passField;
|
||||
private JFXPasswordField passField;
|
||||
@FXML
|
||||
public Label userErrLabel;
|
||||
private Label userErrLabel;
|
||||
@FXML
|
||||
public Label passErrLabel;
|
||||
private Label passErrLabel;
|
||||
|
||||
@FXML
|
||||
protected void login(ActionEvent event) {
|
||||
|
@ -43,7 +43,7 @@
|
||||
<JFXTimePicker styleClass="timePicker" fx:id="timeStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="200" minWidth="200"/>
|
||||
<JFXTimePicker styleClass="timePicker" fx:id="timeEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="200" minWidth="200"/>
|
||||
|
||||
<JFXComboBox fx:id="ComboBoxPriotity" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
||||
<JFXComboBox fx:id="comboBoxPriority" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
||||
<items>
|
||||
<FXCollections fx:factory="observableArrayList">
|
||||
<String fx:value="gering"/>
|
||||
|
@ -43,7 +43,7 @@
|
||||
<JFXTimePicker styleClass="timePicker" fx:id="timeStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="200" minWidth="200"/>
|
||||
<JFXTimePicker styleClass="timePicker" fx:id="timeEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="200" minWidth="200"/>
|
||||
|
||||
<JFXComboBox fx:id="ComboBoxPriotity" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
||||
<JFXComboBox fx:id="comboBoxPriority" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
||||
<items>
|
||||
<FXCollections fx:factory="observableArrayList">
|
||||
<String fx:value="gering"/>
|
||||
|
@ -4,15 +4,26 @@ public class Config {
|
||||
private boolean saveLogin;
|
||||
private long id;
|
||||
private String token;
|
||||
private String connectionMethod;
|
||||
private String hostAddress;
|
||||
private int port;
|
||||
|
||||
public Config(){
|
||||
|
||||
saveLogin = false;
|
||||
id = -1;
|
||||
token = "";
|
||||
connectionMethod = "http";
|
||||
hostAddress = "localhost";
|
||||
port = 8080;
|
||||
}
|
||||
|
||||
public Config(boolean saveLogin, long id, String token) {
|
||||
this.saveLogin = saveLogin;
|
||||
this.id = id;
|
||||
this.token = token;
|
||||
connectionMethod = "http";
|
||||
hostAddress = "localhost";
|
||||
port = 8080;
|
||||
}
|
||||
|
||||
public boolean isSaveLogin() {
|
||||
@ -38,4 +49,32 @@ public class Config {
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public String getConnectionMethod() {
|
||||
return connectionMethod;
|
||||
}
|
||||
|
||||
public void setConnectionMethod(String connectionMethod) {
|
||||
this.connectionMethod = connectionMethod;
|
||||
}
|
||||
|
||||
public String getHostAddress() {
|
||||
return hostAddress;
|
||||
}
|
||||
|
||||
public void setHostAddress(String hostAddress) {
|
||||
this.hostAddress = hostAddress;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String toServerUrl(){
|
||||
return getConnectionMethod() + "://" + getHostAddress() + ":" + getPort();
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,12 @@ public class ConfigLoader {
|
||||
objectMapper.findAndRegisterModules();
|
||||
|
||||
try {
|
||||
Files.writeString(Paths.get(
|
||||
"config.json"),
|
||||
Files.writeString(
|
||||
Paths.get("config.json"),
|
||||
objectMapper.writeValueAsString(config)
|
||||
.replace(",", ",\n\t")
|
||||
.replace("{", "{\n\t")
|
||||
.replace("}", "\n}")
|
||||
);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -12,20 +12,21 @@ import java.util.*;
|
||||
public class DataController {
|
||||
|
||||
public static long USER_ID = -1;
|
||||
public static String SERVER_URL = "http://localhost:8080";
|
||||
|
||||
private static final String ALL_EVENTS_ENDPOINT = "http://localhost:8080/event/all";
|
||||
private static final String ADD_EVENT_ENDPOINT = "http://localhost:8080/event/add";
|
||||
private static final String DELETE_EVENT_ENDPOINT = "http://localhost:8080/event/del";
|
||||
private static final String EDIT_EVENT_ENDPOINT = "http://localhost:8080/event/edit";
|
||||
private static final String ALL_EVENTS_ENDPOINT = "/event/all";
|
||||
private static final String ADD_EVENT_ENDPOINT = "/event/add";
|
||||
private static final String DELETE_EVENT_ENDPOINT = "/event/del";
|
||||
private static final String EDIT_EVENT_ENDPOINT = "/event/edit";
|
||||
|
||||
private static final String ALL_USER_ENDPOINT = "http://localhost:8080/user/all";
|
||||
private static final String ADD_USER_ENDPOINT = "http://localhost:8080/user/add";
|
||||
private static final String DELETE_USER_ENDPOINT = "http://localhost:8080/user/del";
|
||||
private static final String EDIT_USER_ENDPOINT = "http://localhost:8080/user/edit";
|
||||
private static final String ALL_USER_ENDPOINT = "/user/all";
|
||||
private static final String ADD_USER_ENDPOINT = "/user/add";
|
||||
private static final String DELETE_USER_ENDPOINT = "/user/del";
|
||||
private static final String EDIT_USER_ENDPOINT = "/user/edit";
|
||||
|
||||
private static final String LOGIN_ENDPOINT = "http://localhost:8080/user/login";
|
||||
private static final String LOGIN_WITH_TOKEN_ENDPOINT = "http://localhost:8080/user/login-with-token";
|
||||
private static final String HEADER_TEST_ENDPOINT = "http://localhost:8080/vpr/header-test";
|
||||
private static final String LOGIN_ENDPOINT = "/user/login";
|
||||
private static final String LOGIN_WITH_TOKEN_ENDPOINT = "/user/login-with-token";
|
||||
private static final String HEADER_TEST_ENDPOINT = "/vpr/header-test";
|
||||
|
||||
private final HttpRequest httpRequest;
|
||||
|
||||
@ -36,7 +37,7 @@ public class DataController {
|
||||
public boolean login(String username, String password) {
|
||||
try {
|
||||
Tuple<Integer, String> response = httpRequest.sendPostRequest(
|
||||
LOGIN_ENDPOINT,
|
||||
SERVER_URL + LOGIN_ENDPOINT,
|
||||
"login=" + username
|
||||
+ "&password=" + password,
|
||||
false
|
||||
@ -57,7 +58,7 @@ public class DataController {
|
||||
try {
|
||||
HttpRequest.TOKEN = token;
|
||||
Tuple<Integer, String> response = httpRequest.sendPostRequest(
|
||||
LOGIN_WITH_TOKEN_ENDPOINT,
|
||||
SERVER_URL + LOGIN_WITH_TOKEN_ENDPOINT,
|
||||
"userId=" + userId,
|
||||
true
|
||||
);
|
||||
@ -79,7 +80,7 @@ public class DataController {
|
||||
*********/
|
||||
public void createEvent(Event event) throws HttpRequestException {
|
||||
sendBasicHttpRequest(
|
||||
ADD_EVENT_ENDPOINT,
|
||||
SERVER_URL + ADD_EVENT_ENDPOINT,
|
||||
event.getAsUrlParam(),
|
||||
true
|
||||
);
|
||||
@ -87,7 +88,7 @@ public class DataController {
|
||||
|
||||
public void deleteEvent(int userId, int eventId, LocalDateTime date) throws HttpRequestException {
|
||||
sendBasicHttpRequest(
|
||||
DELETE_EVENT_ENDPOINT,
|
||||
SERVER_URL + DELETE_EVENT_ENDPOINT,
|
||||
"userId=" + userId + "&eventId=" + eventId + "&date=" + date.toLocalDate(),
|
||||
true
|
||||
);
|
||||
@ -95,7 +96,7 @@ public class DataController {
|
||||
|
||||
public void editEvent(Event oldEvent, Event event) throws HttpRequestException {
|
||||
sendBasicHttpRequest(
|
||||
EDIT_EVENT_ENDPOINT,
|
||||
SERVER_URL + EDIT_EVENT_ENDPOINT,
|
||||
"eventId=" + oldEvent.getId() +
|
||||
"&userId=" + oldEvent.getOwnerId() +
|
||||
"&date=" + oldEvent.getDate().toLocalDate() +
|
||||
@ -113,7 +114,7 @@ public class DataController {
|
||||
public ArrayList<Event> getAllVisibleEvents(LocalDateTime startDate, LocalDateTime endDate) throws HttpRequestException {
|
||||
try {
|
||||
Tuple<Integer, String> response = httpRequest.sendPostRequest(
|
||||
ALL_EVENTS_ENDPOINT,
|
||||
SERVER_URL + ALL_EVENTS_ENDPOINT,
|
||||
"userId=" + USER_ID + "&startDate=" + startDate.toLocalDate() + "&endDate=" + endDate.toLocalDate(),
|
||||
true
|
||||
);
|
||||
@ -141,7 +142,7 @@ public class DataController {
|
||||
|
||||
public List<User> getAllUser() throws HttpRequestException {
|
||||
String userJSON = sendBasicHttpRequest(
|
||||
ALL_USER_ENDPOINT,
|
||||
SERVER_URL + ALL_USER_ENDPOINT,
|
||||
"",
|
||||
true
|
||||
);
|
||||
@ -164,7 +165,7 @@ public class DataController {
|
||||
|
||||
public void createUser(User user) throws HttpRequestException {
|
||||
sendBasicHttpRequest(
|
||||
ADD_USER_ENDPOINT,
|
||||
SERVER_URL + ADD_USER_ENDPOINT,
|
||||
"name=" + user.getName() +
|
||||
"&forename=" + user.getForename() +
|
||||
"&login=" + user.getLogin() +
|
||||
@ -176,7 +177,7 @@ public class DataController {
|
||||
|
||||
public void deleteUser(User user) throws HttpRequestException {
|
||||
sendBasicHttpRequest(
|
||||
DELETE_USER_ENDPOINT,
|
||||
SERVER_URL + DELETE_USER_ENDPOINT,
|
||||
"userId=" + user.getUserId(),
|
||||
true
|
||||
);
|
||||
@ -192,7 +193,7 @@ public class DataController {
|
||||
|
||||
System.out.println(urlParam);
|
||||
sendBasicHttpRequest(
|
||||
EDIT_USER_ENDPOINT,
|
||||
SERVER_URL + EDIT_USER_ENDPOINT,
|
||||
urlParam,
|
||||
true
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user