use of org.mifos.accounts.savings.persistence.GenericDaoHibernate in project head by mifos.
the class LoanAccountAction method manage.
@TransactionDemarcate(joinToken = true)
public ActionForward manage(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
LoanAccountActionForm loanActionForm = (LoanAccountActionForm) form;
String globalAccountNum = request.getParameter(GLOBAL_ACCOUNT_NUM);
CustomerBO customer = getCustomerFromRequest(request);
if (isGlimEnabled() || isNewGlimEnabled()) {
populateGlimAttributes(request, loanActionForm, globalAccountNum, customer);
}
String recurMonth = customer.getCustomerMeeting().getMeeting().getMeetingDetails().getRecurAfter().toString();
handleRepaymentsIndependentOfMeetingIfConfigured(request, loanActionForm, recurMonth);
LoanBO loanBO = new LoanDaoHibernate(new GenericDaoHibernate()).findByGlobalAccountNum(globalAccountNum);
UserContext userContext = getUserContext(request);
loanBO.setUserContext(userContext);
SessionUtils.setAttribute(PROPOSED_DISBURSAL_DATE, loanBO.getDisbursementDate(), request);
SessionUtils.removeAttribute(LOANOFFERING, request);
LoanOfferingBO loanOffering = getLoanOffering(loanBO.getLoanOffering().getPrdOfferingId(), userContext.getLocaleId());
loanActionForm.setInstallmentRange(loanBO.getMaxMinNoOfInstall());
loanActionForm.setLoanAmountRange(loanBO.getMaxMinLoanAmount());
MaxMinInterestRate interestRateRange = loanBO.getMaxMinInterestRate();
loanActionForm.setMaxInterestRate(interestRateRange.getMaxLoanAmount());
loanActionForm.setMinInterestRate(interestRateRange.getMinLoanAmount());
loanActionForm.setExternalId(loanBO.getExternalId());
if (null != loanBO.getFund()) {
loanActionForm.setLoanOfferingFund(loanBO.getFund().getFundId().toString());
}
if (configService.isRepaymentIndepOfMeetingEnabled()) {
MeetingDetailsEntity meetingDetail = loanBO.getLoanMeeting().getMeetingDetails();
loanActionForm.setMonthDay("");
loanActionForm.setMonthWeek("0");
loanActionForm.setMonthRank("0");
if (meetingDetail.getRecurrenceTypeEnum() == RecurrenceType.MONTHLY) {
setMonthlySchedule(loanActionForm, meetingDetail);
} else {
setWeeklySchedule(loanActionForm, meetingDetail);
}
}
setSessionAtributeForGLIM(request, loanBO);
SessionUtils.setAttribute(LOANOFFERING, loanOffering, request);
// Retrieve and set into the session all collateral types from the
// lookup_value_locale table associated with the current user context
// locale
SessionUtils.setCollectionAttribute(MasterConstants.COLLATERAL_TYPES, legacyMasterDao.getLookUpEntity(MasterConstants.COLLATERAL_TYPES).getCustomValueListElements(), request);
SessionUtils.setCollectionAttribute(MasterConstants.BUSINESS_ACTIVITIES, legacyMasterDao.findValueListElements(MasterConstants.LOAN_PURPOSES), request);
SessionUtils.setCollectionAttribute(CUSTOM_FIELDS, new ArrayList<CustomFieldDefinitionEntity>(), request);
SessionUtils.setAttribute(RECURRENCEID, loanBO.getLoanMeeting().getMeetingDetails().getRecurrenceTypeEnum().getValue(), request);
SessionUtils.setAttribute(RECURRENCENAME, loanBO.getLoanMeeting().getMeetingDetails().getRecurrenceType().getRecurrenceName(), request);
SessionUtils.setCollectionAttribute(LOANFUNDS, getFunds(loanOffering), request);
setRequestAttributesForEditPage(request, loanBO);
InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
SessionUtils.setCollectionAttribute("detailsInformationOrder", informationOrderServiceFacade.getInformationOrder("CreateLoan"), request);
setFormAttributes(loanBO, form, request);
return mapping.findForward(ActionForwards.manage_success.toString());
}
use of org.mifos.accounts.savings.persistence.GenericDaoHibernate in project head by mifos.
the class LegacyAccountDaoIntegrationTest method testGetListOfAccountIdsHavingLoanSchedulesWithinAHoliday.
@Test
public void testGetListOfAccountIdsHavingLoanSchedulesWithinAHoliday() throws Exception {
Set<HolidayBO> holidays;
DateTime fromDate = new DateMidnight().toDateTime().plusDays(1);
DateTime thruDate = new DateMidnight().toDateTime().plusDays(30);
GenericDao genericDao = new GenericDaoHibernate();
OfficeDao officeDao = new OfficeDaoHibernate(genericDao);
HolidayDao holidayDao = new HolidayDaoHibernate(genericDao);
OfficeBO sampleBranch = officeDao.findOfficeById(this.getBranchOffice().getOfficeId());
holidays = new HashSet<HolidayBO>();
holiday = new HolidayBuilder().withName("Welcome Holiday").from(fromDate).to(thruDate).build();
holidayDao.save(holiday);
holidays.add((HolidayBO) holiday);
sampleBranch.setHolidays(holidays);
new OfficePersistence().createOrUpdate(sampleBranch);
StaticHibernateUtil.flushSession();
List<Object[]> AccountIds = legacyAccountDao.getListOfAccountIdsHavingLoanSchedulesWithinAHoliday(holiday);
Assert.assertNotNull(AccountIds);
assertThat(AccountIds.size(), is(2));
}
use of org.mifos.accounts.savings.persistence.GenericDaoHibernate in project head by mifos.
the class LegacyAccountDaoIntegrationTest method testGetListOfAccountIdsHavingCustomerSchedulesWithinAHoliday.
@Test
public void testGetListOfAccountIdsHavingCustomerSchedulesWithinAHoliday() throws Exception {
Set<HolidayBO> holidays;
DateTime fromDate = new DateMidnight().toDateTime().plusDays(1);
DateTime thruDate = new DateMidnight().toDateTime().plusDays(30);
GenericDao genericDao = new GenericDaoHibernate();
OfficeDao officeDao = new OfficeDaoHibernate(genericDao);
HolidayDao holidayDao = new HolidayDaoHibernate(genericDao);
OfficeBO sampleBranch = officeDao.findOfficeById(this.getBranchOffice().getOfficeId());
holidays = new HashSet<HolidayBO>();
holiday = new HolidayBuilder().withName("Welcome Holiday").from(fromDate).to(thruDate).build();
holidayDao.save(holiday);
holidays.add((HolidayBO) holiday);
sampleBranch.setHolidays(holidays);
new OfficePersistence().createOrUpdate(sampleBranch);
StaticHibernateUtil.flushSession();
List<Object[]> AccountIds = legacyAccountDao.getListOfAccountIdsHavingCustomerSchedulesWithinAHoliday(holiday);
Assert.assertNotNull(AccountIds);
assertThat(AccountIds.size(), is(3));
}
use of org.mifos.accounts.savings.persistence.GenericDaoHibernate in project head by mifos.
the class PluginManager method loadImportPlugins.
/**
* Returns list of import plugins. Note that {@link ServiceLoader} caches
* loads, so multiple invocations should not incur extra overhead.
*/
public List<TransactionImport> loadImportPlugins() {
List<TransactionImport> plugins = new ArrayList<TransactionImport>();
ClassLoader pluginClassLoader = initializePluginClassLoader();
ServiceLoader<TransactionImport> loader = ServiceLoader.load(TransactionImport.class, pluginClassLoader);
for (TransactionImport ti : loader) {
ti.setAccountService(new StandardAccountService(ApplicationContextProvider.getBean(LegacyAccountDao.class), ApplicationContextProvider.getBean(LegacyLoanDao.class), ApplicationContextProvider.getBean(LegacyAcceptedPaymentTypeDao.class), new PersonnelDaoHibernate(new GenericDaoHibernate()), new CustomerDaoHibernate(new GenericDaoHibernate()), ApplicationContextProvider.getBean(LoanBusinessService.class), new HibernateTransactionHelperForStaticHibernateUtil(), ApplicationContextProvider.getBean(LegacyMasterDao.class), ApplicationContextProvider.getBean(MonthClosingServiceFacade.class), ApplicationContextProvider.getBean(SavingsServiceFacade.class), ApplicationContextProvider.getBean(GroupLoanAccountServiceFacade.class)));
ti.setCustomerSearchService(new CustomerSearchServiceImpl(new CustomerDaoHibernate(new GenericDaoHibernate())));
plugins.add(ti);
}
return plugins;
}
use of org.mifos.accounts.savings.persistence.GenericDaoHibernate in project head by mifos.
the class CustomerPersistence method phoneNumberSearch.
private QueryResult phoneNumberSearch(final String searchString, final Short officeId, final Short userId) throws HibernateSearchException, SystemException, PersistenceException {
String phoneNumberWithStrippedNonnumerics = MifosStringUtils.removeNondigits(searchString);
if (phoneNumberWithStrippedNonnumerics.isEmpty()) {
return null;
}
List<CustomerDto> customersWithThisPhoneNumber = new CustomerDaoHibernate((new GenericDaoHibernate())).findCustomersWithGivenPhoneNumber(phoneNumberWithStrippedNonnumerics);
if (customersWithThisPhoneNumber == null || customersWithThisPhoneNumber.isEmpty()) {
return null;
}
SearchTemplate template = new SearchTemplate(phoneNumberWithStrippedNonnumerics, officeId, userId);
template.queryNoOfficeCount = NamedQueryConstants.CUSTOMER_PHONE_SEARCH_NOOFFICEID_COUNT;
template.queryNoOffice = NamedQueryConstants.CUSTOMER_PHONE_SEARCH_NOOFFICEID;
template.queryNormalCount = NamedQueryConstants.CUSTOMER_PHONE_SEARCH_COUNT;
template.queryNormal = NamedQueryConstants.CUSTOMER_PHONE_SEARCH;
template.queryNonOfficerCount = NamedQueryConstants.CUSTOMER_PHONE_SEARCH_COUNT_NONLO;
template.queryNonOfficer = NamedQueryConstants.CUSTOMER_PHONE_SEARCH_NONLO;
return template.doSearch();
}
Aggregations