Skip to content

Commit

Permalink
Merge pull request #56 from Group-5/release/v1.0.0
Browse files Browse the repository at this point in the history
Merge Release/v1.0.0 into main
  • Loading branch information
lucych authored Mar 20, 2026
2 parents 7b02f57 + 1a99990 commit 16b02a1
Show file tree
Hide file tree
Showing 78 changed files with 5,787 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@ out/
## VSCode
##############################
.vscode/

##############################
## Misc
##############################
.settings/*
.project
.classpath
482 changes: 482 additions & 0 deletions google_checks.xml

Large diffs are not rendered by default.

67 changes: 66 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,44 @@
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
<classifier>win</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>${javafx.version}</version>
<classifier>win</classifier>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-crypto -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
<version>7.0.2</version>
</dependency>
</dependencies>
<!-- Source: https://mvnrepository.com/artifact/tools.jackson.core/jackson-databind -->
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>3.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>6.1.10</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.224</version>
<scope>runtime</scope>
</dependency>
</dependencies>

<build>
<plugins>
Expand Down Expand Up @@ -86,6 +116,41 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.12.0</version>
</plugin>

<!-- Fat JAR plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/NOTICE</exclude>
<exclude>META-INF/LICENSE</exclude>
<exclude>META-INF.versions.9.module-info</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>edu.group5.app.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
98 changes: 94 additions & 4 deletions src/main/java/edu/group5/app/App.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,100 @@
package edu.group5.app;

import edu.group5.app.control.MainController;
import edu.group5.app.control.wrapper.DbWrapper;
import edu.group5.app.control.wrapper.OrgApiWrapper;
import edu.group5.app.model.donation.Donation;
import edu.group5.app.model.donation.DonationRepository;
import edu.group5.app.model.donation.DonationService;
import edu.group5.app.model.organization.OrganizationRepository;
import edu.group5.app.model.organization.OrganizationService;
import edu.group5.app.model.user.User;
import edu.group5.app.model.user.UserRepository;
import edu.group5.app.model.user.UserService;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

import java.util.List;

import java.util.logging.Logger;

/**
* Hello world!
* Main entry point for the Help-Me-Help charity donation application.
* Handles database connection, data loading, and application setup.
*/
public class App {
public static void main(String[] args) {
System.out.println("Hello World!");
public class App extends Application {
DbWrapper dbWrapper;
UserRepository userRepository;
DonationRepository donationRepository;
private Logger logger;
private MainController controller;
private Scene scene;

@Override
public void init() {
this.logger = Logger.getLogger(App.class.getName());
this.logger.info("Application starting");

this.dbWrapper = new DbWrapper(false);
OrgApiWrapper orgApiWrapper = new OrgApiWrapper("https://app.innsamlingskontrollen.no/api/public/v1/all");

while (!dbWrapper.connect()) {
this.logger.warning("Failed to connect to database");
}

// Load data from database
List<Object[]> userData = dbWrapper.importUsers();
List<Object[]> donationData = dbWrapper.fetchAllDonations();
dbWrapper.disconnect();

// Load organizations from API
Object[] organizationData = new Object[0];
try {
if (orgApiWrapper.importData()) {
organizationData = orgApiWrapper.getData();
}
} catch (InterruptedException e) {
System.err.println("Failed to load organization data: " + e.getMessage());
}

// Create repositories with fetched data
this.userRepository = new UserRepository(userData);
this.donationRepository = new DonationRepository(donationData);
OrganizationRepository organizationRepository = new OrganizationRepository(organizationData);

// Create services (backend wiring)
UserService userService = new UserService(this.userRepository);
DonationService donationService = new DonationService(this.donationRepository, organizationRepository);
OrganizationService organizationService = new OrganizationService(organizationRepository);

this.controller = new MainController(userService, donationService, organizationService);

this.scene = controller.getMainView().getScene();
}

@Override
public void start(Stage stage) {
this.controller.showLoginPage();

stage.getIcons().add(new Image(getClass().getResource("/header/images/hmh-logo.png").toExternalForm()));
stage.setTitle("Help-Me-Help");
stage.setScene(this.scene);
stage.show();
}

@Override
public void stop() throws Exception {
super.stop();
this.logger.info("Application stopping");
this.dbWrapper.connect();
this.dbWrapper.exportUsers(this.userRepository.export());
this.dbWrapper.exportDonations(this.donationRepository.export());
this.dbWrapper.disconnect();
}

public static void main(String[] args) {
launch(args);
}
}
16 changes: 16 additions & 0 deletions src/main/java/edu/group5/app/control/BrowseCardController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package edu.group5.app.control;

import edu.group5.app.model.organization.Organization;

public class BrowseCardController {
private final MainController controller;

public BrowseCardController(MainController mainController) {
this.controller = mainController;
}

public void handleCardClick(Organization organization) {
controller.setCurrentOrganization(organization);
controller.showOrganizationPage();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package edu.group5.app.control;

public class BrowsePageController {
private final MainController controller;

public BrowsePageController(MainController mainController) {
this.controller = mainController;
}
}
28 changes: 28 additions & 0 deletions src/main/java/edu/group5/app/control/HeaderController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package edu.group5.app.control;

public class HeaderController {
private final MainController controller;

public HeaderController(MainController controller) {
this.controller = controller;
}

public void handleHomeBtn() {
System.out.println("Home button pressed");
controller.showHomePage();
}

public void handleCausesBtn() {
System.out.println("Causes button pressed");
controller.showBrowsePage();
}

public void handleAboutBtn() {
System.out.println("About button pressed");
}

public void handleProfileBtn() {
System.out.println("profileSection");
controller.showUserPage();
}
}
19 changes: 19 additions & 0 deletions src/main/java/edu/group5/app/control/HomePageController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package edu.group5.app.control;

public class HomePageController {
private final MainController controller;

public HomePageController(MainController controller) {
this.controller = controller;
}

public void handleDonateToACauseBtn() {
System.out.println("Donate to a cause button pressed");
controller.showBrowsePage();
}

public void handleAboutUsBtn() {
System.out.println("About us button pressed");
controller.showAboutUsPage();
}
}
44 changes: 44 additions & 0 deletions src/main/java/edu/group5/app/control/LoginPageController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package edu.group5.app.control;

import edu.group5.app.model.user.User;
import edu.group5.app.model.user.UserService;
import edu.group5.app.view.loginpage.LoginPageView;

public class LoginPageController {
private final MainController controller;
private final UserService userService;
private LoginPageView view;

public LoginPageController(MainController controller, UserService userService) {
this.controller = controller;
this.userService = userService;
}

public void setView(LoginPageView view) {
this.view = view;
}

public void handleLoginBtn() {
String email = view.getEmail();
char[] passwordChars = view.getPassword();

if (email == null || email.trim().isEmpty() || passwordChars == null || passwordChars.length == 0) {
view.showError("Email and password are required");
return;
}

User user = userService.login(email, passwordChars);

if (user != null) {
controller.setCurrentUser(user);
controller.showHomePage();
} else {
view.showError("Invalid email or password");
}
}

public void handleRegisterBtn() {
System.out.println("Sign in button pressed");
controller.showSignInPage();
}
}
Loading

0 comments on commit 16b02a1

Please sign in to comment.