Hi,
I am trying to change the path of my "demomovement" page to archive-articles. But somewhere its crashing. Can anyone please help me out here?
@Override public void run() {
String rs="/content/enablementCapstone/us-capstone/en/article/demomovement";
Page page = resourceResolver.getResource(rs).adaptTo(Page.class);
PageManager pm = resourceResolver.adaptTo(PageManager.class);
String TargetPage="/content/enablementCapstone/us-capstone/en/archive-articles";
try{
pm.move(page, TargetPage, null, false, true, null);
}
catch(Exception e){
LOG.info("ErrorInMovement");
}
LOG.info("\n ====> RUN METHOD !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!S");
}
Solved! Go to Solution.
Views
Replies
Total Likes
what is the error on logs?
Try having the shallow field as true to move the page content, as in "pm.move(page, TargetPage, null, true, true, null);" and also, make sure you have the write permissions.
are you running this on scheduler? check your cron expression timing etc.., to perform the action immediately.
Also, instead of passing null for references, you can have the references of the resource, check this – here is the way to find our resources' references acs-aem-commons/PagesReferenceProvider.java at master · Adobe-Consulting-Services/acs-aem-commons · ...
Thank you.
what is the error on logs?
Try having the shallow field as true to move the page content, as in "pm.move(page, TargetPage, null, true, true, null);" and also, make sure you have the write permissions.
are you running this on scheduler? check your cron expression timing etc.., to perform the action immediately.
Also, instead of passing null for references, you can have the references of the resource, check this – here is the way to find our resources' references acs-aem-commons/PagesReferenceProvider.java at master · Adobe-Consulting-Services/acs-aem-commons · ...
Thank you.