AEM 6.4 : Replicate content to a different folder

Avatar

Avatar

a_mn1

Avatar

a_mn1

a_mn1

24-04-2019

Hello All, I am looking to see if there is an option to publish the content from author to a different path in the receiving end.

Eg: Path in author:

/content/dam/xyx/logo/logo.jpg

/content/dam/xyx/image/img.jpg

    

This could be published to the received to the folders(in bold)

/content/dam/xyx/logo/logo.jpg --> /content/dam/public/xyx/logo/logo.jpg

/content/dam/xyx/image/img.jpg --> /content/dam/protected/xyx/image/img.jpg

My replication will  be a process step in a workflow. Is this doable?

Regards,

Anand

Replies

Avatar

Avatar

Ravi_Pampana

MVP

Avatar

Ravi_Pampana

MVP

Ravi_Pampana
MVP

24-04-2019

Hi,

Check below link which has same question and solution

Replicating a CQ page to two different paths in CQ publisher

After replicating you can deactivate programmatically actual path if needed.

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

24-04-2019

You can use the AEM Replication API to build workflows. See this HELPX article:

Adobe Experience Manager Help | Replicating Adobe Experience Manager Content using the Replication A...

If you look at the API call - you can define the path:

//Inject a ResourceResolver - make sure to whitelist the bundle

    Session session = wfsession.adaptTo(Session.class);

    ResourceResolver resourceResolver = resolverFactory.getResourceResolver(Collections.singletonMap("user.jcr.session", (Object) session)); 

        

    // Create leanest replication options for activation

    ReplicationOptions options = new ReplicationOptions();

    // Do not create new versions as this adds to overhead

    options.setSuppressVersions(true);

    // Avoid sling job overhead by forcing synchronous. Note this will result in serial activation.

    options.setSynchronous(true);

    // Do NOT suppress status update of resource (set replication properties accordingly)

    options.setSuppressStatusUpdate(false); 

    log.info("**** ABOUT TO REPLICATE" ) ; 

    //Rep the content      replicate(Session session, ReplicationActionType type, String path)

    replicator.replicate(session,ReplicationActionType.ACTIVATE,path);

Hope this helps you!

Avatar

Avatar

a_mn1

Avatar

a_mn1

a_mn1

24-04-2019

Hello Scott, Thanks for the reply.

I am aware of using Replication API in workflow and I have been using that. The problem that I am trying to solve is how to take the content from Author to a different path in Publisher.

So as mentioned in the link,Replicating a CQ page to two different paths in CQ publisher   is a custom Transport handler the only option for this.

Regards