Skip to content

Commit

Permalink
Merge pull request #81 from Group-5/docs/userrepo
Browse files Browse the repository at this point in the history
Docs/userrepo
  • Loading branch information
matheagj authored Apr 23, 2026
2 parents 6547b5b + 46addb5 commit 672ec96
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
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

0 comments on commit 672ec96

Please sign in to comment.