Skip to content
Fredrik Jonathan Marjoni edited this page Apr 23, 2026 · 6 revisions

Appstate

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.

Repository

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.

DBRepository

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 donation

Package for donation related classes.

Consists of Donation, DonationRepository, DonationService.

Donation

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

DonationRepository

Repository class for Donation. Extends DBRepository and manages Donation entities.

DonationService

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 organisation

Package for organisation related class. Consists of Organization, OrganizationRepository, OrganizationScraper, OrganizationService

Organization

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

OrganizationRepository

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.

OrganizationScraper

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.

OrganizationService

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 user

Package for user-related classes. Consists of User, Customer, UserRepository, UserService

User

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

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

UserRepository

UserService

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 wrapper

Package for the organization page. Consists of OrganizationPageView.

DbWrapper

OrgApiWrapper

Wrapper