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());
}
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());
}
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());
}
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);
}
Aggregations