Search in sources :

Example 71 with LoanOfferingBO

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

the class LegacyLoanDao method getLoanOffering.

public LoanOfferingBO getLoanOffering(final Short loanOfferingId, final Short localeId) throws PersistenceException {
    LoanOfferingBO loanOffering = getPersistentObject(LoanOfferingBO.class, loanOfferingId);
    if (loanOffering.getLoanOfferingFunds() != null && loanOffering.getLoanOfferingFunds().size() > 0) {
        for (LoanOfferingFundEntity loanOfferingFund : loanOffering.getLoanOfferingFunds()) {
            loanOfferingFund.getFund().getFundId();
            loanOfferingFund.getFund().getFundName();
        }
    }
    return loanOffering;
}
Also used : LoanOfferingFundEntity(org.mifos.accounts.productdefinition.business.LoanOfferingFundEntity) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO)

Example 72 with LoanOfferingBO

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

the class AdminServiceFacadeWebTier method createLoanProduct.

@Override
public PrdOfferingDto createLoanProduct(LoanProductRequest loanProductRequest) {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    LoanOfferingBO loanProduct = this.loanProductAssembler.fromDto(user, loanProductRequest);
    HibernateTransactionHelper transactionHelper = new HibernateTransactionHelperForStaticHibernateUtil();
    try {
        transactionHelper.startTransaction();
        this.loanProductDao.save(loanProduct);
        transactionHelper.commitTransaction();
        return loanProduct.toDto();
    } catch (Exception e) {
        transactionHelper.rollbackTransaction();
        throw new MifosRuntimeException(e);
    } finally {
        transactionHelper.closeSession();
    }
}
Also used : HibernateTransactionHelper(org.mifos.framework.hibernate.helper.HibernateTransactionHelper) HibernateTransactionHelperForStaticHibernateUtil(org.mifos.framework.hibernate.helper.HibernateTransactionHelperForStaticHibernateUtil) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) MifosUser(org.mifos.security.MifosUser) SystemException(org.mifos.framework.exceptions.SystemException) MifosRuntimeException(org.mifos.core.MifosRuntimeException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) BusinessRuleException(org.mifos.service.BusinessRuleException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) ServiceException(org.mifos.framework.exceptions.ServiceException) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 73 with LoanOfferingBO

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

the class AdminServiceFacadeWebTier method retrieveLoanProductDetails.

@Override
public LoanProductRequest retrieveLoanProductDetails(Integer productId) {
    LoanOfferingBO loanProduct = this.loanProductDao.findById(productId);
    boolean multiCurrencyEnabled = AccountingRules.isMultiCurrencyEnabled();
    LoanProductRequest productDetails = loanProduct.toFullDto();
    productDetails.setMultiCurrencyEnabled(multiCurrencyEnabled);
    return productDetails;
}
Also used : LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) LoanProductRequest(org.mifos.dto.domain.LoanProductRequest)

Example 74 with LoanOfferingBO

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

the class GroupPerformanceHistoryEntity method updateOnDisbursement.

public void updateOnDisbursement(LoanBO loan, Money disburseAmount) throws AccountException {
    LoanOfferingBO loanOffering = loan.getLoanOffering();
    updateLoanCounter(loanOffering, YesNoFlag.YES);
    try {
        if ((configService.isNewGlimEnabled() || configService.isGlimEnabled()) && loan.getAccountId() != null) {
            CollectionUtils.forAllDo(accountBusinessService.getCoSigningClientsForGlim(loan.getAccountId()), new UpdateClientPerfHistoryForGroupLoanOnDisbursement(loan));
        }
    } catch (ServiceException e) {
        throw new AccountException(e);
    }
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) AccountException(org.mifos.accounts.exceptions.AccountException) UpdateClientPerfHistoryForGroupLoanOnDisbursement(org.mifos.customers.group.business.GroupPerformanceHistoryUpdater.UpdateClientPerfHistoryForGroupLoanOnDisbursement) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO)

Example 75 with LoanOfferingBO

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

the class GroupLoanAccountServiceFacadeWebTier method assembleLoanAccountDetail.

private LoanAccountDetail assembleLoanAccountDetail(CreateGroupLoanAccount loanAccountInfo) {
    CustomerBO customer = this.customerDao.findCustomerById(loanAccountInfo.getGroupLoanAccountDetails().getCustomerId());
    LoanOfferingBO loanProduct = this.loanProductDao.findById(loanAccountInfo.getGroupLoanAccountDetails().getProductId());
    Money loanAmount = new Money(loanProduct.getCurrency(), loanAccountInfo.getGroupLoanAccountDetails().getLoanAmount());
    AccountState accountStateType = AccountState.fromShort(loanAccountInfo.getGroupLoanAccountDetails().getAccountState().shortValue());
    FundBO fund = null;
    if (loanAccountInfo.getGroupLoanAccountDetails().getSourceOfFundId() != null) {
        fund = this.fundDao.findById(loanAccountInfo.getGroupLoanAccountDetails().getSourceOfFundId().shortValue());
    }
    return new LoanAccountDetail(customer, loanProduct, loanAmount, accountStateType, fund);
}
Also used : Money(org.mifos.framework.util.helpers.Money) FundBO(org.mifos.accounts.fund.business.FundBO) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) CustomerBO(org.mifos.customers.business.CustomerBO) LoanAccountDetail(org.mifos.clientportfolio.newloan.domain.LoanAccountDetail) AccountState(org.mifos.accounts.util.helpers.AccountState)

Aggregations

LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)135 MeetingBO (org.mifos.application.meeting.business.MeetingBO)44 Date (java.util.Date)37 Test (org.junit.Test)37 ArrayList (java.util.ArrayList)26 Date (java.sql.Date)21 LoanBO (org.mifos.accounts.loan.business.LoanBO)18 LocalDate (org.joda.time.LocalDate)17 CustomerBO (org.mifos.customers.business.CustomerBO)12 LoanProductBuilder (org.mifos.domain.builders.LoanProductBuilder)11 UserContext (org.mifos.security.util.UserContext)9 ClientBuilder (org.mifos.domain.builders.ClientBuilder)8 Money (org.mifos.framework.util.helpers.Money)8 MifosUser (org.mifos.security.MifosUser)8 BusinessRuleException (org.mifos.service.BusinessRuleException)8 ProductCategoryBO (org.mifos.accounts.productdefinition.business.ProductCategoryBO)7 MifosRuntimeException (org.mifos.core.MifosRuntimeException)7 BigDecimal (java.math.BigDecimal)6 AccountException (org.mifos.accounts.exceptions.AccountException)6 FeeBO (org.mifos.accounts.fees.business.FeeBO)6