-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from cathrkri/feature/javafx-frontpage
Feature/javafx frontpage
- Loading branch information
Showing
73 changed files
with
1,613 additions
and
926 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: ci | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: self-hosted | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: "25" | ||
| cache: maven | ||
|
|
||
| - working-directory: helpmehelpapplication | ||
| run: mvn -B test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created | ||
| # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path | ||
|
|
||
| name: Maven Package | ||
|
|
||
| on: | ||
| release: | ||
| types: [created] | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| runs-on: [ self-hosted ] | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up JDK 11 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '11' | ||
| distribution: 'temurin' | ||
| server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | ||
| settings-path: ${{ github.workspace }} # location for the settings.xml file | ||
|
|
||
| - name: Build with Maven | ||
| run: mvn -B package --file pom.xml | ||
|
|
||
| - name: Publish to GitHub Packages Apache Maven | ||
| run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: ci | ||
|
|
||
| on: | ||
| push: | ||
| branches: main | ||
| pull_request: | ||
| branches: main | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| distribition: temurin | ||
| java-version: "25" | ||
| cache: maven | ||
| - run: | ||
| mvn -B test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| .idea/ | ||
| target/ |
7 changes: 7 additions & 0 deletions
7
helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package ntnu.sytemutvikling.team6; | ||
|
|
||
| public class Main { | ||
| public static void main(String[] args) { | ||
| System.out.println("Hello world!"); | ||
| } | ||
| } |
95 changes: 95 additions & 0 deletions
95
helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/models/Charity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| /** | ||
| * This class represents a charity organization. It contains information about the charity such as | ||
| * its name, description, total donations, verification status, and category. | ||
| * | ||
| * @author Adrian Balunan | ||
| */ | ||
| package ntnu.sytemutvikling.team6.models; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.UUID; | ||
|
|
||
| public class Charity { | ||
| /* UUID for uniquely identifying each charity */ | ||
| private UUID id; | ||
|
|
||
| /* Name of the charity */ | ||
| private String name; | ||
|
|
||
| /* Description of the charity's mission and activities */ | ||
| private String description; | ||
|
|
||
| /* Total Donations received */ | ||
| private int totalDonations; | ||
|
|
||
| /* Is the charity verified? */ | ||
| private boolean isVerified; | ||
|
|
||
| /* Category for the charity */ | ||
| private String category; | ||
|
|
||
| /* List that contains the charity's Feedbacks */ | ||
| private List<Feedback> feedbacks; | ||
|
|
||
| /** | ||
| * Konstructor for creating a new charity. The ID is generated automatically using UUID. Total | ||
| * donations are initialized to 0. The charity is unverified by default. | ||
| * | ||
| * @param name | ||
| * @param description | ||
| * @param category | ||
| */ | ||
| public Charity(String name, String description, String category) { | ||
| this.id = UUID.randomUUID(); | ||
| this.name = name; | ||
| this.description = description; | ||
| this.totalDonations = 0; | ||
| this.isVerified = false; | ||
| this.feedbacks = new ArrayList<>(); | ||
| this.category = category; | ||
| } | ||
|
|
||
| /** Getters for the charity's attributes. */ | ||
| public UUID getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public String getCategory() { | ||
| return category; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public String getDescription() { | ||
| return description; | ||
| } | ||
|
|
||
| public int getTotalDonations() { | ||
| return totalDonations; | ||
| } | ||
|
|
||
| public boolean isVerified() { | ||
| return isVerified; | ||
| } | ||
|
|
||
| /** Setter for verification status. This one sets the charity as verified. */ | ||
| public void setVerified() { | ||
| this.isVerified = true; | ||
| } | ||
|
|
||
| /** Setter for verification status. This one sets the charity as unverified. */ | ||
| public void setUnverified() { | ||
| this.isVerified = false; | ||
| } | ||
|
|
||
| /** | ||
| * Setter for total donations. This method is used to update the total donations when a new | ||
| * donation is made. | ||
| */ | ||
| public void setTotalDonations(int amount) { | ||
| this.totalDonations += amount; | ||
| } | ||
| } |
36 changes: 36 additions & 0 deletions
36
helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/models/CharityRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package ntnu.sytemutvikling.team6.models; | ||
|
|
||
| import java.util.*; | ||
|
|
||
| public class CharityRegistry { | ||
| private final List<Charity> charities; | ||
|
|
||
| public CharityRegistry() { | ||
| this.charities = new ArrayList<>(); | ||
| } | ||
|
|
||
| public List<Charity> getAllCharities() { | ||
| return Collections.unmodifiableList(charities); | ||
| } | ||
|
|
||
| public Optional<Charity> findCharityById(UUID charityId) { | ||
| if (charityId == null) { | ||
| throw new IllegalArgumentException("CharityId can not be null."); | ||
| } | ||
| return charities.stream().filter(charity -> charityId.equals(charity.getId())).findFirst(); | ||
| } | ||
|
|
||
| public void addCharity(Charity charity) { | ||
| if (charity == null) { | ||
| throw new IllegalArgumentException("Charity can not be null."); | ||
| } | ||
| charities.add(charity); | ||
| } | ||
|
|
||
| public boolean removeCharity(UUID charityId) { | ||
| if (charityId == null) { | ||
| throw new IllegalArgumentException("CharityId can not be null."); | ||
| } | ||
| return charities.removeIf(charity -> charityId.equals(charity.getId())); | ||
| } | ||
| } |
68 changes: 68 additions & 0 deletions
68
helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/models/Donation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| package ntnu.sytemutvikling.team6.models; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.UUID; | ||
| import ntnu.sytemutvikling.team6.models.user.User; | ||
|
|
||
| public class Donation { | ||
| /* UUID for uniquely identifying each donation */ | ||
| private UUID charityId; | ||
|
|
||
| /* Ammount of money donated */ | ||
| private double amount; | ||
|
|
||
| /* Date and time of the donation */ | ||
| private LocalDateTime date; | ||
|
|
||
| /* The charity that received the donation */ | ||
| private Charity charity; | ||
|
|
||
| /* The user/donor that made the donation */ | ||
| private User donor; | ||
|
|
||
| /** Is the donation made anonymously? This can be null if the donation was made anonymously. */ | ||
| private boolean isAnonymous; | ||
|
|
||
| /** | ||
| * Constructor for creating a new donation. The charityId is generated automatically using UUID. | ||
| * If the donation is made anonymously, the isAnonymous parameter is set to true. | ||
| * | ||
| * @param amount | ||
| * @param date | ||
| * @param charity | ||
| * @param donor | ||
| */ | ||
| public Donation(double amount, LocalDateTime date, Charity charity, User donor) { | ||
| this.charityId = UUID.randomUUID(); | ||
| this.amount = amount; | ||
| this.date = date; | ||
| this.charity = charity; | ||
| this.donor = donor; | ||
| this.isAnonymous = donor.getSettings().isAnonymous(); | ||
| } | ||
|
|
||
| /* Getters for the donation's attributes */ | ||
| public boolean isAnonymous() { | ||
| return isAnonymous; | ||
| } | ||
|
|
||
| public UUID getCharityId() { | ||
| return charityId; | ||
| } | ||
|
|
||
| public double getAmount() { | ||
| return amount; | ||
| } | ||
|
|
||
| public LocalDateTime getDate() { | ||
| return date; | ||
| } | ||
|
|
||
| public Charity getCharity() { | ||
| return charity; | ||
| } | ||
|
|
||
| public User getDonor() { | ||
| return donor; | ||
| } | ||
| } |
38 changes: 38 additions & 0 deletions
38
helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/models/DonationRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package ntnu.sytemutvikling.team6.models; | ||
|
|
||
| import java.util.*; | ||
|
|
||
| public class DonationRegistry { | ||
| private final List<Donation> donations; | ||
|
|
||
| public DonationRegistry() { | ||
| this.donations = new ArrayList<>(); | ||
| } | ||
|
|
||
| public List<Donation> getAllDonations() { | ||
| return Collections.unmodifiableList(donations); | ||
| } | ||
|
|
||
| public Optional<Donation> findDonationById(UUID donationId) { | ||
| if (donationId == null) { | ||
| throw new IllegalArgumentException("DonationId can not be null."); | ||
| } | ||
| return donations.stream() | ||
| .filter(donations -> donationId.equals(donations.getCharityId())) | ||
| .findFirst(); | ||
| } | ||
|
|
||
| public void addDonation(Donation donation) { | ||
| if (donation == null) { | ||
| throw new IllegalArgumentException("Donation can not be null."); | ||
| } | ||
| donations.add(donation); | ||
| } | ||
|
|
||
| public boolean removeDonation(UUID donationId) { | ||
| if (donationId == null) { | ||
| throw new IllegalArgumentException("DonationId can not be null."); | ||
| } | ||
| return donations.removeIf(donation -> donationId.equals(donation.getCharityId())); | ||
| } | ||
| } |
Oops, something went wrong.