Package com.volantis.mcs.expression

Examples of com.volantis.mcs.expression.SelectState


        }
    }


    public void testPushSelectState() throws Exception {
        SelectState initialState = new SelectState(Precept.MATCH_FIRST,
                BooleanValue.TRUE);
        SelectState secondState = new SelectState(Precept.MATCH_EVERY,
                BooleanValue.FALSE);

        context.pushSelectState(initialState);

        assertSame("Expected to find the initial State",
View Full Code Here


                context.peekSelectState(),
                secondState);
    }

    public void testPopSelectState() throws Exception {
        SelectState initialState = new SelectState(Precept.MATCH_FIRST,
                BooleanValue.TRUE);
        SelectState secondState = new SelectState(Precept.MATCH_EVERY,
                BooleanValue.FALSE);

        context.pushSelectState(initialState);
        context.pushSelectState(secondState);
View Full Code Here

            } catch (ExpressionException e) {
                throw new PAPIException(e);
            }
        }

        pageContext.pushSelectState(new SelectState(precept, expr));

        return PROCESS_ELEMENT_BODY;
    }
View Full Code Here

        int returnCode = SKIP_ELEMENT_BODY;
        MarinerPageContext pageContext =
                ContextInternals.getMarinerPageContext(context);
        WhenAttributes attributes = (WhenAttributes) papiAttributes;
        Value expr = null;
        SelectState state = null;

        try {
            state = pageContext.peekSelectState();
        } catch (EmptyStackException e) {
            throw new PAPIException(
                    exceptionLocalizer.format("select-markup-missing"), e);
        }

        if (state.isOtherwiseExecuted()) {
            throw new PAPIException(
                    exceptionLocalizer.format("when-preceed-otherwise"));
        } else if (!state.isMatched() ||
                (state.getPrecept() == Precept.MATCH_EVERY)) {
            // Can continue to see if this when should be evaluated since
            // every precept can be matched or no matches have yet been found
            if (attributes.getExpr() != null) {
                ExpressionContext expressionContext =
                        ContextInternals.getEnvironmentContext(context).
                                getExpressionContext();

                try {
                    // Determine whether the when expression matches that in
                    // the containing select
                    expr = expressionContext.getFactory().
                            createExpressionParser().parse(attributes.getExpr())
                            .
                                    evaluate(expressionContext);

                    if (PipelineExpressionHelper.equals(
                            state.getExpression().getSequence(),
                            expr.getSequence())) {
                        // This when matches the select statement so its
                        // body should be processed
                        returnCode = PROCESS_ELEMENT_BODY;

                        // Ensure that the select state records the fact that
                        // a match has been performed
                        state.setMatched();
                    }
                } catch (ExpressionException e) {
                    throw new PAPIException(e);
                }
            } else {
View Full Code Here

        // when statements matched. This is determined by looking at the
        // select state
        int result = SKIP_ELEMENT_BODY;
        MarinerPageContext pageContext =
                ContextInternals.getMarinerPageContext(context);
        SelectState state = null;

        try {
            state = pageContext.peekSelectState();
        } catch (EmptyStackException e) {
            throw new PAPIException(
                    exceptionLocalizer.format("select-markup-missing"), e);
        }

        if (state.isOtherwiseExecuted()) {
            throw new PAPIException(
                    exceptionLocalizer.format("too-many-otherwises"));
        } else if (!state.isMatched()) {
            // There have been no when statement matches so this otherwise
            // should be executed
            result = PROCESS_ELEMENT_BODY;

            // Record the fact that this otherwise has been executed
            state.setOtherwiseExecuted();
        }

        pageContext.getCurrentOutputBuffer()
                .handleOpenElementWhitespace();
View Full Code Here

                // If an expression was set, then OK to continue
                continueProcessing = true;
            } else {
                // No expression set, see if element is in a select element
                try {
                    SelectState s = pageContext.peekSelectState();
                    // Embedded in a select - ok to continue
                    continueProcessing = true;
                } catch (EmptyStackException ese) {
                    // Not embedded in a select element
                    continueProcessing = false;
View Full Code Here

TOP

Related Classes of com.volantis.mcs.expression.SelectState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.