use of org.mifos.dto.screen.ProductMixDetailsDto in project head by mifos.
the class AdminServiceFacadeWebTier method retrieveProductMixDetails.
@Override
public ProductMixDetailsDto retrieveProductMixDetails(Short prdOfferingId, String productType) {
try {
ProductMixBusinessService service = new ProductMixBusinessService();
PrdOfferingBO product = service.getPrdOfferingByID(prdOfferingId);
List<PrdOfferingBO> allowedPrdOfferingList = service.getAllowedPrdOfferingsByType(prdOfferingId.toString(), productType);
List<PrdOfferingBO> notAllowedPrdOfferingList = service.getNotAllowedPrdOfferingsByType(prdOfferingId.toString());
List<PrdOfferingDto> allowedPrdOfferingNames = new ArrayList<PrdOfferingDto>();
List<PrdOfferingDto> notAllowedPrdOfferingNames = new ArrayList<PrdOfferingDto>();
for (PrdOfferingBO prdOffering : allowedPrdOfferingList) {
allowedPrdOfferingNames.add(prdOffering.toDto());
}
for (PrdOfferingBO prdOffering : notAllowedPrdOfferingList) {
notAllowedPrdOfferingNames.add(prdOffering.toDto());
}
ProductMixDetailsDto dto = new ProductMixDetailsDto(prdOfferingId, product.getPrdOfferingName(), product.getPrdType().getProductTypeID(), allowedPrdOfferingNames, notAllowedPrdOfferingNames);
return dto;
} catch (ServiceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.dto.screen.ProductMixDetailsDto 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