use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class SystemUserSearchController method displaySystemUsers.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView displaySystemUsers(ModelMap model) {
ModelAndView mav = new ModelAndView("viewSystemUsers");
SystemUserSearchFormBean formBean = (SystemUserSearchFormBean) model.get("searchResults");
SystemUserSearchResultsDto result = (SystemUserSearchResultsDto) model.get("pagedResults");
if (result == null) {
List<UserDetailDto> pagedUserDetails = new ArrayList<UserDetailDto>();
result = new SystemUserSearchResultsDto(0, 0, 0, 0, pagedUserDetails);
formBean = new SystemUserSearchFormBean();
}
mav.addObject("searchResults", formBean);
mav.addObject("pagedResults", result);
return mav;
}
use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class SystemUserSearchController method processSearch.
@RequestMapping(method = RequestMethod.POST)
public ModelAndView processSearch(@RequestParam(required = false, value = "next") String next, @RequestParam(required = false, value = "previous") String previous, @RequestParam(required = false, value = "searchbutton") String newSearch, @RequestParam(required = false, value = "lastSearch") String lastSearchTerm, @RequestParam(required = true, value = "lastPage") Integer lastPage, @ModelAttribute("searchResults") SystemUserSearchFormBean searchResultsFormBean) {
int startingPage = lastPage;
if (StringUtils.isNotBlank(next)) {
startingPage++;
searchResultsFormBean.setSearch(lastSearchTerm);
} else if (StringUtils.isNotBlank(previous)) {
startingPage--;
searchResultsFormBean.setSearch(lastSearchTerm);
} else if (StringUtils.isNotBlank(newSearch)) {
startingPage = 1;
}
if (startingPage <= 0) {
startingPage = 1;
}
UserSearchDto searchDto = new UserSearchDto(searchResultsFormBean.getSearch(), startingPage, 10);
SystemUserSearchResultsDto dto = this.personnelServiceFacade.searchUser(searchDto);
ModelAndView mav = new ModelAndView("redirect:/viewSystemUsers.ftl");
mav.addObject("searchResults", searchResultsFormBean);
mav.addObject("pagedResults", dto);
return mav;
}
use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class UncaughtExceptionController method handleException.
@RequestMapping("/uncaughtException.ftl")
public ModelAndView handleException(HttpServletRequest request) {
// http://java.sun.com/developer/technicalArticles/Servlets/servletapi2.3
Object obj = request.getAttribute("javax.servlet.error.exception");
Throwable cause = null;
if (obj != null) {
cause = (Throwable) obj;
}
String requestUri = request.getRequestURI();
logger.error("Uncaught exception while accessing '" + requestUri + "'", cause);
ModelAndView mm = new ModelAndView();
mm.setViewName("uncaughtException");
mm.addObject("uncaughtException", cause);
mm.addObject("requestUri", requestUri);
if (cause != null) {
Writer result = new StringWriter();
cause.printStackTrace(new PrintWriter(result));
mm.addObject("stackString", result.toString());
}
return mm;
}
use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class ViewCustomerDetailsController method showLastPaymentReceipt.
@RequestMapping(value = "/printClientPaymentReceipt", method = RequestMethod.GET)
public ModelAndView showLastPaymentReceipt(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String globalAccountNum) {
ModelAndView modelAndView = new ModelAndView("printClientPaymentReceipt");
String gan = null;
if (globalAccountNum == null) {
gan = request.getSession().getAttribute("globalAccountNum").toString();
} else {
gan = globalAccountNum;
}
String clientSystemId = request.getParameter("globalCustNum");
AccountPaymentDto clientAccountPayment = clientServiceFacade.getClientAccountPayments(gan).get(0);
List<AdminDocumentDto> adminDocuments = adminDocumentsServiceFacade.getAdminDocumentsForAccountPayment(clientAccountPayment.getPaymentId());
if (adminDocuments != null && !adminDocuments.isEmpty()) {
clientAccountPayment.setAdminDocuments(adminDocuments);
}
modelAndView.addObject("clientAccountPayment", clientAccountPayment);
modelAndView.addObject("globalAccountNum", gan);
modelAndView.addObject("clientSystemId", clientSystemId);
return modelAndView;
}
use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.
the class EditOfficeInformationController method populateForm.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView populateForm(HttpServletRequest request) {
ModelAndView modelAndView = new ModelAndView();
Short officeId = officeServiceFacade.retrieveOfficeById(Short.parseShort(request.getParameter("officeLevelId"))).getLevelId();
OfficeDto officeDto = officeServiceFacade.retrieveOfficeById(Short.parseShort(request.getParameter("officeLevelId")));
OfficeFormBean formBean = new OfficeFormBean();
if (officeDto.getAddress() != null) {
formBean.setCity(officeDto.getAddress().getCity());
formBean.setCountry(officeDto.getAddress().getCountry());
formBean.setLine1(officeDto.getAddress().getLine1());
formBean.setLine2(officeDto.getAddress().getLine2());
formBean.setLine3(officeDto.getAddress().getLine3());
formBean.setZip(officeDto.getAddress().getZip());
formBean.setPhoneNumber(officeDto.getAddress().getPhoneNumber());
formBean.setState(officeDto.getAddress().getState());
}
if (officeDto.getCustomFields() != null) {
formBean.setCustomFields(officeDto.getCustomFields());
}
formBean.setGlobalNum(officeDto.getGlobalNum());
formBean.setId(officeDto.getId());
formBean.setLevelId(officeDto.getLevelId().toString());
formBean.setLookupNameKey(officeDto.getLookupNameKey());
formBean.setName(officeDto.getName());
formBean.setOfficeLevelName(officeDto.getOfficeLevelName());
formBean.setOfficeShortName(officeDto.getOfficeShortName());
formBean.setOfficeStatusName(officeDto.getOfficeStatusName());
if (officeDto.getLevelId() != 1) {
formBean.setParentId(officeDto.getParentId().toString());
formBean.setParentOfficeName(officeDto.getParentOfficeName());
}
formBean.setSearchId(officeDto.getSearchId());
formBean.setStatusId(officeDto.getStatusId().toString());
formBean.setVersionNum(officeDto.getVersionNum());
modelAndView.addObject("officeFormBean", formBean);
modelAndView.addObject("parentOffices", getParentDetails(officeId.toString()));
modelAndView.addObject("view", "disable");
modelAndView.addObject("officeTypes", getOfficeTypes(officeDto.getLevelId().toString()));
modelAndView.addObject("showError", "false");
return modelAndView;
}
Aggregations