Skip to content

Instantly share code, notes, and snippets.

@auniverseaway
Created March 23, 2016 18:49
Show Gist options
  • Save auniverseaway/a88d2b4df12b35f5a8f8 to your computer and use it in GitHub Desktop.
Save auniverseaway/a88d2b4df12b35f5a8f8 to your computer and use it in GitHub Desktop.
public NodeIterator getChildren() {
QueryManager queryManager = session.getWorkspace().getQueryManager();
String query = "SELECT * FROM [nt:unstructured] AS s "
+ "WHERE [title] IS NOT NULL "
+ "ORDER BY [created] DESC";
Query query = queryManager.createQuery(query, Query.JCR_SQL2);
// Set Offset
if (offset != null) {
query.setOffset(offset);
}
// Set Limit
if (limit != null) {
query.setLimit(limit);
}
QueryResult result = query.execute();
return result.getNodes();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment