Search in sources :

Example 1 with LoanPrdBusinessService

use of org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService in project head by mifos.

the class LoanPrdAction method loadMasterData.

private void loadMasterData(HttpServletRequest request) throws Exception {
    logger.debug("start Load master data method of Loan Product Action ");
    LoanPrdBusinessService service = new LoanPrdBusinessService();
    List<FeeBO> fees = feeDao.getAllAppllicableFeeForLoanCreation();
    List<PenaltyBO> penalties = penaltyDao.getAllAppllicablePenaltyForLoanCreation();
    Short localeId = getUserContext(request).getLocaleId();
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.LOANPRODUCTCATEGORYLIST, service.getActiveLoanProductCategories(), request);
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.LOANAPPLFORLIST, service.getLoanApplicableCustomerTypes(localeId), request);
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.LOANGRACEPERIODTYPELIST, legacyMasterDao.findMasterDataEntitiesWithLocale(GracePeriodTypeEntity.class), request);
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.INTERESTTYPESLIST, legacyMasterDao.findMasterDataEntitiesWithLocale(InterestTypesEntity.class), request);
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.INTCALCTYPESLIST, legacyMasterDao.findMasterDataEntitiesWithLocale(InterestCalcTypeEntity.class), request);
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.SRCFUNDSLIST, this.fundDao.findAllFunds(), request);
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.LOANFEESLIST, getFeeViewList(getUserContext(request), fees), request);
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.LOANPENALTIESLIST, getPenaltyViewList(penalties), request);
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.LOANPRICIPALGLCODELIST, getGLCodes(FinancialActionConstants.PRINCIPALPOSTING, FinancialConstants.CREDIT), request);
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.LOANINTERESTGLCODELIST, getGLCodes(FinancialActionConstants.INTERESTPOSTING, FinancialConstants.CREDIT), request);
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.LOANPRDFEE, fees, request);
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.LOANPRDPENALTY, penalties, request);
    SessionUtils.setAttribute("GlNamesMode", AccountingRules.getGlNamesMode(), request);
    setQuestionGroupsOnSession(request, getQuestionnaireServiceFacade(request));
    logger.debug("Load master data method of Loan Product Action called");
}
Also used : InterestTypesEntity(org.mifos.application.master.business.InterestTypesEntity) PenaltyBO(org.mifos.accounts.penalties.business.PenaltyBO) InterestCalcTypeEntity(org.mifos.accounts.productdefinition.business.InterestCalcTypeEntity) LoanPrdBusinessService(org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService) FeeBO(org.mifos.accounts.fees.business.FeeBO) GracePeriodTypeEntity(org.mifos.accounts.productdefinition.business.GracePeriodTypeEntity)

Example 2 with LoanPrdBusinessService

use of org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService in project head by mifos.

the class LoanPrdAction method loadStatusList.

private void loadStatusList(HttpServletRequest request) throws Exception {
    logger.debug("start Load Status list method of Loan Product Action ");
    LoanPrdBusinessService service = (LoanPrdBusinessService) ServiceFactory.getInstance().getBusinessService(BusinessServiceName.LoanProduct);
    Short localeId = getUserContext(request).getLocaleId();
    SessionUtils.setCollectionAttribute(ProductDefinitionConstants.LOANPRDSTATUSLIST, service.getApplicablePrdStatus(localeId), request);
    logger.debug("Load Status list method of Loan Product Action called");
}
Also used : LoanPrdBusinessService(org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService)

Example 3 with LoanPrdBusinessService

use of org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService in project head by mifos.

the class AdminServiceFacadeWebTier method retrieveLoanProductFormReferenceData.

@Override
public LoanProductFormDto retrieveLoanProductFormReferenceData() {
    try {
        LoanPrdBusinessService service = new LoanPrdBusinessService();
        List<ListElement> productCategoryOptions = new ArrayList<ListElement>();
        List<ProductCategoryBO> productCategories = service.getActiveLoanProductCategories();
        for (ProductCategoryBO category : productCategories) {
            productCategoryOptions.add(new ListElement(category.getProductCategoryID().intValue(), category.getProductCategoryName()));
        }
        List<ListElement> applicableForOptions = new ArrayList<ListElement>();
        List<PrdApplicableMasterEntity> applicableCustomerTypes = this.loanProductDao.retrieveLoanApplicableProductCategories();
        for (PrdApplicableMasterEntity entity : applicableCustomerTypes) {
            applicableForOptions.add(new ListElement(entity.getId().intValue(), entity.getName()));
        }
        List<ListElement> gracePeriodTypeOptions = new ArrayList<ListElement>();
        List<GracePeriodTypeEntity> gracePeriodTypes = this.loanProductDao.retrieveGracePeriodTypes();
        for (GracePeriodTypeEntity gracePeriodTypeEntity : gracePeriodTypes) {
            gracePeriodTypeOptions.add(new ListElement(gracePeriodTypeEntity.getId().intValue(), gracePeriodTypeEntity.getName()));
        }
        List<ListElement> interestCalcTypesOptions = new ArrayList<ListElement>();
        List<InterestTypesEntity> interestCalcTypes = this.loanProductDao.retrieveInterestTypes();
        for (InterestTypesEntity entity : interestCalcTypes) {
            interestCalcTypesOptions.add(new ListElement(entity.getId().intValue(), entity.getName()));
        }
        List<ListElement> sourceOfFunds = new ArrayList<ListElement>();
        List<FundBO> funds = this.fundDao.findAllFunds();
        for (FundBO fund : funds) {
            sourceOfFunds.add(new ListElement(fund.getFundId().intValue(), fund.getFundName()));
        }
        List<ListElement> loanFee = new ArrayList<ListElement>();
        List<FeeBO> fees = feeDao.getAllAppllicableFeeForLoanCreation();
        for (FeeBO fee : fees) {
            loanFee.add(new ListElement(fee.getFeeId().intValue(), fee.getFeeName()));
        }
        List<ListElement> principalGlCodes = new ArrayList<ListElement>();
        List<GLCodeEntity> principalGlCodeEntities = new FinancialBusinessService().getGLCodes(FinancialActionConstants.PRINCIPALPOSTING, FinancialConstants.CREDIT);
        for (GLCodeEntity glCode : principalGlCodeEntities) {
            principalGlCodes.add(new ListElement(glCode.getGlcodeId().intValue(), glCode.getGlcode()));
        }
        List<ListElement> interestGlCodes = new ArrayList<ListElement>();
        List<GLCodeEntity> interestGlCodeEntities = new FinancialBusinessService().getGLCodes(FinancialActionConstants.INTERESTPOSTING, FinancialConstants.CREDIT);
        for (GLCodeEntity glCode : interestGlCodeEntities) {
            interestGlCodes.add(new ListElement(glCode.getGlcodeId().intValue(), glCode.getGlcode()));
        }
        List<ListElement> statusOptions = new ArrayList<ListElement>();
        List<PrdStatusEntity> applicableStatuses = service.getApplicablePrdStatus(Short.valueOf("1"));
        for (PrdStatusEntity entity : applicableStatuses) {
            statusOptions.add(new ListElement(entity.getOfferingStatusId().intValue(), entity.getPrdState().getName()));
        }
        boolean multiCurrencyEnabled = AccountingRules.isMultiCurrencyEnabled();
        List<ListElement> currencyOptions = new ArrayList<ListElement>();
        if (multiCurrencyEnabled) {
            LinkedList<MifosCurrency> currencies = AccountingRules.getCurrencies();
            for (MifosCurrency mifosCurrency : currencies) {
                currencyOptions.add(new ListElement(mifosCurrency.getCurrencyId().intValue(), mifosCurrency.getCurrencyCode()));
            }
        }
        return new LoanProductFormDto(productCategoryOptions, gracePeriodTypeOptions, sourceOfFunds, loanFee, principalGlCodes, interestGlCodes, interestCalcTypesOptions, applicableForOptions, statusOptions, currencyOptions, multiCurrencyEnabled);
    } catch (PersistenceException e) {
        throw new MifosRuntimeException(e);
    } catch (SystemException e) {
        throw new MifosRuntimeException(e);
    } catch (ApplicationException e) {
        throw new BusinessRuleException(e.getKey(), e);
    }
}
Also used : InterestTypesEntity(org.mifos.application.master.business.InterestTypesEntity) LoanPrdBusinessService(org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService) ArrayList(java.util.ArrayList) FinancialBusinessService(org.mifos.accounts.financial.business.service.FinancialBusinessService) LoanProductFormDto(org.mifos.dto.screen.LoanProductFormDto) BusinessRuleException(org.mifos.service.BusinessRuleException) SystemException(org.mifos.framework.exceptions.SystemException) GracePeriodTypeEntity(org.mifos.accounts.productdefinition.business.GracePeriodTypeEntity) MifosCurrency(org.mifos.application.master.business.MifosCurrency) ProductCategoryBO(org.mifos.accounts.productdefinition.business.ProductCategoryBO) FundBO(org.mifos.accounts.fund.business.FundBO) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) ApplicationException(org.mifos.framework.exceptions.ApplicationException) ListElement(org.mifos.dto.screen.ListElement) PersistenceException(org.mifos.framework.exceptions.PersistenceException) FeeBO(org.mifos.accounts.fees.business.FeeBO) PrdStatusEntity(org.mifos.accounts.productdefinition.business.PrdStatusEntity) PrdApplicableMasterEntity(org.mifos.accounts.productdefinition.business.PrdApplicableMasterEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 4 with LoanPrdBusinessService

use of org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService in project head by mifos.

the class QGFlowsServiceImpl method applyToAllLoanProducts.

@Override
public void applyToAllLoanProducts(Integer questionGroupId) throws SystemException {
    LoanPrdBusinessService loanPrdBusinessService = new LoanPrdBusinessService();
    try {
        List<LoanOfferingBO> offerings = loanPrdBusinessService.getAllLoanOfferings((short) 1);
        if (offerings.size() > 0) {
            QuestionGroupReference questionGroupReference = new QuestionGroupReference();
            questionGroupReference.setQuestionGroupId(questionGroupId);
            for (LoanOfferingBO offering : offerings) {
                offering.getQuestionGroups().add(questionGroupReference);
                offering.save();
            }
            StaticHibernateUtil.commitTransaction();
        }
    } catch (ServiceException e) {
        throw new SystemException(e);
    } catch (ProductDefinitionException e) {
        throw new SystemException(e);
    }
}
Also used : QuestionGroupReference(org.mifos.accounts.productdefinition.business.QuestionGroupReference) ServiceException(org.mifos.framework.exceptions.ServiceException) SystemException(org.mifos.framework.exceptions.SystemException) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) LoanPrdBusinessService(org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO)

Aggregations

LoanPrdBusinessService (org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService)4 FeeBO (org.mifos.accounts.fees.business.FeeBO)2 GracePeriodTypeEntity (org.mifos.accounts.productdefinition.business.GracePeriodTypeEntity)2 InterestTypesEntity (org.mifos.application.master.business.InterestTypesEntity)2 SystemException (org.mifos.framework.exceptions.SystemException)2 ArrayList (java.util.ArrayList)1 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)1 FinancialBusinessService (org.mifos.accounts.financial.business.service.FinancialBusinessService)1 FundBO (org.mifos.accounts.fund.business.FundBO)1 PenaltyBO (org.mifos.accounts.penalties.business.PenaltyBO)1 InterestCalcTypeEntity (org.mifos.accounts.productdefinition.business.InterestCalcTypeEntity)1 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)1 PrdApplicableMasterEntity (org.mifos.accounts.productdefinition.business.PrdApplicableMasterEntity)1 PrdStatusEntity (org.mifos.accounts.productdefinition.business.PrdStatusEntity)1 ProductCategoryBO (org.mifos.accounts.productdefinition.business.ProductCategoryBO)1 QuestionGroupReference (org.mifos.accounts.productdefinition.business.QuestionGroupReference)1 ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)1 MifosCurrency (org.mifos.application.master.business.MifosCurrency)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 ListElement (org.mifos.dto.screen.ListElement)1