Package org.jboss.dna.jcr.xpath.XPath

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


     */
    protected boolean appliesToPathConstraint( List<Component> predicates ) {
        if (predicates.isEmpty()) return true;
        if (predicates.size() > 1) return false;
        assert predicates.size() == 1;
        Component predicate = predicates.get(0);
        if (predicate instanceof Literal && ((Literal)predicate).isInteger()) return true;
        if (predicate instanceof NameTest && ((NameTest)predicate).isWildcard()) return true;
        return false;
    }
View Full Code Here


                        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(']');
                        }
                    }
                }
            } else if (step instanceof FilterStep) {
                FilterStep filter = (FilterStep)step;
                Component primary = filter.getPrimaryExpression();
                if (primary instanceof ContextItem) {
                    continue; // ignore this '.'
                } else if (primary instanceof ParenthesizedExpression) {
                    ParenthesizedExpression paren = (ParenthesizedExpression)primary;
                    Component wrapped = paren.getWrapped().collapse();
                    if (wrapped instanceof AttributeNameTest) {
                        // ignore this; handled earlier ...
                    } else if (wrapped instanceof BinaryComponent) {
                        List<NameTest> names = extractElementNames((BinaryComponent)wrapped);
                        if (names.size() >= 1) {
View Full Code Here

     *
     * @see org.jboss.dna.graph.query.parse.QueryParser#parseQuery(java.lang.String, org.jboss.dna.graph.query.model.TypeSystem)
     */
    public QueryCommand parseQuery( String query,
                                    TypeSystem typeSystem ) throws InvalidQueryException, ParsingException {
        Component xpath = new XPathParser(typeSystem).parseXPath(query);
        // Convert the result into a QueryCommand ...
        QueryCommand command = new XPathToQueryTranslator(typeSystem, query).createQuery(xpath);
        return command;
    }
View Full Code Here

        System.out.println("SQL:   " + translateToSql(xpath));
        System.out.println();
    }

    private QueryCommand translateToSql( String xpath ) {
        Component component = parser.parseXPath(xpath);
        XPathToQueryTranslator translator = new XPathToQueryTranslator(typeSystem, xpath);
        return translator.createQuery(component);
    }
View Full Code Here

        XPathToQueryTranslator translator = new XPathToQueryTranslator(typeSystem, xpath);
        return translator.createQuery(component);
    }

    private QueryCommand xpath( String xpath ) {
        Component component = parser.parseXPath(xpath);
        XPathToQueryTranslator translator = new XPathToQueryTranslator(typeSystem, xpath);
        return translator.createQuery(component);
    }
View Full Code Here

        new XPathQueryParser().parseQuery(xpath, typeSystem);
    }

    protected void assertParsable( String xpath,
                                   Component component ) {
        Component actual = parser.parseExpr(tokenize(xpath));
        if (component != null) {
            assertThat(actual, is(component));
        } else {
            assertThat(actual, is(nullValue()));
        }
View Full Code Here

TOP

Related Classes of org.jboss.dna.jcr.xpath.XPath.Component

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.