aboutsummaryrefslogtreecommitdiff
path: root/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDao.java
diff options
context:
space:
mode:
authorGunther6070 <haydenhartman10@yahoo.com>2025-03-06 12:45:35 -0500
committerGunther6070 <haydenhartman10@yahoo.com>2025-03-06 12:45:35 -0500
commit4cfacd63b1552bf6ea33e28f3f66e11b75e5756a (patch)
tree0e09c0204373a94ec0d0e9ca6b61e0344a79fbd3 /ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDao.java
parent3f015edcf2d03da4b1bbd9c81bbcb3a914428140 (diff)
downloadJellySolutions-4cfacd63b1552bf6ea33e28f3f66e11b75e5756a.tar.gz
JellySolutions-4cfacd63b1552bf6ea33e28f3f66e11b75e5756a.tar.bz2
JellySolutions-4cfacd63b1552bf6ea33e28f3f66e11b75e5756a.zip
Created Cupboard Service and refactored the controller and DAO to add the service as an inbetween with logic
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDao.java')
-rw-r--r--ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDao.java21
1 files changed, 1 insertions, 20 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDao.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDao.java
index 81ee7c0..84ea693 100644
--- a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDao.java
+++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDao.java
@@ -61,18 +61,6 @@ public class CupboardFileDao implements CupboardDAO {
}
/**
- * Returns an array of needs filtered by a search
- *
- * @param search The search substring
- * @return The requested array
- */
- private Need[] getNeedsArray(String search) {
- return needs.values().stream()
- .filter(i -> i.getName().toLowerCase().contains(search.toLowerCase()))
- .toArray(Need[]::new);
- }
-
- /**
* Saves the needs to json
*
* @return True if the save was successful, false otherwise
@@ -93,13 +81,6 @@ public class CupboardFileDao implements CupboardDAO {
}
@Override
- public Need[] findNeeds(String targetName) {
- synchronized (needs) {
- return getNeedsArray(targetName);
- }
- }
-
- @Override
public Need getNeed(int id) {
synchronized (needs) {
return needs.getOrDefault(id, null);
@@ -107,7 +88,7 @@ public class CupboardFileDao implements CupboardDAO {
}
@Override
- public Need createNeed(Need need) throws IOException {
+ public Need addNeed(Need need) throws IOException {
synchronized (needs) {
Need newNeed = new Need(need);
newNeed.setID(nextId());