use of org.mifos.customers.office.persistence.OfficePersistence in project head by mifos.
the class TestObjectFactory method createCenter.
public static CenterBO createCenter(final String customerName, final MeetingBO meeting, final Short officeId, final Short personnelId, final List<FeeDto> fees) {
CenterBO center;
try {
center = new CenterBO(TestUtils.makeUserWithLocales(), customerName, null, null, fees, null, null, new OfficePersistence().getOffice(officeId), meeting, ApplicationContextProvider.getBean(LegacyPersonnelDao.class).getPersonnel(personnelId), new CustomerPersistence());
new CenterPersistence().saveCenter(center);
StaticHibernateUtil.flushSession();
} catch (Exception e) {
throw new RuntimeException(e);
}
return center;
}
use of org.mifos.customers.office.persistence.OfficePersistence in project head by mifos.
the class TestObjectFactory method generateOfficeGlobalNo.
private static String generateOfficeGlobalNo() throws OfficeException {
try {
/*
* TODO: Why not auto-increment? Fetching the max and adding one would seem to have a race condition.
*/
String officeGlobelNo = String.valueOf(new OfficePersistence().getMaxOfficeId().intValue() + 1);
if (officeGlobelNo.length() > 4) {
throw new OfficeException(OfficeConstants.MAXOFFICELIMITREACHED);
}
StringBuilder temp = new StringBuilder("");
for (int i = officeGlobelNo.length(); i < 4; i++) {
temp.append("0");
}
return officeGlobelNo = temp.append(officeGlobelNo).toString();
} catch (PersistenceException e) {
throw new OfficeException(e);
}
}
use of org.mifos.customers.office.persistence.OfficePersistence in project head by mifos.
the class ConfigurationIntegrationTest method testHeadOfficeConfiguration.
@Test
public void testHeadOfficeConfiguration() throws Exception {
OfficeBO headOffice = new OfficePersistence().getHeadOffice();
OfficeConfig officeConfig = configuration.getOfficeConfig(headOffice.getOfficeId());
assertForAccountConfig(officeConfig.getAccountConfig());
}
use of org.mifos.customers.office.persistence.OfficePersistence in project head by mifos.
the class GroupPersistenceIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
this.officePersistence = new OfficePersistence();
this.centerPersistence = new CenterPersistence();
this.groupPersistence = new GroupPersistence();
initializeStatisticsService();
}
use of org.mifos.customers.office.persistence.OfficePersistence in project head by mifos.
the class AddGroupMembershipActionStrutsTest method createAndSetClientInSession.
private void createAndSetClientInSession() throws Exception {
OfficeBO office = new OfficePersistence().getOffice(TestObjectFactory.HEAD_OFFICE);
PersonnelBO personnel = legacyPersonnelDao.getPersonnel(PersonnelConstants.TEST_USER);
meeting = getMeeting();
ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), 1, "Client", "", "1", "");
clientNameDetailDto.setNames(ClientRules.getNameSequence());
ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), 1, "first", "middle", "last", "secondLast");
spouseNameDetailView.setNames(ClientRules.getNameSequence());
ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
client = new ClientBO(TestUtils.makeUser(), clientNameDetailDto.getDisplayName(), CustomerStatus.fromInt(new Short("1")), null, null, new Address(), getCustomFields(), null, null, personnel, office, meeting, personnel, new java.util.Date(), null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
legacyClientDao.saveClient(client);
StaticHibernateUtil.flushSession();
client = TestObjectFactory.getClient(Integer.valueOf(client.getCustomerId()).intValue());
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, client, request);
}
Aggregations