#8: Cleanup & Javadoc
Some checks failed
Quality Check / Linting Check (push) Failing after 16s
Quality Check / Linting Check (pull_request) Failing after 21s
Quality Check / Javadoc Check (push) Successful in 35s
Quality Check / Javadoc Check (pull_request) Successful in 33s

Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
This commit is contained in:
Dominik Säume 2024-05-22 09:49:52 +02:00
parent 7db1c83a08
commit eea10407c9
Signed by: SZUT-Dominik
GPG key ID: 67D15BB250B41E7C
3 changed files with 22 additions and 8 deletions

View file

@ -37,10 +37,17 @@ public class Main extends Application {
@Override @Override
public void start(Stage primaryStage) { public void start(Stage primaryStage) {
this.primaryStage = primaryStage; this.primaryStage = primaryStage;
executePassword(); User user = executeLogin();
if(user != null){
executeMainApplication(user);
}
} }
private void executePassword() { /**
* Executes the login.
* @return User The {@link User} object for the logged-in {@link User}. Is {@code null}, if the login was not successful,
*/
private User executeLogin() {
try { try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/login/LoginView.fxml")); FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/login/LoginView.fxml"));
@ -55,12 +62,10 @@ public class Main extends Application {
controller.initialize(loginStage); controller.initialize(loginStage);
loginStage.showAndWait(); loginStage.showAndWait();
return controller.user;
if(controller.user != null){
executeMainApplication(controller.user);
}
} catch (IOException exception) { } catch (IOException exception) {
exception.printStackTrace(); exception.printStackTrace();
return null;
} }
} }

View file

@ -13,7 +13,12 @@ import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.*; import java.util.*;
public class UserFixture implements Fixture<User>{ /**
* {@link Fixture} for {@link User}.
*
* @author Dominik Säume
*/
public class UserFixture implements Fixture<User> {
private static final String SCHEMA = "/de/hitec/nhplus/login/database/User.sql"; private static final String SCHEMA = "/de/hitec/nhplus/login/database/User.sql";
private static final String PERMISSION_SCHEMA = "/de/hitec/nhplus/login/database/UserPermission.sql"; private static final String PERMISSION_SCHEMA = "/de/hitec/nhplus/login/database/UserPermission.sql";
private static final String TO_NURSE_SCHEMA = "/de/hitec/nhplus/login/database/UserToNurse.sql"; private static final String TO_NURSE_SCHEMA = "/de/hitec/nhplus/login/database/UserToNurse.sql";
@ -94,7 +99,7 @@ public class UserFixture implements Fixture<User>{
UserDao dao = DaoFactory.getInstance().createUserDAO(); UserDao dao = DaoFactory.getInstance().createUserDAO();
Map<String, User> usersByUsername = new HashMap<>(); Map<String, User> usersByUsername = new HashMap<>();
for (User user : users){ for (User user : users) {
dao.create(user); dao.create(user);
usersByUsername.put(user.getUsername(), user); usersByUsername.put(user.getUsername(), user);
} }

View file

@ -1,5 +1,9 @@
package de.hitec.nhplus.utils.tab; package de.hitec.nhplus.utils.tab;
/**
* A simple class holding the data needed for constructing a tab.
* @see TabManager
*/
public class TabStruct { public class TabStruct {
public String title; public String title;
public String view; public String view;