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

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


        if (removeQuotes) value = removeQuotes(value);
        return new Literal(value);
    }

    protected FunctionCall parseFunctionCall( TokenStream tokens ) {
        NameTest name = parseQName(tokens);
        tokens.consume("(");
        List<Component> args = new ArrayList<Component>();
        if (!tokens.matches(')')) {
            do {
                args.add(collapse(parseExprSingle(tokens)));
View Full Code Here


        if (kind != null) return kind;
        return parseNameTest(tokens);
    }

    protected NameTest parseNameTest( TokenStream tokens ) {
        NameTest wildcard = parseWildcard(tokens);
        if (wildcard != null) return wildcard;
        return parseQName(tokens);
    }
View Full Code Here

    protected NameTest parseQName( TokenStream tokens ) {
        String firstPart = parseNCName(tokens);
        if (tokens.canConsume(':')) {
            String secondPart = tokens.consume();
            return new NameTest(firstPart, secondPart);
        }
        return new NameTest(null, firstPart);
    }
View Full Code Here

    protected NameTest parseWildcard( TokenStream tokens ) {
        if (tokens.canConsume('*')) {
            if (tokens.canConsume(':')) {
                if (tokens.canConsume('*')) {
                    return new NameTest(null, null);
                }
                String localName = tokens.consume();
                return new NameTest(null, localName);
            }
            return new NameTest(null, null);
        }
        if (tokens.matches(XPathTokenizer.NAME, XPathTokenizer.SYMBOL, XPathTokenizer.SYMBOL)
            && tokens.matches(TokenStream.ANY_VALUE, ":", "*")) {
            String prefix = tokens.consume();
            tokens.consume(':');
            tokens.consume('*');
            return new NameTest(prefix, null);
        }
        return null;
    }
View Full Code Here

    }

    protected ElementTest parseElementTest( TokenStream tokens ) {
        if (tokens.canConsume("element", "(")) {
            if (tokens.canConsume(")") || tokens.canConsume("*", ")")) {
                return new ElementTest(new NameTest(null, null), new NameTest(null, null));
            }
            ElementTest result = null;
            NameTest elementName = parseNameTest(tokens);
            if (tokens.canConsume(",")) {
                NameTest typeName = parseNameTest(tokens);
                result = new ElementTest(elementName, typeName);
                tokens.canConsume('?'); // just eat this
            } else {
                result = new ElementTest(elementName, new NameTest(null, null));
            }
            tokens.consume(")");
            return result;
        }
        return null;
View Full Code Here

        return null;
    }

    protected SchemaElementTest parseSchemaElementTest( TokenStream tokens ) {
        if (tokens.canConsume("schema-element", "(")) {
            NameTest elementDeclarationName = parseNameTest(tokens);
            SchemaElementTest result = new SchemaElementTest(elementDeclarationName);
            tokens.consume(")");
            return result;
        }
        return null;
View Full Code Here

    }

    protected AttributeTest parseAttributeTest( TokenStream tokens ) {
        if (tokens.canConsume("attribute", "(")) {
            if (tokens.canConsume(")") || tokens.canConsume("*", ")")) {
                return new AttributeTest(new NameTest(null, null), new NameTest(null, null));
            }
            AttributeTest result = null;
            NameTest attributeName = parseNameTest(tokens);
            if (tokens.canConsume(",")) {
                NameTest typeName = parseNameTest(tokens);
                result = new AttributeTest(attributeName, typeName);
            } else {
                result = new AttributeTest(attributeName, new NameTest(null, null));
            }
            tokens.consume(")");
            return result;
        }
        return null;
View Full Code Here

        return null;
    }

    protected SchemaAttributeTest parseSchemaAttributeTest( TokenStream tokens ) {
        if (tokens.canConsume("schema-attribute", "(")) {
            NameTest attributeDeclarationName = parseNameTest(tokens);
            SchemaAttributeTest result = new SchemaAttributeTest(attributeDeclarationName);
            tokens.consume(")");
            return result;
        }
        return null;
View Full Code Here

        return null;
    }

    protected OrderBySpec parseOrderBySpec( TokenStream tokens ) {
        if (tokens.canConsume('@')) {
            NameTest attributeName = parseQName(tokens);
            Order order = Order.ASCENDING;
            if (tokens.canConsume("ascending")) order = Order.ASCENDING;
            else if (tokens.canConsume("descending")) order = Order.DESCENDING;
            return new OrderBySpec(order, attributeName);
        }
View Full Code Here

                        break;
                }
                assert operandBuilder != null;
                if (spec.getAttributeName() != null) {
                    // This order by is defined by an attribute ...
                    NameTest attribute = spec.getAttributeName();
                    assert !attribute.isWildcard();
                    operandBuilder.propertyValue(tableName, attribute.toString());
                    builder.select(tableName + "." + attribute.toString());
                } else {
                    // This order-by is defined by a "jcr:score" function ...
                    FunctionCall scoreFunction = spec.getScoreFunction();
                    assert scoreFunction != null;
                    List<Component> args = scoreFunction.getParameters();
                    String nameOfTableToScore = tableName;
                    if (!args.isEmpty()) {
                        if (args.size() == 1 && args.get(0) instanceof NameTest) {
                            // Just the table name ...
                            NameTest tableNameTest = (NameTest)args.get(0);
                            nameOfTableToScore = tableNameTest.toString();
                        }
                    }
                    operandBuilder.fullTextSearchScore(nameOfTableToScore);
                }
            }
View Full Code Here

TOP

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

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.