diff --git a/src/main/java/edu/group5/app/model/user/UserRepository.java b/src/main/java/edu/group5/app/model/user/UserRepository.java index ea63bb8..aec3e9d 100644 --- a/src/main/java/edu/group5/app/model/user/UserRepository.java +++ b/src/main/java/edu/group5/app/model/user/UserRepository.java @@ -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 { public final static String ROLE_CUSTOMER = "Customer"; @@ -69,6 +75,11 @@ public List 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 getUsers() { return new HashMap<>(content); } diff --git a/src/main/java/edu/group5/app/model/wrapper/DbWrapper.java b/src/main/java/edu/group5/app/model/wrapper/DbWrapper.java index 3325b8c..d0239ae 100644 --- a/src/main/java/edu/group5/app/model/wrapper/DbWrapper.java +++ b/src/main/java/edu/group5/app/model/wrapper/DbWrapper.java @@ -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; diff --git a/src/main/java/edu/group5/app/model/wrapper/OrgApiWrapper.java b/src/main/java/edu/group5/app/model/wrapper/OrgApiWrapper.java index 2a493e4..d2ebb1a 100644 --- a/src/main/java/edu/group5/app/model/wrapper/OrgApiWrapper.java +++ b/src/main/java/edu/group5/app/model/wrapper/OrgApiWrapper.java @@ -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; diff --git a/src/main/java/edu/group5/app/model/wrapper/Wrapper.java b/src/main/java/edu/group5/app/model/wrapper/Wrapper.java index 85d8dc8..cc54c29 100644 --- a/src/main/java/edu/group5/app/model/wrapper/Wrapper.java +++ b/src/main/java/edu/group5/app/model/wrapper/Wrapper.java @@ -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 {