diff options
author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-02-23 15:51:28 -0500 |
---|---|---|
committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-02-23 15:51:28 -0500 |
commit | c7ac2db02a39cf349f9434186996c93eebc17a3c (patch) | |
tree | 704e126d459e147bb9b4d4064ed39b21db9d266a /ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java | |
parent | 1a46e367e2774bf31acd46bf088c29777c6c7f04 (diff) | |
download | JellySolutions-c7ac2db02a39cf349f9434186996c93eebc17a3c.tar.gz JellySolutions-c7ac2db02a39cf349f9434186996c93eebc17a3c.tar.bz2 JellySolutions-c7ac2db02a39cf349f9434186996c93eebc17a3c.zip |
Created UserDAO and file as well as user class
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java')
-rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java new file mode 100644 index 0000000..df797b9 --- /dev/null +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java @@ -0,0 +1,84 @@ +package com.ufund.api.ufundapi.persistence; + +import java.io.IOException; + +import com.ufund.api.ufundapi.model.Need; + +/** + * Defines the interface for Need object persistence + * + * @author Team 2B Jelly Solutions + */ +public interface UserDAO { + /** + * Retrieves all {@linkplain Need needs} + * + * @return An array of {@link Need need} objects, may be empty + * + * @throws IOException if an issue with underlying storage + */ + Need[] getUsers() throws IOException; + + /** + * Finds all {@linkplain Need needs} whose name contains the given text + * + * @param targetName The text to match against + * + * @return An array of {@link Need needs} whose names contains the given text, + * may be empty + * + * @throws IOException if an issue with underlying storage + */ + Need[] findUsers(String targetName) throws IOException; + + /** + * Retrieves a {@linkplain Need need} with the given name + * + * @param id The ID of the {@link Need need} to get + * + * @return a {@link Need need} object with the matching name + * <br> + * null if no {@link Need need} with a matching name is found + * + * @throws IOException if an issue with underlying storage + */ + Need getUser(int id) throws IOException; + + /** + * Creates and saves a {@linkplain Need need} + * + * @param need {@linkplain Need need} object to be created and saved + * <br> + * The id of the need object is automatically incremented. + * + * @return new {@link Need need} if successful, null otherwise + * + * @throws IOException if an issue with underlying storage + */ + Need createNeed(Need need) throws IOException; + + /** + * Updates and saves a {@linkplain Need need} + * + * @param need {@link Need need} object to be updated and saved + * + * @return updated {@link Need need} if successful, null if + * {@link Need need} could not be found + * + * @throws IOException if underlying storage cannot be accessed + */ + Need updateNeed(Need need) throws IOException; + + /** + * Deletes a {@linkplain Need need} with the given id + * + * @param id The id of the {@link Need need} + * + * @return true if the {@link Need need} was deleted + * <br> + * false if the need with the given id does not exist + * + * @throws IOException if underlying storage cannot be accessed + */ + boolean deleteNeed(int id) throws IOException; +} |