@RequiresPermissions(value = {"configuration:manage"}) @RequestMapping(value = "/cm/configurations", method = RequestMethod.POST) public ModelAndView processUpdateConfiguration( @Valid @ModelAttribute("commonInfoViewModel") CommonInfoViewModel commonInfoViewModel, BindingResult bindingResult, HttpServletRequest request, ModelMap model) { if (bindingResult.hasErrors()) { return new ModelAndView("cm/configurations"); } else { CommonInfo commonInfo = (CommonInfo) request.getServletContext().getAttribute("COMMONINFO"); commonInfo.setWebTitle(commonInfoViewModel.getWebTitle()); commonInfo.setMarqueeTitle(commonInfoViewModel.getMarqueeTitle()); commonInfo.setRecentNews(Integer.parseInt(commonInfoViewModel.getRecentNews())); commonInfo.setQuestionAnswer(Integer.parseInt(commonInfoViewModel.getQuestionAnswer())); commonInfo.setTcCatalogs(Integer.parseInt(commonInfoViewModel.getTcCatalogs())); commonInfo.setSameSubjects(Integer.parseInt(commonInfoViewModel.getSameSubjects())); commonInfo.setHeadlines(Integer.parseInt(commonInfoViewModel.getHeadlines())); commonInfo.setHeadlineCaption(commonInfoViewModel.getHeadlineCaption()); commonInfo.setImageCaption(commonInfoViewModel.getImageCaption()); commonInfo.setVideoCaption(commonInfoViewModel.getVideoCaption()); commonInfo.setAudioCaption(commonInfoViewModel.getAudioCaption()); commonInfo.setDetailsCaption(commonInfoViewModel.getDetailsCaption()); commonInfo.setAdministrativeProcedures(commonInfoViewModel.getAdministrativeProcedures()); commonInfo.setAdministrativeProceduresInstruction( commonInfoViewModel.getAdministrativeProceduresInstruction()); commonInfo.setViews(commonInfoViewModel.getViews()); commonInfo.setIntroduction(commonInfoViewModel.getIntroduction()); commonInfo.setOrganizationalStructure(commonInfoViewModel.getOrganizationalStructure()); commonInfo.setMostViewed(Integer.parseInt(commonInfoViewModel.getMostViewed())); commonInfo.setAdAmount(Integer.parseInt(commonInfoViewModel.getAdAmount())); commonInfo.setNewsInSameCatalog(Integer.parseInt(commonInfoViewModel.getNewsInSameCatalog())); commonInfo.setNewsInSearchResult( Integer.parseInt(commonInfoViewModel.getNewsInSearchResult())); commonInfo.setSameSubjectTitle(commonInfoViewModel.getSameSubjectTitle()); commonInfo.setToday(commonInfoViewModel.getToday()); commonInfo.setPostedDate(commonInfoViewModel.getPostedDate()); commonInfo.setAuthor(commonInfoViewModel.getAuthor()); commonInfo.setPrint(commonInfoViewModel.getPrint()); commonInfo.setHomePage(commonInfoViewModel.getHomePage()); commonInfo.setDocument(commonInfoViewModel.getDocument()); commonInfo.setLegalDocument(commonInfoViewModel.getLegalDocument()); commonInfo.setGoTop(commonInfoViewModel.getGoTop()); commonInfo.setDuty(commonInfoViewModel.getDuty()); commonInfo.setAchievement(commonInfoViewModel.getAchievement()); commonInfo.setPageSize(Integer.parseInt(commonInfoViewModel.getPageSize())); commonInfo.setRightTopSize(Integer.parseInt(commonInfoViewModel.getRightTopSize())); commonInfo.setRightCenterSize(Integer.parseInt(commonInfoViewModel.getRightCenterSize())); ResWriter.writeCommonInfo( commonInfo, request.getServletContext().getRealPath(Constants.COMMONINFO_CONFIG_FILE)); request .getSession() .setAttribute("msg", PropertiesUtil.getProperty("configurations.updated.successfully")); return new ModelAndView(new RedirectView(request.getContextPath() + "/cm/configurations")); } }