Include multiple property to match in patterns | AEM Modernization Tool | Community
Skip to main content
Anmol_Bhardwaj
Community Advisor
Community Advisor
April 18, 2022
Solved

Include multiple property to match in patterns | AEM Modernization Tool

  • April 18, 2022
  • 1 reply
  • 774 views

I want to match more than just the sling:resourceType for a component which I want to convert. I want the component to be converted if and only if it the jcr:property , say "testProp" has the value "testValue".

If the property "testProp" has any other value then I don't want to convert the component. 

 

<patterns jcr:primaryType="nt:unstructured"> <lead jcr:primaryType="nt:unstructured" sling:resourceType="geometrixx/components/lead" testProp="testValue"> </lead> </patterns>

 

This pattern is matching with sling:resourceType, but not matching with testProp as I can see components which don't have testProp value as something else other than testValue are also showing up for conversion.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anmol_Bhardwaj
<patterns jcr:primaryType="nt:unstructured">
   <lead
      jcr:primaryType="nt:unstructured" 
      sling:resourceType="geometrixx/components/lead" 
      testProp="testValue" >
   </lead>
</patterns>

This is the right way to match more than one properties.

When we search for the components with the pattern, all the components with the matching resource type will show up for conversion. 

Only the components which match the pattern exactly are going to be converted.

1 reply

Anmol_Bhardwaj
Community Advisor
Anmol_BhardwajCommunity AdvisorAuthorAccepted solution
Community Advisor
April 18, 2022
<patterns jcr:primaryType="nt:unstructured">
   <lead
      jcr:primaryType="nt:unstructured" 
      sling:resourceType="geometrixx/components/lead" 
      testProp="testValue" >
   </lead>
</patterns>

This is the right way to match more than one properties.

When we search for the components with the pattern, all the components with the matching resource type will show up for conversion. 

Only the components which match the pattern exactly are going to be converted.