How to find live copies pages for a blueprint page | Community
Skip to main content
New Participant
Jun 24, 2021 6:35 PM UTC
Solved

How to find live copies pages for a blueprint page

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.
vmadala
vmadalaAccepted solution
Level 3
Jun 25, 2021 6:06 AM UTC

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 }

 

 

5 replies

Level 2
Jun 25, 2021 4:40 PM UTC

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 

Translate
ASK_93Author
New Participant
Jun 28, 2021 5:55 PM UTC
Thanks @anupam_miglani this helped me, as i'm getting live copies afte session refersh.
Translate
vmadala
vmadalaAccepted solution
Level 3
Jun 25, 2021 6:06 AM UTC

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 }

 

 

Translate
Employee
Jun 25, 2021 5:31 AM UTC

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

 

Translate
ibishika
Level 4
Jun 24, 2021 9:33 PM UTC

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.

Translate