use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.
the class AccountBusinessService method getAppllicableFees.
public List<ApplicableCharge> getAppllicableFees(Integer accountId, UserContext userContext) throws ServiceException {
List<ApplicableCharge> applicableChargeList = null;
try {
AccountBO account = getlegacyAccountDao().getAccount(accountId);
FeeCategory categoryType = getCategoryType(account.getCustomer());
if (account.getType() == AccountTypes.LOAN_ACCOUNT || account.getType() == AccountTypes.GROUP_LOAN_ACCOUNT) {
applicableChargeList = getLoanApplicableCharges(getlegacyAccountDao().getAllApplicableFees(accountId, FeeCategory.LOAN), userContext, (LoanBO) account);
} else if (account.getType() == AccountTypes.CUSTOMER_ACCOUNT) {
if (account.getCustomer().getCustomerMeeting() == null) {
throw new ServiceException(AccountExceptionConstants.APPLY_CAHRGE_NO_CUSTOMER_MEETING_EXCEPTION);
}
applicableChargeList = getCustomerApplicableCharges(getlegacyAccountDao().getAllApplicableFees(accountId, categoryType), userContext, ((CustomerAccountBO) account).getCustomer().getCustomerMeeting().getMeeting().getMeetingDetails().getRecurrenceType().getRecurrenceId());
}
addMiscFeeAndPenalty(applicableChargeList);
} catch (PersistenceException pe) {
throw new ServiceException(pe);
}
return applicableChargeList;
}
use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.
the class FeeBO method update.
public void update() throws FeeException {
try {
setUpdateDetails();
ApplicationContextProvider.getBean(LegacyAccountDao.class).createOrUpdate(this);
} catch (PersistenceException e) {
throw new FeeException(FeeConstants.FEE_UPDATE_ERROR, e);
}
}
use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.
the class WebTierAccountServiceFacade method constructPaymentTypeList.
private List<ListItem<Short>> constructPaymentTypeList(String paymentType, Short localeId) {
try {
List<PaymentTypeEntity> paymentTypeList = null;
if (paymentType != null && !Constants.EMPTY_STRING.equals(paymentType.trim())) {
if (isLoanPayment(paymentType)) {
paymentTypeList = acceptedPaymentTypePersistence.getAcceptedPaymentTypesForATransaction(localeId, TrxnTypes.loan_repayment.getValue());
} else {
paymentTypeList = acceptedPaymentTypePersistence.getAcceptedPaymentTypesForATransaction(localeId, TrxnTypes.fee.getValue());
}
}
List<ListItem<Short>> listItems = new ArrayList<ListItem<Short>>();
for (PaymentTypeEntity paymentTypeEntity : paymentTypeList) {
listItems.add(new ListItem<Short>(paymentTypeEntity.getId(), paymentTypeEntity.getName()));
}
return listItems;
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.
the class CollectionSheetDaoHibernate method findAmountDueWhenInterestIsDueAtDibursementTime.
private Double findAmountDueWhenInterestIsDueAtDibursementTime(final Integer accountId) {
final Map<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put("ACCOUNT_ID", accountId);
try {
final Object[] loanScheduleData = (Object[]) execUniqueResultNamedQuery("findFirstLoanSchedule", queryParameters);
final Integer loanScheduleId = Integer.valueOf(loanScheduleData[0].toString());
final Double firstScheduledPaymentAmount = calculateAmountDueFromLoanScheduleFields(loanScheduleData);
final Map<String, Object> feeQueryParameters = new HashMap<String, Object>();
queryParameters.put("LOAN_SCHEDULE_ID", loanScheduleId);
final Object[] loanScheduleFee = (Object[]) execUniqueResultNamedQuery("findLoanFeeSchedulesForALoanSchedule", feeQueryParameters);
final Double feesDueOnLoanSchedule = calculateFeesDueOnLoanSchedule(loanScheduleFee);
return firstScheduledPaymentAmount.doubleValue() + feesDueOnLoanSchedule.doubleValue();
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.
the class AccountingDaoHibernate method updateLastProcessDate.
public void updateLastProcessDate(Date lastProcessDate) {
Query q = createdNamedQuery("getConfigurationKeyValueByKey");
q.setString("KEY", "MisProcessing");
List<ConfigurationKeyValue> list = q.list();
if (list.size() > 0) {
ConfigurationKeyValue configurationKeyValue = list.get(0);
configurationKeyValue.setValue(DateUtils.format(lastProcessDate));
try {
createOrUpdate(configurationKeyValue);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
}
Aggregations