diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f28f5be --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Adrian +.vscode/ +.idea/ diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/AnonymousDonation.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/AnonymousDonation.java deleted file mode 100644 index 6f991e9..0000000 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/AnonymousDonation.java +++ /dev/null @@ -1,4 +0,0 @@ -package ntnu.sytemutvikling.team6.models; - -public class AnonymousDonation extends Donation { -} diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java index 92ebbf1..4a389f4 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java @@ -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 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; + } } diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java index 1f457bd..78569b2 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java @@ -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; + } } diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java index 1cea4ca..891dce1 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java @@ -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; + } } diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PublicDonation.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PublicDonation.java deleted file mode 100644 index 7da3000..0000000 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PublicDonation.java +++ /dev/null @@ -1,5 +0,0 @@ -package ntnu.sytemutvikling.team6.models; - -public class PublicDonation extends Donation { - -} diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/Main.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/Main.class deleted file mode 100644 index 9e9f2a3..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/Main.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/AnonymousDonation.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/AnonymousDonation.class deleted file mode 100644 index b00998e..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/AnonymousDonation.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Charity.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Charity.class deleted file mode 100644 index 42f6e49..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Charity.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Donation.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Donation.class deleted file mode 100644 index 17aeae8..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Donation.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/DonationRegistry.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/DonationRegistry.class deleted file mode 100644 index 3974903..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/DonationRegistry.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class deleted file mode 100644 index 5dfb005..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Inbox.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Inbox.class deleted file mode 100644 index 7b4a306..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Inbox.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/PublicDonation.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/PublicDonation.class deleted file mode 100644 index 7ce5786..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/PublicDonation.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Settings.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Settings.class deleted file mode 100644 index 38f482a..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Settings.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/User.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/User.class deleted file mode 100644 index 7623153..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/User.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/UserRegistry.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/UserRegistry.class deleted file mode 100644 index 970aced..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/UserRegistry.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/AuthenticationService.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/AuthenticationService.class deleted file mode 100644 index 559ce48..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/AuthenticationService.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/CharityService.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/CharityService.class deleted file mode 100644 index c52d762..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/CharityService.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/DonationService.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/DonationService.class deleted file mode 100644 index 86d2996..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/DonationService.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/FeedbackService.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/FeedbackService.class deleted file mode 100644 index 4b0e587..0000000 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/FeedbackService.class and /dev/null differ diff --git a/helpmehelpapplication/target/classes/tempClassDiagram.puml b/helpmehelpapplication/target/classes/tempClassDiagram.puml deleted file mode 100644 index c32ad2a..0000000 --- a/helpmehelpapplication/target/classes/tempClassDiagram.puml +++ /dev/null @@ -1,307 +0,0 @@ -@startuml - - - -' ========================= - -' DOMAIN LAYER - -' ========================= - - - -package "Domain Layer" { - - - -class User { - - - idNext : static int - - - id : int - - - name : String - - - email : String - - - passwordHash : String - - - role : String - - - settings : Settings - - - inbox : Inbox - - - - + getUserId() : int - - + setUserId(id : int) - - + getUserName() : String - - + setUserName(name : String) - - + getUserEmail() : String - - + setUserEmail(email : String) - - + getUserPasswordHash() : String - - + setUserPasswordHash(passwordHash : String) - - + getUserRole() : String - - + setUserRole(role : String) - -} - - - -class Settings { - - - lightmode : boolean - - - language : String - - - anonymous : boolean - - - - + getSettings() : String - -} - - - -class Inbox { - - - messages : ArrayList - - - - + getMessages() : ArrayList - - + addMessage(message : Message) - - + removeMessage(message : Message) - -} - - - -class Message { - - - title : String - - - from : Charity - - - date : LocalDateTime - - - - + getTitle() : String - - + getFrom() : Charity - - + getDate() : LocalDateTime - -} - - - -class Charity { - - - idNext : static int - - - id : int - - - name : String - - - description : String - - - totalDonations : double - - - verified : boolean - - - category : String - - - - + getCharityId() : int - - + setCharityId(id : int) - - + getCharityName() : String - - + setCharityName(name : String) - - + getCharityDescription() : String - - + setCharityDescription(description : String) - - + getCharityTotalDonations() : double - - + setCharityTotalDonations(totalDonations : double) - -} - - - -abstract class Donation { - - - idNext : static int - - - id : int - - - amount : double - - - date : LocalDateTime - - - charity : Charity - - - user : User - - - - + getDonationId() : int - - + setDonationId(id : int) - - + getDonationAmount() : double - - + setDonationAmount(amount : double) - - + getDonationDate() : LocalDateTime - - + setDonationDate(date : LocalDateTime) - - + getDonorInfo() : String - -} - - - -class AnonymousDonation { - - - comment : String - -} - - - -class PublicDonation { - - - comment : String - -} - - - -class Feedback { - - - id : int - - - message : String - - - date : LocalDateTime - - - charityId : int - - - - + getId() : int - - + setId(id : int) - - + getMessage() : String - - + setMessage(message : String) - - + getDate() : LocalDateTime - - + setDate(date : LocalDateTime) - -} - - - -class UserRegistry { - - - users : List - - + addUser(user : User) - - + removeUser(user : User) - - + getUserById(id : int) : User - - + getAllUsers() : List - -} - - - -class CharityRegistry { - - - charities : List - - + addCharity(charity : Charity) - - + removeCharity(charity : Charity) - - + getCharityById(id : int) : Charity - - + getAllCharities() : List - -} - - - -class DonationRegistry { - - - donations : List - - + addDonation(donation : Donation) - - + removeDonation(donation : Donation) - - + getDonationById(id : int) : Donation - - + getAllDonations() : List - -} - - - -' Associations - -User "1" -- "0..*" Donation - -Charity "1" -- "0..*" Donation - - - -User "1" -- "0..*" Feedback - -Charity "1" -- "0..*" Feedback - - - -Donation <|-- AnonymousDonation - -Donation <|-- PublicDonation - - - -User "1" *-- "1" Settings - -User "1" *-- "1" Inbox - -Inbox "1" -- "0..*" Message - -Message "1" --> "1" Charity - - - -} \ No newline at end of file