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); } }
private boolean FindEntity(List<PaymentTypeEntity> entityList, PaymentTypeEntity entity) { for (PaymentTypeEntity e : entityList) { if ((e.getId().shortValue() == entity.getId().shortValue()) && (e.getName().equals(entity.getName()))) { return true; } } return false; }