Skip to content

Docs/userrepo #81

Merged
merged 3 commits into from
Apr 23, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/main/java/edu/group5/app/model/user/UserRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@

import edu.group5.app.model.DBRepository;
import edu.group5.app.utils.ParameterValidator;

/**
* 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.
*/
public class UserRepository extends DBRepository<Integer, User> {
public final static String ROLE_CUSTOMER = "Customer";

Expand Down Expand Up @@ -69,6 +75,11 @@ public List<Object[]> export() {

}

/**
* Retrieves a copy of the current users in the repository.
* @return a HashMap containing the current users,
* where the key is the user ID and the value is the User object
*/
public HashMap<Integer, User> getUsers() {
return new HashMap<>(content);
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/edu/group5/app/model/wrapper/DbWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
import java.util.logging.Logger;

/**
* A class for wrapping the database.
* 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.
*/
public class DbWrapper {
protected Connection connection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import tools.jackson.databind.ObjectMapper;

/**
* A Class for Wrapping an API.
* A Class for Wrapping an API.
* It provides methods for importing data from the API and accessing the imported data.
*/
public class OrgApiWrapper extends Wrapper {
private Object[] data;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/edu/group5/app/model/wrapper/Wrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

/**
* 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.
*/
abstract class Wrapper {

Expand Down