This conversion tool is used to rewrite one component’s node/tree to another. The intent is to upgrade or transform a component, primarily to move from legacy components (AEM or custom) to AEM Core Component proxies or modern implementations.
The operations referenced here are performed on the content in the repository, this tool does not modify any code. There is an implicit expectation that new components have been created to support the content updated by these conversions. See the Plan & Operate section for more information.
Here you’ll find information on what conversion operations occur. For information on how to configure the tool, see the associated configuration page. For information on how the services perform the changes, and options for extending or enhancing, see the developer detail pages.
The following operations are performed during the component transformation. Using this out-of-the-box feature replaces the original matched component node matched, with a new node. If the component’s parent is an ordered node, the component’s position in that order is preserved.
While each of these sections references a node, the rules and conversions apply to entire node trees, depending on how the pattern rules are defined. However, for brevity, the document will only refer to nodes.
Set Static Value
This isn’t a conversion, so much as setting a static value ot the newly created node. Any number of properties can be defined with static values. They need not exist on the original node for the conversion.
The largest use case for this conversion is setting the new node’s
sling:resourceType to the desired value.
Updated nodes will likely still use content from the original. This allows for copying a property from the original node to the newly created one. Some additional options of the copy operation are:
- Change the property name on the new node
- Negate the value of a boolean property.
- Set a default value if the property is not found.
- Set a value of a property to a second property, if the first is not found.
Sometimes a simple property copy is not sufficient as the new node’s values must conform to the new implementation. This feature adds an additional rewrite capability to the property copy. Once the value has been copied from the original node, rewrite rules via regular expressions are applied.
Some components have children nodes, this flag will inform the conversion process to copy all of the children of the matched node to the updated definition.
This is a more advanced form of the copy children operation, where new node names can be specified for each of the expected child nodes from the original tree. It also allows some basic ordering definitions.
This process is a means to consolidate multiple component nodes that appear in a specific order, into a single node with the values from the originals. All of the features listed above are available in this context. The resulting node will use the name of the first in the set, while the remaining matched for consolidation are will be removed from from the repository.
An example use case would be if a page had a title, text, and image components in sequence in the repository. An aggregate rule can be defined to convert these into a single Teaser Core Component.