/**
   * 메인 페이지 호출
   *
   * @ahthor KimByungWook
   * @since 2012. 4. 27.
   * @param request
   * @param response
   * @return
   */
  @SuppressWarnings("unchecked")
  @RequestMapping(value = "/viewHtmlMain")
  public ParametersAndView viewMain(
      HttpServletRequest request, HttpServletResponse response, Parameters inParams) {
    ParametersAndView pav = new ParametersAndView("common.syscommon.htmlMain");

    inParams.setVariable("g_lang", LocaleUtil.getUserLanguage(inParams));
    inParams.setVariable("systemCl", "HTML");
    Parameters outParams =
        (Parameters) menuService.getMenuListAppliedForAuthForSystemClTop(inParams);
    pav.setParameters(outParams);

    // 언어선택 콤보박스 생성을 위한 설정 - config 파일에서 지원가능 로케일정보 Map을 조회하여 셋팅
    Parameters localeMapParams = (Parameters) authorityService.getLocaleList(inParams);
    pav.addObject(
        "localeMap", (List<Map<String, String>>) localeMapParams.getVariable("localeMap"));

    // 언어선택 콤보박스 popluate를 위한 현재 로케일 조회 (세션로케일 우선, 없으면 기본 로케일)
    pav.addObject("currentLocale", LocaleUtil.getUserLanguage(inParams));

    // jQuery-UI 스킨선택 콤보박스 생성용 코드
    pav.addObject("skinList", Config.getStringList("skin.list"));

    pav.addObject("maxOpenPageCount", Config.getString("maxopenpagecount"));
    pav.addObject("msgMapJSON", messageCache(inParams));

    return pav;
  }
  /**
   * 클라이언트 메시지 캐싱
   *
   * @param inParams
   * @return
   */
  private String messageCache(Parameters inParams) {
    Locale userLocale = LocaleUtil.getUserLocale(inParams);
    List<String> aliasList = Config.getStringList("clientCacheMsg.alias");
    List<String> codeList = Config.getStringList("clientCacheMsg.code");
    int listSize = aliasList.size();

    if (LOG.isDebugEnabled()) {
      LOG.debug("=================== cache message - start ======================");
    }

    String alias;
    String code;
    String value;

    Map<String, String> msgMap = new HashMap<String, String>();
    for (int i = 0; i < listSize; i++) {
      alias = aliasList.get(i);
      code = codeList.get(i);
      value = NoticeMessageUtil.getMessage(code, userLocale);
      msgMap.put(alias, value);
      if (LOG.isDebugEnabled()) {
        LOG.debug(" alias: " + alias + ", code: " + code + ", value: " + value);
      }
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("=================== cache message - end =======================");
    }

    return StringUtil.getJSONString(msgMap);
  }
  /**
   * 로케일 변경 메서드<br>
   *
   * @param request
   * @param response
   * @param inParams
   * @return 빈 Parameters 객체
   */
  @RequestMapping(value = "/changeLocale")
  public Parameters changeLocale(
      HttpServletRequest request, HttpServletResponse response, Parameters inParams) {
    Parameters outParam = ParametersFactory.createParameters(inParams);

    // ====================== 세션로케일 설정 - start ========================
    // 파라미터로 받은 ISO-639-1 (2-letter standard) 문자열을 사용하여 세션로케일을 셋팅한다.
    String locale2Letter = request.getParameter("locale");
    Locale locale = LocaleUtil.getLocaleBy2Letter(locale2Letter);
    LocaleUtil.setUserLocale(request.getSession(), locale);
    if (LOG.isDebugEnabled()) {
      LOG.debug("## changeLocale() -  세션로케일 설정");
      LOG.debug("## locale2Letter: " + locale2Letter);
      LOG.debug("## locale: " + locale);
    }

    return outParam;
  }
 @RequestMapping(value = "/searchMenu")
 public Parameters searchMenu(
     HttpServletRequest request, HttpServletResponse response, Parameters inParams) {
   inParams.setVariable("g_lang", LocaleUtil.getUserLanguage(inParams));
   return (Parameters) menuService.getMenuListByKeyword(inParams);
 }
 @RequestMapping(value = "/searchLeft")
 public Parameters searchLeft(
     HttpServletRequest request, HttpServletResponse response, Parameters inParams) {
   inParams.setVariable("g_lang", LocaleUtil.getUserLanguage(inParams));
   return (Parameters) menuService.getMenuListAppliedForAuthForSystemCl(inParams);
 }
 @RequestMapping(value = "/searchVisitedMenu")
 public Parameters searchVisitedMenu(
     HttpServletRequest request, HttpServletResponse response, Parameters inParams) {
   inParams.setVariable("g_lang", LocaleUtil.getUserLanguage(inParams));
   return (Parameters) comBackOfficeService.getRecentMenuHTML(inParams);
 }
 @RequestMapping(value = "/saveBookmark")
 public Parameters saveBookmark(
     HttpServletRequest request, HttpServletResponse response, Parameters inParams) {
   inParams.setVariable("g_lang", LocaleUtil.getUserLanguage(inParams));
   return (Parameters) comBackOfficeService.saveUserMenu(inParams);
 }