Search in sources :

Example 1 with PrdOfferingBO

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;
}
Also used : HashMap(java.util.HashMap) PrdOfferingBO(org.mifos.accounts.productdefinition.business.PrdOfferingBO)

Example 2 with PrdOfferingBO

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);
    }
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) ProductMixBusinessService(org.mifos.accounts.productsmix.business.service.ProductMixBusinessService) PrdOfferingBO(org.mifos.accounts.productdefinition.business.PrdOfferingBO) ArrayList(java.util.ArrayList) PrdOfferingDto(org.mifos.dto.domain.PrdOfferingDto) ProductMixDetailsDto(org.mifos.dto.screen.ProductMixDetailsDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 3 with PrdOfferingBO

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);
    }
}
Also used : ProductCategoryBO(org.mifos.accounts.productdefinition.business.ProductCategoryBO) ProductMixBusinessService(org.mifos.accounts.productsmix.business.service.ProductMixBusinessService) ArrayList(java.util.ArrayList) ProductMixDto(org.mifos.dto.screen.ProductMixDto) ProductCategoryBusinessService(org.mifos.accounts.productdefinition.business.service.ProductCategoryBusinessService) ServiceException(org.mifos.framework.exceptions.ServiceException) PrdOfferingBO(org.mifos.accounts.productdefinition.business.PrdOfferingBO) ProductCategoryTypeDto(org.mifos.dto.screen.ProductCategoryTypeDto) ProductDto(org.mifos.dto.screen.ProductDto) SavingsProductDto(org.mifos.dto.domain.SavingsProductDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 4 with PrdOfferingBO

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);
    }
}
Also used : PrdOfferingPersistence(org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence) PrdOfferingBO(org.mifos.accounts.productdefinition.business.PrdOfferingBO) ArrayList(java.util.ArrayList) PersistenceException(org.mifos.framework.exceptions.PersistenceException) PrdOfferingDto(org.mifos.dto.domain.PrdOfferingDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 5 with PrdOfferingBO

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);
    }
}
Also used : PrdOfferingPersistence(org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence) PrdOfferingBO(org.mifos.accounts.productdefinition.business.PrdOfferingBO) ArrayList(java.util.ArrayList) PersistenceException(org.mifos.framework.exceptions.PersistenceException) PrdOfferingDto(org.mifos.dto.domain.PrdOfferingDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Aggregations

PrdOfferingBO (org.mifos.accounts.productdefinition.business.PrdOfferingBO)6 ArrayList (java.util.ArrayList)5 MifosRuntimeException (org.mifos.core.MifosRuntimeException)5 PrdOfferingPersistence (org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence)3 PrdOfferingDto (org.mifos.dto.domain.PrdOfferingDto)3 PersistenceException (org.mifos.framework.exceptions.PersistenceException)3 ServiceException (org.mifos.framework.exceptions.ServiceException)3 ProductMixBusinessService (org.mifos.accounts.productsmix.business.service.ProductMixBusinessService)2 HashMap (java.util.HashMap)1 DateTime (org.joda.time.DateTime)1 ProductCategoryBO (org.mifos.accounts.productdefinition.business.ProductCategoryBO)1 ProductCategoryBusinessService (org.mifos.accounts.productdefinition.business.service.ProductCategoryBusinessService)1 ProductMixBO (org.mifos.accounts.productsmix.business.ProductMixBO)1 SavingsProductDto (org.mifos.dto.domain.SavingsProductDto)1 ProductCategoryTypeDto (org.mifos.dto.screen.ProductCategoryTypeDto)1 ProductDto (org.mifos.dto.screen.ProductDto)1 ProductMixDetailsDto (org.mifos.dto.screen.ProductMixDetailsDto)1 ProductMixDto (org.mifos.dto.screen.ProductMixDto)1 ApplicationException (org.mifos.framework.exceptions.ApplicationException)1 SystemException (org.mifos.framework.exceptions.SystemException)1