use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.
the class SavingsAction method preview.
@TransactionDemarcate(joinToken = true)
public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
SavingsActionForm savingActionForm = (SavingsActionForm) form;
SessionUtils.setAttribute(SavingsConstants.IS_PENDING_APPROVAL, ProcessFlowRules.isSavingsPendingApprovalStateEnabled(), request.getSession());
return createGroupQuestionnaire.fetchAppliedQuestions(mapping, savingActionForm, request, ActionForwards.preview_success);
}
use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.
the class SavingsAction method update.
@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In SavingsAction::update()");
SavingsActionForm actionForm = (SavingsActionForm) form;
SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
Long savingsId = savings.getAccountId().longValue();
savings = this.savingsDao.findById(savingsId);
Integer version = savings.getVersionNo();
checkVersionMismatch(version, savings.getVersionNo());
this.savingsServiceFacade.updateSavingsAccountDetails(savingsId, actionForm.getRecommendedAmount(), actionForm.getAccountCustomFieldSet());
request.setAttribute(SavingsConstants.GLOBALACCOUNTNUM, savings.getGlobalAccountNum());
logger.info("In SavingsAction::update(), Savings object updated successfully");
doCleanUp(actionForm, request);
return mapping.findForward("update_success");
}
use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.
the class SavingsAction method get.
@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
SavingsActionForm actionForm = (SavingsActionForm) form;
actionForm.setInput(null);
String globalAccountNum = actionForm.getGlobalAccountNum();
if (StringUtils.isBlank(actionForm.getGlobalAccountNum())) {
SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
globalAccountNum = savings.getGlobalAccountNum();
}
logger.debug(" Retrieving for globalAccountNum: " + globalAccountNum);
SavingsBO savings = this.savingsDao.findBySystemId(globalAccountNum);
savings.setUserContext(uc);
SavingsAccountDetailDto savingsAccountDto;
try {
savingsAccountDto = this.savingsServiceFacade.retrieveSavingsAccountDetails(savings.getAccountId().longValue());
} catch (MifosRuntimeException e) {
if (e.getCause() instanceof ApplicationException) {
throw (ApplicationException) e.getCause();
}
throw e;
}
List<AdminDocumentBO> allAdminDocuments = legacyAdminDocumentDao.getAllActiveAdminDocuments();
List<AdminDocumentBO> savingsAdminDocuments = new ArrayList();
for (AdminDocumentBO adminDocumentBO : allAdminDocuments) {
List<AdminDocAccStateMixBO> admindoclist = legacyAdminDocAccStateMixDao.getMixByAdminDocuments(adminDocumentBO.getAdmindocId());
if (!savingsAdminDocuments.contains(adminDocumentBO) && admindoclist.size() > 0 && admindoclist.get(0).getAccountStateID().getPrdType().getProductTypeID().equals(Short.valueOf("2"))) {
savingsAdminDocuments.add(adminDocumentBO);
}
}
SessionUtils.setCollectionAttribute("administrativeDocumentsList", savingsAdminDocuments, request);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, savings, request);
SessionUtils.setCollectionAttribute(MasterConstants.SAVINGS_TYPE, legacyMasterDao.findMasterDataEntitiesWithLocale(SavingsTypeEntity.class), request);
SessionUtils.setCollectionAttribute(MasterConstants.RECOMMENDED_AMOUNT_UNIT, legacyMasterDao.findMasterDataEntitiesWithLocale(RecommendedAmntUnitEntity.class), request);
List<CustomFieldDefinitionEntity> customFieldDefinitions = new ArrayList<CustomFieldDefinitionEntity>();
SessionUtils.setCollectionAttribute(SavingsConstants.CUSTOM_FIELDS, customFieldDefinitions, request);
SessionUtils.setAttribute(SavingsConstants.PRDOFFERING, savings.getSavingsOffering(), request);
actionForm.setRecommendedAmount(savingsAccountDto.getRecommendedOrMandatoryAmount());
actionForm.clear();
SessionUtils.setCollectionAttribute(SavingsConstants.RECENTY_ACTIVITY_DETAIL_PAGE, savingsAccountDto.getRecentActivity(), request);
SessionUtils.setCollectionAttribute(SavingsConstants.NOTES, savings.getRecentAccountNotes(), request);
logger.info(" Savings object retrieved successfully");
setCurrentPageUrl(request, savings);
setQuestionGroupInstances(request, savings);
request.getSession().setAttribute("backPageUrl", request.getAttribute("currentPageUrl"));
return mapping.findForward("get_success");
}
use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.
the class SavingsAction method create.
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
SavingsActionForm savingsActionForm = ((SavingsActionForm) form);
logger.debug("In SavingsAction::create(), accountStateId: " + savingsActionForm.getStateSelected());
UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
CustomerBO customer = (CustomerBO) SessionUtils.getAttribute(SavingsConstants.CLIENT, request);
Integer customerId = customer.getCustomerId();
Integer productId = Integer.valueOf(savingsActionForm.getSelectedPrdOfferingId());
String recommendedOrMandatoryAmount = savingsActionForm.getRecommendedAmount();
Short accountState = Short.valueOf(savingsActionForm.getStateSelected());
customer = this.customerDao.findCustomerById(customerId);
checkPermissionForCreate(accountState, uc, customer.getOffice().getOfficeId(), customer.getPersonnel().getPersonnelId());
SavingsAccountCreationDto savingsAccountCreation = new SavingsAccountCreationDto(productId, customerId, accountState, recommendedOrMandatoryAmount);
Long savingsId = this.savingsServiceFacade.createSavingsAccount(savingsAccountCreation);
SavingsBO saving = this.savingsDao.findById(savingsId);
createGroupQuestionnaire.saveResponses(request, savingsActionForm, saving.getAccountId());
request.setAttribute(SavingsConstants.GLOBALACCOUNTNUM, saving.getGlobalAccountNum());
request.setAttribute(SavingsConstants.RECORD_OFFICE_ID, saving.getOffice().getOfficeId());
request.setAttribute(SavingsConstants.CLIENT_NAME, customer.getDisplayName());
request.setAttribute(SavingsConstants.CLIENT_ID, customer.getCustomerId());
request.setAttribute(SavingsConstants.CLIENT_LEVEL, customer.getCustomerLevel().getId());
logger.info("In SavingsAction::create(), Savings object saved successfully ");
return mapping.findForward("create_success");
}
use of org.mifos.accounts.savings.struts.actionforms.SavingsActionForm in project head by mifos.
the class SavingsAction method waiveAmountDue.
@TransactionDemarcate(joinToken = true)
public ActionForward waiveAmountDue(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In SavingsAction::waiveAmountDue()");
UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
Integer versionNum = savings.getVersionNo();
savings = this.savingsDao.findBySystemId(((SavingsActionForm) form).getGlobalAccountNum());
checkVersionMismatch(versionNum, savings.getVersionNo());
savings.setUserContext(uc);
Long savingsId = savings.getAccountId().longValue();
this.savingsServiceFacade.waiveNextDepositAmountDue(savingsId);
return mapping.findForward("waiveAmount_success");
}
Aggregations