Search in sources :

Example 1 with ReportCategoryDto

use of org.mifos.dto.domain.ReportCategoryDto 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 ReportCategoryDto

use of org.mifos.dto.domain.ReportCategoryDto 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 ReportCategoryDto

use of org.mifos.dto.domain.ReportCategoryDto in project head by mifos.

the class AdminServiceFacadeWebTier method retrieveReportCategories.

@Override
public List<ReportCategoryDto> retrieveReportCategories() {
    List<ReportCategoryDto> reportCategories = new ArrayList<ReportCategoryDto>();
    List<ReportsCategoryBO> allCategories = new ReportsPersistence().getAllReportCategories();
    for (ReportsCategoryBO category : allCategories) {
        reportCategories.add(category.toDto());
    }
    return reportCategories;
}
Also used : ReportsPersistence(org.mifos.reports.persistence.ReportsPersistence) ReportCategoryDto(org.mifos.dto.domain.ReportCategoryDto) ReportsCategoryBO(org.mifos.reports.business.ReportsCategoryBO) ArrayList(java.util.ArrayList)

Example 4 with ReportCategoryDto

use of org.mifos.dto.domain.ReportCategoryDto in project head by mifos.

the class ReportsCategoryPreviewController method processFormSubmit.

@RequestMapping(method = RequestMethod.POST)
public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @RequestParam(value = "EDIT", required = false) String edit, @RequestParam(value = "editFormView", required = true) String editFormView, @ModelAttribute("reportCategory") @Valid ReportCategoryFormBean reportCategoryFormBean, BindingResult result, SessionStatus status) {
    ModelAndView modelAndView = new ModelAndView(REDIRECT_TO_LIST_OF_REPORT_CATEGORIES);
    if (StringUtils.isNotBlank(cancel)) {
        modelAndView.setViewName(REDIRECT_TO_LIST_OF_REPORT_CATEGORIES);
        status.setComplete();
    } else if (StringUtils.isNotBlank(edit)) {
        modelAndView.setViewName(editFormView);
    } else if (result.hasErrors()) {
        modelAndView.setViewName("defineReportCategory");
        modelAndView.addObject("reportCategory", reportCategoryFormBean);
    } else {
        //            if (editFormView.equals("editReportCategory")) {
        //                ReportCategoryDto reportCategory = new ReportCategoryDto(null, reportCategoryFormBean.getName());
        //                adminServiceFacade.updateReportCategory(reportCategory);
        //            } else {
        ReportCategoryDto reportCategory = new ReportCategoryDto(null, reportCategoryFormBean.getName());
        adminServiceFacade.createReportsCategory(reportCategory);
    //            }
    }
    return modelAndView;
}
Also used : ReportCategoryDto(org.mifos.dto.domain.ReportCategoryDto) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ReportCategoryDto (org.mifos.dto.domain.ReportCategoryDto)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ModelAttribute (org.springframework.web.bind.annotation.ModelAttribute)2 ArrayList (java.util.ArrayList)1 ReportsCategoryBO (org.mifos.reports.business.ReportsCategoryBO)1 ReportsPersistence (org.mifos.reports.persistence.ReportsPersistence)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1