Class JCRSQLQueryBuilder
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.query.sql.JCRSQLQueryBuilder
-
- All Implemented Interfaces:
JCRSQLParserVisitor
public class JCRSQLQueryBuilder extends java.lang.Object implements JCRSQLParserVisitor
Implements the query builder for the JCR SQL syntax.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static QueryRootNode
createQuery(java.lang.String statement, NameResolver resolver, QueryNodeFactory factory)
Creates aQueryNode
tree from a SQLstatement
using the passed query nodefactory
.static java.lang.String
toString(QueryRootNode root, NameResolver resolver)
Creates a String representation of the query node tree in SQL syntax.java.lang.Object
visit(ASTAndExpression node, java.lang.Object data)
java.lang.Object
visit(ASTAscendingOrderSpec node, java.lang.Object data)
java.lang.Object
visit(ASTBracketExpression node, java.lang.Object data)
java.lang.Object
visit(ASTContainsExpression node, java.lang.Object data)
java.lang.Object
visit(ASTDescendingOrderSpec node, java.lang.Object data)
java.lang.Object
visit(ASTExcerptFunction node, java.lang.Object data)
java.lang.Object
visit(ASTFromClause node, java.lang.Object data)
java.lang.Object
visit(ASTIdentifier node, java.lang.Object data)
java.lang.Object
visit(ASTLiteral node, java.lang.Object data)
java.lang.Object
visit(ASTLowerFunction node, java.lang.Object data)
java.lang.Object
visit(ASTNotExpression node, java.lang.Object data)
java.lang.Object
visit(ASTOrderByClause node, java.lang.Object data)
java.lang.Object
visit(ASTOrderSpec node, java.lang.Object data)
java.lang.Object
visit(ASTOrExpression node, java.lang.Object data)
java.lang.Object
visit(ASTPredicate node, java.lang.Object data)
java.lang.Object
visit(ASTQuery node, java.lang.Object data)
java.lang.Object
visit(ASTSelectList node, java.lang.Object data)
java.lang.Object
visit(ASTUpperFunction node, java.lang.Object data)
java.lang.Object
visit(ASTWhereClause node, java.lang.Object data)
java.lang.Object
visit(SimpleNode node, java.lang.Object data)
-
-
-
Method Detail
-
createQuery
public static QueryRootNode createQuery(java.lang.String statement, NameResolver resolver, QueryNodeFactory factory) throws InvalidQueryException
Creates aQueryNode
tree from a SQLstatement
using the passed query nodefactory
.- Parameters:
statement
- the SQL statement.resolver
- the namespace resolver to use.- Returns:
- the
QueryNode
tree. - Throws:
InvalidQueryException
- ifstatement
is malformed.
-
toString
public static java.lang.String toString(QueryRootNode root, NameResolver resolver) throws InvalidQueryException
Creates a String representation of the query node tree in SQL syntax.- Parameters:
root
- the root of the query node tree.resolver
- to resolve QNames.- Returns:
- a String representation of the query node tree.
- Throws:
InvalidQueryException
- if the query node tree cannot be converted into a String representation due to restrictions in SQL.
-
visit
public java.lang.Object visit(SimpleNode node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTQuery node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTSelectList node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTFromClause node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTWhereClause node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTPredicate node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTOrExpression node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTAndExpression node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTNotExpression node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTBracketExpression node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTLiteral node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTIdentifier node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTOrderByClause node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTOrderSpec node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTAscendingOrderSpec node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTDescendingOrderSpec node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTContainsExpression node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTLowerFunction node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTUpperFunction node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
visit
public java.lang.Object visit(ASTExcerptFunction node, java.lang.Object data)
- Specified by:
visit
in interfaceJCRSQLParserVisitor
-
-