Search in sources :

Example 1 with FundCodeDto

use of org.mifos.accounts.fund.servicefacade.FundCodeDto in project head by mifos.

the class LoanAccountServiceFacadeWebTier method translateFundCodeToDto.

private FundCodeDto translateFundCodeToDto(FundCodeEntity fundCode) {
    FundCodeDto fundCodeDto = new FundCodeDto();
    fundCodeDto.setId(Short.toString(fundCode.getFundCodeId()));
    fundCodeDto.setValue(fundCode.getFundCodeValue());
    return fundCodeDto;
}
Also used : FundCodeDto(org.mifos.accounts.fund.servicefacade.FundCodeDto)

Example 2 with FundCodeDto

use of org.mifos.accounts.fund.servicefacade.FundCodeDto in project head by mifos.

the class NewFundPreviewController method processFormSubmit.

@RequestMapping(method = RequestMethod.POST)
public ModelAndView processFormSubmit(@RequestParam(value = EDIT_PARAM, required = false) String edit, @RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("formBean") FundFormBean formBean, BindingResult result, SessionStatus status) {
    ModelAndView mav = new ModelAndView(REDIRECT_TO_ADMIN_SCREEN);
    if (StringUtils.isNotBlank(edit)) {
        mav = new ModelAndView("editFunds");
        mav.addObject("formBean", formBean);
        mav.addObject("previewView", "newFundPreview");
    } else if (StringUtils.isNotBlank(cancel)) {
        mav = new ModelAndView(REDIRECT_TO_VIEW_FUNDS);
        status.setComplete();
    } else if (result.hasErrors()) {
        mav = new ModelAndView("newFundPreview");
    } else {
        FundCodeDto codeDto = new FundCodeDto();
        codeDto.setId(formBean.getCodeId());
        codeDto.setValue(formBean.getCodeValue());
        FundDto fundDto = new FundDto();
        fundDto.setCode(codeDto);
        fundDto.setId(formBean.getId());
        fundDto.setName(formBean.getName());
        try {
            this.fundServiceFacade.createFund(fundDto);
            status.setComplete();
        } catch (BusinessRuleException e) {
            ObjectError error = new ObjectError("formBean", new String[] { e.getMessageKey() }, new Object[] {}, "default: ");
            result.addError(error);
            mav.setViewName("newFundPreview");
            mav.addObject("formBean", formBean);
        }
    }
    return mav;
}
Also used : BusinessRuleException(org.mifos.service.BusinessRuleException) ObjectError(org.springframework.validation.ObjectError) ModelAndView(org.springframework.web.servlet.ModelAndView) FundDto(org.mifos.accounts.fund.servicefacade.FundDto) FundCodeDto(org.mifos.accounts.fund.servicefacade.FundCodeDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with FundCodeDto

use of org.mifos.accounts.fund.servicefacade.FundCodeDto in project head by mifos.

the class DefineNewFundController method retrieveFundCodeOptionMap.

private Map<String, String> retrieveFundCodeOptionMap() {
    List<FundCodeDto> codeList = this.fundServiceFacade.getFundCodes();
    Map<String, String> codeMap = new LinkedHashMap<String, String>();
    for (FundCodeDto fundCode : codeList) {
        codeMap.put(fundCode.getId(), fundCode.getValue());
    }
    return codeMap;
}
Also used : FundCodeDto(org.mifos.accounts.fund.servicefacade.FundCodeDto) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

FundCodeDto (org.mifos.accounts.fund.servicefacade.FundCodeDto)3 LinkedHashMap (java.util.LinkedHashMap)1 FundDto (org.mifos.accounts.fund.servicefacade.FundDto)1 BusinessRuleException (org.mifos.service.BusinessRuleException)1 ObjectError (org.springframework.validation.ObjectError)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1