use of org.mifos.customers.business.CustomerStatusEntity in project head by mifos.
the class CenterServiceFacadeWebTier method initializeCenterStates.
@Override
public void initializeCenterStates(String centerGlobalNum) {
CenterBO center = this.customerDao.findCenterBySystemId(centerGlobalNum);
try {
List<ListElement> savingsStatesList = new ArrayList<ListElement>();
AccountStateMachines.getInstance().initializeCenterStates();
List<CustomerStatusEntity> statusList = AccountStateMachines.getInstance().getCenterStatusList(center.getCustomerStatus());
for (CustomerStatusEntity customerState : statusList) {
savingsStatesList.add(new ListElement(customerState.getId().intValue(), customerState.getName()));
}
} catch (StatesInitializationException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.customers.business.CustomerStatusEntity in project head by mifos.
the class CenterServiceFacadeWebTier method initializeGroupStates.
@Override
public void initializeGroupStates(String groupGlobalNum) {
GroupBO group = this.customerDao.findGroupBySystemId(groupGlobalNum);
try {
List<ListElement> savingsStatesList = new ArrayList<ListElement>();
AccountStateMachines.getInstance().initializeGroupStates();
List<CustomerStatusEntity> statusList = AccountStateMachines.getInstance().getGroupStatusList(group.getCustomerStatus());
for (CustomerStatusEntity customerState : statusList) {
savingsStatesList.add(new ListElement(customerState.getId().intValue(), customerState.getName()));
}
} catch (StatesInitializationException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.customers.business.CustomerStatusEntity in project head by mifos.
the class CustomerPersistence method retrieveAllCustomerStatusList.
public List<CustomerStatusEntity> retrieveAllCustomerStatusList(final Short levelId) throws PersistenceException {
Map<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put("LEVEL_ID", levelId);
List<CustomerStatusEntity> queryResult = executeNamedQuery(NamedQueryConstants.GET_CUSTOMER_STATUS_LIST, queryParameters);
for (CustomerStatusEntity customerStatus : queryResult) {
for (CustomerStatusFlagEntity customerStatusFlagEntity : customerStatus.getFlagSet()) {
Hibernate.initialize(customerStatusFlagEntity);
Hibernate.initialize(customerStatusFlagEntity.getNames());
}
Hibernate.initialize(customerStatus.getLookUpValue());
}
return queryResult;
}
use of org.mifos.customers.business.CustomerStatusEntity in project head by mifos.
the class EditCustomerStatusActionStrutsTest method testUpdateStatusForClientForActiveLoanOfficer.
@SuppressWarnings("unchecked")
@Test
public void testUpdateStatusForClientForActiveLoanOfficer() throws CustomerException, PageExpiredException {
createInitialObjects();
CustomerBOTestUtils.setCustomerStatus(client, new CustomerStatusEntity(CustomerStatus.CLIENT_PARTIAL.getValue()));
client.update();
StaticHibernateUtil.flushAndClearSession();
client = TestObjectFactory.getCustomer(client.getCustomerId());
setRequestPathInfo("/editCustomerStatusAction.do");
addRequestParameter("method", Methods.loadStatus.toString());
addRequestParameter("customerId", client.getCustomerId().toString());
actionPerform();
verifyForward(ActionForwards.loadStatus_success.toString());
Assert.assertNotNull(SessionUtils.getAttribute(SavingsConstants.STATUS_LIST, request));
Assert.assertEquals("Size of the status list should be 2", 2, ((List<AccountStateEntity>) SessionUtils.getAttribute(SavingsConstants.STATUS_LIST, request)).size());
setRequestPathInfo("/editCustomerStatusAction.do");
addRequestParameter("method", Methods.previewStatus.toString());
addRequestParameter("notes", "Test");
addRequestParameter("levelId", client.getCustomerLevel().getId().toString());
addRequestParameter("newStatusId", "3");
addRequestParameter("flagId", "");
actionPerform();
verifyForward(ActionForwards.previewStatus_success.toString());
verifyNoActionErrors();
verifyNoActionMessages();
Assert.assertNotNull(SessionUtils.getAttribute(SavingsConstants.NEW_STATUS_NAME, request));
Assert.assertNull("Since new Status is not Closed,so flag should be null.", SessionUtils.getAttribute(SavingsConstants.FLAG_NAME, request.getSession()));
setRequestPathInfo("/editCustomerStatusAction.do");
addRequestParameter("method", Methods.updateStatus.toString());
actionPerform();
verifyNoActionErrors();
verifyForward(ActionForwards.client_detail_page.toString());
client = TestObjectFactory.getCustomer(client.getCustomerId());
Assert.assertTrue(client.isActive());
cleanInitialObjects();
}
use of org.mifos.customers.business.CustomerStatusEntity in project head by mifos.
the class CustomerPersistenceIntegrationTest method testRetrieveAllLoanAccountUnderCustomer.
@Test
public void testRetrieveAllLoanAccountUnderCustomer() throws PersistenceException {
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
center = createCenter("center");
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
CenterBO center1 = createCenter("center1");
GroupBO group1 = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group1", CustomerStatus.GROUP_ACTIVE, center1);
client = TestObjectFactory.createClient("client1", CustomerStatus.CLIENT_ACTIVE, group);
ClientBO client2 = TestObjectFactory.createClient("client2", CustomerStatus.CLIENT_ACTIVE, group);
ClientBO client3 = TestObjectFactory.createClient("client3", CustomerStatus.CLIENT_ACTIVE, group1);
account = getLoanAccount(group, meeting, "cdfggdfs", "1qdd");
AccountBO account1 = getLoanAccount(client, meeting, "fdbdhgsgh", "54hg");
AccountBO account2 = getLoanAccount(client2, meeting, "fasdfdsfasdf", "1qwe");
AccountBO account3 = getLoanAccount(client3, meeting, "fdsgdfgfd", "543g");
AccountBO account4 = getLoanAccount(group1, meeting, "fasdf23", "3fds");
CustomerBOTestUtils.setCustomerStatus(client2, new CustomerStatusEntity(CustomerStatus.CLIENT_CLOSED));
TestObjectFactory.updateObject(client2);
client2 = TestObjectFactory.getClient(client2.getCustomerId());
CustomerBOTestUtils.setCustomerStatus(client3, new CustomerStatusEntity(CustomerStatus.CLIENT_CANCELLED));
TestObjectFactory.updateObject(client3);
client3 = TestObjectFactory.getClient(client3.getCustomerId());
List<AccountBO> loansForCenter = customerPersistence.retrieveAccountsUnderCustomer(center.getSearchId(), Short.valueOf("3"), Short.valueOf("1"));
Assert.assertEquals(3, loansForCenter.size());
List<AccountBO> loansForGroup = customerPersistence.retrieveAccountsUnderCustomer(group.getSearchId(), Short.valueOf("3"), Short.valueOf("1"));
Assert.assertEquals(3, loansForGroup.size());
List<AccountBO> loansForClient = customerPersistence.retrieveAccountsUnderCustomer(client.getSearchId(), Short.valueOf("3"), Short.valueOf("1"));
Assert.assertEquals(1, loansForClient.size());
}
Aggregations