List of usage examples for org.springframework.web.bind.support SessionStatus setComplete
void setComplete();
From source file:org.mifos.ui.core.controller.BatchjobsController.java
@SuppressWarnings("PMD.AvoidRethrowingException") // for default AccessDeniedException feedback @RequestMapping(method = RequestMethod.POST) public ModelAndView processFormSubmit(HttpServletRequest request, @RequestParam(value = SUSPEND_PARAM, required = false) String suspend, @RequestParam(value = RUN_PARAM, required = false) String run, SessionStatus status) throws AccessDeniedException { List<String> errorMessages = new ArrayList<String>(); if (StringUtils.isNotBlank(suspend)) { ServletContext context = request.getSession().getServletContext(); String[] doSuspend = request.getParameterValues("SUSPEND"); if (doSuspend != null) { try { batchjobsServiceFacade.suspend(context, doSuspend[0]); } catch (AccessDeniedException e) { throw e; } catch (Exception e) { errorMessages.add("Could not change Scheduler status. " + new LogUtils().getStackTrace(e)); }//from ww w . java 2 s . co m } } else if (StringUtils.isNotBlank(run)) { rawJobList = request.getParameterValues("ONDEMAND"); if (rawJobList == null) { rawJobList = new String[0]; } else { ServletContext context = request.getSession().getServletContext(); try { batchjobsServiceFacade.runSelectedTasks(context, rawJobList); } catch (AccessDeniedException e) { throw e; } catch (Exception e) { errorMessages.add("Could not run selected Tasks. " + new LogUtils().getStackTrace(e)); } } } status.setComplete(); return produceModelAndView(request, errorMessages); }
From source file:org.mifos.ui.core.controller.ConfigureApplicationLabelsController.java
@RequestMapping(method = RequestMethod.POST) public String processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("formBean") @Valid ConfigureApplicationLabelsFormBean 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 = FORM_VIEW;/*from w w w. jav a 2 s .c o m*/ } else { OfficeLevelDto officeLevels = officeLevelDtoFrom(formBean); GracePeriodDto gracePeriodDto = new GracePeriodDto(); gracePeriodDto.setNone(formBean.getNone()); gracePeriodDto.setGraceOnAllRepayments(formBean.getGraceOnAllRepayments()); gracePeriodDto.setPrincipalOnlyGrace(formBean.getPrincipalOnlyGrace()); ConfigurableLookupLabelDto lookupLabels = new ConfigurableLookupLabelDto(); lookupLabels.setClient(formBean.getClient()); lookupLabels.setGroup(formBean.getGroup()); lookupLabels.setCenter(formBean.getCenter()); lookupLabels.setLoans(formBean.getLoans()); lookupLabels.setSavings(formBean.getSavings()); lookupLabels.setState(formBean.getState()); lookupLabels.setPostalCode(formBean.getPostalCode()); lookupLabels.setEthnicity(formBean.getEthnicity()); lookupLabels.setCitizenship(formBean.getCitizenship()); lookupLabels.setHandicapped(formBean.getHandicapped()); lookupLabels.setGovtId(formBean.getGovtId()); lookupLabels.setAddress1(formBean.getAddress1()); lookupLabels.setAddress2(formBean.getAddress2()); lookupLabels.setAddress3(formBean.getAddress3()); lookupLabels.setInterest(formBean.getInterest()); lookupLabels.setExternalId(formBean.getExternalId()); lookupLabels.setBulkEntry(formBean.getBulkEntry()); AccountStatusesLabelDto accountStatusLabels = new AccountStatusesLabelDto(); accountStatusLabels.setPartialApplication(formBean.getPartialApplication()); accountStatusLabels.setPendingApproval(formBean.getPendingApproval()); accountStatusLabels.setApproved(formBean.getApproved()); accountStatusLabels.setCancel(formBean.getCancel()); accountStatusLabels.setClosed(formBean.getClosed()); accountStatusLabels.setOnhold(formBean.getOnhold()); accountStatusLabels.setActive(formBean.getActive()); accountStatusLabels.setInActive(formBean.getInActive()); accountStatusLabels.setActiveInGoodStanding(formBean.getActiveInGoodStanding()); accountStatusLabels.setActiveInBadStanding(formBean.getActiveInBadStanding()); accountStatusLabels.setClosedObligationMet(formBean.getClosedObligationMet()); accountStatusLabels.setClosedRescheduled(formBean.getClosedRescheduled()); accountStatusLabels.setClosedWrittenOff(formBean.getClosedWrittenOff()); ConfigureApplicationLabelsDto applicationLabels = new ConfigureApplicationLabelsDto(officeLevels, gracePeriodDto, lookupLabels, accountStatusLabels); adminServiceFacade.updateApplicationLabels(applicationLabels); status.setComplete(); } return viewName; }
From source file:org.mifos.ui.core.controller.DefineLoanProductsFormController.java
@RequestMapping(method = RequestMethod.POST) public String processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("loanProduct") @Valid LoanProductFormBean loanProductFormBean, BindingResult result, SessionStatus status) { String viewName = "redirect:/previewLoanProducts.ftl?editFormview=defineLoanProducts"; loanProductFormBeanValidator.setValidator(validator); loanProductFormBeanValidator.validate(loanProductFormBean, result); if (StringUtils.isNotBlank(cancel)) { viewName = REDIRECT_TO_ADMIN_SCREEN; status.setComplete(); } else if (result.hasErrors()) { viewName = "defineLoanProducts"; loanProductFormBean.resetMultiSelectListBoxes(); }/* w ww. j ava 2 s. c om*/ return viewName; }
From source file:org.mifos.ui.core.controller.DefineMandatoryHiddenFieldsController.java
@RequestMapping(method = RequestMethod.POST) public String processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, DefineMandatoryHiddenFieldsFormBean bean, 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 = "defineMandatoryHiddenFields"; } else {//w ww .j a va2 s .c o m MandatoryHiddenFieldsDto dto = assembleDto(bean); adminServiceFacade.updateHiddenMandatoryFields(dto); status.setComplete(); } return viewName; }
From source file:org.mifos.ui.core.controller.DefineNewFundController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView showPreview(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("formBean") @Valid FundFormBean formBean, BindingResult result, SessionStatus status) { ModelAndView modelAndView = new ModelAndView(REDIRECT_TO_ADMIN_SCREEN); if (StringUtils.isNotBlank(cancel)) { modelAndView.setViewName(REDIRECT_TO_ADMIN_SCREEN); status.setComplete(); } else if (result.hasErrors()) { modelAndView.setViewName("defineNewFund"); Map<String, String> codeMap = retrieveFundCodeOptionMap(); modelAndView.addObject("code", codeMap); } else {//from w ww. j a v a 2 s . c o m modelAndView.setViewName("newFundPreview"); Map<String, String> codeMap = retrieveFundCodeOptionMap(); formBean.setCodeValue(codeMap.get(formBean.getCodeId())); modelAndView.addObject("formBean", formBean); } return modelAndView; }
From source file:org.mifos.ui.core.controller.DefineNewHolidayController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @Valid @ModelAttribute("formBean") HolidayFormBean formBean, BindingResult result, SessionStatus status) { ModelAndView mav = new ModelAndView(REDIRECT_TO_ADMIN_SCREEN); if (StringUtils.isNotBlank(cancel)) { status.setComplete(); } else if (result.hasErrors()) { mav = new ModelAndView("defineNewHoliday"); } else {/*from ww w.j av a 2 s.c o m*/ HolidayDetails holidayDetail = holidayAssembler.translateHolidayFormBeanToDto(formBean); List<Short> branchIds = holidayAssembler.convertToIds(formBean.getSelectedOfficeIds()); OfficeHoliday officeHoliday = holidayServiceFacade.retrieveHolidayDetailsForPreview(holidayDetail, branchIds); List<String> otherHolidays = holidayServiceFacade .retrieveOtherHolidayNamesWithTheSameDate(holidayDetail, branchIds); mav = new ModelAndView("previewHoliday"); mav.addObject("formBean", formBean); mav.addObject("officeHoliday", officeHoliday); mav.addObject("otherHolidays", otherHolidays); } return mav; }
From source file:org.mifos.ui.core.controller.DefineNewPenaltyController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView showPreview(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("formBean") @Valid PenaltyFormBean formBean, BindingResult result, SessionStatus status) { ModelAndView modelAndView = new ModelAndView(REDIRECT_TO_ADMIN_SCREEN); if (StringUtils.isNotBlank(cancel)) { modelAndView.setViewName(REDIRECT_TO_ADMIN_SCREEN); status.setComplete(); } else {//from ww w . ja v a 2 s .c o m if (result.hasErrors()) { modelAndView.setViewName("defineNewPenalty"); parametersDto = this.penaltyServiceFacade.getPenaltyParameters(); modelAndView.addObject("param", parametersDto); } else { modelAndView.setViewName("newPenaltyPreview"); modelAndView.addObject("applies", this.parametersDto.getCategoryType().get(formBean.getCategoryTypeId())); modelAndView.addObject("period", this.parametersDto.getPeriodType().get(formBean.getPeriodTypeId())); modelAndView.addObject("formula", this.parametersDto.getFormulaType().get(formBean.getFormulaId())); modelAndView.addObject("frequency", this.parametersDto.getFrequencyType().get(formBean.getFrequencyId())); modelAndView.addObject("glCode", this.parametersDto.getGlCodes().get(formBean.getGlCodeId())); } modelAndView.addObject("formBean", formBean); } return modelAndView; }
From source file:org.mifos.ui.core.controller.DefineProductMixController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String canceBtn, @RequestParam(value = PREVIEW_PARAM, required = false) String previewBtn, @ModelAttribute("formBean") ProductMixFormBean formBean, BindingResult result, SessionStatus status) { ModelAndView mav = new ModelAndView("defineProductMix"); ProductMixFormValidator formValidator = new ProductMixFormValidator(); if (StringUtils.isNotBlank(canceBtn)) { mav = new ModelAndView(REDIRECT_TO_ADMIN_SCREEN); status.setComplete(); }//from w ww . j a va 2s .co m if (StringUtils.isBlank(formBean.getProductTypeId())) { List<ProductTypeDto> productTypes = this.adminServiceFacade .retrieveProductTypesApplicableToProductMix(); mav.addObject("formBean", productMixAssembler.createFormBean(productTypes)); validateForPreview(formValidator, formBean, result, previewBtn); } else if (StringUtils.isNotBlank(formBean.getProductTypeId()) && StringUtils.isBlank(formBean.getProductId())) { populateProductNameOptions(formBean); validateForPreview(formValidator, formBean, result, previewBtn); } else if (StringUtils.isNotBlank(formBean.getProductTypeId()) && StringUtils.isNotBlank(formBean.getProductId()) && (formBean.getAllowed() == null && formBean.getNotAllowed() == null)) { populateAllowedNotAllowedOptions(formBean); validateForPreview(formValidator, formBean, result, previewBtn); } else { checkAndFixFormStringArrys(formBean); validateForPreview(formValidator, formBean, result, previewBtn); ProductMixPreviewDto preview = this.productMixAssembler.createProductMixPreview(formBean); mav = new ModelAndView("previewProductMix"); mav.addObject("ref", preview); mav.addObject("formView", "defineProductMix"); } return mav; }
From source file:org.mifos.ui.core.controller.DefineSavingsProductsFormController.java
@RequestMapping(method = RequestMethod.POST) public String processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("savingsProduct") @Valid SavingsProductFormBean savingsProductFormBean, BindingResult result, SessionStatus status) { String viewName = "redirect:/previewSavingsProducts.ftl?editFormview=defineSavingsProduct"; if (StringUtils.isNotBlank(cancel)) { viewName = REDIRECT_TO_ADMIN_SCREEN; status.setComplete(); } else if (result.hasErrors()) { viewName = "defineSavingsProduct"; }//from w ww . j a v a2 s . c om return viewName; }
From source file:org.mifos.ui.core.controller.EditFundsController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @RequestParam(value = "PREVIEWVIEW", required = true) String previewView, @ModelAttribute("formBean") @Valid FundFormBean formBean, BindingResult result, SessionStatus status) { ModelAndView modelAndView = new ModelAndView(REDIRECT_TO_VIEW_FUNDS); if (StringUtils.isNotBlank(cancel)) { modelAndView.setViewName(REDIRECT_TO_VIEW_FUNDS); status.setComplete(); } else if (result.hasErrors()) { modelAndView.setViewName(FORM_VIEW); modelAndView.addObject("previewView", previewView); } else {/*from w ww . j a v a 2 s .c om*/ modelAndView.setViewName(previewView); modelAndView.addObject("formBean", formBean); } return modelAndView; }