List of usage examples for java.util HashMap size
int size
To view the source code for java.util HashMap size.
Click Source Link
From source file:ru.apertum.qsystem.reports.formirovators.DistributionJobDayUsers.java
@Override public String validate(String driverClassName, String url, String username, String password, HttpRequest request, HashMap<String, String> params) { // ? /*w w w. j av a 2s . com*/ QLog.l().logger().trace("? \"" + params.toString() + "\"."); if (params.size() == 3) { // date/user_id/user Date date; String sdate, user; long user_id; try { date = Uses.format_dd_MM_yyyy.parse(params.get("date")); sdate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(date); user_id = Long.parseLong(params.get("user_id")); user = params.get("user"); } catch (ParseException | NumberFormatException ex) { return "<br> ! ? ? (..)."; } paramMap.put("sdate", sdate); paramMap.put("date", date); paramMap.put("user_id", user_id); paramMap.put("user", user); } else { return "<br> !"; } return null; }
From source file:ru.apertum.qsystem.reports.formirovators.DistributionJobDayServices.java
@Override public String validate(String driverClassName, String url, String username, String password, HttpRequest request, HashMap<String, String> params) { // ? /* www .j ava 2s.com*/ QLog.l().logger().trace("? \"" + params.toString() + "\"."); if (params.size() == 3) { // date/service_id/service Date date; String sdate, service; long service_id; try { date = Uses.format_dd_MM_yyyy.parse(params.get("date")); sdate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(date); service_id = Long.parseLong(params.get("service_id")); service = params.get("service"); } catch (ParseException | NumberFormatException ex) { return "<br> ! ? ? (..)."; } paramMap.put("sdate", sdate); paramMap.put("date", date); paramMap.put("service_id", service_id); paramMap.put("service", service); } else { return "<br> !"; } return null; }
From source file:ru.apertum.qsystem.reports.formirovators.DistributionWaitDayServices.java
@Override public String validate(String driverClassName, String url, String username, String password, HttpRequest request, HashMap<String, String> params) { // ? //from w w w . j a va2 s .co m QLog.l().logger().trace("? \"" + params.toString() + "\"."); if (params.size() == 3) { // date/service_id/service Date date; String sdate; long service_id; String service; try { date = Uses.format_dd_MM_yyyy.parse(params.get("date")); sdate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(date); service_id = Long.parseLong(params.get("service_id")); service = params.get("service"); } catch (NumberFormatException | ParseException ex) { return "<br> ! ? ? (..)."; } paramMap.put("sdate", sdate); paramMap.put("date", date); paramMap.put("service_id", service_id); paramMap.put("service", service); } else { return "<br> !"; } return null; }
From source file:ru.apertum.qsystem.reports.formirovators.DistributionWaitDayUsers.java
@Override public String validate(String driverClassName, String url, String username, String password, HttpRequest request, HashMap<String, String> params) { // ? // w ww.j a va2s.c o m QLog.l().logger().trace("? \"" + params.toString() + "\"."); if (params.size() == 3) { // date/user_id/user Date date; String sdate; long user_id; String user; try { date = Uses.format_dd_MM_yyyy.parse(params.get("date")); sdate = (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(date); user_id = Long.parseLong(params.get("user_id")); user = params.get("user"); } catch (NumberFormatException | ParseException ex) { return "<br> ! ? ? (..)."; } paramMap.put("sdate", sdate); paramMap.put("date", date); paramMap.put("user_id", user_id); paramMap.put("user", user); } else { return "<br> !"; } return null; }
From source file:com.ba.masters.stock.BAStockAction.java
public ActionForward baGet(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { JSONObject json = new JSONObject(); BAStockDTO vo = new BAStockDTO(); try {//from ww w . j ava 2 s.c om logger.info(" get method starts here"); String stockId = request.getParameter("search"); HashMap hashMpStockItemDet = BaStockFactory.getInstanceOfBaStockFactory().getStockItemDtls(stockId); json.put("exception", ""); json.put("StockItemDets", hashMpStockItemDet); json.put("StockItemExit", hashMpStockItemDet.size()); logger.warn("strCurrent PageNo ------------->" + objPageCount); } catch (Exception ex) { logger.error("The Exception is :" + ex); ex.printStackTrace(); json.put("exception", BAHandleAllException.exceptionHandler(ex)); } response.getWriter().write(json.toString()); return null; }
From source file:es.upm.fiware.rss.expenditureLimit.dao.impl.tests.DbeExpendLimitDaoTest.java
public void testOrderedGetExpenditureLimitInfByUser() { BmCurrency bmCurrency = new BmCurrency(); bmCurrency.setNuCurrencyId(1);/*from ww w .j a v a 2 s. c o m*/ HashMap<String, List<DbeExpendLimit>> h = expLimitDao.getOrdExpLimitsForUserAppProvCurrency("agg123", "userId01", "app123456", bmCurrency); Assert.assertTrue("List founds", h != null && h.size() == 4); List<DbeExpendLimit> l = h.get(DbeExpendLimitDao.USER_APP_PROV_KEY); Assert.assertTrue("Especific elements founds", l != null && l.size() == 1); Iterator<DbeExpendLimit> it = l.iterator(); while (it.hasNext()) { DbeExpendLimit el = it.next(); if (!el.getId().getTxAppProviderId().equalsIgnoreCase("app123456")) { Assert.fail("Application provider invalid: " + el.getId().getTxAppProviderId()); } if (!el.getId().getTxEndUserId().equalsIgnoreCase("userId01")) { Assert.fail("User invalid: " + el.getId().getTxEndUserId()); } } l = h.get(DbeExpendLimitDao.USER_KEY); Assert.assertTrue("User elements founds", l != null && l.size() == 1); it = l.iterator(); while (it.hasNext()) { DbeExpendLimit el = it.next(); if (!el.getId().getTxAppProviderId().equalsIgnoreCase(DbeExpendLimitDao.NO_APP_PROVIDER_ID)) { Assert.fail("Application provider invalid: " + el.getId().getTxAppProviderId()); } if (!el.getId().getTxEndUserId().equalsIgnoreCase("userId01")) { Assert.fail("User invalid: " + el.getId().getTxEndUserId()); } } l = h.get(DbeExpendLimitDao.APP_PROV_KEY); Assert.assertTrue("App provider elements founds", l != null && l.size() == 1); it = l.iterator(); while (it.hasNext()) { DbeExpendLimit el = it.next(); if (!el.getId().getTxAppProviderId().equalsIgnoreCase("app123456")) { Assert.fail("Application provider invalid: " + el.getId().getTxAppProviderId()); } if (!el.getId().getTxEndUserId().equalsIgnoreCase(DbeExpendLimitDao.NO_USER_ID)) { Assert.fail("User invalid: " + el.getId().getTxEndUserId()); } } l = h.get(DbeExpendLimitDao.ALL_GENERIC_KEY); Assert.assertTrue("Generic elements founds", l != null && l.size() == 3); it = l.iterator(); while (it.hasNext()) { DbeExpendLimit el = it.next(); if (!el.getId().getTxAppProviderId().equalsIgnoreCase(DbeExpendLimitDao.NO_APP_PROVIDER_ID)) { Assert.fail("Application provider invalid: " + el.getId().getTxAppProviderId()); } if (!el.getId().getTxEndUserId().equalsIgnoreCase(DbeExpendLimitDao.NO_USER_ID)) { Assert.fail("User invalid: " + el.getId().getTxEndUserId()); } } }
From source file:org.forgerock.openam.mobile.commons.ASyncRestRequest.java
/** * Appends parameter information to the query string of this underlying request */// w w w .jav a 2 s . c o m private void appendParams(HashMap<String, String> params) { // No URIBuilder included in the HTTPClient inside Android; Uri.Builder not so lovely. // So lets do it by hand if (params == null || params.size() == 0) { return; } HttpRequestBase request = getRequest(); boolean first = false; StringBuilder sb = new StringBuilder(request.getURI().toString()); if (!sb.toString().contains("?")) { first = true; } for (String key : params.keySet()) { if (first) { sb.append("?"); } else { sb.append("&"); } try { sb.append(key).append("=").append(URLEncoder.encode(params.get(key), RestConstants.UTF8)); } catch (UnsupportedEncodingException e) { fail(TAG, "Unable to URL encode params to add to request."); } } URI validUri = null; try { validUri = new URI(sb.toString()); } catch (URISyntaxException e) { fail(TAG, "Unable to validate URL after adding HTTP parameters."); } request.setURI(validUri); }
From source file:ru.apertum.qsystem.reports.formirovators.StatisticUsers.java
@Override public String validate(String driverClassName, String url, String username, String password, HttpRequest request, HashMap<String, String> params) { //sd=20.01.2009&ed=28.01.2009 // ? /*from ww w . java2 s.c o m*/ QLog.l().logger().trace("? \"" + params.toString() + "\"."); if (params.size() == 2) { Date sd, fd, fd1; try { sd = Uses.format_dd_MM_yyyy.parse(params.get("sd")); fd = Uses.format_dd_MM_yyyy.parse(params.get("ed")); fd1 = DateUtils.addDays(Uses.format_dd_MM_yyyy.parse(params.get("ed")), 1); } catch (ParseException ex) { return "<br> ! ? ? (..)."; } if (!sd.after(fd)) { paramMap.put("sd", sd); paramMap.put("ed", fd); paramMap.put("ed1", fd1); } else { return "<br> ! ?."; } } else { return "<br> !"; } return null;// ? }
From source file:ru.apertum.qsystem.reports.formirovators.RatioServices.java
@Override public String validate(String driverClassName, String url, String username, String password, HttpRequest request, HashMap<String, String> params) { //sd=20.01.2009&ed=28.01.2009 // ? /*from w w w. j a v a 2 s . co m*/ QLog.l().logger().trace("? \"" + params.toString() + "\"."); if (params.size() == 2) { Date sd; Date fd; Date fd1; try { sd = Uses.format_dd_MM_yyyy.parse(params.get("sd")); fd = Uses.format_dd_MM_yyyy.parse(params.get("ed")); fd1 = DateUtils.addDays(Uses.format_dd_MM_yyyy.parse(params.get("ed")), 1); } catch (ParseException ex) { return "<br> ! ? ? (..)."; } if (!sd.after(fd)) { paramMap.put("sd", sd); paramMap.put("ed", fd); paramMap.put("ed1", fd1); } else { return "<br> ! ?."; } } else { return "<br> !"; } return null;// ? }
From source file:com.ba.masters.tariff.BATariffAction.java
public ActionForward baGet(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { JSONObject json = new JSONObject(); BATariffDTO vo = new BATariffDTO(); try {// www. j ava 2s . co m logger.info(" get method starts here"); String order = request.getParameter("search"); HashMap hashMpTariffDet = BATariffFactory.getInstanceOfBATariffFactory().getTariffDtls(order); json.put("exception", ""); json.put("TariffDets", hashMpTariffDet); json.put("TariffExit", hashMpTariffDet.size()); // logger.warn("strCurrent PageNo ------------->"+objPageCount); } catch (Exception ex) { logger.error("The Exception is :" + ex); ex.printStackTrace(); json.put("exception", BAHandleAllException.exceptionHandler(ex)); } response.getWriter().write(json.toString()); return null; }