Search in sources :

Example 1 with CustomerRecentActivityDto

use of org.mifos.dto.screen.CustomerRecentActivityDto in project head by mifos.

the class CenterServiceFacadeWebTier method retrieveAllAccountActivity.

@Override
public List<CustomerRecentActivityDto> retrieveAllAccountActivity(String globalCustNum) {
    List<CustomerRecentActivityDto> customerActivityViewList = new ArrayList<CustomerRecentActivityDto>();
    CustomerBO customerBO = this.customerDao.findCustomerBySystemId(globalCustNum);
    List<CustomerActivityEntity> customerActivityDetails = customerBO.getCustomerAccount().getCustomerActivitDetails();
    for (CustomerActivityEntity customerActivityEntity : customerActivityDetails) {
        customerActivityViewList.add(assembleCustomerActivityDto(customerActivityEntity, Locale.getDefault()));
    }
    return customerActivityViewList;
}
Also used : CustomerActivityEntity(org.mifos.customers.business.CustomerActivityEntity) ArrayList(java.util.ArrayList) CustomerBO(org.mifos.customers.business.CustomerBO) CustomerRecentActivityDto(org.mifos.dto.screen.CustomerRecentActivityDto)

Example 2 with CustomerRecentActivityDto

use of org.mifos.dto.screen.CustomerRecentActivityDto in project head by mifos.

the class CenterServiceFacadeWebTier method retrieveRecentActivities.

@Override
public List<CustomerRecentActivityDto> retrieveRecentActivities(Integer customerId, Integer countOfActivities) {
    CustomerBO customerBO = this.customerDao.findCustomerById(customerId);
    List<CustomerActivityEntity> customerActivityDetails = customerBO.getCustomerAccount().getCustomerActivitDetails();
    List<CustomerRecentActivityDto> customerActivityViewList = new ArrayList<CustomerRecentActivityDto>();
    int count = 0;
    for (CustomerActivityEntity customerActivityEntity : customerActivityDetails) {
        customerActivityViewList.add(getCustomerActivityView(customerActivityEntity));
        if (++count == countOfActivities) {
            break;
        }
    }
    return customerActivityViewList;
}
Also used : CustomerActivityEntity(org.mifos.customers.business.CustomerActivityEntity) ArrayList(java.util.ArrayList) CustomerBO(org.mifos.customers.business.CustomerBO) CustomerRecentActivityDto(org.mifos.dto.screen.CustomerRecentActivityDto)

Example 3 with CustomerRecentActivityDto

use of org.mifos.dto.screen.CustomerRecentActivityDto in project head by mifos.

the class CenterServiceFacadeWebTier method getCustomerActivityView.

private CustomerRecentActivityDto getCustomerActivityView(CustomerActivityEntity customerActivityEntity) {
    CustomerRecentActivityDto customerRecentActivityDto = new CustomerRecentActivityDto();
    String preferredDate = DateUtils.getUserLocaleDate(Locale.getDefault(), customerActivityEntity.getCreatedDate());
    customerRecentActivityDto.setUserPrefferedDate(preferredDate);
    customerRecentActivityDto.setActivityDate(customerActivityEntity.getCreatedDate());
    customerRecentActivityDto.setDescription(customerActivityEntity.getDescription());
    Money amount = removeSign(customerActivityEntity.getAmount());
    if (amount.isZero()) {
        customerRecentActivityDto.setAmount("-");
    } else {
        customerRecentActivityDto.setAmount(amount.toString());
    }
    if (customerActivityEntity.getPersonnel() != null) {
        customerRecentActivityDto.setPostedBy(customerActivityEntity.getPersonnel().getDisplayName());
    }
    return customerRecentActivityDto;
}
Also used : Money(org.mifos.framework.util.helpers.Money) CustomerRecentActivityDto(org.mifos.dto.screen.CustomerRecentActivityDto)

Example 4 with CustomerRecentActivityDto

use of org.mifos.dto.screen.CustomerRecentActivityDto in project head by mifos.

the class CenterServiceFacadeWebTier method assembleCustomerActivityDto.

private CustomerRecentActivityDto assembleCustomerActivityDto(CustomerActivityEntity customerActivityEntity, Locale locale) {
    CustomerRecentActivityDto customerRecentActivityDto = new CustomerRecentActivityDto();
    String preferredDate = DateUtils.getUserLocaleDate(locale, customerActivityEntity.getCreatedDate().toString());
    customerRecentActivityDto.setActivityDate(customerActivityEntity.getCreatedDate());
    customerRecentActivityDto.setUserPrefferedDate(preferredDate);
    customerRecentActivityDto.setDescription(customerActivityEntity.getDescription());
    Money amount = removeSign(customerActivityEntity.getAmount());
    if (amount.isZero()) {
        customerRecentActivityDto.setAmount("-");
    } else {
        customerRecentActivityDto.setAmount(amount.toString());
    }
    if (customerActivityEntity.getPersonnel() != null) {
        customerRecentActivityDto.setPostedBy(customerActivityEntity.getPersonnel().getDisplayName());
    }
    return customerRecentActivityDto;
}
Also used : Money(org.mifos.framework.util.helpers.Money) CustomerRecentActivityDto(org.mifos.dto.screen.CustomerRecentActivityDto)

Example 5 with CustomerRecentActivityDto

use of org.mifos.dto.screen.CustomerRecentActivityDto in project head by mifos.

the class CustomerHelpersIntegrationTest method testCustomerRecentActivityView.

@Test
public void testCustomerRecentActivityView() throws Exception {
    java.sql.Date sampleDate = new java.sql.Date(System.currentTimeMillis());
    CustomerRecentActivityDto customerRecentActivityDto = new CustomerRecentActivityDto(sampleDate, "description", "1000", "mifos");
    customerRecentActivityDto.setLocale(new Locale("1"));
    Assert.assertEquals("date", sampleDate, customerRecentActivityDto.getActivityDate());
    Assert.assertEquals("description", customerRecentActivityDto.getDescription());
    Assert.assertEquals("1000", customerRecentActivityDto.getAmount());
    Assert.assertEquals("mifos", customerRecentActivityDto.getPostedBy());
    Assert.assertEquals("1", customerRecentActivityDto.getLocale().toString());
}
Also used : Locale(java.util.Locale) CustomerRecentActivityDto(org.mifos.dto.screen.CustomerRecentActivityDto) Test(org.junit.Test)

Aggregations

CustomerRecentActivityDto (org.mifos.dto.screen.CustomerRecentActivityDto)6 CustomerBO (org.mifos.customers.business.CustomerBO)3 ArrayList (java.util.ArrayList)2 CustomerActivityEntity (org.mifos.customers.business.CustomerActivityEntity)2 Money (org.mifos.framework.util.helpers.Money)2 Locale (java.util.Locale)1 Test (org.junit.Test)1 ActionForwards (org.mifos.application.util.helpers.ActionForwards)1 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)1 CustomerAccountActionForm (org.mifos.customers.struts.actionforms.CustomerAccountActionForm)1 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)1