|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.chemistry.opencmis.jcr.query.QueryTranslator
public abstract class QueryTranslator
Abstract base class for translating a CMIS query statement to a JCR XPath query statement. Overriding class need to implement methods for mapping CMIS ids to JCR paths, CMIS property names to JCR property names, CMIS type names to JCR type name and in addition a method for adding further constraints to a query based on a CMIS type.
Constructor Summary | |
---|---|
QueryTranslator(JcrTypeManager typeManager)
Create a new query translator which uses the provided typeManager
to resolve CMIS type names to CMIS types. |
Method Summary | |
---|---|
protected java.lang.String |
buildElementTest(TypeDefinition fromType)
Build a XPath element test for the given CMIS type. |
protected java.lang.String |
buildOrderByClause(TypeDefinition fromType,
java.util.List<QueryObject.SortSpec> orderBys)
Build a XPath order by clause for the given CMIS type and a list of QueryObject.SortSpec s. |
protected java.lang.String |
buildPathExpression(TypeDefinition fromType,
java.lang.String folderPredicate)
Build a XPath path expression for the CMIS type queried for and a folder predicate. |
protected java.lang.String |
buildPredicates(TypeDefinition fromType,
java.lang.String condition)
Build a XPath predicate for the given CMIS type and an additional condition. |
QueryObject |
getQueryObject()
|
protected abstract java.lang.String |
jcrPathFromCol(TypeDefinition fromType,
java.lang.String name)
Map a column name in the CMIS query to the corresponding relative JCR path. |
protected abstract java.lang.String |
jcrPathFromId(java.lang.String id)
Map a CMIS objectId to an absolute JCR path. |
protected abstract java.lang.String |
jcrTypeCondition(TypeDefinition fromType)
Create and additional condition in order for the query to only return nodes of the right type. |
protected abstract java.lang.String |
jcrTypeName(TypeDefinition fromType)
Map a CMIS type to the corresponding JCR type name. |
java.lang.String |
translateToXPath(java.lang.String statement)
Translate a CMIS query statement to a JCR XPath query statement. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueryTranslator(JcrTypeManager typeManager)
typeManager
to resolve CMIS type names to CMIS types.
typeManager
- Method Detail |
---|
public QueryObject getQueryObject()
QueryObject
from the last translation performed through
translateToXPath(String)
.public java.lang.String translateToXPath(java.lang.String statement)
statement
-
protected abstract java.lang.String jcrPathFromId(java.lang.String id)
id
- objectId
id
.protected abstract java.lang.String jcrPathFromCol(TypeDefinition fromType, java.lang.String name)
fromType
- Type on which the CMIS query is performedname
- column name
protected abstract java.lang.String jcrTypeName(TypeDefinition fromType)
fromType
- CMIS type
fromType
jcrTypeCondition(TypeDefinition)
protected abstract java.lang.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 java.lang.String buildPathExpression(TypeDefinition fromType, java.lang.String folderPredicate)
fromType
- CMIS type queried forfolderPredicate
- folder predicate
null
if none.protected java.lang.String buildElementTest(TypeDefinition fromType)
fromType
- CMIS type queried for
protected java.lang.String buildPredicates(TypeDefinition fromType, java.lang.String condition)
fromType
.
fromType
- CMIS type queried forcondition
- additional condition.
null
if none.protected java.lang.String buildOrderByClause(TypeDefinition fromType, java.util.List<QueryObject.SortSpec> orderBys)
QueryObject.SortSpec
s.
fromType
- CMIS type queried fororderBys
- SortSpec
s
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |