Search in sources :

Example 1 with GroupPerformanceHistoryEntity

use of org.mifos.customers.group.business.GroupPerformanceHistoryEntity in project head by mifos.

the class LoanBO method updatePerformanceHistory.

private void updatePerformanceHistory(boolean accountReOpened) {
    if (accountReOpened && this.getCustomer().isClient()) {
        ClientPerformanceHistoryEntity clientHistory = (ClientPerformanceHistoryEntity) this.getCustomer().getPerformanceHistory();
        clientHistory.incrementNoOfActiveLoans();
        Money newLastLoanAmount = getlegacyLoanDao().findClientPerformanceHistoryLastLoanAmountWhenRepaidLoanAdjusted(this.getCustomer().getCustomerId(), this.getAccountId());
        clientHistory.setLastLoanAmount(newLastLoanAmount);
    }
    if (accountReOpened && this.getCustomer().isGroup()) {
        final GroupPerformanceHistoryEntity groupHistory = (GroupPerformanceHistoryEntity) this.getCustomer().getPerformanceHistory();
        Money newLastGroupLoanAmount = getlegacyLoanDao().findGroupPerformanceHistoryLastLoanAmountWhenRepaidLoanAdjusted(this.getCustomer().getCustomerId(), this.getAccountId());
        groupHistory.setLastGroupLoanAmount(newLastGroupLoanAmount);
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) GroupPerformanceHistoryEntity(org.mifos.customers.group.business.GroupPerformanceHistoryEntity) ClientPerformanceHistoryEntity(org.mifos.customers.client.business.ClientPerformanceHistoryEntity)

Example 2 with GroupPerformanceHistoryEntity

use of org.mifos.customers.group.business.GroupPerformanceHistoryEntity in project head by mifos.

the class CustomerBOIntegrationTest method testGroupPerformanceObject.

@Test
public void testGroupPerformanceObject() throws Exception {
    GroupPerformanceHistoryEntity groupPerformanceHistory = new GroupPerformanceHistoryEntity(Integer.valueOf("1"), new Money(getCurrency(), "23"), new Money(getCurrency(), "24"), new Money(getCurrency(), "26"), new Money(getCurrency(), "25"), new Money(getCurrency(), "27"));
    Assert.assertEquals(new Money(getCurrency(), "23"), groupPerformanceHistory.getLastGroupLoanAmount());
    Assert.assertEquals(new Money(getCurrency(), "27"), groupPerformanceHistory.getPortfolioAtRisk());
    Assert.assertEquals(1, groupPerformanceHistory.getClientCount().intValue());
}
Also used : Money(org.mifos.framework.util.helpers.Money) GroupPerformanceHistoryEntity(org.mifos.customers.group.business.GroupPerformanceHistoryEntity) Test(org.junit.Test)

Example 3 with GroupPerformanceHistoryEntity

use of org.mifos.customers.group.business.GroupPerformanceHistoryEntity in project head by mifos.

the class CustomerBOIntegrationTest method testGroupPerfObject.

@Test
public void testGroupPerfObject() throws PersistenceException {
    createInitialObjects();
    GroupPerformanceHistoryEntity groupPerformanceHistory = group.getGroupPerformanceHistory();
    GroupTestUtils.setLastGroupLoanAmount(groupPerformanceHistory, new Money(getCurrency(), "100"));
    TestObjectFactory.updateObject(group);
    StaticHibernateUtil.flushAndClearSession();
    group = (GroupBO) customerPersistence.findBySystemId(group.getGlobalCustNum(), group.getCustomerLevel().getId());
    Assert.assertEquals(group.getCustomerId(), group.getGroupPerformanceHistory().getGroup().getCustomerId());
    Assert.assertEquals(new Money(getCurrency(), "100"), group.getGroupPerformanceHistory().getLastGroupLoanAmount());
    StaticHibernateUtil.flushAndClearSession();
    center = TestObjectFactory.getCenter(center.getCustomerId());
    group = TestObjectFactory.getGroup(group.getCustomerId());
    client = TestObjectFactory.getClient(client.getCustomerId());
}
Also used : Money(org.mifos.framework.util.helpers.Money) GroupPerformanceHistoryEntity(org.mifos.customers.group.business.GroupPerformanceHistoryEntity) Test(org.junit.Test)

Aggregations

GroupPerformanceHistoryEntity (org.mifos.customers.group.business.GroupPerformanceHistoryEntity)3 Money (org.mifos.framework.util.helpers.Money)3 Test (org.junit.Test)2 ClientPerformanceHistoryEntity (org.mifos.customers.client.business.ClientPerformanceHistoryEntity)1