Search in sources :

Example 1 with AccountStatusActionForm

use of org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm in project head by mifos.

the class AccountStatusAction method searchResults.

@TransactionDemarcate(joinToken = true)
public ActionForward searchResults(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse httpservletresponse) throws Exception {
    AccountStatusActionForm accountStatusActionForm = (AccountStatusActionForm) form;
    List<LoanBO> searchResults = loanService.getSearchResults(accountStatusActionForm.getOfficeId(), accountStatusActionForm.getPersonnelId(), accountStatusActionForm.getCurrentStatus());
    if (searchResults.size() == 0) {
        return mapping.findForward(ActionForwards.noresultfound.toString());
    }
    SessionUtils.setCollectionAttribute(LoanConstants.SEARCH_RESULTS, searchResults, request);
    return mapping.findForward(ActionForwards.changeAccountStatusSearch_success.toString());
}
Also used : LoanBO(org.mifos.accounts.loan.business.LoanBO) AccountStatusActionForm(org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 2 with AccountStatusActionForm

use of org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm in project head by mifos.

the class AccountStatusAction method getLoanOfficers.

@TransactionDemarcate(joinToken = true)
public ActionForward getLoanOfficers(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse httpservletresponse) throws Exception {
    AccountStatusActionForm accountStatusActionForm = (AccountStatusActionForm) form;
    Short officeId = Short.valueOf(accountStatusActionForm.getOfficeId());
    ChangeAccountStatusDto changeAccountStatusDto = this.loanAccountServiceFacade.retrieveLoanOfficerDetailsForBranch(officeId);
    SessionUtils.setCollectionAttribute(LoanConstants.LOAN_OFFICERS, changeAccountStatusDto.getLoanOfficers(), request);
    if (officeId != null) {
        AccountStateEntity accountStateEntity = legacyMasterDao.getPersistentObject(AccountStateEntity.class, changeAccountStatusDto.getAccountState());
        SessionUtils.setAttribute(LoanConstants.LOANACCOUNTSTAES, accountStateEntity, request);
    }
    return mapping.findForward(ActionForwards.changeAccountStatus_success.toString());
}
Also used : ChangeAccountStatusDto(org.mifos.dto.screen.ChangeAccountStatusDto) AccountStatusActionForm(org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm) AccountStateEntity(org.mifos.accounts.business.AccountStateEntity) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 3 with AccountStatusActionForm

use of org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm in project head by mifos.

the class AccountStatusAction method update.

@TransactionDemarcate(validateAndResetToken = true)
public ActionForward update(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse httpservletresponse) throws Exception {
    AccountStatusActionForm accountStatusActionForm = (AccountStatusActionForm) form;
    List<AccountUpdateStatus> accountsForUpdate = new ArrayList<AccountUpdateStatus>();
    List<AccountUpdateStatus> individualAccountsForUpdate = new ArrayList<AccountUpdateStatus>();
    for (String accountId : accountStatusActionForm.getAccountRecords()) {
        if (StringUtils.isNotBlank(accountId)) {
            Long accountIdValue = Long.parseLong(accountId);
            //GLIM
            List<LoanBO> individualLoans = this.loanDao.findIndividualLoans(Integer.valueOf(accountId));
            for (LoanBO indivdual : individualLoans) {
                Short newStatusId = getShortValue(accountStatusActionForm.getNewStatus());
                individualAccountsForUpdate.add(new AccountUpdateStatus(indivdual.getAccountId().longValue(), newStatusId, null, accountStatusActionForm.getComments()));
            }
            this.loanAccountServiceFacade.updateSeveralLoanAccountStatuses(individualAccountsForUpdate, null);
            Short newStatusId = getShortValue(accountStatusActionForm.getNewStatus());
            Short flagId = null;
            String comment = accountStatusActionForm.getComments();
            accountsForUpdate.add(new AccountUpdateStatus(accountIdValue, newStatusId, flagId, comment));
        }
    }
    List<String> accountNumbers = this.loanAccountServiceFacade.updateSeveralLoanAccountStatuses(accountsForUpdate, null);
    request.setAttribute(LoanConstants.ACCOUNTS_LIST, accountNumbers);
    return mapping.findForward(ActionForwards.changeAccountStatusConfirmation_success.toString());
}
Also used : AccountUpdateStatus(org.mifos.dto.domain.AccountUpdateStatus) LoanBO(org.mifos.accounts.loan.business.LoanBO) AccountStatusActionForm(org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm) ArrayList(java.util.ArrayList) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 4 with AccountStatusActionForm

use of org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm in project head by mifos.

the class AccountStatusAction method cleanUp.

private void cleanUp(final ActionForm form, final HttpServletRequest request) {
    AccountStatusActionForm accountStatusActionForm = (AccountStatusActionForm) form;
    accountStatusActionForm.setAccountRecords(new ArrayList<String>());
    accountStatusActionForm.setComments("");
    accountStatusActionForm.setCurrentStatus("");
    accountStatusActionForm.setLoadOfficer("");
    accountStatusActionForm.setNewStatus("");
    accountStatusActionForm.setOfficeId("");
    accountStatusActionForm.setOfficeName("");
    accountStatusActionForm.setPersonnelId("");
    accountStatusActionForm.setType("");
    request.setAttribute("session", null);
}
Also used : AccountStatusActionForm(org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm)

Aggregations

AccountStatusActionForm (org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm)4 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)3 LoanBO (org.mifos.accounts.loan.business.LoanBO)2 ArrayList (java.util.ArrayList)1 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)1 AccountUpdateStatus (org.mifos.dto.domain.AccountUpdateStatus)1 ChangeAccountStatusDto (org.mifos.dto.screen.ChangeAccountStatusDto)1