List of usage examples for com.google.gson.internal LinkedTreeMap get
@Override
public V get(Object key)
From source file:com.magestore.app.pos.api.m1.config.POSConfigDataAccessM1.java
@Override public Map<String, String> getCustomerGroup() throws DataAccessException, ConnectionException, ParseException, IOException, ParseException { // nu cha load config, cn khi to ch default if (mConfig == null) mConfig = new PosConfigDefault(); // Chuyn i customer List<LinkedTreeMap> customerGroupList = (ArrayList) mConfig.getValue("customerGroup"); LinkedTreeMap<String, String> returnCustomerGroup = new LinkedTreeMap<String, String>(); for (LinkedTreeMap customerGroup : customerGroupList) { Double id = (Double) customerGroup.get("id"); returnCustomerGroup.put(String.format("%.0f", id), customerGroup.get("code").toString()); }/*w ww. j ava2 s. c o m*/ return returnCustomerGroup; }
From source file:com.magestore.app.pos.api.m1.config.POSConfigDataAccessM1.java
@Override public Map<String, ConfigCountry> getCountryGroup() throws DataAccessException, ConnectionException, ParseException, IOException, ParseException { // nu cha load config, cn khi to ch default if (mConfig == null) mConfig = new PosConfigDefault(); List<LinkedTreeMap> countryList = (ArrayList) mConfig.getValue("country"); Map<String, ConfigCountry> listConfigCountry = new LinkedTreeMap<>(); Collections.sort(countryList, new Comparator<LinkedTreeMap>() { @Override/*from ww w . j a v a2 s . co m*/ public int compare(LinkedTreeMap linkedTreeMap, LinkedTreeMap linkedTreeMap1) { String name = linkedTreeMap.get("country_name").toString(); String name1 = linkedTreeMap1.get("country_name").toString(); return name.compareToIgnoreCase(name1); } }); for (LinkedTreeMap country : countryList) { ConfigCountry configCountry = new PosConfigCountry(); String country_id = country.get("country_id").toString(); String country_name = country.get("country_name").toString(); configCountry.setCountryID(country_id); configCountry.setCountryName(country_name); Map<String, ConfigRegion> mapRegion = getRegion(country_id); if (mapRegion != null) { configCountry.setRegions(mapRegion); } listConfigCountry.put(country_id, configCountry); } return listConfigCountry; }
From source file:com.magestore.app.pos.api.m1.config.POSConfigDataAccessM1.java
private Map<String, Map<String, ConfigRegion>> getRegionGroup() { // nu cha load config, cn khi to ch default if (mConfig == null) mConfig = new PosConfigDefault(); Map<String, LinkedTreeMap> regionGroup = (Map) mConfig.getValue("regionJson"); Map<String, Map<String, ConfigRegion>> mapCountry = new HashMap<>(); for (String key : regionGroup.keySet()) { if (!key.equals("config")) { Map<String, ConfigRegion> listConfigRegion = new LinkedTreeMap<>(); Map<String, LinkedTreeMap> region = (Map<String, LinkedTreeMap>) regionGroup.get(key); for (String id : region.keySet()) { ConfigRegion configRegion = new PosConfigRegion(); LinkedTreeMap item = (LinkedTreeMap) region.get(id); String code = (String) item.get("code"); String name = (String) item.get("name"); configRegion.setID(id);/* w ww . jav a2 s. c o m*/ configRegion.setCode(code); configRegion.setName(name); listConfigRegion.put(id, configRegion); } mapCountry.put(key, listConfigRegion); } } return mapCountry; }
From source file:com.magestore.app.pos.api.m1.config.POSConfigDataAccessM1.java
@Override public List<Currency> getCurrencies() throws DataAccessException, ConnectionException, ParseException, IOException, ParseException { if (mConfig == null) mConfig = new PosConfigDefault(); List<LinkedTreeMap> currencyList = (ArrayList) mConfig.getValue("currencies"); List<Currency> listCurrency = new ArrayList<>(); for (LinkedTreeMap item : currencyList) { Currency currency = new PosCurrency(); String code = item.get("code").toString(); String currency_name = item.get("currency_name").toString(); String currency_symbol = ""; if (item.get("currency_symbol") != null) { String symbol = item.get("currency_symbol").toString(); if (symbol.length() > 0) { String sSymbol = symbol.substring(0, 1); if (sSymbol.equals("u")) { currency_symbol = StringEscapeUtils.unescapeJava("\\" + symbol); } else if (sSymbol.equals("\\")) { currency_symbol = StringEscapeUtils.unescapeJava(symbol); } else if (symbol.contains("\\u")) { currency_symbol = StringEscapeUtils.unescapeJava(symbol); } else { currency_symbol = StringEscapeUtils.unescapeJava(symbol); }/* w ww . j a va 2 s . c o m*/ } } String is_default = item.get("is_default").toString(); String currency_rate = item.get("currency_rate").toString(); currency.setCode(code); currency.setCurrenyName(currency_name); currency.setCurrencySymbol(currency_symbol); currency.setIsDefault(is_default); try { currency.setCurrencyRate(Double.parseDouble(currency_rate)); } catch (Exception e) { } listCurrency.add(currency); } return listCurrency; }
From source file:com.magestore.app.pos.api.m1.config.POSConfigDataAccessM1.java
@Override public boolean getConfigStoreCredit() throws DataAccessException, ConnectionException, ParseException, IOException, ParseException { if (mConfig == null) mConfig = new PosConfigDefault(); if (mConfig.getValue("plugins_config") != null) { if (mConfig.getValue("plugins_config") instanceof LinkedTreeMap) { LinkedTreeMap plugins_config = (LinkedTreeMap) mConfig.getValue("plugins_config"); LinkedTreeMap os_store_credit = (LinkedTreeMap) plugins_config.get("os_store_credit"); if (os_store_credit != null) { String enable_store_credit = (String) os_store_credit.get("customercredit/general/enable"); boolean isShowStoreCredit; if (!StringUtil.isNullOrEmpty(enable_store_credit)) { if (enable_store_credit.equals("1")) { isShowStoreCredit = true; return isShowStoreCredit; }/* w w w.ja va2 s .co m*/ } } } } return false; }
From source file:com.magestore.app.pos.api.m1.config.POSConfigDataAccessM1.java
@Override public boolean getConfigRewardPoint() throws DataAccessException, ConnectionException, ParseException, IOException, ParseException { if (mConfig == null) mConfig = new PosConfigDefault(); if (mConfig.getValue("plugins_config") != null) { if (mConfig.getValue("plugins_config") instanceof LinkedTreeMap) { LinkedTreeMap plugins_config = (LinkedTreeMap) mConfig.getValue("plugins_config"); LinkedTreeMap os_reward_points = (LinkedTreeMap) plugins_config.get("os_reward_points"); if (os_reward_points != null) { String enable_store_credit = (String) os_reward_points.get("rewardpoints/general/enable"); boolean isShowStoreCredit; if (!StringUtil.isNullOrEmpty(enable_store_credit)) { if (enable_store_credit.equals("1")) { isShowStoreCredit = true; return isShowStoreCredit; }//from w w w . j a v a 2 s . co m } } } } return false; }
From source file:com.magestore.app.pos.api.m1.config.POSConfigDataAccessM1.java
@Override public boolean getConfigGiftCard() throws DataAccessException, ConnectionException, ParseException, IOException, ParseException { if (mConfig == null) mConfig = new PosConfigDefault(); if (mConfig.getValue("plugins_config") != null) { if (mConfig.getValue("plugins_config") instanceof LinkedTreeMap) { LinkedTreeMap plugins_config = (LinkedTreeMap) mConfig.getValue("plugins_config"); LinkedTreeMap os_gift_card = (LinkedTreeMap) plugins_config.get("os_gift_card"); if (os_gift_card != null) { String enable_gift_card = (String) os_gift_card.get("giftvoucher/general/active"); boolean isShowGiftCard; if (!StringUtil.isNullOrEmpty(enable_gift_card)) { if (enable_gift_card.equals("1")) { isShowGiftCard = true; return isShowGiftCard; }//from w w w.j a v a 2 s .c om } } } } return false; }
From source file:com.magestore.app.pos.api.m1.config.POSConfigDataAccessM1.java
private ConfigPriceFormat getPriceFormat(LinkedTreeMap priceFormat) { String currencySymbol = (String) mConfig.getValue("currentCurrencySymbol"); String currency_symbol = ""; if (currencySymbol.length() > 0) { String sSymbol = currencySymbol.substring(0, 1); if (sSymbol.equals("u")) { currency_symbol = StringEscapeUtils.unescapeJava("\\" + currencySymbol); } else if (sSymbol.equals("\\")) { currency_symbol = StringEscapeUtils.unescapeJava(currencySymbol); } else if (currencySymbol.contains("\\u")) { currency_symbol = StringEscapeUtils.unescapeJava(currencySymbol); } else {/*from w w w .j ava2s.c om*/ currency_symbol = StringEscapeUtils.unescapeJava(currencySymbol); } } String pattern = priceFormat.get("pattern").toString(); int precision = ((Double) priceFormat.get("precision")).intValue(); int requiredPrecision = ((Double) priceFormat.get("requiredPrecision")).intValue(); String decimalSymbol = priceFormat.get("decimalSymbol").toString(); String groupSymbol = priceFormat.get("groupSymbol").toString(); int groupLength = ((Double) priceFormat.get("groupLength")).intValue(); int integerRequired = ((Double) priceFormat.get("integerRequired")).intValue(); ConfigPriceFormat configPriceFormat = new PosConfigPriceFormat(); configPriceFormat.setPattern(pattern); configPriceFormat.setPrecision(precision); configPriceFormat.setRequirePrecision(requiredPrecision); configPriceFormat.setDecimalSymbol(decimalSymbol); configPriceFormat.setGroupSymbol(groupSymbol); configPriceFormat.setGroupLength(groupLength); configPriceFormat.setIntegerRequied(integerRequired); configPriceFormat.setCurrencySymbol(currency_symbol); return configPriceFormat; }
From source file:com.magestore.app.pos.api.m1.config.POSConfigDataAccessM1.java
private ConfigQuantityFormat getQuantityFormat(LinkedTreeMap quantityFormat) { String currencySymbol = (String) mConfig.getValue("currentCurrencySymbol"); String pattern = quantityFormat.get("pattern").toString(); int precision = ((Double) quantityFormat.get("precision")).intValue(); int requiredPrecision = ((Double) quantityFormat.get("requiredPrecision")).intValue(); String decimalSymbol = quantityFormat.get("decimalSymbol").toString(); String groupSymbol = quantityFormat.get("groupSymbol").toString(); int groupLength = ((Double) quantityFormat.get("groupLength")).intValue(); int integerRequired = 0; ConfigQuantityFormat configQuantityFormat = new PosConfigQuantityFormat(); configQuantityFormat.setPattern(pattern); configQuantityFormat.setPrecision(precision); configQuantityFormat.setRequirePrecision(requiredPrecision); configQuantityFormat.setDecimalSymbol(decimalSymbol); configQuantityFormat.setGroupSymbol(groupSymbol); configQuantityFormat.setGroupLength(groupLength); configQuantityFormat.setIntegerRequied(integerRequired); // configQuantityFormat.setCurrencySymbol(currencySymbol); return configQuantityFormat; }
From source file:com.magestore.app.pos.api.m2.config.POSConfigDataAccess.java
/** * Ly customer group trong config//from w w w .ja va2 s . c o m * * @return * @throws DataAccessException * @throws ConnectionException * @throws ParseException * @throws IOException * @throws ParseException */ @Override public Map<String, String> getCustomerGroup() throws DataAccessException, ConnectionException, ParseException, IOException, ParseException { // nu cha load config, cn khi to ch default if (mConfig == null) mConfig = new PosConfigDefault(); // Chuyn i customer List<LinkedTreeMap> customerGroupList = (ArrayList) mConfig.getValue("customerGroup"); LinkedTreeMap<String, String> returnCustomerGroup = new LinkedTreeMap<String, String>(); for (LinkedTreeMap customerGroup : customerGroupList) { Double id = (Double) customerGroup.get("id"); returnCustomerGroup.put(String.format("%.0f", id), customerGroup.get("code").toString()); } return returnCustomerGroup; }