Search in sources :

Example 86 with RequestMapping

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;
}
Also used : UserDetailDto(org.mifos.dto.domain.UserDetailDto) ModelAndView(org.springframework.web.servlet.ModelAndView) ArrayList(java.util.ArrayList) SystemUserSearchResultsDto(org.mifos.dto.screen.SystemUserSearchResultsDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 87 with RequestMapping

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;
}
Also used : UserSearchDto(org.mifos.dto.domain.UserSearchDto) ModelAndView(org.springframework.web.servlet.ModelAndView) SystemUserSearchResultsDto(org.mifos.dto.screen.SystemUserSearchResultsDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 88 with RequestMapping

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;
}
Also used : StringWriter(java.io.StringWriter) ModelAndView(org.springframework.web.servlet.ModelAndView) PrintWriter(java.io.PrintWriter) StringWriter(java.io.StringWriter) Writer(java.io.Writer) PrintWriter(java.io.PrintWriter) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 89 with RequestMapping

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;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) AdminDocumentDto(org.mifos.dto.domain.AdminDocumentDto) AccountPaymentDto(org.mifos.dto.screen.AccountPaymentDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 90 with RequestMapping

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;
}
Also used : OfficeDto(org.mifos.dto.domain.OfficeDto) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1964 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)459 ModelAndView (org.springframework.web.servlet.ModelAndView)413 ApiOperation (io.swagger.annotations.ApiOperation)305 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)234 ArrayList (java.util.ArrayList)197 HashMap (java.util.HashMap)155 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)124 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)124 IOException (java.io.IOException)97 ResponseEntity (org.springframework.http.ResponseEntity)92 Date (java.util.Date)83 Aggregation (org.springframework.data.mongodb.core.aggregation.Aggregation)80 DBObject (com.mongodb.DBObject)71 BasicDBObject (com.mongodb.BasicDBObject)67 InputStream (java.io.InputStream)66 Aggregation.newAggregation (org.springframework.data.mongodb.core.aggregation.Aggregation.newAggregation)64 HttpServletResponse (javax.servlet.http.HttpServletResponse)59 User (org.hisp.dhis.user.User)59 List (java.util.List)53