Search in sources :

Example 6 with GuarantyEntity

use of org.mifos.accounts.loan.business.GuarantyEntity in project head by mifos.

the class LoanAccountServiceFacadeWebTier method linkGuarantor.

public void linkGuarantor(Integer guarantorId, Integer loanId) {
    CustomerBO customerBO = this.customerDao.findCustomerById(guarantorId);
    if (customerBO == loanDao.findById(loanId).getCustomer()) {
        return;
    }
    transactionHelper.startTransaction();
    GuarantyEntity guaranty = new GuarantyEntity();
    guaranty.setGuarantorId(guarantorId);
    guaranty.setLoanId(loanId);
    guaranty.setState(true);
    genericDao.getSession().save(guaranty);
    try {
        transactionHelper.commitTransaction();
    } catch (Exception e) {
        transactionHelper.rollbackTransaction();
    }
}
Also used : GuarantyEntity(org.mifos.accounts.loan.business.GuarantyEntity) CustomerBO(org.mifos.customers.business.CustomerBO) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) BusinessRuleException(org.mifos.service.BusinessRuleException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) ServiceException(org.mifos.framework.exceptions.ServiceException) HibernateSearchException(org.mifos.framework.exceptions.HibernateSearchException) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) SystemException(org.mifos.framework.exceptions.SystemException) MifosRuntimeException(org.mifos.core.MifosRuntimeException) AccountException(org.mifos.accounts.exceptions.AccountException) PropertyNotFoundException(org.mifos.framework.exceptions.PropertyNotFoundException) ConfigurationException(org.mifos.config.exceptions.ConfigurationException) MeetingException(org.mifos.application.meeting.exceptions.MeetingException)

Example 7 with GuarantyEntity

use of org.mifos.accounts.loan.business.GuarantyEntity in project head by mifos.

the class LoanAccountServiceFacadeWebTier method unlinkGuaranty.

@Override
public void unlinkGuaranty(Integer guarantorId, Integer loanId) throws PersistenceException {
    transactionHelper.startTransaction();
    List<GuarantyEntity> guaranties = legacyAccountDao.getGuarantyByLoanIdAndGuarantorId(guarantorId, loanId);
    if (guaranties != null && guaranties.size() > 0) {
        for (GuarantyEntity en : guaranties) {
            genericDao.getSession().delete(en);
        }
    }
    try {
        transactionHelper.commitTransaction();
    } catch (Exception e) {
        transactionHelper.rollbackTransaction();
    }
}
Also used : GuarantyEntity(org.mifos.accounts.loan.business.GuarantyEntity) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) BusinessRuleException(org.mifos.service.BusinessRuleException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) ServiceException(org.mifos.framework.exceptions.ServiceException) HibernateSearchException(org.mifos.framework.exceptions.HibernateSearchException) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) SystemException(org.mifos.framework.exceptions.SystemException) MifosRuntimeException(org.mifos.core.MifosRuntimeException) AccountException(org.mifos.accounts.exceptions.AccountException) PropertyNotFoundException(org.mifos.framework.exceptions.PropertyNotFoundException) ConfigurationException(org.mifos.config.exceptions.ConfigurationException) MeetingException(org.mifos.application.meeting.exceptions.MeetingException)

Example 8 with GuarantyEntity

use of org.mifos.accounts.loan.business.GuarantyEntity in project head by mifos.

the class LoanAccountServiceFacadeWebTier method getGuarantorsByLoanId.

public List<CustomerDto> getGuarantorsByLoanId(Integer loanId) throws PersistenceException {
    List<CustomerDto> guarantors = new ArrayList<CustomerDto>();
    List<GuarantyEntity> guaranties = legacyAccountDao.getGuarantyByLoanId(loanId);
    for (GuarantyEntity guaranty : guaranties) {
        ClientBO guarantor = customerDao.findClientById(guaranty.getGuarantorId());
        CustomerDto customerDto = new CustomerDto(guarantor.getCustomerId(), guarantor.getClientName().getDisplayName(), guarantor.getGlobalCustNum(), null);
        guarantors.add(customerDto);
    }
    return guarantors;
}
Also used : GuarantyEntity(org.mifos.accounts.loan.business.GuarantyEntity) ClientBO(org.mifos.customers.client.business.ClientBO) ArrayList(java.util.ArrayList) CustomerDto(org.mifos.dto.domain.CustomerDto)

Aggregations

GuarantyEntity (org.mifos.accounts.loan.business.GuarantyEntity)8 ArrayList (java.util.ArrayList)4 AccountException (org.mifos.accounts.exceptions.AccountException)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 PersistenceException (org.mifos.framework.exceptions.PersistenceException)4 LoanBO (org.mifos.accounts.loan.business.LoanBO)3 MeetingException (org.mifos.application.meeting.exceptions.MeetingException)3 ConfigurationException (org.mifos.config.exceptions.ConfigurationException)3 HibernateSearchException (org.mifos.framework.exceptions.HibernateSearchException)3 PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)3 PropertyNotFoundException (org.mifos.framework.exceptions.PropertyNotFoundException)3 ServiceException (org.mifos.framework.exceptions.ServiceException)3 StatesInitializationException (org.mifos.framework.exceptions.StatesInitializationException)3 SystemException (org.mifos.framework.exceptions.SystemException)3 BusinessRuleException (org.mifos.service.BusinessRuleException)3 CustomerBO (org.mifos.customers.business.CustomerBO)2 ClientBO (org.mifos.customers.client.business.ClientBO)2 AccountBO (org.mifos.accounts.business.AccountBO)1 CustomerAccountSummaryDto (org.mifos.dto.domain.CustomerAccountSummaryDto)1 CustomerAddressDto (org.mifos.dto.domain.CustomerAddressDto)1