Search in sources :

Example 1 with AccountPaymentDtoComperator

use of org.mifos.application.util.helpers.AccountPaymentDtoComperator in project head by mifos.

the class LoanAccountServiceFacadeWebTier method getLoanAccountPayments.

@Override
public List<AccountPaymentDto> getLoanAccountPayments(String globalAccountNum) {
    List<AccountPaymentDto> loanAccountPayments = new ArrayList<AccountPaymentDto>();
    LoanBO loanAccount = loanDao.findByGlobalAccountNum(globalAccountNum);
    List<AccountPaymentEntity> loanAccountPaymentsEntities = loanAccount.getAccountPayments();
    for (AccountPaymentEntity accountPaymentEntity : loanAccountPaymentsEntities) {
        loanAccountPayments.add(accountPaymentEntity.toScreenDto());
    }
    //for new group loan accounts
    if (loanAccount.isGroupLoanAccount() && null == loanAccount.getParentAccount()) {
        for (LoanBO member : loanAccount.getMemberAccounts()) {
            for (AccountPaymentEntity accPayment : member.getAccountPayments()) {
                if (!accPayment.isLoanDisbursment()) {
                    loanAccountPayments.add(accPayment.toScreenDto());
                }
            }
        }
        Collections.sort(loanAccountPayments, new AccountPaymentDtoComperator());
        Collections.reverse(loanAccountPayments);
    }
    return loanAccountPayments;
}
Also used : AccountPaymentDtoComperator(org.mifos.application.util.helpers.AccountPaymentDtoComperator) LoanBO(org.mifos.accounts.loan.business.LoanBO) ArrayList(java.util.ArrayList) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) AccountPaymentDto(org.mifos.dto.screen.AccountPaymentDto)

Aggregations

ArrayList (java.util.ArrayList)1 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 AccountPaymentDtoComperator (org.mifos.application.util.helpers.AccountPaymentDtoComperator)1 AccountPaymentDto (org.mifos.dto.screen.AccountPaymentDto)1