How to programatically delete revisions of a page in CQ5? | Community
Skip to main content
cquser_cquser
Level 2
Oct 16, 2015 2:29 AM UTC
Solved

How to programatically delete revisions of a page in CQ5?

In the current setup; we are trying to automate the process of creating the blueprint page, rolling it out to its live copies; and activating the live copy pages.Also; deactivation and deletion of pages is also done programmatically . All this is done via code using the com.day.cq.wcm.api.msm and com.day.cq.replication api.

The problem we are facing right now is after deleting the blueprint and live copy pages programmatically ; if we again create the same page programmatically ; then; there comes an option of 'No Action' ; rather than 'Create' while rolling out the page; which means that the live copy has been detached. What we want to do is that while deleting the pages; we want to delete the history associated with the relationship ; so that next time the same page is created; it would get rolled out to the live copy branch.

We tried the cancelRelationship and endRelationship(mentioned in the docs that it deletes the history https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/wcm/msm/api/LiveRelationshipManager.html#endRelationship ) but it does not deletes the history.

This is because every time the page is activated; a version is created. How can we programmatically delete the revision/version of the page? There is an option to create revision https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/wcm/api/PageManager.html#createRevision but no option to delete the created revisions.

Should we try to remove the version nodes which get created at /var/audit/com.day.cq.replication ?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
Oct 16, 2015 2:29 AM UTC

yes.. with pagemanager there is no option for deleting the revision. Please raise a support ticket here http://daycare.day.com/public/contact.html

6 replies

joerghoh
Employee
Nov 15, 2017 9:51 PM UTC

The pagemanager does not have this feature, rather check the VersionManager of the AEM API:

VersionManager ("The Adobe AEM Quickstart and Web Application.")

Jörg

Translate
New Participant
Nov 15, 2017 11:59 AM UTC

Still no method to delete revisions via pagemanager in AME6.

Translate
Lokesh_Shivalingaiah
Level 10
Oct 16, 2015 2:29 AM UTC

Try using 'VersionHistory' API. Refer [1] [2] and check if it helps

[1] http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/version/VersionHistory.html

[2] http://wemcode.wemblog.com/version-purging

Translate
cquser_cquser
Level 2
Oct 16, 2015 2:29 AM UTC

VersionHistory can be accessed only if the jcr mixintype is mix:versionable. The pages get rolled out automatically; hence can't set the jcr:mixintype on pages. Hence; can't access the versionhistory of pages. Can access the revisions using pagemanager.getrevisions method; but there is no option to delete the revisions.

Translate
Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
Oct 16, 2015 2:29 AM UTC

yes.. with pagemanager there is no option for deleting the revision. Please raise a support ticket here http://daycare.day.com/public/contact.html

Translate
cquser_cquser
Level 2
Oct 16, 2015 2:29 AM UTC

Thanks .. will raise the daycare ticket... but in the meantime.... is there any other way to meet the current requirement? Can anyone else help me on this?

Translate