Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
None
-
None
-
None
Description
Steps to reproduce in the console:
1. add nodes /test, /test/test and /test/test/test and write changes to the repository
In content/src/main/resources we now have two additional xml files: test.xml and test/test/test.xml
3. move /test to /test2 (for instance by renaming the node) and write changes to the repository
In content/src/main/resources we now have test2.xml instead of test.xml but test/test/test.xml is untouched as well as its corresponding initialize item in hippoecm-extension.xml: it still has a contentroot of /test/test as before. The result is that the project is broken. Note that test2.xml includes /test2 and the complete subtree under it. It does not have any file structure anymore.
Reason: Jcr move only generates events for the node actually moved (a remove event on /test and an add event on /test2), not for its subnodes.
Possible solution: After events have stopped arriving and before the processing stage of the events we could have a preprocessing step where the set of events is enhanced with the missing events for node_added events. For all such events in the original event set, visit the subtree under the event's path and add corresponding events for all the descendent nodes if they don't exist. Enhancing the set of events only works for node_added events but not for node_removed events because the subtree is no longer available for visiting in that case. We can detect sub initialize items under a certain path and therefore be able to remove those as well.