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;
}
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;
}
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;
}
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;
}
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());
}
Aggregations