Search in sources :

Example 41 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class BirtAdminDocumentUploadAction method editpreview.

@TransactionDemarcate(joinToken = true)
public ActionForward editpreview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    BirtAdminDocumentUploadActionForm uploadForm = (BirtAdminDocumentUploadActionForm) form;
    if (uploadForm.getAccountTypeId().equals(ProductType.LOAN.getValue().toString())) {
        uploadForm.setAccountTypeName("LOAN");
    } else if (uploadForm.getAccountTypeId().equals(ProductType.SAVINGS.getValue().toString())) {
        uploadForm.setAccountTypeName("SAVINGS");
    } else {
        uploadForm.setAccountTypeName("TRANSACTIONS PAYMENTS");
    }
    updateSelectedStatus(request, uploadForm);
    return mapping.findForward("edit_preview_success");
}
Also used : BirtAdminDocumentUploadActionForm(org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 42 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate 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)

Example 43 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class NotesAction method create.

@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    NotesActionForm notesActionForm = (NotesActionForm) form;
    UserContext uc = getUserContext(request);
    CreateAccountNote accountNote = (CreateAccountNote) SessionUtils.getAttribute("model.accountNote", request);
    AccountBO accountBO = new AccountBusinessService().getAccount(accountNote.getAccountId());
    if (accountBO.getPersonnel() != null) {
        checkPermissionForAddingNotes(accountBO.getType(), null, uc, accountBO.getOffice().getOfficeId(), accountBO.getPersonnel().getPersonnelId());
    } else {
        checkPermissionForAddingNotes(accountBO.getType(), null, uc, accountBO.getOffice().getOfficeId(), uc.getId());
    }
    if (accountBO.isSavingsAccount()) {
        this.savingsServiceFacade.addNote(accountNote);
    } else {
        this.loanAccountServiceFacade.addNote(accountNote);
    }
    return mapping.findForward(chooseForward(Short.valueOf(notesActionForm.getAccountTypeId())));
}
Also used : AccountBO(org.mifos.accounts.business.AccountBO) CreateAccountNote(org.mifos.dto.domain.CreateAccountNote) AccountBusinessService(org.mifos.accounts.business.service.AccountBusinessService) UserContext(org.mifos.security.util.UserContext) NotesActionForm(org.mifos.accounts.struts.actionforms.NotesActionForm) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 44 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class SavingsApplyAdjustmentAction method load.

@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    clearActionForm(form);
    doCleanUp(request);
    UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
    SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
    Long savingsId = Long.valueOf(savings.getAccountId());
    savings = this.savingsDao.findById(savingsId);
    savings.setUserContext(uc);
    String paymentIdParam = request.getParameter("paymentId");
    Integer paymentId;
    if (paymentIdParam == null) {
        AccountPaymentEntity payment = savings.getLastPmnt();
        paymentId = (payment == null) ? null : payment.getPaymentId();
    } else {
        paymentId = Integer.valueOf(paymentIdParam);
    }
    SavingsAdjustmentReferenceDto savingsAdjustmentDto = this.savingsServiceFacade.retrieveAdjustmentReferenceData(savingsId, paymentId);
    if (savingsAdjustmentDto.isDepositOrWithdrawal()) {
        AccountPaymentEntity payment = (paymentId == null) ? savings.findMostRecentPaymentByPaymentDate() : savings.findPaymentById(paymentId);
        AccountActionEntity accountAction = legacyMasterDao.getPersistentObject(AccountActionEntity.class, new SavingsHelper().getPaymentActionType(payment));
        Hibernate.initialize(savings.findMostRecentPaymentByPaymentDate().getAccountTrxns());
        SessionUtils.setAttribute(SavingsConstants.ACCOUNT_ACTION, accountAction, request);
        SessionUtils.setAttribute(SavingsConstants.CLIENT_NAME, savingsAdjustmentDto.getClientName(), request);
        SessionUtils.setAttribute(SavingsConstants.IS_LAST_PAYMENT_VALID, Constants.YES, request);
        SessionUtils.setAttribute(SavingsConstants.ADJUSTMENT_AMOUNT, payment.getAmount().getAmount(), request);
        SavingsApplyAdjustmentActionForm actionForm = (SavingsApplyAdjustmentActionForm) form;
        actionForm.setPaymentId(paymentId);
        actionForm.setTrxnDate(new LocalDate(payment.getPaymentDate()));
    } else {
        SessionUtils.setAttribute(SavingsConstants.IS_LAST_PAYMENT_VALID, Constants.NO, request);
    }
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, savings, request);
    return mapping.findForward("load_success");
}
Also used : SavingsAdjustmentReferenceDto(org.mifos.dto.screen.SavingsAdjustmentReferenceDto) UserContext(org.mifos.security.util.UserContext) SavingsHelper(org.mifos.accounts.savings.util.helpers.SavingsHelper) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) SavingsApplyAdjustmentActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsApplyAdjustmentActionForm) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) LocalDate(org.joda.time.LocalDate) AccountActionEntity(org.mifos.accounts.business.AccountActionEntity) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 45 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class SavingsClosureAction method captureQuestionResponses.

@TransactionDemarcate(joinToken = true)
public ActionForward captureQuestionResponses(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
    request.setAttribute(METHODCALLED, "captureQuestionResponses");
    ActionErrors errors = closeSavingsQuestionnaire.validateResponses(request, (SavingsClosureActionForm) form);
    if (errors != null && !errors.isEmpty()) {
        addErrors(request, errors);
        return mapping.findForward(ActionForwards.captureQuestionResponses.toString());
    }
    return closeSavingsQuestionnaire.rejoinFlow(mapping);
}
Also used : ActionErrors(org.apache.struts.action.ActionErrors) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)259 UserContext (org.mifos.security.util.UserContext)72 ArrayList (java.util.ArrayList)41 CloseSession (org.mifos.framework.util.helpers.CloseSession)35 LoanBO (org.mifos.accounts.loan.business.LoanBO)26 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)21 CustomerBO (org.mifos.customers.business.CustomerBO)20 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)19 AccountBO (org.mifos.accounts.business.AccountBO)18 ApplicationException (org.mifos.framework.exceptions.ApplicationException)17 ActionErrors (org.apache.struts.action.ActionErrors)14 LocalDate (org.joda.time.LocalDate)14 AccountApplyPaymentActionForm (org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm)14 ClientBO (org.mifos.customers.client.business.ClientBO)14 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)13 List (java.util.List)12 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)12 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)12 MeetingBO (org.mifos.application.meeting.business.MeetingBO)12 ActionForward (org.apache.struts.action.ActionForward)11