use of org.mifos.accounts.productsmix.business.service.ProductMixBusinessService 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.accounts.productsmix.business.service.ProductMixBusinessService in project head by mifos.
the class AdminServiceFacadeWebTier method retrieveAllProductMix.
@Override
public ProductDto retrieveAllProductMix() {
try {
List<ProductCategoryBO> productCategoryList = new ProductCategoryBusinessService().getAllCategories();
List<PrdOfferingBO> prdOfferingList = new ProductMixBusinessService().getPrdOfferingMix();
List<ProductCategoryTypeDto> pcList = new ArrayList<ProductCategoryTypeDto>();
for (ProductCategoryBO pcBO : productCategoryList) {
ProductCategoryTypeDto pcDto = new ProductCategoryTypeDto(pcBO.getProductType().getProductTypeID(), pcBO.getProductType().getLookUpValue().getLookUpName());
pcList.add(pcDto);
}
List<ProductMixDto> pmList = new ArrayList<ProductMixDto>();
for (PrdOfferingBO poBO : prdOfferingList) {
ProductMixDto pmDto = new ProductMixDto(poBO.getPrdCategory().getProductType().getProductTypeID(), poBO.getPrdOfferingId(), poBO.getPrdType().getProductTypeID(), poBO.getPrdOfferingName());
pmList.add(pmDto);
}
ProductDto productDto = new ProductDto(pcList, pmList);
return productDto;
} catch (ServiceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.accounts.productsmix.business.service.ProductMixBusinessService in project head by mifos.
the class ProductMixValidatorIntegrationTest method testShouldReturnAllLoansIfNotGlim.
@Test
public void testShouldReturnAllLoansIfNotGlim() throws Exception {
expect(configServiceMock.isGlimEnabled()).andReturn(false);
replay(loanMock, customerMock, configServiceMock);
Assert.assertEquals(Arrays.asList(loanMock), new ProductMixValidator(configServiceMock, new ProductMixBusinessService()).getLoansToCheckAgainstProductMix(customerMock, Arrays.asList(loanMock)));
verify(loanMock, customerMock, configServiceMock);
}
Aggregations