Search in sources :

Example 6 with ModelAndView

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

the class UncaughtExceptionHandler method checkForPageJndiException.

private ModelAndView checkForPageJndiException(Exception ex, HttpServletRequest request) {
    if (ex instanceof JNDIException) {
        ModelAndView modelAndView = null;
        String viewName = determineViewName(ex, request);
        if (viewName != null) {
            modelAndView = getModelAndView(viewName, ex, request);
        }
        return modelAndView;
    }
    return null;
}
Also used : JNDIException(org.mifos.reports.pentaho.util.JNDIException) ModelAndView(org.springframework.web.servlet.ModelAndView)

Example 7 with ModelAndView

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

the class ApprovalController method list.

@RequestMapping("restApprovalList.ftl")
public ModelAndView list() {
    ModelAndView mav = new ModelAndView("approval/list");
    List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder().withLink("View REST Approval List", "").build();
    mav.addObject("isApprovalRequired", RESTConfigKey.isApprovalRequired(configurationServiceFacade));
    mav.addObject("breadcrumbs", breadcrumbs);
    mav.addObject("waitingForApprovalList", approvalService.getAllWaiting());
    mav.addObject("approvedList", approvalService.getAllNotWaiting());
    return mav;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) BreadCrumbsLinks(org.mifos.ui.core.controller.BreadCrumbsLinks) AdminBreadcrumbBuilder(org.mifos.ui.core.controller.AdminBreadcrumbBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with ModelAndView

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

the class ApprovalController method details.

@RequestMapping("restApproval/id-{id}/details.ftl")
public ModelAndView details(@PathVariable Long id) {
    ModelAndView mav = new ModelAndView("approval/details");
    mav.addObject("waitingForApprovalList", approvalService.getAllWaiting());
    RESTApprovalEntity approval = approvalService.getDetails(id);
    mav.addObject("approval", approval);
    PersonnelInformationDto p = personnelServiceFacade.getPersonnelInformationDto(approval.getCreatedBy().longValue(), null);
    mav.addObject("createdBy", p.getDisplayName());
    if (!approval.getState().equals(ApprovalState.WAITING)) {
        p = personnelServiceFacade.getPersonnelInformationDto(approval.getApprovedBy().longValue(), null);
        mav.addObject("approvedBy", p.getDisplayName());
    }
    return mav;
}
Also used : PersonnelInformationDto(org.mifos.dto.screen.PersonnelInformationDto) RESTApprovalEntity(org.mifos.rest.approval.domain.RESTApprovalEntity) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with ModelAndView

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

the class JSONAjaxController method deleteCacheDir.

@RequestMapping("jsonAjax.ftl")
public ModelAndView deleteCacheDir(HttpServletResponse response) {
    ModelAndView mav;
    if (TestMode.MAIN == testingService.getTestMode()) {
        response.setStatus(HttpServletResponse.SC_NOT_FOUND);
        mav = new ModelAndView("pageNotFound");
    } else {
        mav = new ModelAndView("jsonAjax");
    }
    return mav;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with ModelAndView

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

the class MonthClosingController method handleRequestInternal.

@RequestMapping(method = RequestMethod.GET)
public ModelAndView handleRequestInternal() {
    Map<String, Object> model = new HashMap<String, Object>();
    String monthClosingDateString = "-";
    if (monthClosingServiceFacade.getMonthClosingDate() != null) {
        monthClosingDateString = org.joda.time.format.DateTimeFormat.forStyle("S-").withLocale(Locale.getDefault()).print(new DateTime(monthClosingServiceFacade.getMonthClosingDate()));
    }
    model.put("currentDate", monthClosingDateString);
    Map<String, Object> status = new HashMap<String, Object>();
    List<String> errorMessages = new ArrayList<String>();
    status.put("errorMessages", errorMessages);
    ModelAndView modelAndView = new ModelAndView("monthClosing", "model", model);
    modelAndView.addObject("status", status);
    return modelAndView;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ModelAndView(org.springframework.web.servlet.ModelAndView) DateTime(org.joda.time.DateTime) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ModelAndView (org.springframework.web.servlet.ModelAndView)1573 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)668 Test (org.junit.jupiter.api.Test)195 Test (org.junit.Test)188 HashMap (java.util.HashMap)165 ArrayList (java.util.ArrayList)139 RedirectView (org.springframework.web.servlet.view.RedirectView)90 Map (java.util.Map)84 List (java.util.List)69 IOException (java.io.IOException)60 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 JSONView (com.intel.mountwilson.util.JSONView)34