Examples of AxisStep


Examples of org.jboss.dna.jcr.xpath.XPath.AxisStep

    protected StepExpression parseStepExpr( TokenStream tokens ) {
        KindTest kindTest = parseKindTest(tokens);
        if (kindTest != null) {
            // Now parse the predicates ...
            List<Component> predicates = parsePredicates(tokens);
            return new AxisStep(kindTest, predicates);
        }
        if (tokens.matches('(') || tokens.matches('.') || tokens.matches(XPathTokenizer.QUOTED_STRING)
            || tokens.matches(ANY_VALUE, "(") || tokens.matches(ANY_VALUE, ":", ANY_VALUE, "(")) {
            // We know its a filter expression (though literals don't fit this pattern) ...
            return parseFilterExpr(tokens);
        }
        AxisStep result = parseAxisStep(tokens);
        if (result != null) return result;
        // It must be the remaining kind of filter expression ...
        return parseFilterExpr(tokens);
    }
View Full Code Here

Examples of org.jboss.dna.jcr.xpath.XPath.AxisStep

            return null;
        }

        // Parse the predicates
        List<Component> predicates = parsePredicates(tokens);
        return new AxisStep(nodeTest, predicates);
    }
View Full Code Here

Examples of org.jboss.dna.jcr.xpath.XPath.AxisStep

        ConstraintBuilder where = builder.where();
        List<StepExpression> path = new ArrayList<StepExpression>();
        String tableName = null;
        for (StepExpression step : steps) {
            if (step instanceof AxisStep) {
                AxisStep axis = (AxisStep)step;
                NodeTest nodeTest = axis.getNodeTest();
                if (nodeTest instanceof NameTest) {
                    if (appliesToPathConstraint(axis.getPredicates())) {
                        // Everything in this axis/step applies to the path, so add it and we'll translate it below ...
                        path.add(step);
                    } else {
                        // The constraints are more complicated than can be applied to the path ...
                        // if (!nameTest.isWildcard()) {
                        // There is a non-wildcard name test that we still need to add to the path ...
                        path.add(step);
                        // }
                        // We need to define a new source/table ...
                        tableName = translateSource(tableName, path, where);
                        translatePredicates(axis.getPredicates(), tableName, where);
                        path.clear();
                    }
                } else if (nodeTest instanceof ElementTest) {
                    // We need to build a new source with the partial path we have so far ...
                    tableName = translateElementTest((ElementTest)nodeTest, path, where);
                    translatePredicates(axis.getPredicates(), tableName, where);
                    path.clear();
                } else if (nodeTest instanceof AttributeNameTest) {
                    AttributeNameTest attributeName = (AttributeNameTest)nodeTest;
                    builder.select(nameFrom(attributeName.getNameTest()));
                } else {
View Full Code Here

Examples of org.jboss.dna.jcr.xpath.XPath.AxisStep

                } else {
                    builder = new DualPathLikeBuilder(builder.clone(), builder.append("/%"));
                }
            } else if (step instanceof AxisStep) {
                ++depth;
                AxisStep axis = (AxisStep)step;
                NodeTest nodeTest = axis.getNodeTest();
                assert !(nodeTest instanceof ElementTest);
                if (nodeTest instanceof NameTest) {
                    NameTest nameTest = (NameTest)nodeTest;
                    builder.append('/');
                    if (nameTest.getPrefixTest() != null) {
                        builder.append(nameTest.getPrefixTest()).append(':');
                    }
                    if (nameTest.getLocalTest() != null) {
                        builder.append(nameTest.getLocalTest());
                    } else {
                        builder.append('%');
                    }
                    List<Component> predicates = axis.getPredicates();
                    if (!predicates.isEmpty()) {
                        assert predicates.size() == 1;
                        Component predicate = predicates.get(0);
                        if (predicate instanceof Literal && ((Literal)predicate).isInteger()) {
                            builder.append('[').append(((Literal)predicate).getValue()).append(']');
View Full Code Here

Examples of org.jboss.dna.jcr.xpath.XPath.AxisStep

        return new DescendantOrSelf();
    }

    protected AxisStep axisStep( NodeTest nodeTest,
                                 Component... predicates ) {
        return new AxisStep(nodeTest, predicates(predicates));
    }
View Full Code Here

Examples of org.modeshape.jcr.query.xpath.XPath.AxisStep

        return new DescendantOrSelf();
    }

    protected AxisStep axisStep( NodeTest nodeTest,
                                 Component... predicates ) {
        return new AxisStep(nodeTest, predicates(predicates));
    }
View Full Code Here

Examples of org.modeshape.jcr.query.xpath.XPath.AxisStep

        ConstraintBuilder where = builder.where();
        List<StepExpression> path = new ArrayList<StepExpression>();
        String tableName = null;
        for (StepExpression step : steps) {
            if (step instanceof AxisStep) {
                AxisStep axis = (AxisStep)step;
                NodeTest nodeTest = axis.getNodeTest();
                if (nodeTest instanceof NameTest) {
                    if (appliesToPathConstraint(axis.getPredicates())) {
                        // Everything in this axis/step applies to the path, so add it and we'll translate it below ...
                        path.add(step);
                    } else {
                        // The constraints are more complicated than can be applied to the path ...
                        // if (!nameTest.isWildcard()) {
                        // There is a non-wildcard name test that we still need to add to the path ...
                        path.add(step);
                        // }
                        // We need to define a new source/table ...
                        tableName = translateSource(tableName, path, where);
                        translatePredicates(axis.getPredicates(), tableName, where);
                        path.clear();
                    }
                } else if (nodeTest instanceof ElementTest) {
                    // We need to build a new source with the partial path we have so far ...
                    tableName = translateElementTest((ElementTest)nodeTest, path, where);
                    translatePredicates(axis.getPredicates(), tableName, where);
                    path.clear();
                } else if (nodeTest instanceof AttributeNameTest) {
                    AttributeNameTest attributeName = (AttributeNameTest)nodeTest;
                    builder.select(nameFrom(attributeName.getNameTest()));
                } else if (nodeTest instanceof TextTest) {
                    NameTest nameTest = new NameTest("jcr", "xmltext");
                    List<Component> predicates = axis.getPredicates();
                    if (predicates == null || predicates.isEmpty() || appliesToPathConstraint(predicates)) {
                        AxisStep textStep = new AxisStep(nameTest, axis.getPredicates());
                        path.add(textStep);
                    } else {
                        tableName = translateSource(tableName, path, where);
                        translatePredicates(predicates, tableName, where);
                        path.clear();
View Full Code Here

Examples of org.modeshape.jcr.query.xpath.XPath.AxisStep

            where.depth(tableName).isEqualTo(1);
        } else {
            List<StepExpression> path = new ArrayList<StepExpression>(pathConstraint);
            if (!path.isEmpty() && path.get(path.size() - 1) instanceof AxisStep) {
                // Element test should always apply to descendants, never to self, so add a descedant
                path.add(new AxisStep(new NameTest(null, null), Collections.<Component>emptyList()));
            }
            translatePathExpressionConstraint(new PathExpression(true, path, null), where, tableName);
        }
        return tableName;
    }
View Full Code Here

Examples of org.modeshape.jcr.query.xpath.XPath.AxisStep

                        builder.append('/').append('%');
                    }
                }
            } else if (step instanceof AxisStep) {
                ++depth;
                AxisStep axis = (AxisStep)step;
                NodeTest nodeTest = axis.getNodeTest();
                assert !(nodeTest instanceof ElementTest);
                if (nodeTest instanceof NameTest) {
                    NameTest nameTest = (NameTest)nodeTest;
                    builder.append('/');
                    boolean addSns = true;
                    if (nameTest.getPrefixTest() != null) {
                        builder.append(nameTest.getPrefixTest()).append(':');
                    }
                    if (nameTest.getLocalTest() != null) {
                        builder.append(nameTest.getLocalTest());
                    } else {
                        builder.append('%');
                        addSns = false;
                    }
                    List<Component> predicates = axis.getPredicates();
                    boolean addedSns = false;
                    if (!predicates.isEmpty()) {
                        assert predicates.size() == 1;
                        Component predicate = predicates.get(0);
                        if (predicate instanceof Literal && ((Literal)predicate).isInteger()) {
View Full Code Here

Examples of org.modeshape.jcr.query.xpath.XPath.AxisStep

    protected StepExpression parseStepExpr( TokenStream tokens ) {
        KindTest kindTest = parseKindTest(tokens);
        if (kindTest != null) {
            // Now parse the predicates ...
            List<Component> predicates = parsePredicates(tokens);
            return new AxisStep(kindTest, predicates);
        }
        if (tokens.matches('(') || tokens.matches('.') || tokens.matches(XPathTokenizer.QUOTED_STRING)
            || tokens.matches(ANY_VALUE, "(") || tokens.matches(ANY_VALUE, ":", ANY_VALUE, "(")) {
            // We know its a filter expression (though literals don't fit this pattern) ...
            return parseFilterExpr(tokens);
        }
        AxisStep result = parseAxisStep(tokens);
        if (result != null) return result;
        // It must be the remaining kind of filter expression ...
        return parseFilterExpr(tokens);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.