diff --git a/src/main/java/database.txt b/src/main/java/database.txt index e69de29..05b2935 100644 --- a/src/main/java/database.txt +++ b/src/main/java/database.txt @@ -0,0 +1 @@ +{"allUsers":{"admin1":{"personalInfo":"{\"username\":\"a\",\"firstName\":\"a\",\"lastName\":\"a\",\"emailAddress\":\"a@a.com\",\"phoneNumber\":\"11111\",\"password\":\"a\"}"}},"requestedSellers":{"seller2":{"personalInfo":"{\"username\":\"s\",\"firstName\":\"s\",\"lastName\":\"s\",\"emailAddress\":\"s@s.com\",\"phoneNumber\":\"11111\",\"password\":\"s\"}","listOfOffs":"[]","balance":"0","listOfSellLogs":"[]","availableProducts":"{}","company":"c"}},"allCodedDiscounts":{},"allCategories":{},"mainCategories":{},"allProducts":{},"allLogs":{},"allOffs":{},"allRequests":{"seller register1":{"seller":"seller2","fieldsAndValues":"null","id":"seller register1","requestStatus":"null"}},"allProductSellInfos":{},"allRates":{},"allCompanies":[],"idKeeper":{"usersNewId":2,"codedDiscountsNewId":0,"categoriesNewId":0,"productsNewId":0,"logsNewId":0,"offsNewId":0,"requestsNewId":1,"productSellInfosNewId":0,"ratesNewId":0}} \ No newline at end of file diff --git a/src/main/java/model/MarketCopier.java b/src/main/java/model/MarketCopier.java index 014ceb0..ca14390 100644 --- a/src/main/java/model/MarketCopier.java +++ b/src/main/java/model/MarketCopier.java @@ -22,14 +22,14 @@ public class MarketCopier { // copies and rebuilds market private static MarketCopier instance = new MarketCopier(); private static Market market = Market.getInstance(); private HashMap> allUsers;// configure type by Id - private HashMap requestedSellers; + private HashMap> requestedSellers; private HashMap allCodedDiscounts; private HashMap> allCategories; // configure type by Id private HashMap mainCategories; // be made from allCategories private HashMap allProducts; private HashMap allLogs; private HashMap allOffs; - private HashMap allRequests; // configure type by Id + private HashMap> allRequests; // configure type by Id private HashMap allProductSellInfos; // add news to it private HashMap allRates; private ArrayList allCompanies; @@ -67,9 +67,9 @@ public void copyMarket() { allCategories = buildIdToObjectHashMapHashMap(market.getAllCategories()); // mainCategories = buildIdToObjectHashMapHashMap(market.getMainCategories()); // allProducts = buildIdToObjectHashMapHashMap(market.getAllProducts()); -// allRequests = buildIdToObjectHashMapHashMap(market.getAllRequests()); + allRequests = buildIdToObjectHashMapHashMap(market.getAllRequests()); // allProductSellInfos = buildIdToObjectHashMapHashMap(market.getAllProductSellInfos()); -// requestedSellers = buildIdToObjectHashMapHashMap(market.getRequestedSellers()); + requestedSellers = buildIdToObjectHashMapHashMap(market.getRequestedSellers()); // allRates = buildIdToObjectHashMapHashMap(market.getAllRates()); // allCompanies = market.getAllCompanies(); } @@ -90,9 +90,9 @@ public void buildMarketWithIds() { market.setAllCategories(buildArrayListOfPrimaryCategories(allCategories.keySet())); // market.setMainCategories(buildArrayListOfPrimaryCategories(mainCategories.keySet())); // market.setAllProducts(buildArrayListOfPrimaryObjects(Product.class, allProducts.keySet())); -// market.setAllRequests(buildArrayListOfPrimaryRequests(allRequests.keySet())); + market.setAllRequests(buildArrayListOfPrimaryRequests(allRequests.keySet())); // market.setAllProductSellInfos(buildArrayListOfPrimaryObjects(ProductSellInfo.class, allProductSellInfos.keySet())); -// market.setRequestedSellers(buildArrayListOfPrimaryObjects(Seller.class, requestedSellers.keySet())); + market.setRequestedSellers(buildArrayListOfPrimaryObjects(Seller.class, requestedSellers.keySet())); // market.setAllRates(buildArrayListOfPrimaryObjects(Rate.class, allRates.keySet())); // market.setAllCompanies(allCompanies); // IdKeeper.setInstance(idKeeper); @@ -174,14 +174,14 @@ private ArrayList buildArrayListOfPrimaryRequests(Set set) { public void buildMarketWithHashMaps() { buildUsersWithHashMaps(); -// buildRequestedSellersWithHashMaps(); + buildRequestedSellersWithHashMaps(); // buildDiscountsWithHashMaps(); buildCategoriesWithHashMaps(); // buildMainCategoriesWithHashMaps(); // buildProductsWithHashMaps(); // buildLogsWithHashMaps(); // buildOffsWithHashMaps(); -// buildRequestsWithHashMaps(); + buildRequestsWithHashMaps(); // buildProductSellInfosWithHashMaps(); // buildRatesWithHashMaps(); } @@ -245,7 +245,7 @@ private void buildOffsWithHashMaps() { private void buildRequestsWithHashMaps() { for (String id : allRequests.keySet()) { Request request = Market.getInstance().getRequestById(id); -// request.setFieldsFromHashMap(allRequests.get(id)); + request.setFieldsFromHashMap(allRequests.get(id)); } } diff --git a/src/main/java/model/user/Seller.java b/src/main/java/model/user/Seller.java index d4d7efc..8ce6341 100644 --- a/src/main/java/model/user/Seller.java +++ b/src/main/java/model/user/Seller.java @@ -138,7 +138,7 @@ public void setFieldsFromHashMap(HashMap theMap) { // } availableProducts = new HashMap<>(); - HashMap products = (new Gson()).fromJson(theMap.get("availableProducts"), new TypeToken>(){}.getType()); + HashMap products = (new Gson()).fromJson(theMap.get("availableProducts"), new TypeToken>(){}.getType()); for (String productId : products.keySet()) { availableProducts.put(Market.getInstance().getProductById(productId), Market.getInstance().getProductSellInfoById(products.get(productId))); diff --git a/src/main/java/view/userMenus/adminMenus/RequestsManagingMenu.java b/src/main/java/view/userMenus/adminMenus/RequestsManagingMenu.java index ea9792a..1845784 100644 --- a/src/main/java/view/userMenus/adminMenus/RequestsManagingMenu.java +++ b/src/main/java/view/userMenus/adminMenus/RequestsManagingMenu.java @@ -14,8 +14,8 @@ public RequestsManagingMenu() { super("requests managing menu"); this.manager = RequestController.getInstance(); this.managingObject = "Requests"; - submenus.put("details (\\S+)", createOneItemDisplayPanel("request", (Printer) manager)); - submenus.put("(accept|decline) (\\S+)", getAcceptDeclinePanel()); + submenus.put("details (.+)", createOneItemDisplayPanel("request", (Printer) manager)); + submenus.put("(accept|decline) (.+)", getAcceptDeclinePanel()); } private Panel getAcceptDeclinePanel(){