aboutsummaryrefslogtreecommitdiff
path: root/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardDAO.java
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-02-16 11:05:59 -0500
committersowgro <tpoke.ferrari@gmail.com>2025-02-16 11:05:59 -0500
commitbe155cb28c8c5662a6dd9ce9268b06869087b4a0 (patch)
tree987aa467d7a298931bfe2ea363c8f8d2b186f5ca /ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardDAO.java
parenta2dbadb51d61cb8b16965ed895144050c1dc3c9a (diff)
downloadJellySolutions-be155cb28c8c5662a6dd9ce9268b06869087b4a0.tar.gz
JellySolutions-be155cb28c8c5662a6dd9ce9268b06869087b4a0.tar.bz2
JellySolutions-be155cb28c8c5662a6dd9ce9268b06869087b4a0.zip
Organize into sub-packages
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardDAO.java')
-rw-r--r--ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardDAO.java83
1 files changed, 83 insertions, 0 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardDAO.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardDAO.java
new file mode 100644
index 0000000..4b016fa
--- /dev/null
+++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardDAO.java
@@ -0,0 +1,83 @@
+package com.ufund.api.ufundapi.persistence;
+
+import com.ufund.api.ufundapi.model.Need;
+
+import java.io.IOException;
+
+/**
+ * Defines the interface for Need object persistence
+ *
+ * @author Team 2B Jelly Solutions
+ */
+public interface CupboardDAO {
+ /**
+ * 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[] getNeeds() throws IOException;
+
+ /**
+ * Finds all {@linkplain Need needs} whose name contains the given text
+ *
+ * @param containsText The text to match against
+ *
+ * @return An array of {@link Need needs} whose nemes contains the given text, may be empty
+ *
+ * @throws IOException if an issue with underlying storage
+ */
+ Need[] findNeeds(String targetName) throws IOException;
+
+ /**
+ * Retrieves a {@linkplain Need need} with the given name
+ *
+ * @param name The name 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 getNeed(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, false otherwise
+ *
+ * @throws IOException if an issue with underlying storage
+ */
+ Need createNeed(Need need) throws IOException;
+
+ /**
+ * Updates and saves a {@linkplain Need need}
+ *
+ * @param {@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 need with the given id does not exist
+ *
+ * @throws IOException if underlying storage cannot be accessed
+ */
+ boolean deleteNeed(int id) throws IOException;
+}