use of org.mifos.customers.office.persistence.OfficePersistence in project head by mifos.
the class CenterPersistenceIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
officePersistence = new OfficePersistence();
centerPersistence = new CenterPersistence();
initializeStatisticsService();
}
use of org.mifos.customers.office.persistence.OfficePersistence in project head by mifos.
the class TestObjectFactory method createClient.
public static ClientBO createClient(final String customerName, final CustomerStatus status, final CustomerBO parentCustomer, final Date startDate) {
ClientBO client;
Short personnel = PersonnelConstants.SYSTEM_USER;
try {
ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.MAYBE_CLIENT.getValue(), SAMPLE_SALUTATION, customerName, "", customerName, "");
clientNameDetailDto.setNames(ClientRules.getNameSequence());
ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), SAMPLE_SALUTATION, customerName, "middle", customerName, "secondLast");
ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
// groups
if (null == parentCustomer) {
client = new // UserContext
ClientBO(// UserContext
TestUtils.makeUserWithLocales(), // String
clientNameDetailDto.getDisplayName(), // CustomerStatus
status, // String externalId
null, // Date mfiJoiningDate
null, // Address
null, // List<CustomFieldDto> customFields
null, // List<FeeDto> fees
getFees(), // List<SavingsOfferingBO> offeringsSelected
null, // Short
getPersonnel(personnel), // Short
new OfficePersistence().getOffice(SAMPLE_BRANCH_OFFICE), // MeetingBO
null, // Short loanOfficerId
null, // Date dateOfBirth
null, // String governmentId
"", // Short trained
null, // Date trainedDate
null, // Short groupFlag
YesNoFlag.NO.getValue(), // ClientNameDetailDto
clientNameDetailDto, // ClientNameDetailDto
spouseNameDetailView, // ClientPersonalDetailDto
clientPersonalDetailDto, // InputStream picture
null);
} else {
client = new ClientBO(TestUtils.makeUserWithLocales(), clientNameDetailDto.getDisplayName(), status, null, null, null, null, getFees(), null, getPersonnel(personnel), parentCustomer.getOffice(), parentCustomer, null, null, null, null, YesNoFlag.YES.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto);
}
ApplicationContextProvider.getBean(LegacyClientDao.class).saveClient(client);
StaticHibernateUtil.flushSession();
} catch (Exception e) {
throw new RuntimeException(e);
}
return client;
}
use of org.mifos.customers.office.persistence.OfficePersistence in project head by mifos.
the class TestObjectFactory method createClient.
public static ClientBO createClient(final String customerName, final CustomerStatus status, final CustomerBO parentCustomer, final List<FeeDto> fees, final String governmentId, final Date dateOfBirth, final Address address) {
ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(132, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
ClientNameDetailDto clientNameDetailDto = clientNameView(NameType.CLIENT, customerName);
ClientNameDetailDto spouseNameDetailView = clientNameView(NameType.SPOUSE, customerName);
ClientBO client;
try {
client = new ClientBO(TestUtils.makeUserWithLocales(), customerName, status, null, null, address, null, fees, null, getPersonnel(PersonnelConstants.SYSTEM_USER), new OfficePersistence().getOffice(SAMPLE_BRANCH_OFFICE), parentCustomer, dateOfBirth, governmentId, null, null, YesNoFlag.YES.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto);
ApplicationContextProvider.getBean(LegacyClientDao.class).saveClient(client);
} catch (CustomerException e) {
throw new RuntimeException(e);
} catch (PersistenceException e) {
throw new RuntimeException(e);
}
StaticHibernateUtil.flushSession();
return client;
}
use of org.mifos.customers.office.persistence.OfficePersistence in project head by mifos.
the class TestObjectFactory method createClient.
public static ClientBO createClient(final String customerName, final MeetingBO meeting, final CustomerStatus status) {
ClientBO client;
try {
PersonnelBO systemUser = getPersonnel(PersonnelConstants.SYSTEM_USER);
ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), SAMPLE_SALUTATION, customerName, "middle", customerName, "secondLast");
clientNameDetailDto.setNames(ClientRules.getNameSequence());
ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), SAMPLE_SALUTATION, customerName, "middle", customerName, "secondLast");
ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
client = new ClientBO(TestUtils.makeUserWithLocales(), clientNameDetailDto.getDisplayName(), status, null, null, null, null, getFees(), null, systemUser, new OfficePersistence().getOffice(SAMPLE_BRANCH_OFFICE), meeting, systemUser, new DateTimeService().getCurrentJavaDateTime(), null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
ApplicationContextProvider.getBean(LegacyClientDao.class).saveClient(client);
StaticHibernateUtil.flushSession();
} catch (Exception e) {
throw new RuntimeException(e);
}
return client;
}
use of org.mifos.customers.office.persistence.OfficePersistence in project head by mifos.
the class TestObjectFactory method createOffice.
public static OfficeBO createOffice(final OfficeLevel level, final OfficeBO parentOffice, final String officeName, final String shortName) throws Exception {
OfficeBO officeBO = new OfficeBO(TestUtils.makeUserWithLocales(), level, parentOffice, null, officeName, shortName, null, OperationMode.REMOTE_SERVER);
String searchId = generateSearchId(parentOffice);
officeBO.setSearchId(searchId);
String globalOfficeNum = generateOfficeGlobalNo();
officeBO.setGlobalOfficeNum(globalOfficeNum);
try {
StaticHibernateUtil.startTransaction();
new OfficePersistence().save(officeBO);
StaticHibernateUtil.commitTransaction();
} catch (Exception e) {
StaticHibernateUtil.rollbackTransaction();
throw new MifosRuntimeException(e);
} finally {
StaticHibernateUtil.closeSession();
}
return officeBO;
}
Aggregations