Expand my Community achievements bar.

SOLVED

Bulk replication assets and folders- activate/deactivate

Avatar

Level 10

Hi,

 

Tried checking replicator.replicate option for activate, but it only activates the node and not sub nodes, and node can be a sling folder or dam:asset. 

The same with deactivate. Is this the expected behavior via api?

 

I would also like to avoid replication of a subfolder A, if there are children in that sub folder , that have not been replicated . Same with deactivation. What is the best approach other than traversal or query builder query? can/should sling query be used?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
4 Replies

Avatar

Level 10

I think i might have the answer, let me know your thoughts, not sure of any limitation wrt api

 

replicator.getActivatedPaths(session, path);- get the string path array and then deactivate. 

 

String[] pathArray = pathList.toArray(new String[0]);
replicator.replicate(session, ReplicationActionType.DEACTIVATE, path);

 

 

Avatar

Community Advisor

Hi @NitroHazeDev ,

Activating the given path does not activate child node within that path. But It invalidates every page within that path in Dispatcher. 

Tree Activation may helps in your case, please check here: https://aem4beginner.blogspot.com/how-to-perform-tree-activation-in-cq-aem

Regards,

Santosh

Avatar

Level 10

@SantoshSai Do you know of unpublish, based on my observations it is the same as replication where it is targeted to the specific path to activate or deactivate via api vs all it’s children.  The problem is since not all resources may or may not be published , I can’t replicate the tree . By tree replication, first glance , it is iteration and activating one resource at a time ? 
 
It invalidates but does not unpublish IMO ? 

Avatar

Correct answer by
Community Advisor