@RequestMapping(value = "/engine-settings.html*", method = RequestMethod.GET) public ModelAndView engineSettingList( final HttpServletRequest request, final HttpServletResponse response) throws Exception { ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice( getCurrentVelocityPath(request), "engine-setting/engine-setting-list"); final Localization currentLocalization = requestUtil.getCurrentLocalization(request); final Locale locale = currentLocalization.getLocale(); final String titleKeyPrefixSufix = "engine.setting.list"; initPage(request, response, modelAndView, titleKeyPrefixSufix); initLinks(request, modelAndView, locale, null); List<EngineSetting> engineSettings = engineSettingService.findEngineSettings(); String url = requestUtil.getCurrentRequestUrl(request); String sessionKey = "PagedListHolder_Search_List_Product_" + request.getSession().getId(); String page = request.getParameter(Constants.PAGE_PARAMETER); PagedListHolder<EngineSettingViewBean> engineSettingViewBeanPagedListHolder; if (StringUtils.isEmpty(page)) { engineSettingViewBeanPagedListHolder = initList( request, sessionKey, engineSettings, new PagedListHolder<EngineSettingViewBean>()); } else { engineSettingViewBeanPagedListHolder = (PagedListHolder) request.getSession().getAttribute(sessionKey); if (engineSettingViewBeanPagedListHolder == null) { engineSettingViewBeanPagedListHolder = initList(request, sessionKey, engineSettings, engineSettingViewBeanPagedListHolder); } int pageTarget = new Integer(page).intValue() - 1; int pageCurrent = engineSettingViewBeanPagedListHolder.getPage(); if (pageCurrent < pageTarget) { for (int i = pageCurrent; i < pageTarget; i++) { engineSettingViewBeanPagedListHolder.nextPage(); } } else if (pageCurrent > pageTarget) { for (int i = pageTarget; i < pageCurrent; i++) { engineSettingViewBeanPagedListHolder.previousPage(); } } } modelAndView.addObject(Constants.PAGE_URL, url); modelAndView.addObject(Constants.PAGE_PAGED_LIST_HOLDER, engineSettingViewBeanPagedListHolder); formFactory.buildEngineSettingQuickSearchForm(request, modelAndView); return modelAndView; }
@RequestMapping(value = "/engine-setting-details.html*", method = RequestMethod.GET) public ModelAndView engineSettingDetails( final HttpServletRequest request, final HttpServletResponse response) throws Exception { ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice( getCurrentVelocityPath(request), "engine-setting/engine-setting-details"); final String engineSettingId = request.getParameter(Constants.REQUEST_PARAM_ENGINE_SETTING_ID); if (StringUtils.isNotEmpty(engineSettingId)) { EngineSetting engineSetting = engineSettingService.getEngineSettingById(engineSettingId); if (engineSetting != null) { final Localization currentLocalization = requestUtil.getCurrentLocalization(request); final Locale locale = currentLocalization.getLocale(); final String titleKeyPrefixSufix = "engine.setting.details"; initPage(request, response, modelAndView, titleKeyPrefixSufix); initLinks(request, modelAndView, locale, engineSetting); modelAndView.addObject( "engineSettingDetails", viewBeanFactory.buildEngineSettingDetailsViewBean(request, currentLocalization)); modelAndView.addObject( "engineSetting", viewBeanFactory.buildEngineSettingViewBean(request, engineSetting)); } else { final String url = requestUtil.getLastRequestUrl(request); return new ModelAndView(new RedirectView(url)); } } else { final String url = requestUtil.getLastRequestUrl(request); return new ModelAndView(new RedirectView(url)); } formFactory.buildEngineSettingQuickSearchForm(request, modelAndView); return modelAndView; }