use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class SavingsAccountController method showSavingsAccountRecentActivity.
@RequestMapping(value = "/viewSavingsAccountRecentActivity", method = RequestMethod.GET)
public ModelAndView showSavingsAccountRecentActivity(HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
sitePreferenceHelper.resolveSiteType(modelAndView, "viewSavingsAccountRecentActivity", request);
modelAndView.addObject("include_page", new IncludePage(request, response));
String globalAccountNum = request.getParameter("globalAccountNum");
SavingsAccountDetailDto savingsAccountDetailDto = savingsServiceFacade.retrieveSavingsAccountDetails(globalAccountNum);
modelAndView.addObject("savingsAccountDetailDto", savingsAccountDetailDto);
modelAndView.addObject("currentDate", new Date());
List<SavingsRecentActivityDto> recentActivity = this.savingsServiceFacade.retrieveRecentSavingsActivities(savingsAccountDetailDto.getAccountId().longValue());
request.setAttribute("recentActivityList", recentActivity);
savingsServiceFacade.putSavingsBusinessKeyInSession(globalAccountNum, request);
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class SavingsProductController method showAllSavingsProducts.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView showAllSavingsProducts() {
ModelAndView modelAndView = new ModelAndView("viewSavingsProducts");
List<ProductDisplayDto> productDto = adminServiceFacade.retrieveSavingsProducts();
modelAndView.addObject("products", productDto);
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class PreviewProductMixController method processFormSubmit.
@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 {
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;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class ProductCategoryPreviewController method processFormSubmit.
@RequestMapping(method = RequestMethod.POST)
public ModelAndView processFormSubmit(@RequestParam(value = EDIT_PARAM, required = false) String edit, @RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("formBean") ProductCategoryFormBean formBean, BindingResult result) {
String viewName = REDIRECT_TO_ADMIN_SCREEN;
ModelAndView modelAndView = new ModelAndView();
if (StringUtils.isNotBlank(edit)) {
viewName = "editCategoryInformation";
modelAndView.setViewName(viewName);
modelAndView.addObject("formBean", formBean);
modelAndView.addObject("breadcrumbs", new AdminBreadcrumbBuilder().withLink("admin.viewproductcategories", "viewProductCategories.ftl").withLink(formBean.getProductCategoryName(), "").build());
} else if (StringUtils.isNotBlank(cancel)) {
viewName = REDIRECT_TO_ADMIN_SCREEN;
modelAndView.setViewName(viewName);
} else if (result.hasErrors()) {
viewName = "categoryPreview";
modelAndView.setViewName(viewName);
modelAndView.addObject("formBean", formBean);
modelAndView.addObject("breadcrumbs", new AdminBreadcrumbBuilder().withLink("admin.viewproductcategories", "viewProductCategories.ftl").withLink(formBean.getProductCategoryName(), "").build());
} else {
Integer productStatusId = Integer.parseInt(formBean.getProductCategoryStatusId());
Integer productTypeId = Integer.parseInt(formBean.getProductTypeId());
CreateOrUpdateProductCategory productCategory = new CreateOrUpdateProductCategory(productTypeId.shortValue(), formBean.getProductCategoryName(), formBean.getProductCategoryDesc(), productStatusId.shortValue(), formBean.getGlobalPrdCategoryNum());
try {
this.adminServiceFacade.updateProductCategory(productCategory);
modelAndView.setViewName(REDIRECT_TO_ADMIN_SCREEN);
} catch (BusinessRuleException e) {
ObjectError error = new ObjectError("formBean", new String[] { e.getMessageKey() }, new Object[] {}, "default: ");
result.addError(error);
modelAndView.setViewName("categoryPreview");
modelAndView.addObject("formBean", formBean);
modelAndView.addObject("breadcrumbs", new AdminBreadcrumbBuilder().withLink("admin.viewproductcategories", "viewProductCategories.ftl").withLink(formBean.getProductCategoryName(), "").build());
}
}
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class ReportsCategoryDefineController method processFormSubmit.
@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 {
modelAndView.setViewName("redirect:/previewReportCategory.ftl");
modelAndView.addObject("reportCategory", reportCategory);
}
return modelAndView;
}
Aggregations