use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class PentahoReportingController method executeReport.
@RequestMapping(value = "/execPentahoReport.ftl", method = RequestMethod.POST)
public ModelAndView executeReport(final HttpServletRequest request, HttpServletResponse response, @RequestParam(value = CANCEL_PARAM, required = false) String cancel, @Valid @ModelAttribute("pentahoReportFormBean") PentahoReportFormBean pentahoReportFormBean, BindingResult bindingResult) throws IOException {
if (!this.pentahoReportsService.checkAccessToReport(pentahoReportFormBean.getReportId())) {
throw new AccessDeniedException("Access denied");
}
ModelAndView mav = null;
Integer reportId = pentahoReportFormBean.getReportId();
if (StringUtils.isNotBlank(cancel)) {
mav = new ModelAndView("redirect:" + REPORTS_MAIN_URL);
} else if (bindingResult.hasErrors()) {
mav = new ModelAndView("viewPentahoReport");
initFormBean(pentahoReportFormBean, reportId, request);
} else {
Integer outputType = Integer.parseInt(pentahoReportFormBean.getOutputType());
Map<String, AbstractPentahoParameter> reportParams = pentahoReportFormBean.getAllParameteres();
PentahoReport report = this.pentahoReportsService.getReport(reportId, outputType, reportParams);
if (report.isInError()) {
for (PentahoValidationError error : report.getErrors()) {
addErrorToBindingResult(error, bindingResult);
}
mav = new ModelAndView("viewPentahoReport");
initFormBean(pentahoReportFormBean, reportId, request);
} else {
if (report.getContentType().equalsIgnoreCase("text/html")) {
HashMap<String, String> modelMap = new HashMap<String, String>();
modelMap.put("reportContent", new String(report.getContent()));
mav = new ModelAndView("viewHtmlReport", modelMap);
} else {
response.setHeader("Content-Disposition", "attachment; filename=\"" + report.getFilename() + "\"");
response.setContentType(report.getContentType());
response.setContentLength(report.getContentSize());
response.getOutputStream().write(report.getContent());
}
}
}
return mav;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class ViewEditLoanProductController method showLoanProductDetails.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView showLoanProductDetails(@RequestParam("productId") Integer productId) {
LoanProductRequest loanProductDetails = adminServiceFacade.retrieveLoanProductDetails(productId);
ModelAndView mav = new ModelAndView("viewEditLoanProduct");
mav.addObject("loanProductDetails", loanProductDetails);
return mav;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class ViewEditSavingsProductController method showSavingProductDetails.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView showSavingProductDetails(@RequestParam("productId") Integer productId) {
ModelAndView modelAndView = new ModelAndView("viewEditSavingsProduct");
AccountingConfigurationDto configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
modelAndView.addObject("savingsProductDetails", adminServiceFacade.retrieveSavingsProductDetails(productId));
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class ViewImportedTransactionFileController method viewImportedTransactions.
@RequestMapping("/viewImportedTransactions.ftl")
public ModelAndView viewImportedTransactions(@RequestParam(required = false) String fileName) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("viewImportedTransactions");
List<ImportedFileDto> importedFiles = this.importTransactionsServiceFacade.getImportedFiles();
List<ImportedFileDto> supportedFiles = new ArrayList<ImportedFileDto>();
for (ImportedFileDto importedFile : importedFiles) {
if (importedFile.getUndoable()) {
supportedFiles.add(importedFile);
}
}
modelAndView.addObject("importedFiles", supportedFiles);
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class ViewLoanAccountDetailsController method showLoanAccountDetails.
@RequestMapping(value = "/viewLoanAccountDetails", method = RequestMethod.GET)
public ModelAndView showLoanAccountDetails(HttpServletRequest request, HttpServletResponse response) throws ApplicationException {
ModelAndView modelAndView = new ModelAndView();
sitePreferenceHelper.resolveSiteType(modelAndView, "viewLoanAccountDetails", request);
modelAndView.addObject("include_page", new IncludePage(request, response));
String globalAccountNum = request.getParameter("globalAccountNum");
LoanInformationDto loanInformationDto = loanAccountServiceFacade.retrieveLoanInformation(globalAccountNum);
modelAndView.addObject("loanInformationDto", loanInformationDto);
boolean containsQGForCloseLoan = questionnaireServiceFacade.getQuestionGroupInstances(loanInformationDto.getAccountId(), "Close", "Loan").size() > 0;
modelAndView.addObject("containsQGForCloseLoan", containsQGForCloseLoan);
// for mifostabletag
List<LoanActivityDto> activities = loanInformationDto.getRecentAccountActivity();
for (LoanActivityDto activity : activities) {
activity.setUserPrefferedDate(DateFormatUtils.format(activity.getActionDate(), "dd/MM/yyyy", personnelServiceFacade.getUserPreferredLocale()));
}
request.getSession().setAttribute("recentAccountActivities", loanInformationDto.getRecentAccountActivity());
request.getSession().setAttribute("guarantyInformation", loanAccountServiceFacade.handleGuaranties(loanInformationDto));
//for GLIM
if (configurationServiceFacade.isGlimEnabled() && loanInformationDto.isGroup()) {
List<LoanAccountDetailsDto> loanAccountsDetails = loanAccountServiceFacade.retrieveLoanAccountDetails(loanInformationDto);
addEmptyBuisnessActivities(loanAccountsDetails);
modelAndView.addObject("loanAccountDetailsView");
request.setAttribute("loanAccountDetailsView", loanAccountsDetails);
}
modelAndView.addObject("backPageUrl", UrlHelper.constructCurrentPageUrl(request));
request.getSession().setAttribute("backPageUrl", request.getAttribute("currentPageUrl"));
loanAccountServiceFacade.putLoanBusinessKeyInSession(globalAccountNum, request);
return modelAndView;
}
Aggregations