Making resourceType property configurable using a variable

Avatar

Avatar
Validate 25
Level 3
Shehjadkhan
Level 3

Likes

10 likes

Total Posts

72 posts

Correct reply

3 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 3
Shehjadkhan
Level 3

Likes

10 likes

Total Posts

72 posts

Correct reply

3 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
Shehjadkhan
Level 3

15-10-2015

Hi All,

Whenever we create a new template we define some of the properties of template like below. A new page is created using this template on the jcr:content node of that page I would see the 

resourceType property as sling:resourceType="/apps/myapp/components/pages/test"

Now say later if I want to change my page component from test to test1, all my previously created page would be broken. Is there a way rather than storing a exact string I can store some variable constant which I can change any time without affecting my previously created content. Something similar to declaring a constant variable in java class, and using the constant at multiple places and whenever I want to change the value of constant I just upate at one place without impacting the places where it was used. Does JCR or Sling can do something similar to this?

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:description="Test template description"
    jcr:primaryType="cq:Template"
    jcr:title="Test Template"
    ranking="{Long}100">
    <jcr:content
        jcr:primaryType="cq:PageContent"
        sling:resourceType="/apps/myapp/components/pages/test"/>
</jcr:root>

Thanks!

Shehjad

View Entire Topic

Avatar

Avatar
Boost 5
Employee
kalyanar
Employee

Likes

5 likes

Total Posts

182 posts

Correct reply

78 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 50
Affirm 5
View profile

Avatar
Boost 5
Employee
kalyanar
Employee

Likes

5 likes

Total Posts

182 posts

Correct reply

78 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 50
Affirm 5
View profile
kalyanar
Employee

15-10-2015

You can try leveraging http://adobe-consulting-services.github.io/acs-aem-commons/features/delegating-servlet.html . I feel..if you customize it appropriately, you can validate it for paths and apply per side using config factory