I'd like to use the JCR API to access a node underneath a folder.
I am here: /content/dam/Agility project/agility_products/wm/wmap/wmapsp (this is a sling:orderedFolder)
but I want to point here instead: /content/dam/Agility project/agility_products/wm/wmap/wmapsp/wmapsp.jpg (this is a dam:Asset)
So I want to go one level down from the orderedFolder to the dam:Asset just underneath it. How to I do that through the JCR API please?
Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
Read this developer article - it uses JCR API to search JCR from an external Java Swing app:
https://helpx.adobe.com/experience-manager/using/java-swing-applications.html
You can search the current folder like this:
String path = node.getPath();
String sql= "SELECT * FROM sling:Folder WHERE jcr:path LIKE '"+path +"/%' AND NOT jcr:path LIKE '"+path +"/%/%'";
javax.jcr.query.Query query = qm.createQuery(sql, Query.SQL);
//Execute the query and get the results ...
javax.jcr.query.QueryResult result = query.execute();
Here is a good online resource for more information about JCR SQL/SQL2:
http://docs.jboss.org/jbossdna/0.7/manuals/reference/html/jcr-query-and-search.html
Views
Replies
Total Likes
Read this developer article - it uses JCR API to search JCR from an external Java Swing app:
https://helpx.adobe.com/experience-manager/using/java-swing-applications.html
You can search the current folder like this:
String path = node.getPath();
String sql= "SELECT * FROM sling:Folder WHERE jcr:path LIKE '"+path +"/%' AND NOT jcr:path LIKE '"+path +"/%/%'";
javax.jcr.query.Query query = qm.createQuery(sql, Query.SQL);
//Execute the query and get the results ...
javax.jcr.query.QueryResult result = query.execute();
Here is a good online resource for more information about JCR SQL/SQL2:
http://docs.jboss.org/jbossdna/0.7/manuals/reference/html/jcr-query-and-search.html
Views
Replies
Total Likes