List of usage examples for org.springframework.web.bind.support SessionStatus setComplete
void setComplete();
From source file:org.mifos.ui.core.controller.PreviewProductMixController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView processFormSubmit(@RequestParam(value = EDIT_PARAM, required = false) String edit, @RequestParam(value = CANCEL_PARAM, required = false) String cancel, @RequestParam(value = "FORMVIEW", required = true) String formView, @ModelAttribute("formBean") ProductMixFormBean formBean, BindingResult result, SessionStatus status) { ModelAndView mav = new ModelAndView(REDIRECT_TO_ADMIN_SCREEN); if (StringUtils.isNotBlank(edit)) { updateAllowedNotAllowedProductMix(formBean); resetAllowedAndNotAllowed(formBean); mav = new ModelAndView(formView); mav.addObject("formBean", formBean); } else if (StringUtils.isNotBlank(cancel)) { status.setComplete(); } else if (result.hasErrors()) { mav = new ModelAndView("previewProductMix"); } else {// w w w.j av a 2s .co m Integer productId = Integer.parseInt(formBean.getProductId()); List<Integer> notAllowedProductIds = toIntegers(formBean.getNotAllowed()); this.adminServiceFacade.createOrUpdateProductMix(productId, notAllowedProductIds); mav = new ModelAndView("confirmProductMix"); mav.addObject("productId", productId); } return mav; }
From source file:org.mifos.ui.core.controller.ReportsCategoryDefineController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("reportCategory") @Valid ReportCategoryFormBean reportCategory, BindingResult result, SessionStatus status) { ModelAndView modelAndView = new ModelAndView(); if (StringUtils.isNotBlank(cancel)) { modelAndView.setViewName(REDIRECT_TO_ADMIN_SCREEN); status.setComplete(); } else if (result.hasErrors()) { modelAndView.setViewName("defineReportCategory"); modelAndView.addObject("reportCategory", reportCategory); } else {//from w ww. ja v a2 s. co m modelAndView.setViewName("redirect:/previewReportCategory.ftl"); modelAndView.addObject("reportCategory", reportCategory); } return modelAndView; }
From source file:org.mifos.ui.core.controller.ReportsCategoryDeleteController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("reportCategory") @Valid ReportCategoryFormBean reportCategory, SessionStatus status) { ModelAndView modelAndView = new ModelAndView(REDIRECT_TO_ADMIN_SCREEN); if (StringUtils.isNotBlank(cancel)) { modelAndView.setViewName(REDIRECT_TO_ADMIN_SCREEN); }// www . ja v a2 s. c o m status.setComplete(); return modelAndView; }
From source file:org.mifos.ui.core.controller.ReportsCategoryEditController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("reportCategory") @Valid ReportCategoryFormBean reportCategory, BindingResult result, SessionStatus status) { ModelAndView modelAndView = new ModelAndView(); if (StringUtils.isNotBlank(cancel)) { modelAndView.setViewName(REDIRECT_TO_ADMIN_SCREEN); status.setComplete(); } else if (result.hasErrors()) { modelAndView.setViewName("editReportCategory"); modelAndView.addObject("reportCategory", reportCategory); } else {//w w w. ja va 2s . c om modelAndView.setViewName("redirect:/previewReportCategory.ftl"); modelAndView.addObject("reportCategory", reportCategory); } return modelAndView; }
From source file:org.mifos.ui.core.controller.ReportsCategoryPreviewController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @RequestParam(value = "EDIT", required = false) String edit, @RequestParam(value = "editFormView", required = true) String editFormView, @ModelAttribute("reportCategory") @Valid ReportCategoryFormBean reportCategoryFormBean, BindingResult result, SessionStatus status) { ModelAndView modelAndView = new ModelAndView(REDIRECT_TO_LIST_OF_REPORT_CATEGORIES); if (StringUtils.isNotBlank(cancel)) { modelAndView.setViewName(REDIRECT_TO_LIST_OF_REPORT_CATEGORIES); status.setComplete(); } else if (StringUtils.isNotBlank(edit)) { modelAndView.setViewName(editFormView); } else if (result.hasErrors()) { modelAndView.setViewName("defineReportCategory"); modelAndView.addObject("reportCategory", reportCategoryFormBean); } else {/*from w ww . j a v a 2 s. c o m*/ // if (editFormView.equals("editReportCategory")) { // ReportCategoryDto reportCategory = new ReportCategoryDto(null, reportCategoryFormBean.getName()); // adminServiceFacade.updateReportCategory(reportCategory); // } else { ReportCategoryDto reportCategory = new ReportCategoryDto(null, reportCategoryFormBean.getName()); adminServiceFacade.createReportsCategory(reportCategory); // } } return modelAndView; }
From source file:org.mifos.ui.core.controller.ShutdownController.java
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = { "ICAST" }, justification = "timeout is not null") @RequestMapping(method = RequestMethod.POST) public ModelAndView processFormSubmit(HttpServletRequest request, @RequestParam(value = START_PARAM, required = false) String start, @RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("shutdownFormBean") @Valid ShutdownFormBean formBean, BindingResult result, SessionStatus status) { if (!result.hasErrors()) { if (StringUtils.isNotBlank(start)) { this.shutdownServiceFacade.scheduleShutdown(request, formBean.getTimeout() * 1000L); } else if (StringUtils.isNotBlank(cancel)) { this.shutdownServiceFacade.cancelShutdown(request); }/*from w ww. j a va2 s . co m*/ status.setComplete(); } return loadShutdownInfo(request); }
From source file:org.mifos.ui.core.controller.ViewFundsPreviewController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView processFormSubmit(@RequestParam(value = EDIT_PARAM, required = false) String edit, @RequestParam(value = CANCEL_PARAM, required = false) String cancel, FundFormBean formBean, BindingResult result, SessionStatus status) { String viewName = REDIRECT_TO_ADMIN_SCREEN; ModelAndView modelAndView = new ModelAndView(); if (StringUtils.isNotBlank(edit)) { viewName = "editFunds"; modelAndView.setViewName(viewName); modelAndView.addObject("formBean", formBean); modelAndView.addObject("previewView", "fundPreview"); } else if (StringUtils.isNotBlank(cancel)) { viewName = REDIRECT_TO_VIEW_FUNDS; modelAndView.setViewName(viewName); status.setComplete(); } else if (result.hasErrors()) { viewName = "fundPreview"; modelAndView.setViewName(viewName); modelAndView.addObject("formBean", formBean); } else {/*from www . j a va2s . co m*/ Integer fundCode = Integer.parseInt(formBean.getId()); FundDto fundUpdate = fundServiceFacade.getFund(fundCode.shortValue()); fundUpdate.setName(formBean.getName()); this.fundServiceFacade.updateFund(fundUpdate); viewName = REDIRECT_TO_ADMIN_SCREEN; modelAndView.setViewName(viewName); status.setComplete(); } return modelAndView; }
From source file:org.mifos.ui.core.controller.ViewOfficeHierarchyController.java
@RequestMapping(method = RequestMethod.POST) public String processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("formBean") ViewOfficeHierarchyFormBean formBean, BindingResult result, SessionStatus status) { String viewName = REDIRECT_TO_ADMIN_SCREEN; if (StringUtils.isNotBlank(cancel)) { viewName = REDIRECT_TO_ADMIN_SCREEN; status.setComplete(); } else if (result.hasErrors()) { viewName = populateFormBeanForErrorView(formBean); } else {/* w ww.j a v a 2 s . co m*/ try { UpdateConfiguredOfficeLevelRequest updateRequest = new UpdateConfiguredOfficeLevelRequest( formBean.isSubRegionalOffice(), formBean.isRegionalOffice(), formBean.isAreaOffice()); adminServiceFacade.updateOfficeLevelHierarchies(updateRequest); status.setComplete(); } catch (BusinessRuleException e) { result.reject(e.getMessageKey(), "The update to office levels was not successful."); viewName = populateFormBeanForErrorView(formBean); } } return viewName; }
From source file:org.nishkarma.petclinic.controller.OwnerController.java
@RequestMapping(value = "/{internationalPath:[a-zA-Z]{2,10}\\-[a-zA-Z]{2,10}}/owners/new", method = RequestMethod.POST) public String processCreationForm(@Valid @ModelAttribute("owner") Owners owner, BindingResult result, SessionStatus status) { int ownerId = 0; try {/*from w w w. j a va 2 s . co m*/ if (result.hasErrors()) { BindingResultDebug.print(result); return "owners/createOrUpdateOwnerForm"; } clinicService.saveOwner(owner); status.setComplete(); ownerId = owner.getId(); } catch (Exception e) { logger.error(ExceptionUtils.getStackTrace(e)); throw new NishkarmaException( NishkarmaMessageSource.getMessage("exception_message", NishkarmaLocaleUtil.resolveLocale())); } return "redirect:/{internationalPath}/owners/" + ownerId; }
From source file:org.nishkarma.petclinic.controller.OwnerController.java
@RequestMapping(value = "/{internationalPath:[a-zA-Z]{2,10}\\-[a-zA-Z]{2,10}}/owners/{ownerId}/edit", method = RequestMethod.POST) public String processUpdateOwnerForm(@Valid Owners owner, BindingResult result, SessionStatus status) { try {//w w w . j av a 2 s . co m if (result.hasErrors()) { return "owners/createOrUpdateOwnerForm"; } this.clinicService.saveOwner(owner); status.setComplete(); } catch (Exception e) { logger.error(ExceptionUtils.getStackTrace(e)); throw new NishkarmaException( NishkarmaMessageSource.getMessage("exception_message", NishkarmaLocaleUtil.resolveLocale())); } return "redirect:/{internationalPath}/owners/{ownerId}"; }