diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index 964ee63..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 189b78c..7904ce4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,8 +1,5 @@
-
-
-
-
+
\ No newline at end of file
diff --git a/AccountInfo.csv b/AccountInfo.csv
index e69de29..27b1512 100644
Binary files a/AccountInfo.csv and b/AccountInfo.csv differ
diff --git a/Dishes.csv b/Dishes.csv
new file mode 100644
index 0000000..85b4f2b
--- /dev/null
+++ b/Dishes.csv
@@ -0,0 +1,8 @@
+Restaurant,Name,Rating,Description,Category,Price
+Quetzal,Sikil Pak,8,Pumpkin seed with roasted poblano and cotijia,Appetizer,23.00
+Quetzal,Newfoundland Scallops,7,In the shell with ramp butter and sea asparagus with morita chili,Entree,38.00
+Quetzal,Octopus,9,Salsa macha and corn miso butter with charred brussel sprout leaves,Entree,44.00
+Don Alfonso,Il Carpaccio,10,Ontario Wagyu beef tenderloin with Dijon mustard sauce and balsamic vinegar caviar,Entree,32.00
+Don Alfonso,L'Insalata Caprese,7,Cherry tomato and burrata D'Andria with arugala and oregano or pesto,Entree,28.00
+Alobar,East Coast Oysters,8,Citrus and tobasco,Entree,26.00
+Alobar,Chilled Lobster,9,Gem lettuce with lime aioli,Entree,40.00
\ No newline at end of file
diff --git a/Restaurant.csv b/Restaurant.csv
index 2e85c57..01fbd39 100644
--- a/Restaurant.csv
+++ b/Restaurant.csv
@@ -12,3 +12,5 @@ Quetzal,Mexican,419 College St,1
Shousin,Japanese,3328 Yonge St,1
Yukashi,Japanese,643A Mt Pleasant Rd,1
Sushi Masaki Saito,Japanese,88 Avenue Rd,2
+Olive garden,italian,college st,2,
+hello,a,a,3,
diff --git a/Reviews.csv b/Reviews.csv
index 39771ae..c597512 100644
Binary files a/Reviews.csv and b/Reviews.csv differ
diff --git a/accounts.csv b/accounts.csv
new file mode 100644
index 0000000..a3bdb9f
Binary files /dev/null and b/accounts.csv differ
diff --git a/bg.png b/bg.png
new file mode 100644
index 0000000..41860da
Binary files /dev/null and b/bg.png differ
diff --git a/src/main/java/APP_Business_Rules/DishMenu/DishDataAccess.java b/src/main/java/APP_Business_Rules/DishMenu/DishDataAccess.java
index 85bf1f1..911c291 100644
--- a/src/main/java/APP_Business_Rules/DishMenu/DishDataAccess.java
+++ b/src/main/java/APP_Business_Rules/DishMenu/DishDataAccess.java
@@ -5,5 +5,5 @@
public interface DishDataAccess {
boolean dishExistsByName(String identifier);
- HashMap>> getDish(String file);
+ List> getDish(String file);
}
\ No newline at end of file
diff --git a/src/main/java/APP_Business_Rules/DishMenu/DishFileReader.java b/src/main/java/APP_Business_Rules/DishMenu/DishFileReader.java
index 5b32eae..a531130 100644
--- a/src/main/java/APP_Business_Rules/DishMenu/DishFileReader.java
+++ b/src/main/java/APP_Business_Rules/DishMenu/DishFileReader.java
@@ -51,9 +51,10 @@ public HashMap>> createList() {
return dishes;
}
@Override
- public HashMap>> getDish(String file){
+ public List> getDish(String resName){
DishFileReader fileReader = new DishFileReader(file);
- return fileReader.createList();
+ HashMap>> allDishes = fileReader.createList();
+ return allDishes.get(resName);
}
@Override
diff --git a/src/main/java/APP_Business_Rules/MenuUseCase/MenuInputBoundary.java b/src/main/java/APP_Business_Rules/MenuUseCase/MenuInputBoundary.java
deleted file mode 100644
index d0c4bd7..0000000
--- a/src/main/java/APP_Business_Rules/MenuUseCase/MenuInputBoundary.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package APP_Business_Rules.MenuUseCase;
-
-public interface MenuInputBoundary {
- void generateMenu(MenuRequestModel menuRequestModel);
-}
diff --git a/src/main/java/APP_Business_Rules/MenuUseCase/MenuInteractor.java b/src/main/java/APP_Business_Rules/MenuUseCase/MenuInteractor.java
deleted file mode 100644
index ed905f4..0000000
--- a/src/main/java/APP_Business_Rules/MenuUseCase/MenuInteractor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package APP_Business_Rules.MenuUseCase;
-
-import APP_Business_Rules.DishMenu.DishDataAccess;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-public class MenuInteractor implements MenuInputBoundary {
- private DishDataAccess dataAccess;
- private MenuOutputBoundary outputBoundary;
-
- public MenuInteractor(DishDataAccess dataAccess, MenuOutputBoundary outputBoundary) {
- this.dataAccess = dataAccess;
- this.outputBoundary = outputBoundary;
- }
-
- @Override
- public void generateMenu(MenuRequestModel menuRequestModel) {
- HashMap>> data = dataAccess.getDish("src/main/java/Frameworks_and_Drivers/Dishes.csv");
- List> formattedData = new ArrayList<>();
- if (data.containsKey(menuRequestModel.getRestaurantName())) {
- formattedData = new ArrayList<>(dataAccess.getDish("src/main/java/Frameworks_and_Drivers/Dishes.csv").get(menuRequestModel.getRestaurantName()));
- }
- outputBoundary.update(new MenuResponseModel(formattedData));
- }
-}
diff --git a/src/main/java/APP_Business_Rules/MenuUseCase/MenuOutputBoundary.java b/src/main/java/APP_Business_Rules/MenuUseCase/MenuOutputBoundary.java
deleted file mode 100644
index ccf96bf..0000000
--- a/src/main/java/APP_Business_Rules/MenuUseCase/MenuOutputBoundary.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package APP_Business_Rules.MenuUseCase;
-
-public interface MenuOutputBoundary {
- void update(MenuResponseModel menuResponseModel);
-}
diff --git a/src/main/java/APP_Business_Rules/MenuUseCase/MenuRequestModel.java b/src/main/java/APP_Business_Rules/MenuUseCase/MenuRequestModel.java
deleted file mode 100644
index 54c6e3d..0000000
--- a/src/main/java/APP_Business_Rules/MenuUseCase/MenuRequestModel.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package APP_Business_Rules.MenuUseCase;
-
-public class MenuRequestModel {
- private String restaurantName;
-
- public MenuRequestModel(String restaurantName) {
- this.restaurantName = restaurantName;
- }
-
- public String getRestaurantName() {
- return restaurantName;
- }
-}
diff --git a/src/main/java/APP_Business_Rules/MenuUseCase/MenuResponseModel.java b/src/main/java/APP_Business_Rules/MenuUseCase/MenuResponseModel.java
deleted file mode 100644
index d242327..0000000
--- a/src/main/java/APP_Business_Rules/MenuUseCase/MenuResponseModel.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package APP_Business_Rules.MenuUseCase;
-
-import java.util.List;
-
-public class MenuResponseModel {
- private List> dishList;
-
- public MenuResponseModel(List> dishList) {
- this.dishList = dishList;
- }
-
- public List> getDishList() {
- return dishList;
- }
-}
diff --git a/src/main/java/APP_Business_Rules/OutputBoundary.java b/src/main/java/APP_Business_Rules/OutputBoundary.java
new file mode 100644
index 0000000..b67ee0b
--- /dev/null
+++ b/src/main/java/APP_Business_Rules/OutputBoundary.java
@@ -0,0 +1,10 @@
+package APP_Business_Rules;
+
+import APP_Business_Rules.SearchUseCase.SearchResponseModel;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public interface OutputBoundary {
+ void update(SearchResponseModel searchResponseModel);
+}
diff --git a/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantDataAccess.java b/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantDataAccess.java
index 93dc490..4c65c0b 100644
--- a/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantDataAccess.java
+++ b/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantDataAccess.java
@@ -10,7 +10,7 @@ public interface RestaurantDataAccess {
Passes Restaurant information from the file reader to the Restaurant interactor and screens
*/
boolean existsByName(String identifier);
- RestaurantGatewayModel loadRestaurant(RestaurantGatewayModel model);
+ RestaurantGatewayModel save(RestaurantGatewayModel model);
List> getRes();
}
diff --git a/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantFileReader.java b/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantFileReader.java
index 2c7e99a..138b731 100644
--- a/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantFileReader.java
+++ b/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantFileReader.java
@@ -58,7 +58,7 @@ public boolean existsByName(String identifier) {
return restaurants.equals(identifier);
}
@Override
- public RestaurantGatewayModel loadRestaurant(RestaurantGatewayModel model) {
+ public RestaurantGatewayModel save(RestaurantGatewayModel model) {
List restaurantInfo = new ArrayList<>();
String resName = model.getResName();
String resCategory = model.getResCategory();
@@ -75,8 +75,8 @@ public RestaurantGatewayModel loadRestaurant(RestaurantGatewayModel model) {
for (String x : restaurantInfo) {
output.append(x);
output.append(",");
- output.newLine();
}
+ output.newLine();
output.close();
diff --git a/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantInteractor.java b/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantInteractor.java
index 2399cb9..4272430 100644
--- a/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantInteractor.java
+++ b/src/main/java/APP_Business_Rules/RestaurantUseCase/RestaurantInteractor.java
@@ -21,9 +21,13 @@ public RestaurantResponseModel create(RestaurantRequestModel requestModel) {
requestModel.getResLocation(), requestModel.getStars());
RestaurantGatewayModel gatewayModel= new RestaurantGatewayModel(restaurant.getName(), restaurant.getResCategory(),
restaurant.getLocation(), restaurant.getStars());
- gateway.loadRestaurant(gatewayModel);
- RestaurantResponseModel restaurantResponseModel = new RestaurantResponseModel(gateway.loadRestaurant(gatewayModel));
+ RestaurantGatewayModel saved = gateway.save(gatewayModel);
+ RestaurantResponseModel restaurantResponseModel = new RestaurantResponseModel(saved);
return restaurantPresenter.prepareSuccessView(restaurantResponseModel);
}
+ public Restaurant getRes(RestaurantRequestModel requestModel){
+ return restaurantFactory.create(requestModel.getResName(), requestModel.getResCategory(),
+ requestModel.getResLocation(), requestModel.getStars());
+ }
}
diff --git a/src/main/java/APP_Business_Rules/SearchUseCase/SearchDishUseCase.java b/src/main/java/APP_Business_Rules/SearchUseCase/SearchDishUseCase.java
deleted file mode 100644
index 4e29488..0000000
--- a/src/main/java/APP_Business_Rules/SearchUseCase/SearchDishUseCase.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package APP_Business_Rules.SearchUseCase;
-
-import APP_Business_Rules.DishMenu.DishDataAccess;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-import static java.lang.Double.compare;
-import static java.lang.Integer.parseInt;
-
-public class SearchDishUseCase implements SearchInputBoundary{
- /**
- * Class that takes care of querying dishes and filtering out the ones that do not match the search
- * @param searchPresenter presenter that updates the UI with the restaurants that match the search
- * @param dataAccess class that reads the dish database
- */
- private SearchOutputBoundary searchPresenter;
- private DishDataAccess dataAccess;
-
- public SearchDishUseCase(SearchOutputBoundary searchPresenter, DishDataAccess dataAccess){
- this.searchPresenter = searchPresenter;
- this.dataAccess = dataAccess;
- }
-
- /**
- * Function that gets all the available dishes and keeps the ones that match the search then calls the presenter
- * to update the UI
- * @param searchRequestModel request model that contains all the information about the search
- */
- public void Search(SearchRequestModel searchRequestModel){
- List>> data = new ArrayList<>(dataAccess.getDish("src/main/java/Frameworks_and_Drivers/Dishes.csv").values()); //Might need to change the return type of accessData() to Arraylist