use of org.mifos.customers.business.CustomerBO in project head by mifos.
the class CustomerPersistenceIntegrationTest method testGetChildernOtherThanClosedAndCancelled.
@Test
public void testGetChildernOtherThanClosedAndCancelled() throws Exception {
CustomerPersistence customerPersistence = new CustomerPersistence();
center = createCenter();
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group1", CustomerStatus.GROUP_ACTIVE, center);
client = TestObjectFactory.createClient("client1", CustomerStatus.CLIENT_ACTIVE, group);
ClientBO client2 = TestObjectFactory.createClient("client2", CustomerStatus.CLIENT_CLOSED, group);
ClientBO client3 = TestObjectFactory.createClient("client3", CustomerStatus.CLIENT_CANCELLED, group);
ClientBO client4 = TestObjectFactory.createClient("client4", CustomerStatus.CLIENT_PENDING, group);
List<CustomerBO> customerList = customerPersistence.getChildren(center.getSearchId(), center.getOffice().getOfficeId(), CustomerLevel.CLIENT, ChildrenStateType.OTHER_THAN_CANCELLED_AND_CLOSED);
Assert.assertEquals(new Integer("2").intValue(), customerList.size());
for (CustomerBO customer : customerList) {
if (customer.getCustomerId().equals(client4.getCustomerId())) {
Assert.assertTrue(true);
}
}
// TestObjectFactory.cleanUp(client2);
// TestObjectFactory.cleanUp(client3);
// TestObjectFactory.cleanUp(client4);
}
use of org.mifos.customers.business.CustomerBO 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.customers.business.CustomerBO 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.customers.business.CustomerBO in project head by mifos.
the class CollectionSheetServiceFacadeWebTier method getCollectionSheet.
@Override
public CollectionSheetDto getCollectionSheet(Integer customerId, LocalDate meetingDate) {
MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(mifosUser);
CustomerBO customerBO = this.customerDao.findCustomerById(customerId);
try {
personnelDao.checkAccessPermission(userContext, customerBO.getOfficeId(), customerBO.getLoanOfficerId());
} catch (AccountException e) {
throw new MifosRuntimeException("Access denied!", e);
}
return collectionSheetService.retrieveCollectionSheet(customerId, meetingDate);
}
use of org.mifos.customers.business.CustomerBO in project head by mifos.
the class CenterServiceFacadeWebTier method retrieveCustomerNote.
@Override
public CustomerNoteFormDto retrieveCustomerNote(String globalCustNum) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
CustomerBO customer = this.customerDao.findCustomerBySystemId(globalCustNum);
PersonnelBO loggedInUser = this.personnelDao.findPersonnelById(userContext.getId());
Integer customerLevel = customer.getCustomerLevel().getId().intValue();
String globalNum = customer.getGlobalCustNum();
String displayName = customer.getDisplayName();
LocalDate commentDate = new LocalDate();
String commentUser = loggedInUser.getDisplayName();
return new CustomerNoteFormDto(globalNum, displayName, customerLevel, commentDate, commentUser, "");
}
Aggregations