-
Notifications
You must be signed in to change notification settings - Fork 0
Model
AppState class represents the current state of the application, including:
- the current user
- the selected organization
- current donation amount
- current payment method
It serves as a centralized data store for the application's stateful information, allowing different components of the application to access and modify this information as needed.
Abstract base class for repositories. Repositories are responsible for managing collections of entities, providing basic operations for accessing and manipulating these entities. The specific type of entities and the underlying data structure are defined by subclasses.
Abstract base class for repositories that store their data in a database-related structure. Extends {@link Repository} and specifies that the content is stored as a {@link Map}.
Package for donation related classes.
Consists of Donation, DonationRepository, DonationService.
Represents a verified donation made by a user to an organization. Parameters: donationId - the unique ID of this donation userId - the ID of the user making the donation organizationId - the ID of the organization receiving the donation amount - the donation amount date - the timestamp when the donation was made paymentMethod - the payment method used
Repository class for Donation. Extends DBRepository and manages Donation entities.
DonationService class provides functionality for handling donations in the system. It interacts with the DonationRepository to manage donation records and the OrganizationRepository to validate organization information. The donate method allows a customer to make a donation to a specified organization, ensuring that the customer, organization, and donation amount are valid before processing the donation.
Package for organisation related class. Consists of Organization, OrganizationRepository, OrganizationScraper, OrganizationService
Represents an organization.
An organization is identified by an organization number, a name, trust status, website Url, pre-approval status, and a textual description, and a logo URL.
Instances are validated on creation:
- orgNumber must be non-negative
- name and websiteUrl must not be null or blank
- description must not be null
- logoUrl may be null if no logo is available
Repository class for managing Organization entities. It provides methods to retrieve trusted organizations, find organizations by their organization number or name, and initializes the repository with input data. The repository uses a HashMap to store Organization objects for efficient retrieval based on their organization number. Delegates web scraping to OrganizationScraper for separation of concerns.
Handles web scraping of organization information from Innsamlingskontrollen. Responsible for fetching logos and descriptions from organization pages. All results are cached to avoid redundant network requests.
Service class for managing organization-related operations. It interacts with the OrganizationRepository to retrieve organization information and contains business logic associated with organization management. It provides fetching logo URLs by delegating to OrganizationScraper. Fetched logo URLs are cached to avoid redundant network requests.
Package for user-related classes. Consists of User, Customer, UserRepository, UserService
User class represents a user in the system. It is an abstract class that will be extended by specific user types such as Donor, Recipient, and Admin. Each user has a unique userId, a role that defines their permissions in the system, and personal information such as first name, last name, email, and password hash. The constructor validates that all required fields are provided and throws an IllegalArgumentException if any of the fields are null or empty. This ensures that the User objects are always in a valid state when created. The class also includes a method to verify the user's password by comparing the provided plaintext password with the stored hashed password using BCrypt.
Customer class represents a customer in the system. It extends the User class and includes additional functionality specific to customers, such as managing their preferences for organizations. Each customer has a map of preferences that associates organization numbers with the corresponding Organization objects
Repository class for managing User entities. It provides methods to retrieve users, find users by their unique identifier or email address, and initializes the repository with input data. The repository uses a HashMap to store User objects for efficient retrieval based on their unique identifier.
Service class for managing user-related operations, such as registration and login. It interacts with the UserRepository to perform these operations and contains the business logic associated with user management, including validation of input data and handling of user authentication.
Package for the wrapper classes. Consists of Wrapper, DbWrapper, OrgApiWrapper
A class for wrapping the database. It provides methods for connecting and disconnecting to the database, importing and exporting users and donations, and handling SQL exceptions. The class uses a logger to log important events and exceptions that occur during database operations.
A Class for Wrapping an API. It provides methods for importing data from the API and accessing the imported data.
An abstract class for all Wrappers of datasets. This class defines the structure for dataset wrappers, which are responsible for importing data from various sources and providing access to the imported data. Each wrapper must implement the importData method to handle the specific data import logic and the getData method to return the imported data in a suitable format.
📘 Project Wiki
Last updated: April 2026
Maintained by (BIDATA) Team 5 in the course IDATT1005