public abstract class QueryTranslator extends Object
Modifier | Constructor and Description |
---|---|
protected |
QueryTranslator(JcrTypeManager typeManager)
Create a new query translator which uses the provided
typeManager to resolve CMIS type names to CMIS types. |
Modifier and Type | Method and Description |
---|---|
protected String |
buildElementTest(TypeDefinition fromType)
Build a XPath element test for the given CMIS type.
|
protected String |
buildOrderByClause(TypeDefinition fromType,
List<QueryObject.SortSpec> orderBys)
Build a XPath order by clause for the given CMIS type and a list of
QueryObject.SortSpec s. |
protected String |
buildPathExpression(TypeDefinition fromType,
String folderPredicate)
Build a XPath path expression for the CMIS type queried for and a folder
predicate.
|
protected String |
buildPredicates(TypeDefinition fromType,
String condition)
Build a XPath predicate for the given CMIS type and an additional
condition.
|
QueryObject |
getQueryObject() |
protected abstract String |
jcrPathFromCol(TypeDefinition fromType,
String name)
Map a column name in the CMIS query to the corresponding relative JCR
path.
|
protected abstract String |
jcrPathFromId(String id)
Map a CMIS objectId to an absolute JCR path.
|
protected abstract String |
jcrTypeCondition(TypeDefinition fromType)
Create and additional condition in order for the query to only return
nodes of the right type.
|
protected abstract String |
jcrTypeName(TypeDefinition fromType)
Map a CMIS type to the corresponding JCR type name.
|
String |
translateToXPath(String statement)
Translate a CMIS query statement to a JCR XPath query statement.
|
protected QueryTranslator(JcrTypeManager typeManager)
typeManager
to resolve CMIS type names to CMIS types.typeManager
- public QueryObject getQueryObject()
QueryObject
from the last translation performed
through translateToXPath(String)
.public String translateToXPath(String statement)
statement
- protected abstract String jcrPathFromId(String id)
id
- objectIdid
.protected abstract String jcrPathFromCol(TypeDefinition fromType, String name)
fromType
- Type on which the CMIS query is performedname
- column nameprotected abstract String jcrTypeName(TypeDefinition fromType)
fromType
- CMIS typefromType
jcrTypeCondition(TypeDefinition)
protected abstract String jcrTypeCondition(TypeDefinition fromType)
element(*, nt:file)[not(@jcr:mixinTypes = 'mix:simpleVersionable')]Here the element test is covered by
jcrTypeName(TypeDefinition)
while the predicate is covered by this method.fromType
- null
if none.jcrTypeName(TypeDefinition)
protected String buildPathExpression(TypeDefinition fromType, String folderPredicate)
fromType
- CMIS type queried forfolderPredicate
- folder predicatenull
if none.protected String buildElementTest(TypeDefinition fromType)
fromType
- CMIS type queried forprotected String buildPredicates(TypeDefinition fromType, String condition)
fromType
.fromType
- CMIS type queried forcondition
- additional condition.null
if none.protected String buildOrderByClause(TypeDefinition fromType, List<QueryObject.SortSpec> orderBys)
QueryObject.SortSpec
s.fromType
- CMIS type queried fororderBys
- SortSpec
sCopyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.