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);
}
}
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);
}
}
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);
}
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;
}
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;
}
Aggregations