How to create LiveCopy of a page with rollout configuration using Java? | Community
Skip to main content
RashidJorvee
Level 4
June 26, 2018

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

  • June 26, 2018
  • 3 replies
  • 7773 views

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.

3 replies

peterp18579053
June 26, 2018

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

RashidJorvee
Level 4
June 26, 2018

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.

smacdonald2008
Level 10
June 26, 2018

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.

July 18, 2018

@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);

}

}

July 18, 2018

You can try using above code