This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
Hi Team,
I am having one requirement to create inventory report in excel format which should include jcr content and the components properties for 32k pages.
I tried with infinity.json which will give the entire details however with this approach issue is we have to hit the url again and again for getting the properties.
Could you please provide any suggestion or solutions for the same.
Eg: I want all the jcr:content and the components properties of this page.
Thanks in advance.
@jbrar @Arun_Patidar @kautuk_sahni @BrianKasingli
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Shreya_Shruti,
For this use case, you need to write your custome code and add the values in an excel.
Try like this.
Challanges:
Hope this helps.
Thanks,
Kiran Vedantam.
Hi @Shreya_Shruti,
For this use case, you need to write your custome code and add the values in an excel.
Try like this.
Challanges:
Hope this helps.
Thanks,
Kiran Vedantam.
My suggestion is to create a standalone Java Class (with main method) and using JCR API create and execute a query to get all you pages. Then on each page run one more query (using current page path) to get all nodes having sling:ResourceType property, this will give all components including the jcr:content of the page. Write your logic and you logic to create and add your report data to excel sheet using same class.
Better break the pages in to multiple sets(by path) and run, as you have 32K pages.
Below is the sample code.
public class App {
public static void main(String[] ag) {
Repository repository = null;
Session session = null;
String queryString = "SELECT * FROM [cq:Page] AS page WHERE ISDESCENDANTNODE(page ,'/content/your/path') ";
try{
repository = JcrUtils.getRepository("http://localhost:4502/crx/server");
session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
QueryManager qm = session.getWorkspace().getQueryManager();
Query query = qm.createQuery(queryString, Query.JCR_SQL2);
QueryResult resultPages = query.execute();
RowIterator pageRows = resultPages.getRows();
javax.jcr.query.Row eachRow = null;
Node resultNode = null;
while(pageRows.hasNext()){
// Logic
}
//session.save(); if you update/create nodes save the session
} catch (Exception e){
e.printStackTrace();
} finally{
session.logout();
}
}
}
Views
Likes
Replies
Views
Likes
Replies