Issue with Publish workflow not working for parent folders.
I have used /var/workflow/models/activationmodel for the publishing.
I have programmatically added the activation of the workflow it seems to be recognizing the complete path of the file but if we give parent folders , it does not recognize it. Expectation is it would activate the parent folder alongwith all the files inside the folder. Please help suggest.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @sonaliku ,
Try to create a list, which will eventually have all the paths that is being published. For that you will have to iterate a folder first where all the child nodes are residing.
Now in replicator you can replicate these paths.
Sample code that you can refer:
if (path.contains("<folder-path>")) {
Resource resource = resourceResolver.getResource(path)
if(resource != null && !ResourceUtil.isNonExistingResource(resource)) {
Node node = resource.adaptTo(Node.class);
NodeIterator nodeIterator = node.getNodes();
while (nodeIterator.hasNext()) {
String contentPath = nodeIterator.nextNode().getPath().toString()
myList.add(contentPath);
}
}
}else{
logger.debug("Activate only single page.");
myList.add(path);
}
AgentIdFilter filter = new com.day.cq.replication.AgentIdFilter(<replication-agent>);
ReplicationOptions opts = new ReplicationOptions();
opts.setFilter(filter);
replicator.replicate(session, ReplicationActionType.ACTIVATE, multiplePagePaths, opts);
}
Hope it helps!
-Tarun
Hi @sonaliku ,
Try to create a list, which will eventually have all the paths that is being published. For that you will have to iterate a folder first where all the child nodes are residing.
Now in replicator you can replicate these paths.
Sample code that you can refer:
if (path.contains("<folder-path>")) {
Resource resource = resourceResolver.getResource(path)
if(resource != null && !ResourceUtil.isNonExistingResource(resource)) {
Node node = resource.adaptTo(Node.class);
NodeIterator nodeIterator = node.getNodes();
while (nodeIterator.hasNext()) {
String contentPath = nodeIterator.nextNode().getPath().toString()
myList.add(contentPath);
}
}
}else{
logger.debug("Activate only single page.");
myList.add(path);
}
AgentIdFilter filter = new com.day.cq.replication.AgentIdFilter(<replication-agent>);
ReplicationOptions opts = new ReplicationOptions();
opts.setFilter(filter);
replicator.replicate(session, ReplicationActionType.ACTIVATE, multiplePagePaths, opts);
}
Hope it helps!
-Tarun
@sonaliku Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies