use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class AccountBOIntegrationTest method testGetAllInstallments.
@Test
public void testGetAllInstallments() {
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
CenterBO centerBO = TestObjectFactory.createWeeklyFeeCenter("Center_Active", meeting);
StaticHibernateUtil.flushAndClearSession();
centerBO = TestObjectFactory.getCenter(centerBO.getCustomerId());
List<AccountActionDateEntity> allInstallments = centerBO.getCustomerAccount().getAllInstallments();
Assert.assertNotNull(allInstallments);
Assert.assertEquals(10, allInstallments.size());
centerBO = null;
}
use of org.mifos.customers.center.business.CenterBO 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.center.business.CenterBO in project head by mifos.
the class CustomerPersistence method findBySystemId.
/**
* @deprecated use {@link CustomerDao#findCenterBySystemId(String)}.
*/
@Deprecated
public CustomerBO findBySystemId(final String globalCustNum, final Short levelId) throws PersistenceException {
Map<String, String> queryParameters = new HashMap<String, String>();
CustomerBO customer = null;
queryParameters.put("globalCustNum", globalCustNum);
if (levelId.shortValue() == CustomerLevel.CENTER.getValue()) {
List<CenterBO> queryResult = executeNamedQuery(NamedQueryConstants.GET_CENTER_BY_SYSTEMID, queryParameters);
if (null != queryResult && queryResult.size() > 0) {
customer = queryResult.get(0);
initializeCustomer(customer);
}
} else if (levelId.shortValue() == CustomerLevel.GROUP.getValue()) {
List<GroupBO> queryResult = executeNamedQuery(NamedQueryConstants.GET_GROUP_BY_SYSTEMID, queryParameters);
if (null != queryResult && queryResult.size() > 0) {
customer = queryResult.get(0);
initializeCustomer(customer);
}
} else if (levelId.shortValue() == CustomerLevel.CLIENT.getValue()) {
List<ClientBO> queryResult = executeNamedQuery(NamedQueryConstants.GET_CLIENT_BY_SYSTEMID, queryParameters);
if (null != queryResult && queryResult.size() > 0) {
customer = queryResult.get(0);
initializeCustomer(customer);
}
}
return customer;
}
use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class CenterCustActionForm method validateFields.
/*
* Validation is done in the order that the fields appear on the UI.
*
* @see org.mifos.customers.struts.actionforms.CustomerActionForm#
* validateFields(javax.servlet.http.HttpServletRequest, java.lang.String)
*/
@Override
protected ActionErrors validateFields(HttpServletRequest request, String method) throws ApplicationException {
ActionErrors errors = new ActionErrors();
if (method.equals(Methods.preview.toString())) {
validateName(errors);
validateLO(errors);
validateMeeting(request, errors);
} else if (method.equals(Methods.editPreview.toString())) {
validateName(errors);
CenterBO center = (CenterBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
if (center.isActive()) {
validateLO(errors);
}
}
if (method.equals(Methods.preview.toString()) || method.equals(Methods.editPreview.toString())) {
validateMfiJoiningDate(request, errors);
validateConfigurableMandatoryFields(request, errors, EntityType.CENTER);
validateCustomFieldsForCustomers(request, errors);
}
// fees are only editable in preview and come last
if (method.equals(Methods.preview.toString())) {
validateFees(request, errors);
}
return errors;
}
use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class CenterCreationTest method createsCenterWithCustomerAccount.
@Test
public void createsCenterWithCustomerAccount() throws Exception {
// setup
OfficeBO withOffice = new OfficeBO(new Short("1"), "testOffice", new Integer("1"), new Short("1"));
CenterBO center = new CenterBuilder().withLoanOfficer(anyLoanOfficer()).with(withOffice).build();
center.setCustomerDao(customerDao);
List<AccountFeesEntity> accountFees = new ArrayList<AccountFeesEntity>();
// stub
CalendarEvent upcomingCalendarEvents = new CalendarEventBuilder().build();
when(holidayDao.findCalendarEventsForThisYearAndNext((short) 1)).thenReturn(upcomingCalendarEvents);
when(customerAccountFactory.create(center, accountFees, meeting, upcomingCalendarEvents)).thenReturn(customerAccount);
when(customerAccount.getType()).thenReturn(AccountTypes.CUSTOMER_ACCOUNT);
// exercise test
customerService.createCenter(center, meeting, accountFees);
// verification
assertThat(center.getCustomerAccount(), is(customerAccount));
}
Aggregations