use of org.mifos.customers.persistence.CustomerPersistence 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.persistence.CustomerPersistence in project head by mifos.
the class ProcessFlowRulesIntegrationTest method testValidOverrideAgainstDb.
@Test
public void testValidOverrideAgainstDb() throws Exception {
CustomerPersistence cp = new CustomerPersistence();
CustomerStatusEntity cse = (CustomerStatusEntity) cp.loadPersistentObject(CustomerStatusEntity.class, CustomerStatus.CLIENT_PENDING.getValue());
Assert.assertTrue(cse.getIsOptional());
cse.setIsOptional(false);
StaticHibernateUtil.flushSession();
Assert.assertFalse(cse.getIsOptional());
Assert.assertTrue(ProcessFlowRules.isClientPendingApprovalStateEnabled());
ProcessFlowRules.init();
Assert.assertTrue(cse.getIsOptional());
}
use of org.mifos.customers.persistence.CustomerPersistence in project head by mifos.
the class CustomerCreationDaoHibernateIntegrationTest method testShouldCreateCustomerAndCustomerAccount.
@Test
public void testShouldCreateCustomerAndCustomerAccount() throws Exception {
String displayName = "centerCascade";
Address address = null;
final List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
final List<FeeDto> fees = new ArrayList<FeeDto>();
final String externalId = null;
final Date mfiJoiningDate = new DateTime().minusDays(1).toDate();
final OfficeBO existingOffice = IntegrationTestObjectMother.sampleBranchOffice();
final PersonnelBO loanOfficer = IntegrationTestObjectMother.testUser();
UserContext userContext = new UserContext();
userContext.setId(loanOfficer.getPersonnelId());
userContext.setBranchId(existingOffice.getOfficeId());
userContext.setBranchGlobalNum(existingOffice.getGlobalOfficeNum());
center = new CenterBO(userContext, displayName, address, customFields, fees, externalId, mfiJoiningDate, existingOffice, weeklyMeeting, loanOfficer, new CustomerPersistence());
StaticHibernateUtil.startTransaction();
customerDao.save(center);
StaticHibernateUtil.flushSession();
assertThat(center.getCustomerAccount(), is(notNullValue()));
assertThat(center.getGlobalCustNum(), is(nullValue()));
}
use of org.mifos.customers.persistence.CustomerPersistence in project head by mifos.
the class IntegrationTestObjectMother method update.
public static void update(CustomerBO customer) {
try {
new CustomerPersistence().createOrUpdate(customer);
StaticHibernateUtil.flushSession();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.mifos.customers.persistence.CustomerPersistence in project head by mifos.
the class CustAction method getClosedAccounts.
@TransactionDemarcate(joinToken = true)
public ActionForward getClosedAccounts(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In CustAction::getClosedAccounts()");
UserContext userContext = getUserContext(request);
Integer customerId = getIntegerValue(((CustActionForm) form).getCustomerId());
List<ClosedAccountDto> allClosedAccounts = this.centerServiceFacade.retrieveAllClosedAccounts(customerId);
List<AccountBO> loanAccountsList = new CustomerPersistence().getAllClosedAccount(customerId, AccountTypes.LOAN_ACCOUNT.getValue());
loanAccountsList.addAll(new CustomerPersistence().getAllClosedAccount(customerId, AccountTypes.GROUP_LOAN_ACCOUNT.getValue()));
List<AccountBO> savingsAccountList = new CustomerPersistence().getAllClosedAccount(customerId, AccountTypes.SAVINGS_ACCOUNT.getValue());
SessionUtils.setCollectionAttribute(AccountConstants.CLOSEDLOANACCOUNTSLIST, loanAccountsList, request);
SessionUtils.setCollectionAttribute(AccountConstants.CLOSEDSAVINGSACCOUNTSLIST, savingsAccountList, request);
return mapping.findForward(ActionForwards.getAllClosedAccounts.toString());
}
Aggregations