Detach a live copy programatically | Community
Skip to main content
Level 2
June 24, 2021
Solved

Detach a live copy programatically

  • June 24, 2021
  • 2 replies
  • 1530 views

My translation tool creates new language copies as live copies since we send live copies for translation. I am looking for a way to detach live relationship through code. Any suggestions will help.

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 BimmiSo

Hi @aemg12 ,

 

You can use the below method of LiveRelationshipManager to detach relationship as detach(Resource resource, boolean autoSave) is Deprecated. 

 

endRelationship(Resource resource, boolean autoSave)

Ends the LiveRelationship of the given Resource.
The Resource has to be part of a LiveCopy As indicated by hasLiveRelationship method
A detached Resource is treated as any other Resource that is created in the LiveCopy tree.
NOTE: this means especially that any history of this relation is gone

2 replies

vmadala
Level 3
June 24, 2021

@aemg12 ,

The best practice is always sent the english language copy  (not the live copy) for translation. You have to create your blueprint accordingly.  

 

Anyway, Yes we can detach the live copy through programatically, in your site root page,   "jcr:content/cq:LiveSyncConfig" in this node needs to add "cq:excludedPath" property with all the detach page paths.

 

Thanks,

Venkat 

 

 

 

aemg12Author
Level 2
June 24, 2021
Thanks Venkat I think it will be too much of work for us to send blueprint for translation since then we will have to at least roll out content in 15 different languages. What I fail to understand is why our translation tool copies over the live copy nodes to language copy
BimmiSoAdobe EmployeeAccepted solution
Adobe Employee
June 24, 2021

Hi @aemg12 ,

 

You can use the below method of LiveRelationshipManager to detach relationship as detach(Resource resource, boolean autoSave) is Deprecated. 

 

endRelationship(Resource resource, boolean autoSave)

Ends the LiveRelationship of the given Resource.
The Resource has to be part of a LiveCopy As indicated by hasLiveRelationship method
A detached Resource is treated as any other Resource that is created in the LiveCopy tree.
NOTE: this means especially that any history of this relation is gone

aemg12Author
Level 2
June 24, 2021
Thanks this probably solves my issue.