Search in sources :

Example 46 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project head by mifos.

the class DefineNewFundController method showPopulatedForm.

@RequestMapping(method = RequestMethod.GET)
public ModelAndView showPopulatedForm() {
    ModelAndView modelAndView = new ModelAndView();
    FundFormBean bean = new FundFormBean();
    modelAndView.setViewName("defineNewFund");
    modelAndView.addObject("formBean", bean);
    Map<String, String> codeMap = retrieveFundCodeOptionMap();
    modelAndView.addObject("code", codeMap);
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 47 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project head by mifos.

the class DefineNewFundController method showPreview.

@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 {
        modelAndView.setViewName("newFundPreview");
        Map<String, String> codeMap = retrieveFundCodeOptionMap();
        formBean.setCodeValue(codeMap.get(formBean.getCodeId()));
        modelAndView.addObject("formBean", formBean);
    }
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 48 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project head by mifos.

the class DefineNewOfficeController method populateForm.

@RequestMapping(method = RequestMethod.GET)
public ModelAndView populateForm(HttpServletRequest request, OfficeFormBean officeFormBean) {
    ModelAndView modelAndView = new ModelAndView("defineNewOffice");
    EditOfficeInformationController editOfficeInformationController = new EditOfficeInformationController(officeServiceFacade);
    if (StringUtils.isNotBlank(request.getParameter("levelId"))) {
        officeFormBean.setLevelId(request.getParameter("levelId"));
    }
    officeFormBean.setName("");
    officeFormBean.setLevelId("");
    officeFormBean.setOfficeShortName("");
    modelAndView.addObject("officeTypes", editOfficeInformationController.getOfficeTypes("new"));
    modelAndView.addObject("showError", "false");
    modelAndView.addObject("officeFormBean", officeFormBean);
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 49 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project head by mifos.

the class DefineNewPenaltyController method showForm.

@RequestMapping(method = RequestMethod.GET)
public ModelAndView showForm() {
    ModelAndView modelAndView = new ModelAndView("defineNewPenalty");
    PenaltyFormBean bean = new PenaltyFormBean();
    parametersDto = this.penaltyServiceFacade.getPenaltyParameters();
    configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
    modelAndView.addObject("formBean", bean);
    modelAndView.addObject("param", parametersDto);
    modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 50 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project head by mifos.

the class DashboardDetailsController method showBadStandingLoansDBDetails.

@RequestMapping(value = "/viewBadStandingLoansDBDetails", method = RequestMethod.GET)
public ModelAndView showBadStandingLoansDBDetails(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView modelAndView = getLoanModelAndView();
    List<DashboardDetailDto> loans = (List<DashboardDetailDto>) dashboardServiceFacade.getLoansInArrears(0, 10, null);
    modelAndView.addObject("totalSize", dashboardServiceFacade.countBadStandingLoans());
    modelAndView.addObject("dashboardDetails", loans);
    modelAndView.addObject("ajaxUrl", "badStandingLoansDBDetailsAjax.ftl");
    return modelAndView;
}
Also used : DashboardDetailDto(org.mifos.dto.domain.DashboardDetailDto) ModelAndView(org.springframework.web.servlet.ModelAndView) List(java.util.List) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ModelAndView (org.springframework.web.servlet.ModelAndView)1576 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)669 Test (org.junit.jupiter.api.Test)195 Test (org.junit.Test)188 HashMap (java.util.HashMap)166 ArrayList (java.util.ArrayList)140 RedirectView (org.springframework.web.servlet.view.RedirectView)90 Map (java.util.Map)85 List (java.util.List)69 IOException (java.io.IOException)62 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)60 Date (java.util.Date)57 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)50 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)49 MockHttpServletResponse (org.springframework.web.testfixture.servlet.MockHttpServletResponse)49 MockHttpServletRequest (org.springframework.web.testfixture.servlet.MockHttpServletRequest)47 GetMapping (org.springframework.web.bind.annotation.GetMapping)45 HandlerMethod (org.springframework.web.method.HandlerMethod)45 IPerson (org.apereo.portal.security.IPerson)43 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)35