From cb8c2889c3377311a9dd564cb15016f3e1cdd6e8 Mon Sep 17 00:00:00 2001 From: nedaei79 Date: Wed, 3 Jun 2020 07:23:18 +0430 Subject: [PATCH] file reading and writing - uncommenting MarketCopier. --- src/main/java/model/MarketCopier.java | 74 +++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/main/java/model/MarketCopier.java b/src/main/java/model/MarketCopier.java index 2c330dd..8737ac8 100644 --- a/src/main/java/model/MarketCopier.java +++ b/src/main/java/model/MarketCopier.java @@ -20,18 +20,18 @@ public class MarketCopier { private static MarketCopier instance = new MarketCopier(); - private static Market market = Market.getInstance(); + private static final Market market = Market.getInstance(); private HashMap> allUsers; private HashMap> requestedSellers; - private HashMap allCodedDiscounts; + private HashMap> allCodedDiscounts; private HashMap> allCategories; - private HashMap mainCategories; - private HashMap allProducts; - private HashMap allLogs; - private HashMap allOffs; + private HashMap> mainCategories; + private HashMap> allProducts; + private HashMap> allLogs; + private HashMap> allOffs; private HashMap> allRequests; - private HashMap allProductSellInfos; - private HashMap allRates; + private HashMap> allProductSellInfos; + private HashMap> allRates; private ArrayList allCompanies; private IdKeeper idKeeper; @@ -60,18 +60,18 @@ public static void setInstance(MarketCopier instance) { } public void copyMarket() { -// allLogs = buildIdToObjectHashMapHashMap(market.getAllLogs()); -// allOffs = buildIdToObjectHashMapHashMap(market.getAllOffs()); + allLogs = buildIdToObjectHashMapHashMap(market.getAllLogs()); + allOffs = buildIdToObjectHashMapHashMap(market.getAllOffs()); allUsers = buildIdToObjectHashMapHashMap(market.getAllUsers()); -// allCodedDiscounts = buildIdToObjectHashMapHashMap(market.getAllCodedDiscounts()); + allCodedDiscounts = buildIdToObjectHashMapHashMap(market.getAllCodedDiscounts()); allCategories = buildIdToObjectHashMapHashMap(market.getAllCategories()); -// mainCategories = buildIdToObjectHashMapHashMap(market.getMainCategories()); -// allProducts = buildIdToObjectHashMapHashMap(market.getAllProducts()); + mainCategories = buildIdToObjectHashMapHashMap(market.getMainCategories()); + allProducts = buildIdToObjectHashMapHashMap(market.getAllProducts()); allRequests = buildIdToObjectHashMapHashMap(market.getAllRequests()); -// allProductSellInfos = buildIdToObjectHashMapHashMap(market.getAllProductSellInfos()); + allProductSellInfos = buildIdToObjectHashMapHashMap(market.getAllProductSellInfos()); requestedSellers = buildIdToObjectHashMapHashMap(market.getRequestedSellers()); -// allRates = buildIdToObjectHashMapHashMap(market.getAllRates()); -// allCompanies = market.getAllCompanies(); + allRates = buildIdToObjectHashMapHashMap(market.getAllRates()); + allCompanies = market.getAllCompanies(); } private HashMap> buildIdToObjectHashMapHashMap(ArrayList objects) { @@ -83,19 +83,19 @@ private HashMap ArrayList buildArrayListOfPrimaryObjects(Class typeClass, Set set) { @@ -175,15 +175,15 @@ private ArrayList buildArrayListOfPrimaryRequests(Set set) { public void buildMarketWithHashMaps() { buildUsersWithHashMaps(); buildRequestedSellersWithHashMaps(); -// buildDiscountsWithHashMaps(); + buildDiscountsWithHashMaps(); buildCategoriesWithHashMaps(); -// buildMainCategoriesWithHashMaps(); -// buildProductsWithHashMaps(); -// buildLogsWithHashMaps(); -// buildOffsWithHashMaps(); + buildMainCategoriesWithHashMaps(); + buildProductsWithHashMaps(); + buildLogsWithHashMaps(); + buildOffsWithHashMaps(); buildRequestsWithHashMaps(); -// buildProductSellInfosWithHashMaps(); -// buildRatesWithHashMaps(); + buildProductSellInfosWithHashMaps(); + buildRatesWithHashMaps(); } private void buildUsersWithHashMaps() { @@ -203,7 +203,7 @@ private void buildRequestedSellersWithHashMaps() { private void buildDiscountsWithHashMaps() { for (String id : allCodedDiscounts.keySet()) { CodedDiscount discount = Market.getInstance().getCodedDiscountById(id); -// discount.setFieldsFromHashMap(allCodedDiscounts.get(id)); + discount.setFieldsFromHashMap(allCodedDiscounts.get(id)); } } @@ -231,14 +231,14 @@ private void buildProductsWithHashMaps() { private void buildLogsWithHashMaps() { for (String id : allLogs.keySet()) { Log log = Market.getInstance().getLogById(id); -// log.setFieldsFromHashMap(allLogs.get(id)); + log.setFieldsFromHashMap(allLogs.get(id)); } } private void buildOffsWithHashMaps() { for (String id : allOffs.keySet()) { Off off = Market.getInstance().getOffById(id); -// off.setFieldsFromHashMap(allOffs.get(id)); + off.setFieldsFromHashMap(allOffs.get(id)); } } @@ -252,14 +252,14 @@ private void buildRequestsWithHashMaps() { private void buildProductSellInfosWithHashMaps() { for (String id : allProductSellInfos.keySet()) { ProductSellInfo sellInfo = Market.getInstance().getProductSellInfoById(id); -// sellInfo.setFieldsFromHashMap(allProductSellInfos.get(id)); + sellInfo.setFieldsFromHashMap(allProductSellInfos.get(id)); } } private void buildRatesWithHashMaps() { for (String id : allRates.keySet()) { Rate rate = Market.getInstance().getRateById(id); -// rate.setFieldsFromHashMap(allRates.get(id)); + rate.setFieldsFromHashMap(allRates.get(id)); } }