Expand my Community achievements bar.

SOLVED

How to create a new LiveCopy Site through Java API

Avatar

Level 4

Hi Masters!

I would like to know how to create a new LiveCopy Site through Java API. I mean, the same action that you can do in Siteadmin->New Site. It seems an easy task, but I’m trying to find out the entry point in Java API, with no success.

Any help will be appreciated.

Thank you very much!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Are you looking at "New Site" or "New Live Copy". New site is little different from New Live copy. New site creates multiple live copies. One level down the root page it creates live copy with isDeep=true.

For creating Live copy.

  1. Create Copy of the page.
  2. Use RelationShipManager API to establish LiveRelationShip - relationshipManager.establishRelationship(master, liveCopy, deep, false, configs);
  3. Rollout the page using RolloutManger - rolloutManager.rollout(resourceresolver, relationship, true, true);

View solution in original post

4 Replies

Avatar

Level 10

The only AEM LiveCopy API that is exposed is:

https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/wcm/msm/api/LiveCopy.html

However - according to this Javadoc - this API defines a Live Copy configuration between a blueprint and its target. I am not seeing a method that creates a new one.  In fact - most of the methods are  get methods that return information. 

Avatar

Correct answer by
Former Community Member

Are you looking at "New Site" or "New Live Copy". New site is little different from New Live copy. New site creates multiple live copies. One level down the root page it creates live copy with isDeep=true.

For creating Live copy.

  1. Create Copy of the page.
  2. Use RelationShipManager API to establish LiveRelationShip - relationshipManager.establishRelationship(master, liveCopy, deep, false, configs);
  3. Rollout the page using RolloutManger - rolloutManager.rollout(resourceresolver, relationship, true, true);

Avatar

Level 4

Thank you very much, maruthid!

I was looking for the same behavior than to create a "New Site", with 'Live Copy' checkbox selected.

I'm not sure if I've understood you comment about 'New site creates multiple live copies. One level down the root page it creates live copy with isDeep=true.'

I've got a site with standard structure: 1)root level, 2)language level, and 3)chapter level. I would like to choose the language levels available in the new livecopy site. I don't need to choose the chapters (but it would be interesting to know how).

Which steps should I follow?

I've checked in CRXDE the contents of a livecopy site created via siteadmin UI. I've seen that both root level and language levels have 'jcr:content/cq:LiveSyncConfig' node with 'cq:isDeep' = false, and chapter level has 'jcr:content/cq:LiveSyncConfig' node with 'cq:isDeep' = true.

Should I copy the root level, delete the languages (and chapters, in general case, not in mine) I don't need, and establish LiveRelationShip at both root level (with 'cq:isDeep' = false), at language level (with 'cq:isDeep' = false) and at chapter level (with 'cq:isDeep' = true), for each languages and chapters? Is this correct?

Thank you again!

Avatar

Level 2

Hi Maruthid,

Do you happen to know how to get RolloutConfig object in order to use it inside the establishRelationship method?

There is a RolloutConfigManager interface but I was not able to found available implementations.

Best regards,

Andrii

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----