コード例 #1
0
  /**
   * Handles the "list" request. Note the use of Spring MVC-style annotations to map the Web Script
   * URI configuration and request handling objects.
   *
   * @param t : type
   * @param s : searchTerm
   * @param response
   * @throws Exception
   */
  @Uri(URI_PREFIX + "/listIcharge")
  public void handleListIcharge(
      @RequestParam(required = true) String query, final WebScriptResponse response)
      throws Exception {

    String json = null;

    try {
      Map<String, Object> params = new HashMap<String, Object>();

      if (query != null) {
        int pos = query.indexOf(" ");
        String lang = query.substring(0, pos);
        lang = lang != null && lang.startsWith("th") ? "_th" : "";
        params.put("lang", lang);
        params.put("orderBy", "name" + lang);

        String[] terms = query.substring(pos + 1).split(" ");

        params.put("terms", terms);
      }

      List<Map<String, Object>> list = activityService.listIcharge(params);

      json = CommonUtil.jsonSuccess(list);

    } catch (Exception ex) {
      log.error("", ex);
      json = CommonUtil.jsonFail(ex.toString());
      throw ex;

    } finally {
      CommonUtil.responseWrite(response, json);
    }
  }
コード例 #2
0
  public List<Map<String, Object>> list(Map<String, Object> params) {

    List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();

    SqlSession session = DbConnectionFactory.getSqlSessionFactory(dataSource).openSession();
    try {
      MainAccountActivityGroupDAO dao = session.getMapper(MainAccountActivityGroupDAO.class);

      List<Map<String, Object>> tmpList = dao.list(params);

      String name = MainAccountActivityGroupConstant.TFN_NAME + params.get("lang");

      for (Map<String, Object> tmpMap : tmpList) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(
            JsonConstant.COMBOBOX_ID,
            (Integer) tmpMap.get(MainAccountActivityGroupConstant.TFN_ID));
        map.put(JsonConstant.COMBOBOX_NAME, (String) tmpMap.get(name.toUpperCase()));

        tmpMap = CommonUtil.removeThElement(tmpMap);
        map.put(JsonConstant.COMBOBOX_DATA, tmpMap);

        list.add(map);
      }

    } catch (Exception ex) {
      log.error(ex);
    } finally {
      session.close();
    }

    return list;
  }
コード例 #3
0
ファイル: ExpBrwUtil.java プロジェクト: pabi2/pb2_pabiweb
 public static String getMessage(String key, Locale locale) {
   return CommonUtil.getMessage(CommonConstant.MODULE_EXP, key, locale);
 }