Search in sources :

Example 1 with ModelAttribute

use of org.springframework.web.bind.annotation.ModelAttribute in project head by mifos.

the class ReportsCategoryDeleteController method showEmptyForm.

@RequestMapping(method = RequestMethod.GET)
@ModelAttribute("reportCategory")
public ReportCategoryFormBean showEmptyForm(@RequestParam(value = "categoryId", required = true) Integer reportCategoryId) {
    ReportCategoryDto reportCategoryDetails = adminServiceFacade.retrieveReportCategory(reportCategoryId);
    ReportCategoryFormBean bean = new ReportCategoryFormBean();
    bean.setName(reportCategoryDetails.getName());
    return bean;
}
Also used : ReportCategoryDto(org.mifos.dto.domain.ReportCategoryDto) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with ModelAttribute

use of org.springframework.web.bind.annotation.ModelAttribute in project head by mifos.

the class ReportsCategoryEditController method showEmptyForm.

@RequestMapping(method = RequestMethod.GET)
@ModelAttribute("reportCategory")
public ReportCategoryFormBean showEmptyForm(@RequestParam(value = "categoryId", required = true) Integer reportCategoryId) {
    ReportCategoryDto reportCategoryDetails = adminServiceFacade.retrieveReportCategory(reportCategoryId);
    ReportCategoryFormBean bean = new ReportCategoryFormBean();
    bean.setName(reportCategoryDetails.getName());
    return bean;
}
Also used : ReportCategoryDto(org.mifos.dto.domain.ReportCategoryDto) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with ModelAttribute

use of org.springframework.web.bind.annotation.ModelAttribute in project head by mifos.

the class HomePageController method showPopulatedForm.

@RequestMapping(method = RequestMethod.GET)
@ModelAttribute("customerSearch")
public ModelAndView showPopulatedForm(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("customerSearch") CustomerSearchFormBean customerSearchFormBean) throws MifosException, PersistenceException {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    ModelAndView modelAndView = new ModelAndView();
    sitePreferenceHelper.resolveSiteType(modelAndView, "home", request);
    modelAndView.addObject("include_page", new IncludePage(request, response));
    Short userId = (short) user.getUserId();
    UserDetailDto userDetails = this.centerServiceFacade.retrieveUsersDetails(userId);
    modelAndView.addObject("customerSearch", customerSearchFormBean);
    boolean isCenterHierarchyExists = configurationServiceFacade.getBooleanConfig("ClientRules.CenterHierarchyExists");
    modelAndView.addObject("isCenterHierarchyExists", isCenterHierarchyExists);
    if (sitePreferenceHelper.isMobile(request)) {
        List<ValueListElement> availibleClientGenders = clientServiceFacade.getClientGenders();
        modelAndView.addObject("availibleClientGenders", availibleClientGenders);
        HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
        customerStates.putAll(customerSearchServiceFacade.getAvailibleCustomerStates());
        modelAndView.addObject("availibleCustomerStates", customerStates);
    }
    if (userDetails.isLoanOfficer()) {
        loadLoanOfficerCustomersHierarchyForSelectedDay(userId, modelAndView, customerSearchFormBean);
        modelAndView.addObject("isLoanOfficer", true);
    } else {
        modelAndView.addObject("isLoanOfficer", false);
    }
    return modelAndView;
}
Also used : CustomerStatusDetailDto(org.mifos.dto.screen.CustomerStatusDetailDto) HashMap(java.util.HashMap) ModelAndView(org.springframework.web.servlet.ModelAndView) ArrayList(java.util.ArrayList) MifosUser(org.mifos.security.MifosUser) UserDetailDto(org.mifos.dto.domain.UserDetailDto) IncludePage(freemarker.ext.servlet.IncludePage) ValueListElement(org.mifos.dto.domain.ValueListElement) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with ModelAttribute

use of org.springframework.web.bind.annotation.ModelAttribute in project head by mifos.

the class LoanProductChangeLogController method showAllAuditLogsForSavingsProducts.

@ModelAttribute("auditLog")
@RequestMapping(method = RequestMethod.GET)
public AuditLogScreenDto showAllAuditLogsForSavingsProducts(@RequestParam(value = "productId", required = true) Integer productId) {
    LoanProductRequest productDetails = adminServiceFacade.retrieveLoanProductDetails(productId);
    List<AuditLogDto> auditLogRecords = adminServiceFacade.retrieveLoanProductAuditLogs(productId);
    return new AuditLogScreenDto(productDetails.getProductDetails().getId(), productDetails.getProductDetails().getName(), productDetails.getProductDetails().getCreatedDateFormatted(), auditLogRecords);
}
Also used : AuditLogScreenDto(org.mifos.dto.screen.AuditLogScreenDto) AuditLogDto(org.mifos.dto.domain.AuditLogDto) LoanProductRequest(org.mifos.dto.domain.LoanProductRequest) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with ModelAttribute

use of org.springframework.web.bind.annotation.ModelAttribute in project head by mifos.

the class AcceptedPaymentTypesController method showPopulatedForm.

@RequestMapping(method = RequestMethod.GET)
@ModelAttribute("acceptedPaymentTypesBean")
public AcceptedPaymentTypesBean showPopulatedForm() {
    AcceptedPaymentTypeDto acceptedPaymentTypeDto = adminServiceFacade.retrieveAcceptedPaymentTypes();
    AcceptedPaymentTypesBean paymentTypes = populateAcceptedPaymentTypesBean(acceptedPaymentTypeDto);
    return paymentTypes;
}
Also used : AcceptedPaymentTypeDto(org.mifos.dto.domain.AcceptedPaymentTypeDto) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ModelAttribute (org.springframework.web.bind.annotation.ModelAttribute)59 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)19 IOException (java.io.IOException)7 Valid (javax.validation.Valid)6 RequestMethod (org.springframework.web.bind.annotation.RequestMethod)6 SimpleDateFormat (java.text.SimpleDateFormat)5 LinkedHashMap (java.util.LinkedHashMap)5 HttpSession (javax.servlet.http.HttpSession)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 Sort (org.springframework.data.domain.Sort)5 FileNotFoundException (java.io.FileNotFoundException)4 DateFormat (java.text.DateFormat)4 java.util (java.util)4 Callable (java.util.concurrent.Callable)4 ExecutionException (java.util.concurrent.ExecutionException)4 ExecutorService (java.util.concurrent.ExecutorService)4 Executors (java.util.concurrent.Executors)4 Future (java.util.concurrent.Future)4 TimeUnit (java.util.concurrent.TimeUnit)4 PreDestroy (javax.annotation.PreDestroy)4