How to find live copies pages for a blueprint page | Community
Skip to main content
June 24, 2021
Solved

How to find live copies pages for a blueprint page

  • June 24, 2021
  • 4 replies
  • 1834 views

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

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by vmadala

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 }

 

 

4 replies

ibishika
Level 4
June 24, 2021

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.

Adobe Employee
June 25, 2021

@ask_93  : LiveRelationshipManager should ideally work. What is the error you are getting?

 

vmadala
vmadalaAccepted solution
Level 3
June 25, 2021

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 }

 

 

Level 2
June 25, 2021

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 

ASK_93Author
June 28, 2021
Thanks @anupam_miglani this helped me, as i'm getting live copies afte session refersh.