Search in sources :

Example 11 with PageExpiredException

use of org.mifos.framework.exceptions.PageExpiredException in project head by mifos.

the class BulkEntryActionForm method validate.

@Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    logger.debug("BulkEntryActionForm.validate");
    request.setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
    ActionErrors errors = new ActionErrors();
    if (request.getParameter(CollectionSheetEntryConstants.METHOD).equalsIgnoreCase(CollectionSheetEntryConstants.GETMETHOD)) {
        java.sql.Date meetingDate = null;
        try {
            Object lastMeetingDate = SessionUtils.getAttribute("LastMeetingDate", request);
            if (lastMeetingDate != null) {
                meetingDate = new java.sql.Date(((java.util.Date) lastMeetingDate).getTime());
            }
            short isCenterHierarchyExists = (Short) SessionUtils.getAttribute(CollectionSheetEntryConstants.ISCENTERHIERARCHYEXISTS, request);
            return mandatoryCheck(meetingDate, getUserContext(request), isCenterHierarchyExists);
        } catch (PageExpiredException e) {
            errors.add(ExceptionConstants.PAGEEXPIREDEXCEPTION, new ActionMessage(ExceptionConstants.PAGEEXPIREDEXCEPTION));
        }
    }
    return errors;
}
Also used : PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) ActionMessage(org.apache.struts.action.ActionMessage) ActionErrors(org.apache.struts.action.ActionErrors) Date(java.sql.Date) Date(java.sql.Date)

Example 12 with PageExpiredException

use of org.mifos.framework.exceptions.PageExpiredException in project head by mifos.

the class BulkEntryTag method doStartTag.

@SuppressWarnings("unchecked")
@Override
public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    JspWriter out = pageContext.getOut();
    StringBuilder builder = new StringBuilder();
    CollectionSheetEntryGridDto bulkEntry = null;
    try {
        bulkEntry = (CollectionSheetEntryGridDto) SessionUtils.getAttribute(CollectionSheetEntryConstants.BULKENTRY, request);
    } catch (PageExpiredException e) {
        logger.error("Page expired getting BulkEntryBO.");
    }
    if (null != bulkEntry) {
        List<ProductDto> loanProducts = bulkEntry.getLoanProducts();
        List<ProductDto> savingsProducts = bulkEntry.getSavingProducts();
        try {
            final List<CustomValueListElementDto> custAttTypes = (List<CustomValueListElementDto>) SessionUtils.getAttribute(CollectionSheetEntryConstants.CUSTOMERATTENDANCETYPES, request);
            String method = request.getParameter(CollectionSheetEntryConstants.METHOD);
            generateTagData(bulkEntry, loanProducts, savingsProducts, custAttTypes, method, builder);
        } catch (ApplicationException ae) {
            throw new JspException(ae);
        } catch (SystemException se) {
            throw new JspException(se);
        }
    }
    try {
        out.write(builder.toString());
    } catch (IOException ioe) {
        throw new JspException(ioe);
    }
    return SKIP_BODY;
}
Also used : CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) IOException(java.io.IOException) JspWriter(javax.servlet.jsp.JspWriter) HttpServletRequest(javax.servlet.http.HttpServletRequest) JspException(javax.servlet.jsp.JspException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) SystemException(org.mifos.framework.exceptions.SystemException) List(java.util.List) ProductDto(org.mifos.application.servicefacade.ProductDto) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)

Example 13 with PageExpiredException

use of org.mifos.framework.exceptions.PageExpiredException in project head by mifos.

the class LoanPrdActionForm method setSelectedFeesPenaltiesAndFundsAndValidateForFrequency.

private void setSelectedFeesPenaltiesAndFundsAndValidateForFrequency(HttpServletRequest request, ActionErrors errors) {
    logger.debug("start setSelectedFeesPenaltiesAndFundsAndValidateForFrequency method " + "of Loan Product Action form method :");
    request.setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
    List<FeeDto> feeDtos = new ArrayList<FeeDto>();
    try {
        if (getPrdOfferinFees() != null && getPrdOfferinFees().length > 0) {
            List<FeeBO> fees = getAllLoanPrdFee(request);
            for (String selectedFee : getPrdOfferinFees()) {
                FeeBO fee = getFeeFromList(fees, selectedFee);
                if (fee != null) {
                    isFrequencyMatchingOfferingFrequency(fee, errors);
                    if (AccountingRules.isMultiCurrencyEnabled()) {
                        isValidForCurrency(fee, errors, request);
                    }
                    feeDtos.add(getFeeDto(request, fee));
                }
            }
        }
        setSelectedFeeDtoOnSession(request, feeDtos);
    } catch (PageExpiredException e) {
    }
    List<FundBO> selectedFunds = new ArrayList<FundBO>();
    try {
        if (getLoanOfferingFunds() != null && getLoanOfferingFunds().length > 0) {
            List<FundBO> funds = (List<FundBO>) SessionUtils.getAttribute(ProductDefinitionConstants.SRCFUNDSLIST, request);
            for (String selectedFund : getLoanOfferingFunds()) {
                FundBO fund = getFundFromList(funds, selectedFund);
                if (fund != null) {
                    selectedFunds.add(fund);
                }
            }
        }
        SessionUtils.setCollectionAttribute(ProductDefinitionConstants.LOANPRDFUNDSELECTEDLIST, selectedFunds, request);
    } catch (PageExpiredException e) {
    }
    List<PenaltyDto> selectedPenalties = new ArrayList<PenaltyDto>();
    try {
        if (getPrdOfferinPenalties() != null && getPrdOfferinPenalties().length > 0) {
            List<PenaltyBO> penalties = getAllLoanPrdPenalty(request);
            for (String selectedPenalty : getPrdOfferinPenalties()) {
                PenaltyBO penalty = getPenaltyFromList(penalties, selectedPenalty);
                if (penalty != null) {
                    selectedPenalties.add(penalty.toDto());
                }
            }
        }
        setSelectedPenaltyDtoOnSession(request, selectedPenalties);
    } catch (PageExpiredException e) {
    }
    logger.debug("setSelectedFeesPenaltiesAndFundsAndValidateForFrequency method " + "of Loan Product Action form method called :");
}
Also used : PenaltyDto(org.mifos.dto.domain.PenaltyDto) PenaltyBO(org.mifos.accounts.penalties.business.PenaltyBO) FundBO(org.mifos.accounts.fund.business.FundBO) ArrayList(java.util.ArrayList) FeeDto(org.mifos.accounts.fees.business.FeeDto) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) FeeBO(org.mifos.accounts.fees.business.FeeBO) RateFeeBO(org.mifos.accounts.fees.business.RateFeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) ArrayList(java.util.ArrayList) List(java.util.List)

Example 14 with PageExpiredException

use of org.mifos.framework.exceptions.PageExpiredException in project head by mifos.

the class LoanPrdActionForm method validateStartDateForEditPreview.

private void validateStartDateForEditPreview(HttpServletRequest request, ActionErrors errors) {
    logger.debug("start validateStartDateForEditPreview method of Loan Product Action form method :" + startDate);
    request.setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
    java.util.Date oldStartDate = null;
    Date changedStartDate = null;
    try {
        oldStartDate = (java.util.Date) SessionUtils.getAttribute(ProductDefinitionConstants.LOANPRDSTARTDATE, request);
    } catch (PageExpiredException e) {
    }
    try {
        changedStartDate = getStartDateValue(getUserContext(request).getPreferredLocale());
    } catch (InvalidDateException ide) {
        addError(errors, "startdate", ProductDefinitionConstants.STARTDATEUPDATEEXCEPTION);
    }
    if (oldStartDate != null && changedStartDate != null) {
        if (LoanOfferingBO.isBackDatedLoanProductCreationAllowed() && DateUtils.getDateWithoutTimeStamp(oldStartDate.getTime()).compareTo(DateUtils.getDateWithoutTimeStamp(changedStartDate.getTime())) != 0) {
            addError(errors, "startDate", ProductDefinitionConstants.STARTDATEUPDATEEXCEPTION);
        } else if (!LoanOfferingBO.isBackDatedLoanProductCreationAllowed() && DateUtils.getDateWithoutTimeStamp(oldStartDate.getTime()).compareTo(DateUtils.getCurrentDateWithoutTimeStamp()) <= 0 && (DateUtils.getDateWithoutTimeStamp(oldStartDate.getTime()).compareTo(DateUtils.getDateWithoutTimeStamp(changedStartDate.getTime())) != 0)) {
            addError(errors, "startDate", ProductDefinitionConstants.STARTDATEUPDATEEXCEPTION);
        }
    } else if (changedStartDate != null && DateUtils.getDateWithoutTimeStamp(changedStartDate.getTime()).compareTo(DateUtils.getCurrentDateWithoutTimeStamp()) > 0) {
        validateStartDate(request, errors);
    }
    logger.debug("validateStartDateForEditPreview method of Loan Product Action form method called :" + startDate + "---" + oldStartDate);
}
Also used : InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) Date(java.sql.Date)

Example 15 with PageExpiredException

use of org.mifos.framework.exceptions.PageExpiredException in project head by mifos.

the class LoanAccountActionForm method validateRedoLoanPayments.

private void validateRedoLoanPayments(HttpServletRequest request, ActionErrors errors, MifosCurrency currency) {
    Locale locale = getUserContext(request).getPreferredLocale();
    try {
        CustomerBO customer = getCustomer(request);
        List<PaymentDataHtmlBean> validPaymentBeans = getValidatablePaymentBeans();
        for (PaymentDataHtmlBean bean : validPaymentBeans) {
            validatePaymentDataHtmlBean(errors, currency, locale, customer, bean);
        }
        validatePaymentDatesOrdering(validPaymentBeans, errors);
        validateMaxPayableAmount(request, errors);
    } catch (InvalidDateException invalidDate) {
        errors.add(LoanExceptionConstants.INVALIDTRANSACTIONDATE, new ActionMessage(LoanExceptionConstants.INVALIDTRANSACTIONDATE));
    } catch (FrameworkRuntimeException invalidDate) {
        errors.add(LoanExceptionConstants.INVALIDTRANSACTIONDATE, new ActionMessage(LoanExceptionConstants.INVALIDTRANSACTIONDATE));
    } catch (MeetingException e) {
        errors.add(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION, new ActionMessage(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION));
    } catch (PageExpiredException e) {
        errors.add(ExceptionConstants.PAGEEXPIREDEXCEPTION, new ActionMessage(ExceptionConstants.PAGEEXPIREDEXCEPTION));
    } catch (PersistenceException e) {
        errors.add(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION, new ActionMessage(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION));
    }
}
Also used : Locale(java.util.Locale) FrameworkRuntimeException(org.mifos.framework.exceptions.FrameworkRuntimeException) MeetingException(org.mifos.application.meeting.exceptions.MeetingException) PaymentDataHtmlBean(org.mifos.accounts.loan.struts.uihelpers.PaymentDataHtmlBean) InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) ActionMessage(org.apache.struts.action.ActionMessage) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) CustomerBO(org.mifos.customers.business.CustomerBO)

Aggregations

PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)23 ArrayList (java.util.ArrayList)9 List (java.util.List)9 HttpServletRequest (javax.servlet.http.HttpServletRequest)6 ActionMessage (org.apache.struts.action.ActionMessage)6 IOException (java.io.IOException)5 JspException (javax.servlet.jsp.JspException)5 ActionErrors (org.apache.struts.action.ActionErrors)4 Test (org.junit.Test)4 FeeBO (org.mifos.accounts.fees.business.FeeBO)4 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)4 FeeDto (org.mifos.accounts.fees.business.FeeDto)3 Date (java.sql.Date)2 Date (java.util.Date)2 JspWriter (javax.servlet.jsp.JspWriter)2 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)2 InvalidDateException (org.mifos.application.admin.servicefacade.InvalidDateException)2 HibernateSearchException (org.mifos.framework.exceptions.HibernateSearchException)2 TableTagParseException (org.mifos.framework.exceptions.TableTagParseException)2 Flow (org.mifos.framework.util.helpers.Flow)2