use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class LoanProductPreviewController method showPopulatedForm.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView showPopulatedForm(@ModelAttribute("loanProduct") LoanProductFormBean loanProduct, @RequestParam(value = "editFormview", required = false) String editFormview) {
ModelAndView modelAndView = new ModelAndView("previewLoanProducts");
modelAndView.addObject("loanProduct", loanProduct);
modelAndView.addObject("editFormview", editFormview);
new ProductModelAndViewPopulator().populateModelAndViewForPreview(loanProduct, modelAndView);
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class AdminDocumentController method postDocument.
@RequestMapping(value = "/updateAdminDoc", method = RequestMethod.POST)
public ModelAndView postDocument(@ModelAttribute AdminDocumentFormBean formBean, BindingResult result) {
// if( result.hasErrors()) {
// System.out.println("BindingResult has errors!");
// } else {
// System.out.println("No BindingResult errors!");
// }
ModelAndView mav = new ModelAndView("updateAdminDoc");
mav.addObject("formBean", formBean);
return mav;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class AdminDocumentController method showDocument.
@RequestMapping(value = "/editAdminDocs", method = RequestMethod.GET)
public ModelAndView showDocument(HttpServletRequest request) {
Integer id = Integer.parseInt(request.getParameter("id"));
AdminDocumentDto document = findByDocId(id);
/*
* Since the DocumentDto is an immutable object. We would like to have
* a bean bound to the form that updates the document info. Basically don't want to
* change the DocumentDto object.
*
* TODO: Need to understand where AdminDocumentFormBean gets all it's data
* Some of it comes from AdminDocumentDto, but not all variables.
*
* Work In Progress.
*/
ModelAndView mav = new ModelAndView("editAdminDocs");
// Form Backed Object
AdminDocumentFormBean formBean = new AdminDocumentFormBean();
formBean.setAccountType("loan");
formBean.setName(document.getName());
formBean.setId(document.getId());
Map<String, String> accountType = accountTypeMap();
Map<String, String> showStatus = accountStatusMap(formBean.getAccountType());
mav.addObject("status", showStatus);
mav.addObject("accountType", accountType);
mav.addObject("formBean", formBean);
return mav;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class BatchjobsController method produceModelAndView.
private ModelAndView produceModelAndView(HttpServletRequest request, List<String> errorMessages) {
ServletContext context = request.getSession().getServletContext();
List<BatchjobsDto> batchjobs;
BatchjobsSchedulerDto batchjobsScheduler;
try {
batchjobs = batchjobsServiceFacade.getBatchjobs(context);
} catch (Exception tse) {
errorMessages.add("Error when retrieving batch jobs information: " + tse.getMessage());
batchjobs = new ArrayList<BatchjobsDto>();
}
try {
batchjobsScheduler = batchjobsServiceFacade.getBatchjobsScheduler(context);
} catch (Exception tse) {
errorMessages.add("Error when retrieving batch jobs information: " + tse.getMessage());
batchjobsScheduler = new BatchjobsSchedulerDto(false);
}
Map<String, Object> model = new HashMap<String, Object>();
model.put("request", request);
model.put("batchjobs", batchjobs);
if (batchjobsScheduler == null) {
model.put("scheduler", "");
} else {
model.put("scheduler", batchjobsScheduler.isStatus());
}
model.put("date0", new Date(0));
model.put("executedTasks", rawJobList);
if (rawJobList.length > 0) {
rawJobList = new String[0];
}
Map<String, Object> status = new HashMap<String, Object>();
status.put("errorMessages", errorMessages);
ModelAndView modelAndView = new ModelAndView("batchjobs", "model", model);
modelAndView.addObject("status", status);
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project head by mifos.
the class BatchjobsDetailsController method processFormSubmit.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView processFormSubmit(HttpServletRequest request) {
Map<String, Object> model = new HashMap<String, Object>();
List<String> errorMessages = new ArrayList<String>();
ServletContext context = request.getSession().getServletContext();
List<BatchjobsDto> batchjobs;
try {
batchjobs = batchjobsServiceFacade.getBatchjobs(context);
} catch (Exception tse) {
errorMessages.add("Error when retrieving batch jobs information: " + tse.getMessage());
batchjobs = new ArrayList<BatchjobsDto>();
}
model.put("batchjobs", batchjobs);
String[] jobFailNames = request.getParameterValues("jobFailName");
if (jobFailNames != null && jobFailNames.length > 0) {
model.put("jobFailName", jobFailNames[0]);
} else {
model.put("jobFailName", "");
}
Map<String, Object> status = new HashMap<String, Object>();
status.put("errorMessages", errorMessages);
ModelAndView modelAndView = new ModelAndView("batchjobsdetails", "model", model);
modelAndView.addObject("status", status);
return modelAndView;
}
Aggregations