Highlighted

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

Rashid_Jorvee

26-06-2018

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

Replies

Highlighted

Rashid_Jorvee

26-06-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.

Highlighted

Rashid_Jorvee

26-06-2018

Right Scoot, I am trying to achieve this using LiveRelationshipManager API. But when I try to inject RolloutConfigManager interface to create the RolloutConfig then I am getting the unsatisfied message "No service bound error" and unable to execute this service.

Please help me to resolve this issue.

Below is the code which I am trying:

@Reference
LiveRelationshipManager liveRelationshipManager;
@Reference
RolloutConfigManager rolloutConfigManager;
String rolloutConfigPath="/etc/msm/rolloutconfigs/default";

RolloutConfig rolloutConfig=rolloutConfigManager.getRolloutConfig(rolloutConfigPath);
liveRelationshipManager.establishRelationship(fromLive, toLive, deep, autoSave, rolloutConfig);

Error:

1516369_pastedImage_3.png

Highlighted

ad6

17-07-2018

Hi we had tried resolving the rolloutconfigmanager by adapting it using resolver:

RolloutConfigManager rolloutConfigManager = resolver.adapto(RolloutConfigManager.class);

and then we used it in code.

Highlighted

santhiswaroopg

18-07-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);

}

}