Search in sources :

Example 1 with ModelAndView

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

the class AccountingDataController method confirmExportsDelete.

@RequestMapping("confirmExportsDelete.ftl")
public final ModelAndView confirmExportsDelete() {
    ModelAndView mav = new ModelAndView("confirmExportsDelete");
    List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder().withLink("accounting.viewaccountingexports", "confirmExportsDelete.ftl").build();
    mav.addObject("breadcrumbs", breadcrumbs);
    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 2 with ModelAndView

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

the class AccountingDataController method showAccountingDataFor.

@RequestMapping("renderAccountingData.ftl")
public final ModelAndView showAccountingDataFor(@RequestParam(value = FROM_DATE) String paramFromDate, @RequestParam(value = TO_DATE) String paramToDate) {
    DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd");
    LocalDate fromDate = fmt.parseDateTime(paramFromDate).toLocalDate();
    LocalDate toDate = fmt.parseDateTime(paramToDate).toLocalDate();
    Boolean hasAlreadyRanQuery = Boolean.FALSE;
    String fileName = null;
    List<AccountingDto> accountingData = new ArrayList<AccountingDto>();
    try {
        fileName = accountingService.getExportOutputFileName(fromDate, toDate).replace(".xml", "");
        hasAlreadyRanQuery = accountingService.hasAlreadyRanQuery(fromDate, toDate);
        accountingData = accountingService.getExportDetails(fromDate, toDate);
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
    ModelAndView mav = new ModelAndView("renderAccountingData");
    List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder().withLink("accounting.viewaccountingexports", "renderAccountingDataCacheInfo.ftl").withLink(fileName, "").build();
    mav.addObject("breadcrumbs", breadcrumbs);
    mav.addObject("accountingData", accountingData);
    mav.addObject("hasAlreadyRanQuery", hasAlreadyRanQuery);
    mav.addObject("fileName", fileName);
    mav.addObject("fromDate", fromDate);
    mav.addObject("toDate", toDate);
    return mav;
}
Also used : ArrayList(java.util.ArrayList) ModelAndView(org.springframework.web.servlet.ModelAndView) BreadCrumbsLinks(org.mifos.ui.core.controller.BreadCrumbsLinks) AccountingDto(org.mifos.platform.accounting.AccountingDto) DateTimeFormatter(org.joda.time.format.DateTimeFormatter) LocalDate(org.joda.time.LocalDate) AdminBreadcrumbBuilder(org.mifos.ui.core.controller.AdminBreadcrumbBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with ModelAndView

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

the class AccountingDataController method generateList.

@RequestMapping("generateExportsList.ftl")
public final ModelAndView generateList(@RequestParam(value = LIST_START_DAY) Integer listStartDay, @RequestParam(value = "type") String type) {
    ModelAndView mav = new ModelAndView("generateExportsList");
    List<ExportFileInfo> exports = accountingService.getLastTenExports(listStartDay);
    mav.addObject("exports", exports);
    mav.addObject("size", listStartDay);
    return mav;
}
Also used : ExportFileInfo(org.mifos.platform.accounting.service.ExportFileInfo) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with ModelAndView

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

the class AccountingDataController method listAllExports.

@RequestMapping("renderAccountingDataCacheInfo.ftl")
public final ModelAndView listAllExports() {
    List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder().withLink("accounting.viewaccountingexports", "renderAccountingDataCacheInfo.ftl").build();
    ModelAndView mav = new ModelAndView("renderAccountingDataCacheInfo");
    mav.addObject("breadcrumbs", breadcrumbs);
    mav.addObject("numberDaysFromStartOfFinancialTransactions", accountingService.getNumberDaysFromStartOfFinancialTransactions());
    return mav;
}
Also used : BreadCrumbsLinks(org.mifos.ui.core.controller.BreadCrumbsLinks) ModelAndView(org.springframework.web.servlet.ModelAndView) AdminBreadcrumbBuilder(org.mifos.ui.core.controller.AdminBreadcrumbBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with ModelAndView

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

the class UncaughtExceptionHandler method checkForAccessDenied.

private ModelAndView checkForAccessDenied(Exception ex, HttpServletRequest request) {
    if (ex instanceof AccessDeniedException) {
        ModelAndView modelAndView = null;
        String viewName = determineViewName(ex, request);
        if (viewName != null) {
            modelAndView = getModelAndView(viewName, ex, request);
        }
        return modelAndView;
    }
    if (ex.getCause() != null && ex.getCause() instanceof Exception) {
        return checkForAccessDenied((Exception) ex.getCause(), request);
    }
    return null;
}
Also used : AccessDeniedException(org.springframework.security.access.AccessDeniedException) ModelAndView(org.springframework.web.servlet.ModelAndView) AccessDeniedException(org.springframework.security.access.AccessDeniedException) MaxUploadSizeExceededException(org.springframework.web.multipart.MaxUploadSizeExceededException) JNDIException(org.mifos.reports.pentaho.util.JNDIException) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) RESTCallInterruptException(org.mifos.rest.approval.service.RESTCallInterruptException) FlowExecutionRestorationFailureException(org.springframework.webflow.execution.repository.FlowExecutionRestorationFailureException)

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