Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

AEM Modernizer tool Error - Showing component and rule count is zero

Avatar

Level 5

Hi Team,

 

We have installed AEM modernizer tool and are not sure where we need to configure the rules. 

 

com.adobe.aem.modernize.component.impl.ComponentRewriteRuleServiceImpl 

 

search.paths=[path to rule root] -  do we have any sample zip or format to check it?

 

https://opensource.adobe.com/aem-modernize-tools/pages/component/config.html

 

1 Accepted Solution

Avatar

Correct answer by
Level 4

You have to create your own (`nt:unstructured`) nodes tree somewhere in the repo, for example, `/apps/my-migration-project/rules`, and create there all the rule definitions you need as children. The OSGi configuration file for the ComponentRewriteRuleServiceImpl I believe should be placed somewhere in /apps/.../config..., as usual.

All those XML pieces on the documentation page are definitions for those migration rules, you should go through them and get what you need for your project. 

 

Some kind of a sample that you are looking for, you can see at the end of that page, I am copying it here:

<teaser jcr:primaryType="nt:unstructured"
    jcr:title="GeoDemo Teaser"
    cq:rewriteRanking="1">
  <aggregate jcr:primaryType="nt:unstructured">
    <patterns jcr:primaryType="nt:unstructured">
      <imagePattern
          jcr:primaryType="nt:unstructured"
          sling:resourceType="foundation/components/image"/>
      <titlePattern
          jcr:primaryType="nt:unstructured"
          sling:resourceType="geometrixx/components/title"/>
      <textPattern
          jcr:primaryType="nt:unstructured"
          sling:resourceType="foundation/components/text"/>
    </patterns>
  </aggregate>
  <replacement jcr:primaryType="nt:unstructured">
    <text
        jcr:primaryType="nt:unstructured"
        sling:resourceType="geodemo/components/content/teaser"
        jcr:title="${'./[pattern:titlePattern]/jcr:title'}"
        jcr:description="${./[pattern:textPattern]/text}"
        textIsRich="${./[pattern:textPattern]/text}"
        fileReference="${'./[pattern:imagePattern]/fileReference'}"
    />
  </replacement>
</teaser>

 

For this sample rule, it should find some node with such children as image, title, and text (resource types in the patterns section) and convert the whole parent node to one `geodemo/components/content/teaser` element.

 

Note that you can mark properties that you are looking for as optional, and also you can add the `cq:rewriteFinal` property to the replacement section to stop checking the processed node for other rules once it is replaced by one of them.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 4

You have to create your own (`nt:unstructured`) nodes tree somewhere in the repo, for example, `/apps/my-migration-project/rules`, and create there all the rule definitions you need as children. The OSGi configuration file for the ComponentRewriteRuleServiceImpl I believe should be placed somewhere in /apps/.../config..., as usual.

All those XML pieces on the documentation page are definitions for those migration rules, you should go through them and get what you need for your project. 

 

Some kind of a sample that you are looking for, you can see at the end of that page, I am copying it here:

<teaser jcr:primaryType="nt:unstructured"
    jcr:title="GeoDemo Teaser"
    cq:rewriteRanking="1">
  <aggregate jcr:primaryType="nt:unstructured">
    <patterns jcr:primaryType="nt:unstructured">
      <imagePattern
          jcr:primaryType="nt:unstructured"
          sling:resourceType="foundation/components/image"/>
      <titlePattern
          jcr:primaryType="nt:unstructured"
          sling:resourceType="geometrixx/components/title"/>
      <textPattern
          jcr:primaryType="nt:unstructured"
          sling:resourceType="foundation/components/text"/>
    </patterns>
  </aggregate>
  <replacement jcr:primaryType="nt:unstructured">
    <text
        jcr:primaryType="nt:unstructured"
        sling:resourceType="geodemo/components/content/teaser"
        jcr:title="${'./[pattern:titlePattern]/jcr:title'}"
        jcr:description="${./[pattern:textPattern]/text}"
        textIsRich="${./[pattern:textPattern]/text}"
        fileReference="${'./[pattern:imagePattern]/fileReference'}"
    />
  </replacement>
</teaser>

 

For this sample rule, it should find some node with such children as image, title, and text (resource types in the patterns section) and convert the whole parent node to one `geodemo/components/content/teaser` element.

 

Note that you can mark properties that you are looking for as optional, and also you can add the `cq:rewriteFinal` property to the replacement section to stop checking the processed node for other rules once it is replaced by one of them.