diff options
author | Tyler Ferrari <69283684+Sowgro@users.noreply.github.com> | 2025-02-26 17:20:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-26 17:20:11 -0500 |
commit | 9d832c1e96ca061b80b32abda472269bf7e0bbb7 (patch) | |
tree | 67ccc4c1f33b64d75c9cc7d57d05da3bc541bd26 /ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java | |
parent | 4c452d39214c42e2b0dc2a557b0c2ef1e3bcd9c0 (diff) | |
parent | da74d5c7e67b873dc8fdbfc672891eb63c0b8ea2 (diff) | |
download | JellySolutions-9d832c1e96ca061b80b32abda472269bf7e0bbb7.tar.gz JellySolutions-9d832c1e96ca061b80b32abda472269bf7e0bbb7.tar.bz2 JellySolutions-9d832c1e96ca061b80b32abda472269bf7e0bbb7.zip |
Merge pull request #7 from RIT-SWEN-261-02/user-functionality
Merge user-functionality into main
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 | 74 |
1 files changed, 74 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..d456abc --- /dev/null +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java @@ -0,0 +1,74 @@ +package com.ufund.api.ufundapi.persistence; + +import java.io.IOException; + +import com.ufund.api.ufundapi.model.User; + + +/** + * Defines the interface for User object persistence + * + * @author Team 2B Jelly Solutions + */ +public interface UserDAO { + /** + * Retrieves all {@linkplain User users} + * + * @return An array of {@link User user} objects, may be empty + * + * @throws IOException if an issue with underlying storage + */ + User[] getUsers() throws IOException; + + /** + * Retrieves a {@linkplain User user} with the given name + * + * @param id The ID of the {@link User user} to get + * + * @return a {@link User user} object with the matching name + * <br> + * null if no {@link User user} with a matching name is found + * + * @throws IOException if an issue with underlying storage + */ + User getUser(String name) throws IOException; + + /** + * Creates and saves a {@linkplain User user} + * + * @param user {@linkplain User user} object to be created and saved + * <br> + * The id of the user object is automatically incremented. + * + * @return new {@link User user} if successful, null otherwise + * + * @throws IOException if an issue with underlying storage + */ + User createUser(User user) throws IOException; + + /** + * Updates and saves a {@linkplain User user} + * + * @param newUser {@link User user} object to be updated and saved + * @param name {@link String name} name of object to be updated + * + * @return updated {@link User user} if successful, null if + * {@link User user} could not be found + * + * @throws IOException if underlying storage cannot be accessed + */ + User updateUser(User newUser, String name) throws IOException; + + /** + * Deletes a {@linkplain User user} with the given id + * + * @param id The id of the {@link User user} + * + * @return true if the {@link User user} was deleted + * <br> + * false if the user with the given id does not exist + * + * @throws IOException if underlying storage cannot be accessed + */ + boolean deleteUser(String name) throws IOException; +} |