Search in sources :

Example 6 with PageExpiredException

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

the class LoanPrdActionForm method setSelectedQuestionGroups.

// Intentionally made public to aid testing !!!
void setSelectedQuestionGroups(HttpServletRequest request) {
    try {
        List<QuestionGroupDetail> questionGroups = new ArrayList<QuestionGroupDetail>();
        if (loanOfferingQGs != null && loanOfferingQGs.length > 0) {
            List<QuestionGroupDetail> srcQGDetails = (List<QuestionGroupDetail>) SessionUtils.getAttribute(ProductDefinitionConstants.SRCQGLIST, request);
            for (String loanOfferingQG : loanOfferingQGs) {
                for (QuestionGroupDetail questionGroupDetail : srcQGDetails) {
                    if (String.valueOf(questionGroupDetail.getId()).equals(loanOfferingQG)) {
                        questionGroups.add(questionGroupDetail);
                        break;
                    }
                }
            }
        }
        SessionUtils.setCollectionAttribute(ProductDefinitionConstants.SELECTEDQGLIST, questionGroups, request);
    } catch (PageExpiredException e) {
        logger.error("An error occurred while setting selected question groups on session", e);
    }
}
Also used : QuestionGroupDetail(org.mifos.platform.questionnaire.service.QuestionGroupDetail) ArrayList(java.util.ArrayList) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) ArrayList(java.util.ArrayList) List(java.util.List)

Example 7 with PageExpiredException

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

the class LoanPrdActionForm method validateSelectedFeeForVariableInstallment.

@SuppressWarnings("unchecked")
//made default access to assist testing
void validateSelectedFeeForVariableInstallment(HttpServletRequest request, ActionErrors errors) {
    request.setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
    List<FeeDto> feeDtos = new ArrayList<FeeDto>();
    try {
        if (getPrdOfferinFees() != null && getPrdOfferinFees().length > 0) {
            List<FeeBO> fees = (List<FeeBO>) SessionUtils.getAttribute(ProductDefinitionConstants.LOANPRDFEE, request);
            for (String selectedFee : getPrdOfferinFees()) {
                FeeBO fee = getFeeFromList(fees, selectedFee);
                if (fee != null) {
                    if (canConfigureVariableInstallments()) {
                        if (validateIfFeeTypeNonPeriodic(fee, errors) && validateFeeIsNotDependentOnPercentOfInterest(fee, errors)) {
                            feeDtos.add(getFeeDto(request, fee));
                        }
                    } else {
                        feeDtos.add(getFeeDto(request, fee));
                    }
                }
            }
        }
        setSelectedFeeDtoOnSession(request, feeDtos);
    } catch (PageExpiredException e) {
    }
}
Also used : ArrayList(java.util.ArrayList) FeeDto(org.mifos.accounts.fees.business.FeeDto) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) ArrayList(java.util.ArrayList) List(java.util.List) FeeBO(org.mifos.accounts.fees.business.FeeBO) RateFeeBO(org.mifos.accounts.fees.business.RateFeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO)

Example 8 with PageExpiredException

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

the class ClientCustActionForm method validateSelectedOfferings.

@SuppressWarnings("unchecked")
private void validateSelectedOfferings(ActionErrors errors, HttpServletRequest request) {
    boolean duplicateFound = false;
    for (int i = 0; i < selectedOfferings.size() - 1; i++) {
        for (int j = i + 1; j < selectedOfferings.size(); j++) {
            if (selectedOfferings.get(i) != null && selectedOfferings.get(j) != null && selectedOfferings.get(i).equals(selectedOfferings.get(j))) {
                String selectedOffering = "";
                try {
                    List<SavingsDetailDto> offeringsList = (List<SavingsDetailDto>) SessionUtils.getAttribute(ClientConstants.SAVINGS_OFFERING_LIST, request);
                    for (SavingsDetailDto savingsOffering : offeringsList) {
                        if (selectedOfferings.get(i).equals(savingsOffering.getPrdOfferingId())) {
                            selectedOffering = savingsOffering.getPrdOfferingName();
                        }
                        break;
                    }
                } catch (PageExpiredException pee) {
                }
                errors.add(ClientConstants.ERRORS_DUPLICATE_OFFERING_SELECTED, new ActionMessage(ClientConstants.ERRORS_DUPLICATE_OFFERING_SELECTED, selectedOffering));
                duplicateFound = true;
                break;
            }
        }
        if (duplicateFound) {
            break;
        }
    }
}
Also used : SavingsDetailDto(org.mifos.dto.domain.SavingsDetailDto) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) ActionMessage(org.apache.struts.action.ActionMessage) ArrayList(java.util.ArrayList) List(java.util.List)

Example 9 with PageExpiredException

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

the class FlowKeyInterceptor method joinToken.

private void joinToken(HttpServletRequest request) throws PageExpiredException {
    String flowKey = request.getParameter(Constants.CURRENTFLOWKEY);
    if (null == flowKey) {
        flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
    }
    FlowManager flowManager = (FlowManager) request.getSession().getAttribute(Constants.FLOWMANAGER);
    if (flowKey == null || !flowManager.isFlowValid(flowKey)) {
        throw new PageExpiredException("no flow for key " + flowKey);
    }
}
Also used : FlowManager(org.mifos.framework.util.helpers.FlowManager) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException)

Example 10 with PageExpiredException

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

the class PersonActionForm method validate.

@Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    String method = request.getParameter("method");
    request.setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
    request.getSession().setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
    if (method.equals(Methods.preview.toString())) {
        handleCreatePreviewValidations(errors, request);
    }
    if (method.equals(Methods.previewManage.toString())) {
        handleManagePreviewValidations(errors, request);
    }
    if (method.equals(Methods.search.toString())) {
        if (StringUtils.isBlank(searchString)) {
            try {
                cleanUpSearch(request);
            } catch (PageExpiredException e) {
                errors.add(ExceptionConstants.PAGEEXPIREDEXCEPTION, new ActionMessage(ExceptionConstants.PAGEEXPIREDEXCEPTION));
            }
            errors.add(PersonnelConstants.NO_SEARCH_STRING, new ActionMessage(PersonnelConstants.NO_SEARCH_STRING));
        }
    }
    if (!errors.isEmpty()) {
        request.setAttribute(Globals.ERROR_KEY, errors);
        request.setAttribute("methodCalled", method);
        try {
            updateRoleLists(request);
        } 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)

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