use of org.mifos.dto.domain.ProductTypeDto in project head by mifos.
the class ProductMixAssembler method createFormBean.
public ProductMixFormBean createFormBean(List<ProductTypeDto> productTypes) {
ProductMixFormBean formBean = new ProductMixFormBean();
Map<String, String> productTypeOptions = new LinkedHashMap<String, String>();
for (ProductTypeDto productTypeDto : productTypes) {
productTypeOptions.put(productTypeDto.getProductTypeId().toString(), productTypeDto.getProductTypeKey());
}
formBean.setProductTypeOptions(productTypeOptions);
return formBean;
}
use of org.mifos.dto.domain.ProductTypeDto in project head by mifos.
the class DefineProductMixController method processFormSubmit.
@RequestMapping(method = RequestMethod.POST)
public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String canceBtn, @RequestParam(value = PREVIEW_PARAM, required = false) String previewBtn, @ModelAttribute("formBean") ProductMixFormBean formBean, BindingResult result, SessionStatus status) {
ModelAndView mav = new ModelAndView("defineProductMix");
ProductMixFormValidator formValidator = new ProductMixFormValidator();
if (StringUtils.isNotBlank(canceBtn)) {
mav = new ModelAndView(REDIRECT_TO_ADMIN_SCREEN);
status.setComplete();
}
if (StringUtils.isBlank(formBean.getProductTypeId())) {
List<ProductTypeDto> productTypes = this.adminServiceFacade.retrieveProductTypesApplicableToProductMix();
mav.addObject("formBean", productMixAssembler.createFormBean(productTypes));
validateForPreview(formValidator, formBean, result, previewBtn);
} else if (StringUtils.isNotBlank(formBean.getProductTypeId()) && StringUtils.isBlank(formBean.getProductId())) {
populateProductNameOptions(formBean);
validateForPreview(formValidator, formBean, result, previewBtn);
} else if (StringUtils.isNotBlank(formBean.getProductTypeId()) && StringUtils.isNotBlank(formBean.getProductId()) && (formBean.getAllowed() == null && formBean.getNotAllowed() == null)) {
populateAllowedNotAllowedOptions(formBean);
validateForPreview(formValidator, formBean, result, previewBtn);
} else {
checkAndFixFormStringArrys(formBean);
validateForPreview(formValidator, formBean, result, previewBtn);
ProductMixPreviewDto preview = this.productMixAssembler.createProductMixPreview(formBean);
mav = new ModelAndView("previewProductMix");
mav.addObject("ref", preview);
mav.addObject("formView", "defineProductMix");
}
return mav;
}
use of org.mifos.dto.domain.ProductTypeDto in project head by mifos.
the class AdminServiceFacadeWebTier method retrieveProductTypesApplicableToProductMix.
@Override
public List<ProductTypeDto> retrieveProductTypesApplicableToProductMix() {
List<ProductTypeDto> productTypes = new ArrayList<ProductTypeDto>();
productTypes.add(new ProductTypeDto(ProductType.LOAN.getValue().intValue(), "manageProduct.viewProductMix.loan"));
return productTypes;
}
use of org.mifos.dto.domain.ProductTypeDto in project head by mifos.
the class EditProductMixController method showEditForm.
@RequestMapping(method = RequestMethod.GET)
@ModelAttribute("formBean")
public ProductMixFormBean showEditForm(@RequestParam(value = "productId", required = true) Integer productId) {
List<ProductTypeDto> productTypes = this.adminServiceFacade.retrieveProductTypesApplicableToProductMix();
ProductMixFormBean formBean = productMixAssembler.createFormBean(productTypes);
formBean.setProductId(productId.toString());
formBean.setProductTypeId("1");
ProductMixDetailsDto productMixDetails = adminServiceFacade.retrieveProductMixDetails(productId.shortValue(), formBean.getProductTypeId());
Map<String, String> productNameOptions = new LinkedHashMap<String, String>();
productNameOptions.put(productMixDetails.getPrdOfferingId().toString(), productMixDetails.getPrdOfferingName());
formBean.setProductNameOptions(productNameOptions);
populateAllowedNotAllowedOptions(formBean, productMixDetails);
return formBean;
}
Aggregations