How to create LiveCopy of a page with rollout configuration using Java? | Community
Skip to main content
RashidJorvee
Level 4
Jun 26, 2018 9:04 AM UTC

How to create LiveCopy of a page with rollout configuration using Java?

Hi Guys,

I have a requirement to create LiveCopy of a page programmatically using Java. Do we have any API which provides this feature which will create exact liveCopy of a page with its complete structure same as liveCopy option of siteadmin and site.html/content?

thanks!

Rashid

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

7 replies

New Participant
Jul 18, 2018 4:42 PM UTC

You can try using above code

Translate
New Participant
Jul 18, 2018 4:42 PM UTC

@Reference

private RolloutManager rolloutManager;

Resource resource = resourceResolver.getResource(sourcePath);

LiveRelationshipManager liveRelationshipManager = resourceResolver.adaptTo(LiveRelationshipManager.class);

Collection<LiveRelationship> liveRelationShips;

liveRelationShips = liveRelationshipManager.getLiveRelationships(resource, Trigger.ROLLOUT, null, true);

if (null != liveRelationShips) {

// get each relationship

for (LiveRelationship liveRelationship : liveRelationShips) {

rolloutManager.rollout(resourceResolver, liveRelationship, true);

}

}

Translate
peterp18579053
New Participant
Jun 26, 2018 9:25 AM UTC

Dear Rashid,

First copy/paste page using PageManager API, then use LiveRelationshipManager API[2] to establish relationship between pages.

[1] PageManager ("The Adobe AEM Quickstart and Web Application.")

[2] LiveRelationshipManager ("The Adobe AEM Quickstart and Web Application.")


Regards,Peter

Translate
RashidJorvee
Level 4
Jun 26, 2018 11:51 AM UTC

I am unable to generate  RolloutConfig... rolloutConfig parameters, Since when I try to uisng RolloutConfigManager then my component is not getting resolve.

Please suggest how to pass RolloutConfig parameter.

Translate
smacdonald2008
Level 10
Jun 26, 2018 1:19 PM UTC

WHile not the exact use case - we have an AEM article that shows use of the MSM API here: Adobe Experience Manager Help | Retrieving Adobe Experience Manager LiveCopy information using the MSM API

This is the API you want to use for your use case.

Translate