如何以编程方式删除CQ5中页面的修订? [英] How to programatically delete revisions of a page in CQ5?

查看:97
本文介绍了如何以编程方式删除CQ5中页面的修订?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在当前设置中;我们正在尝试自动化创建蓝图页面的过程,并将其发布到其实时副本中;并激活实时复制页面。页面的停用和删除也可以通过编程完成。所有这些都是使用com.day.cq.wcm.api.msm和com.day.cq.replication api通过代码完成的。

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.

我们尝试了cancelRelationship和endRelationship(在文档中提到,它删除了历史记录
https://docs.adobe.com/docs/ zh_cn / cq / 5-6-1 / javadoc / com / day / cq / wcm / msm / api / LiveRelationshipManager.html#endRelationship ),但不会删除历史记录。

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 delete the history.

这是因为每次页面都被激活;创建一个版本。我们如何以编程方式删除页面的修订/版本?
有一个创建修订版本的选项 https://docs.adobe.com/docs/zh-CN/cq/5-6-1/javadoc/com/day/cq/wcm/api/PageManager.html# createRevision ,但是没有删除创建的修订的选项。

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.

我们应该尝试删除在/var/audit/com.day.cq.replication中创建的版本节点吗?

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

推荐答案

我认为您希望能够重新创建以前是实时副本的页面。然后只需确保在删除作为实时副本的页面之前,然后终止实时关系( https://docs.adobe.com/ docs / en / aem / 6-0 / develop / ref / javadoc / com / day / cq / wcm / msm / api / LiveRelationshipManager.html#endRelationship(org.apache.sling.api.resource.Resource ,布尔值)

I think you want to be able to recreate a page that has previously been a live copy. Then just make sure that BEFORE you delete a page that is a live copy, then the live relationship is terminated (https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/day/cq/wcm/msm/api/LiveRelationshipManager.html#endRelationship(org.apache.sling.api.resource.Resource, boolean)

此方法不会删除任何历史记录,只会删除页面上的所有实时副本信息,因此当您以后删除页面时,该页面的创建版本

This method DOES NOT delete any history. It just removes any live copy information on the page so that when you delete the page afterwards, the created revision of that page does not have any live copy information either.

为了查明删除的页面是否是实时副本,AEM / MSM会将该页面的最新版本查找为

In order to find out if a deleted page was a live copy, AEM/MSM looks for the last revision of that page to check if it had any live copy information by the time it was deleted.

要清除版本,应使用: https://docs.adobe.com/docs/zh/cq/5-6-1/ deploying / version_purging.html

To purge the version you should use: https://docs.adobe.com/docs/en/cq/5-6-1/deploying/version_purging.html

这篇关于如何以编程方式删除CQ5中页面的修订?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆