adobe / aem-modernize-tools

A suite of tools to modernize your AEM Sites implementations off legacy features.
http://opensource.adobe.com/aem-modernize-tools/
Apache License 2.0
64 stars 40 forks source link

Component Conversion Deletes Subnodes #180

Closed pat-lego closed 2 years ago

pat-lego commented 2 years ago

Expected Behaviour

When running a component conversion on a node that has subnodes the subnodes should be left in the repository and not deleted.

Actual Behaviour

When running a component conversion on a node with subnodes the conversion occurs correctly but all nodes below the converted component are removed.

Steps to Reproduce

Create a component conversion rule that converts a component that has subnodes below it. For instance if you want to convert a container to a new container component make sure that this component has subnodes below it in the CRX/DE.

Run the component conversion tool and then look at the converted node and see that the resource type has been changed but all subnodes below this have been removed.

Platform and Version

AEM 6.5.12 Java 8 aem-modernize-tools-2.1.0

Sample Code that illustrates the problem

Before After

Logs taken while reproducing problem

bstopp commented 2 years ago

This is intentional; the assumption is that a given component conversion rule takes into consideration the entire tree.

If the rule will only apply to an intermediate node, and the children need to be preserved, add the cq:copyChildren property to the replacement definition. (Reference)

pat-lego commented 2 years ago

@bstopp awesome thanks for this 👍