use of org.mifos.dto.screen.ListElement in project head by mifos.
the class AdminServiceFacadeWebTier method retrieveLoanProductFormReferenceData.
@Override
public LoanProductFormDto retrieveLoanProductFormReferenceData() {
try {
LoanPrdBusinessService service = new LoanPrdBusinessService();
List<ListElement> productCategoryOptions = new ArrayList<ListElement>();
List<ProductCategoryBO> productCategories = service.getActiveLoanProductCategories();
for (ProductCategoryBO category : productCategories) {
productCategoryOptions.add(new ListElement(category.getProductCategoryID().intValue(), category.getProductCategoryName()));
}
List<ListElement> applicableForOptions = new ArrayList<ListElement>();
List<PrdApplicableMasterEntity> applicableCustomerTypes = this.loanProductDao.retrieveLoanApplicableProductCategories();
for (PrdApplicableMasterEntity entity : applicableCustomerTypes) {
applicableForOptions.add(new ListElement(entity.getId().intValue(), entity.getName()));
}
List<ListElement> gracePeriodTypeOptions = new ArrayList<ListElement>();
List<GracePeriodTypeEntity> gracePeriodTypes = this.loanProductDao.retrieveGracePeriodTypes();
for (GracePeriodTypeEntity gracePeriodTypeEntity : gracePeriodTypes) {
gracePeriodTypeOptions.add(new ListElement(gracePeriodTypeEntity.getId().intValue(), gracePeriodTypeEntity.getName()));
}
List<ListElement> interestCalcTypesOptions = new ArrayList<ListElement>();
List<InterestTypesEntity> interestCalcTypes = this.loanProductDao.retrieveInterestTypes();
for (InterestTypesEntity entity : interestCalcTypes) {
interestCalcTypesOptions.add(new ListElement(entity.getId().intValue(), entity.getName()));
}
List<ListElement> sourceOfFunds = new ArrayList<ListElement>();
List<FundBO> funds = this.fundDao.findAllFunds();
for (FundBO fund : funds) {
sourceOfFunds.add(new ListElement(fund.getFundId().intValue(), fund.getFundName()));
}
List<ListElement> loanFee = new ArrayList<ListElement>();
List<FeeBO> fees = feeDao.getAllAppllicableFeeForLoanCreation();
for (FeeBO fee : fees) {
loanFee.add(new ListElement(fee.getFeeId().intValue(), fee.getFeeName()));
}
List<ListElement> principalGlCodes = new ArrayList<ListElement>();
List<GLCodeEntity> principalGlCodeEntities = new FinancialBusinessService().getGLCodes(FinancialActionConstants.PRINCIPALPOSTING, FinancialConstants.CREDIT);
for (GLCodeEntity glCode : principalGlCodeEntities) {
principalGlCodes.add(new ListElement(glCode.getGlcodeId().intValue(), glCode.getGlcode()));
}
List<ListElement> interestGlCodes = new ArrayList<ListElement>();
List<GLCodeEntity> interestGlCodeEntities = new FinancialBusinessService().getGLCodes(FinancialActionConstants.INTERESTPOSTING, FinancialConstants.CREDIT);
for (GLCodeEntity glCode : interestGlCodeEntities) {
interestGlCodes.add(new ListElement(glCode.getGlcodeId().intValue(), glCode.getGlcode()));
}
List<ListElement> statusOptions = new ArrayList<ListElement>();
List<PrdStatusEntity> applicableStatuses = service.getApplicablePrdStatus(Short.valueOf("1"));
for (PrdStatusEntity entity : applicableStatuses) {
statusOptions.add(new ListElement(entity.getOfferingStatusId().intValue(), entity.getPrdState().getName()));
}
boolean multiCurrencyEnabled = AccountingRules.isMultiCurrencyEnabled();
List<ListElement> currencyOptions = new ArrayList<ListElement>();
if (multiCurrencyEnabled) {
LinkedList<MifosCurrency> currencies = AccountingRules.getCurrencies();
for (MifosCurrency mifosCurrency : currencies) {
currencyOptions.add(new ListElement(mifosCurrency.getCurrencyId().intValue(), mifosCurrency.getCurrencyCode()));
}
}
return new LoanProductFormDto(productCategoryOptions, gracePeriodTypeOptions, sourceOfFunds, loanFee, principalGlCodes, interestGlCodes, interestCalcTypesOptions, applicableForOptions, statusOptions, currencyOptions, multiCurrencyEnabled);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
} catch (SystemException e) {
throw new MifosRuntimeException(e);
} catch (ApplicationException e) {
throw new BusinessRuleException(e.getKey(), e);
}
}
use of org.mifos.dto.screen.ListElement in project head by mifos.
the class Localization method getLocaleList.
public List<ListElement> getLocaleList() {
List<ListElement> localeForUI = new ArrayList<ListElement>();
for (Short key : LOCALE_MAP.keySet()) {
String displayName = getDisplayName(key);
ListElement localeValue = new ListElement(key.intValue(), displayName);
localeForUI.add(localeValue);
Collections.sort(localeForUI, new ListElementSortByName());
}
return localeForUI;
}
use of org.mifos.dto.screen.ListElement in project head by mifos.
the class SavingsServiceFacadeWebTier method retrieveClosingDetails.
@Override
public SavingsAccountClosureDto retrieveClosingDetails(Long savingsId, LocalDate closureDate) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
SavingsBO savingsAccount = this.savingsDao.findById(savingsId);
InterestScheduledEvent postingSchedule = savingsInterestScheduledEventFactory.createScheduledEventFrom(savingsAccount.getInterestPostingMeeting());
LocalDate nextPostingDate = new LocalDate(savingsAccount.getNextIntPostDate());
LocalDate startOfPostingPeriod = postingSchedule.findFirstDateOfPeriodForMatchingDate(nextPostingDate);
CalendarPeriod postingPeriodAtClosure;
if (startOfPostingPeriod.isAfter(closureDate)) {
postingPeriodAtClosure = new CalendarPeriod(closureDate, closureDate);
} else {
postingPeriodAtClosure = new CalendarPeriod(startOfPostingPeriod, closureDate);
}
List<EndOfDayDetail> allEndOfDayDetailsForAccount = savingsDao.retrieveAllEndOfDayDetailsFor(savingsAccount.getCurrency(), Long.valueOf(savingsId));
InterestPostingPeriodResult postingPeriodAtClosureResult = determinePostingPeriodResult(postingPeriodAtClosure, savingsAccount, allEndOfDayDetailsForAccount);
Money endOfAccountBalance = postingPeriodAtClosureResult.getPeriodBalance();
Money interestAmountAtClosure = postingPeriodAtClosureResult.getPeriodInterest();
List<ListElement> depositPaymentTypes = retrieveDepositPaymentTypes(userContext);
return new SavingsAccountClosureDto(new LocalDate(), endOfAccountBalance.toString(), interestAmountAtClosure.toString(), depositPaymentTypes);
}
use of org.mifos.dto.screen.ListElement in project head by mifos.
the class SavingsServiceFacadeWebTier method retrieveSavingsProductReferenceData.
@Override
public SavingsProductReferenceDto retrieveSavingsProductReferenceData(Integer productId) {
SavingsOfferingBO savingsProduct = this.savingsProductDao.findById(productId);
List<ListElement> interestCalcTypeOptions = new ArrayList<ListElement>();
List<InterestCalcTypeEntity> interestCalculationTypes = this.savingsProductDao.retrieveInterestCalculationTypes();
for (InterestCalcTypeEntity entity : interestCalculationTypes) {
interestCalcTypeOptions.add(new ListElement(entity.getId().intValue(), entity.getName()));
}
boolean savingsPendingApprovalEnabled = ProcessFlowRules.isSavingsPendingApprovalStateEnabled();
return new SavingsProductReferenceDto(interestCalcTypeOptions, savingsProduct.toFullDto(), savingsPendingApprovalEnabled);
}
use of org.mifos.dto.screen.ListElement in project head by mifos.
the class SavingsServiceFacadeWebTier method retrieveAccountStatuses.
@Override
public AccountStatusDto retrieveAccountStatuses(Long savingsId) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
SavingsBO savingsAccount = this.savingsDao.findById(savingsId);
try {
List<ListElement> savingsStatesList = new ArrayList<ListElement>();
AccountStateMachines.getInstance().initializeSavingsStates();
List<AccountStateEntity> statusList = AccountStateMachines.getInstance().getSavingsStatusList(savingsAccount.getAccountState());
for (AccountStateEntity accountState : statusList) {
savingsStatesList.add(new ListElement(accountState.getId().intValue(), accountState.getName()));
}
return new AccountStatusDto(savingsStatesList);
} catch (StatesInitializationException e) {
throw new MifosRuntimeException(e);
}
}
Aggregations