use of org.mifos.accounts.business.AccountActionEntity in project head by mifos.
the class SavingsDepositWithdrawalAction method load.
@TransactionDemarcate(joinToken = true)
public ActionForward load(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
SavingsDepositWithdrawalActionForm actionForm = (SavingsDepositWithdrawalActionForm) form;
clearActionForm(actionForm);
Long savingsId = savings.getAccountId().longValue();
Integer customerId = savings.getCustomer().getCustomerId();
if (StringUtils.isNotBlank(actionForm.getCustomerId())) {
customerId = Integer.valueOf(actionForm.getCustomerId());
}
DepositWithdrawalReferenceDto depositWithdrawalReferenceDto = this.savingsServiceFacade.retrieveDepositWithdrawalReferenceData(savingsId, customerId);
savings = this.savingsDao.findById(savingsId);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, savings, request);
if (savings.isGroupModelWithIndividualAccountability()) {
List<CustomerBO> activeAndOnHoldClients = new CustomerPersistence().getActiveAndOnHoldChildren(savings.getCustomer().getSearchId(), savings.getCustomer().getOfficeId(), CustomerLevel.CLIENT);
SessionUtils.setCollectionAttribute(SavingsConstants.CLIENT_LIST, activeAndOnHoldClients, request);
} else {
SessionUtils.setAttribute(SavingsConstants.CLIENT_LIST, new ArrayList<CustomerBO>(), request);
}
LegacyAcceptedPaymentTypeDao persistence = legacyAcceptedPaymentTypeDao;
List<PaymentTypeEntity> acceptedPaymentTypes = persistence.getAcceptedPaymentTypesForATransaction(uc.getLocaleId(), TrxnTypes.savings_deposit.getValue());
SessionUtils.setCollectionAttribute(MasterConstants.PAYMENT_TYPE, acceptedPaymentTypes, request);
List<AccountActionEntity> trxnTypes = new ArrayList<AccountActionEntity>();
trxnTypes.add(getAccountsService().getAccountAction(AccountActionTypes.SAVINGS_DEPOSIT.getValue(), uc.getLocaleId()));
trxnTypes.add(getAccountsService().getAccountAction(AccountActionTypes.SAVINGS_WITHDRAWAL.getValue(), uc.getLocaleId()));
SessionUtils.setCollectionAttribute(AccountConstants.TRXN_TYPES, trxnTypes, request);
SessionUtils.setAttribute(SavingsConstants.IS_BACKDATED_TRXN_ALLOWED, depositWithdrawalReferenceDto.isBackDatedTransactionsAllowed(), request);
AccountPaymentEntity lastPayment = savings.findMostRecentDepositOrWithdrawalByDate();
if (lastPayment != null) {
actionForm.setLastTrxnDate(lastPayment.getPaymentDate());
}
actionForm.setTrxnDate(DateUtils.getCurrentDate(uc.getPreferredLocale()));
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.accounts.business.AccountActionEntity in project head by mifos.
the class AccountServiceIntegrationTest method testGetAccountAction.
@Test
public void testGetAccountAction() throws Exception {
AccountBusinessService service = new AccountBusinessService();
AccountActionEntity accountaction = service.getAccountAction(AccountActionTypes.SAVINGS_DEPOSIT.getValue(), Short.valueOf("1"));
Assert.assertNotNull(accountaction);
}
use of org.mifos.accounts.business.AccountActionEntity in project head by mifos.
the class BirtAdminDocumentUploadAction method editThenUpload.
@SuppressWarnings("unchecked")
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward editThenUpload(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
BirtAdminDocumentUploadActionForm uploadForm = (BirtAdminDocumentUploadActionForm) form;
FormFile formFile = uploadForm.getFile();
boolean newFile = false;
if (StringUtils.isEmpty(formFile.getFileName())) {
formFile.destroy();
} else {
uploadFile(formFile);
newFile = true;
}
AdminDocumentBO admindoc = legacyAdminDocumentDao.getAdminDocumentById(Short.valueOf(SessionUtils.getAttribute("admindocId", request).toString()));
admindoc.setAdminDocumentName(uploadForm.getAdminiDocumentTitle());
admindoc.setIsActive(Short.valueOf(uploadForm.getIsActive()));
if (newFile) {
admindoc.setAdminDocumentIdentifier(formFile.getFileName());
}
legacyAdminDocumentDao.createOrUpdate(admindoc);
if (Short.valueOf(uploadForm.getAccountTypeId()).shortValue() <= 2) {
List<AccountStateEntity> masterList = (List<AccountStateEntity>) SessionUtils.getAttribute("SelectedStatus", request);
List<AdminDocAccStateMixBO> admindoclist = legacyAdminDocAccStateMixDao.getMixByAdminDocuments(Short.valueOf(SessionUtils.getAttribute("admindocId", request).toString()));
for (AdminDocAccStateMixBO temp : admindoclist) {
legacyAdminDocAccStateMixDao.delete(temp);
}
AdminDocAccStateMixBO admindocaccstatemixBO = new AdminDocAccStateMixBO();
for (AccountStateEntity acc : masterList) {
admindocaccstatemixBO = new AdminDocAccStateMixBO();
admindocaccstatemixBO.setAccountStateID(acc);
admindocaccstatemixBO.setAdminDocumentID(admindoc);
legacyAdminDocAccStateMixDao.createOrUpdate(admindocaccstatemixBO);
}
} else {
List<AccountActionEntity> masterList = (List<AccountActionEntity>) SessionUtils.getAttribute("SelectedStatus", request);
List<AdminDocAccActionMixBO> admindoclist = legacyAdminDocAccStateMixDao.getAccActionMixByAdminDocument(Short.valueOf(SessionUtils.getAttribute("admindocId", request).toString()));
for (AdminDocAccActionMixBO temp : admindoclist) {
legacyAdminDocAccStateMixDao.delete(temp);
}
AdminDocAccActionMixBO adminDocAccActionMixBO = new AdminDocAccActionMixBO();
for (AccountActionEntity acc : masterList) {
adminDocAccActionMixBO = new AdminDocAccActionMixBO();
adminDocAccActionMixBO.setAccountAction(acc);
adminDocAccActionMixBO.setAdminDocument(admindoc);
legacyAdminDocAccStateMixDao.createOrUpdate(adminDocAccActionMixBO);
}
}
return getViewBirtAdminDocumentPage(mapping, form, request, response);
}
Aggregations