Search in sources :

Example 1 with LoanAccountDetailDto

use of org.mifos.dto.screen.LoanAccountDetailDto in project head by mifos.

the class NotesAction method load.

@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    clearActionForm(form);
    NotesActionForm notesActionForm = (NotesActionForm) form;
    Integer accountId = Integer.valueOf(notesActionForm.getAccountId());
    AccountBO account = new AccountBusinessService().getAccount(accountId);
    if (account.isLoanAccount() || account.isGroupLoanAccount()) {
        LoanAccountDetailDto loanAccountDto = this.loanAccountServiceFacade.retrieveLoanAccountNotes(accountId.longValue());
        if (account.isLoanAccount()) {
            notesActionForm.setAccountTypeId(AccountTypes.LOAN_ACCOUNT.getValue().toString());
        } else {
            notesActionForm.setAccountTypeId(AccountTypes.GROUP_LOAN_ACCOUNT.getValue().toString());
        }
        notesActionForm.setGlobalAccountNum(loanAccountDto.getGlobalAccountNum());
        notesActionForm.setPrdOfferingName(loanAccountDto.getProductDetails().getPrdOfferingName());
    } else if (account.isSavingsAccount()) {
        SavingsAccountDetailDto savingsAccountDto = this.savingsServiceFacade.retrieveSavingsAccountNotes(accountId.longValue());
        notesActionForm.setPrdOfferingName(savingsAccountDto.getProductDetails().getProductDetails().getName());
        notesActionForm.setAccountTypeId(AccountTypes.SAVINGS_ACCOUNT.getValue().toString());
        notesActionForm.setGlobalAccountNum(savingsAccountDto.getGlobalAccountNum());
    }
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : AccountBO(org.mifos.accounts.business.AccountBO) AccountBusinessService(org.mifos.accounts.business.service.AccountBusinessService) NotesActionForm(org.mifos.accounts.struts.actionforms.NotesActionForm) LoanAccountDetailDto(org.mifos.dto.screen.LoanAccountDetailDto) SavingsAccountDetailDto(org.mifos.dto.domain.SavingsAccountDetailDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

AccountBO (org.mifos.accounts.business.AccountBO)1 AccountBusinessService (org.mifos.accounts.business.service.AccountBusinessService)1 NotesActionForm (org.mifos.accounts.struts.actionforms.NotesActionForm)1 SavingsAccountDetailDto (org.mifos.dto.domain.SavingsAccountDetailDto)1 LoanAccountDetailDto (org.mifos.dto.screen.LoanAccountDetailDto)1 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)1