Search in sources :

Example 1 with PrdOfferingDto

use of org.mifos.dto.domain.PrdOfferingDto 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 2 with PrdOfferingDto

use of org.mifos.dto.domain.PrdOfferingDto 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 3 with PrdOfferingDto

use of org.mifos.dto.domain.PrdOfferingDto in project head by mifos.

the class SavingsAction method getPrdOfferings.

@TransactionDemarcate(saveToken = true)
public ActionForward getPrdOfferings(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    SavingsActionForm savingsActionForm = ((SavingsActionForm) form);
    doCleanUp(savingsActionForm, request);
    Integer customerId = Integer.valueOf(savingsActionForm.getCustomerId());
    CustomerBO customer = this.customerDao.findCustomerById(customerId);
    SessionUtils.setAttribute(SavingsConstants.CLIENT, customer, request);
    List<PrdOfferingDto> savingPrds = this.savingsServiceFacade.retrieveApplicableSavingsProductsForCustomer(customerId);
    SessionUtils.setCollectionAttribute(SavingsConstants.SAVINGS_PRD_OFFERINGS, savingPrds, request);
    return mapping.findForward(AccountConstants.GET_PRDOFFERINGS_SUCCESS);
}
Also used : SavingsActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsActionForm) CustomerBO(org.mifos.customers.business.CustomerBO) PrdOfferingDto(org.mifos.dto.domain.PrdOfferingDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 4 with PrdOfferingDto

use of org.mifos.dto.domain.PrdOfferingDto in project head by mifos.

the class XlsSavingsAccountImporter method validateProductName.

private PrdOfferingDto validateProductName(String productName, CustomerBO customerBO, HSSFRow row, int currentCell) throws XlsParsingException {
    if (StringUtils.isBlank(productName)) {
        throw new XlsParsingException(getCellError(XlsMessageConstants.MISSING_PRODUCT_NAME, row, currentCell, null));
    }
    List<PrdOfferingDto> products = savingsProductDao.findSavingsProductByCustomerLevel(customerBO.getCustomerLevel());
    PrdOfferingDto foundProduct = null;
    for (PrdOfferingDto prdOfferingDto : products) {
        if (prdOfferingDto.getPrdOfferingName().equals(productName)) {
            foundProduct = prdOfferingDto;
            break;
        }
    }
    if (foundProduct == null) {
        List<Object> params = new ArrayList<Object>();
        params.add(productName);
        throw new XlsParsingException(getCellError(XlsMessageConstants.PRODUCT_NOT_FOUND, row, currentCell, params));
    }
    return foundProduct;
}
Also used : ArrayList(java.util.ArrayList) PrdOfferingDto(org.mifos.dto.domain.PrdOfferingDto) XlsParsingException(org.mifos.application.importexport.xls.XlsLoansAccountImporter.XlsParsingException)

Example 5 with PrdOfferingDto

use of org.mifos.dto.domain.PrdOfferingDto in project head by mifos.

the class SavingsServiceFacadeWebTier method retrieveApplicableSavingsProductsForCustomer.

@Override
public List<PrdOfferingDto> retrieveApplicableSavingsProductsForCustomer(Integer customerId) {
    List<PrdOfferingDto> applicableSavingsProducts = new ArrayList<PrdOfferingDto>();
    CustomerBO customer = this.customerDao.findCustomerById(customerId);
    applicableSavingsProducts = this.savingsProductDao.findSavingsProductByCustomerLevel(customer.getCustomerLevel());
    return applicableSavingsProducts;
}
Also used : ArrayList(java.util.ArrayList) PrdOfferingDto(org.mifos.dto.domain.PrdOfferingDto) CustomerBO(org.mifos.customers.business.CustomerBO)

Aggregations

PrdOfferingDto (org.mifos.dto.domain.PrdOfferingDto)19 ArrayList (java.util.ArrayList)10 CustomerBO (org.mifos.customers.business.CustomerBO)6 LinkedHashMap (java.util.LinkedHashMap)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 LocalDate (org.joda.time.LocalDate)3 PrdOfferingBO (org.mifos.accounts.productdefinition.business.PrdOfferingBO)3 PersistenceException (org.mifos.framework.exceptions.PersistenceException)3 BigDecimal (java.math.BigDecimal)2 Date (java.util.Date)2 Test (org.junit.Test)2 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)2 PrdOfferingPersistence (org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence)2 MeetingBO (org.mifos.application.meeting.business.MeetingBO)2 ClientBO (org.mifos.customers.client.business.ClientBO)2 CustomerDetailDto (org.mifos.dto.domain.CustomerDetailDto)2 LoanAccountDetailsDto (org.mifos.dto.domain.LoanAccountDetailsDto)2 ValueListElement (org.mifos.dto.domain.ValueListElement)2 LoanCreationProductDetailsDto (org.mifos.dto.screen.LoanCreationProductDetailsDto)2 MultipleLoanAccountDetailsDto (org.mifos.dto.screen.MultipleLoanAccountDetailsDto)2