Hi All,
How can I find out live copies for a blueprint page in my servlet or any backend class (event listener - node move of type cq:Page)? I have tried the LiveRelationshipManager API but it was not working?
we get the live copies in the left side rail when select a blueprint page in sites.
Thanks in Advance
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @ASK_93 , The below piece of code is working fine for me to get the live relation copies from the master page.
LiveRelationshipManager liveRelationManager = resourceResolver.adaptTo(LiveRelationshipManager.class);
Resource resource = resourceResolver.getResource(<path to master page>);
try {
RangeIterator iterator = liveRelationManager.getLiveRelationships(resource, null, null);
while(iterator.hasNext()) {
LiveRelationship liveCopy = (LiveRelationship)iterator.next();
}
} catch (WCMException e) {
//Log the error
}
I will try doing this if the LiveRelationship api is not working:
Get the node from jcr which is storing the livecopy related info and process them as required in your code. I am not sure if that works for your use case.
Hello @ASK_93 , The below piece of code is working fine for me to get the live relation copies from the master page.
LiveRelationshipManager liveRelationManager = resourceResolver.adaptTo(LiveRelationshipManager.class);
Resource resource = resourceResolver.getResource(<path to master page>);
try {
RangeIterator iterator = liveRelationManager.getLiveRelationships(resource, null, null);
while(iterator.hasNext()) {
LiveRelationship liveCopy = (LiveRelationship)iterator.next();
}
} catch (WCMException e) {
//Log the error
}
Hi @ASK_93
I would suggest you to try to refresh the session, as this is triggered on NODE_MOVED, so it might be the case that when repository session was taken, the live copy wasn't synced to moved page.
Thanks
Anupam
Views
Replies
Total Likes