Hello there I am trying to move page to achieve after a certain period of time I had created scheduler for that but I am not able to move pages also i tried with workspace and session.move method to move the pages but it is not working kindly help!
Solved! Go to Solution.
Views
Replies
Total Likes
I have a sample example here
https://github.com/arunpatidar02/aem63app-repo/blob/master/java/MovePageServlet.java
You should use the PageManager API for this task, see [1].
It could look like this:
Page pageToMove = ... String targetPath = ... String[] references = ... PageManager = pageToMove.adaptTo(PageManager.class); PageManager.move (pageToMove.adaptTo(Resource.class), targetPath, false, true, references);
You should not use the lowlevel of Sling and JCR for that task, because they cannot handle aspects like the MSM and many other specialities.
Another important aspect I left out is the question if references to this page must be adjusted, too. To help you in that task, please consult [2].
@Jörg_Hoh Hi there in continuation with the previous query i tried the same this still i am getting the error
This is my crxde Hierarchy
|-Articles
|-jcr.content
|-Article-1
| |-root
| |-container
| |-responsivegrid
| |-rtetext
| |-bannerarticle
|-Article-2
...
This is my QueryBuilder Output
-------------------------------------------
/content/.../Articles/Article-3, (crxde, html, json)
/content/.../Articles/Article-5, (crxde, html, json)
/content/.../Articles/Article-2, (crxde, html, json)
/content/.../Articles/Article-4, (crxde, html, json)
/content/.../Articles/Article-1, (crxde, html, json)
Here is my code
---------------------------------------------
You must have the path created till/content/.../Articles/Archived and trying to remove page name from target path. e.g.
String targetPath = "/content/.../Articles/Archived
@arunpatidar Done! Still getting java.lang.NullPointerException... is there any other modification needed?
I think you are not passing the right paths in the 'references' parameter.
You can also use acs common's MCP Renovator
@poojac_2204 Hi Pooja I tried to include page path as well but that is also not working for me.
I have a sample example here
https://github.com/arunpatidar02/aem63app-repo/blob/master/java/MovePageServlet.java