From 8268f5ee92372afb2f23045b25ec9bd45213f869 Mon Sep 17 00:00:00 2001 From: beanplebs Date: Sat, 15 Feb 2025 15:43:35 -0500 Subject: CupboardController CRUD methods --- .../com/ufund/api/ufundapi/CupboardController.java | 40 ++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'ufund-api/src') diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/CupboardController.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/CupboardController.java index 6b200d3..85f9933 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/CupboardController.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/CupboardController.java @@ -2,6 +2,42 @@ package com.ufund.api.ufundapi; import java.util.ArrayList; -public class Cupboard { - ArrayList needs; +public class CupboardController { + private ArrayList needs; + private Cupboard cupboard; + private CupboardDAO dao; + + public CupboardController(CupboardDAO dao) { + this.dao = dao; + } + + public void createNeed(String name, double max, Need.GoalType type) {; + cupboard.createNeed(name, max, type); + //dao.createNeed(need); + //implement in dao + } + + public Need[] getNeeds() { + return cupboard.getNeeds(); + //return dao.getNeeds(); + //implement in dao + } + + public Need getNeed(int index) { + return cupboard.getNeed(index); + //return dao.getNeed(); + //implement in dao + } + public void updateNeed(Need need) { + cupboard.updateNeed(need); + //dao.updateNeed(need); + //implement in dao + } + + public void deleteNeed(String name) { + cupboard.removeNeed(name); + //dao.removeNeed(name); + //implement in dao + } + } -- cgit v1.2.3