-
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 #26 from cathrkri/Develop
Developed three classes: Donations (no abstract classes, explained in #19), Feedback and Chairty based on v2 class diagram
- Loading branch information
Showing
22 changed files
with
233 additions
and
316 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,3 @@ | ||
| # Adrian | ||
| .vscode/ | ||
| .idea/ |
4 changes: 0 additions & 4 deletions
4
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/AnonymousDonation.java
This file was deleted.
Oops, something went wrong.
94 changes: 94 additions & 0 deletions
94
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/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 |
|---|---|---|
| @@ -1,4 +1,98 @@ | ||
| /** | ||
| * 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.List; | ||
| import java.util.UUID; | ||
| import java.util.ArrayList; | ||
|
|
||
| abstract 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; | ||
| } | ||
| } |
75 changes: 75 additions & 0 deletions
75
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/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 |
|---|---|---|
| @@ -1,4 +1,79 @@ | ||
| package ntnu.sytemutvikling.team6.models; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.UUID; | ||
|
|
||
| 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; | ||
|
|
||
|
|
||
| // ASSUMES that this is the way to get the anonymous setting from the user's settings. | ||
| if (donor.getSettings().getAnonymous() == false) { | ||
| this.isAnonymous = true; | ||
| } else { | ||
| this.isAnonymous = false; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| /* 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; | ||
| } | ||
| } |
61 changes: 61 additions & 0 deletions
61
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.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 |
|---|---|---|
| @@ -1,4 +1,65 @@ | ||
| package ntnu.sytemutvikling.team6.models; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.UUID; | ||
|
|
||
| public class Feedback { | ||
| /* Feedback id */ | ||
| private UUID feedbackId; | ||
|
|
||
| /** | ||
| * The author of the feedback | ||
| * If annonymous the presentation of the user will be "Anonymous". | ||
| */ | ||
| private User user; | ||
|
|
||
| /* The details of the feedback*/ | ||
| private String comment; | ||
|
|
||
| /* The date and time when the feedback was given */ | ||
| private LocalDateTime date; | ||
|
|
||
| /* Is the feedback given anonymously? */ | ||
| private boolean isAnonymous; | ||
|
|
||
| /** | ||
| * Constructor for creating a new feedback. | ||
| * | ||
| * @param user The user who gives the feedback. | ||
| * @param comment The content of the feedback. | ||
| */ | ||
| public Feedback(User user, String comment) { | ||
| this.feedbackId = UUID.randomUUID(); | ||
| this.user = user; | ||
| this.comment = comment; | ||
| this.date = LocalDateTime.now(); | ||
|
|
||
| // ASSUMES that this is the way to get the anonymous setting from the user's settings. | ||
| if (user.getSettings().getAnonymous() == false) { | ||
| this.isAnonymous = true; | ||
| } else { | ||
| this.isAnonymous = false; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Getters for the feedback's attributes. | ||
| * | ||
| * @return The feedback's attributes. | ||
| */ | ||
| public UUID getFeedbackId() { | ||
| return feedbackId; | ||
| } | ||
| public String getComment() { | ||
| return comment; | ||
| } | ||
| public LocalDateTime getDate() { | ||
| return date; | ||
| } | ||
| public User getUser() { | ||
| return user; | ||
| } | ||
| public boolean isAnonymous() { | ||
| return isAnonymous; | ||
| } | ||
| } |
5 changes: 0 additions & 5 deletions
5
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PublicDonation.java
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-568 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/Main.class
Binary file not shown.
Binary file removed
BIN
-539 Bytes
...mehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/AnonymousDonation.class
Binary file not shown.
Binary file removed
BIN
-312 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Charity.class
Binary file not shown.
Binary file removed
BIN
-315 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Donation.class
Binary file not shown.
Binary file removed
BIN
-339 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/DonationRegistry.class
Binary file not shown.
Binary file removed
BIN
-315 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class
Binary file not shown.
Binary file removed
BIN
-306 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Inbox.class
Binary file not shown.
Binary file removed
BIN
-530 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/PublicDonation.class
Binary file not shown.
Binary file removed
BIN
-315 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Settings.class
Binary file not shown.
Binary file removed
BIN
-303 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/User.class
Binary file not shown.
Binary file removed
BIN
-327 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/UserRegistry.class
Binary file not shown.
Binary file removed
BIN
-356 Bytes
...papplication/target/classes/ntnu/sytemutvikling/team6/service/AuthenticationService.class
Binary file not shown.
Binary file removed
BIN
-335 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/CharityService.class
Binary file not shown.
Binary file removed
BIN
-338 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/DonationService.class
Binary file not shown.
Binary file removed
BIN
-338 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/FeedbackService.class
Binary file not shown.
Oops, something went wrong.