int max = maxItems == null ? Integer.MAX_VALUE : maxItems.intValue();
if (max < 0) {
max = Integer.MAX_VALUE;
}
QueryTranslator queryTranslator = new QueryTranslator(typeManager) {
@Override
protected String jcrPathFromId(String id) {
try {
JcrFolder folder = getJcrNode(session, id).asFolder();
String path = folder.getNode().getPath();
return Util.escape(path);
}
catch (RepositoryException e) {
log.debug(e.getMessage(), e);
throw new CmisRuntimeException(e.getMessage(), e);
}
}
@Override
protected String jcrPathFromCol(TypeDefinition fromType, String name) {
return typeHandlerManager.getIdentifierMap(fromType.getId()).jcrPathFromCol(name);
}
@Override
protected String jcrTypeName(TypeDefinition fromType) {
return typeHandlerManager.getIdentifierMap(fromType.getId()).jcrTypeName();
}
@Override
protected String jcrTypeCondition(TypeDefinition fromType) {
return typeHandlerManager.getIdentifierMap(fromType.getId()).jcrTypeCondition();
}
};
String xPath = queryTranslator.translateToXPath(statement);
try {
// Execute query
QueryManager queryManager = session.getWorkspace().getQueryManager();
Query query = queryManager.createQuery(xPath, Query.XPATH);