use of org.mifos.accounts.productdefinition.business.PrdOfferingBO in project head by mifos.
the class PrdOfferingPersistence method getPrdOfferingByID.
public PrdOfferingBO getPrdOfferingByID(Short prdId) throws PersistenceException {
logger.debug("getting the product offering by id :" + prdId);
HashMap<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put(ProductDefinitionConstants.PRODUCTID, Short.valueOf(prdId));
PrdOfferingBO prdOffring = (PrdOfferingBO) execUniqueResultNamedQuery(NamedQueryConstants.PRD_BYID, queryParameters);
return prdOffring;
}
use of org.mifos.accounts.productdefinition.business.PrdOfferingBO 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.productdefinition.business.PrdOfferingBO 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.productdefinition.business.PrdOfferingBO in project head by mifos.
the class AdminServiceFacadeWebTier method retrieveNotAllowedProductsForMix.
@Override
public List<PrdOfferingDto> retrieveNotAllowedProductsForMix(Integer productTypeId, Integer productId) {
try {
List<PrdOfferingDto> notAllowedProductDtos = new ArrayList<PrdOfferingDto>();
List<PrdOfferingBO> allowedProducts = new PrdOfferingPersistence().getNotAllowedPrdOfferingsForMixProduct(productId.toString(), productTypeId.toString());
for (PrdOfferingBO product : allowedProducts) {
notAllowedProductDtos.add(product.toDto());
}
return notAllowedProductDtos;
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.accounts.productdefinition.business.PrdOfferingBO in project head by mifos.
the class AdminServiceFacadeWebTier method retrieveAllowedProductsForMix.
@Override
public List<PrdOfferingDto> retrieveAllowedProductsForMix(Integer productTypeId, Integer productId) {
try {
List<PrdOfferingDto> allowedProductDtos = new ArrayList<PrdOfferingDto>();
List<PrdOfferingBO> allowedProducts = new PrdOfferingPersistence().getAllowedPrdOfferingsForMixProduct(productId.toString(), productTypeId.toString());
for (PrdOfferingBO product : allowedProducts) {
allowedProductDtos.add(product.toDto());
}
return allowedProductDtos;
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
Aggregations