Expand my Community achievements bar.

SOLVED

Does CQ5 have a built in mixin type that can be used to add arbitrary properties to a node?

Avatar

Level 7

Hi,

In particular, I want to be able to add custom properties to sling:Mapping nodes.

Is there a mixin type I can use with sling:Mapping nodes so that I can add custom properties to them?

1 Accepted Solution

Avatar

Correct answer by
Level 10

LinearGradient wrote...

Hi Sham,

I want to add an attribute domainName that stores the domain name (e.g. www.example.com) associated with a given sling:Mapping node under /etc/map (or /etc/map.publish).

Thanks.

 

sling:Mapping already provides required matching and redirection properties (sling:match & sling:internalRedirect) for an domainname. What benefit you will achieve adding additional one.  I am still not clear of use case. 

View solution in original post

7 Replies

Avatar

Employee

Hi,

Just to be clear, the use of the sling:Mapping node type is not strictly necessary. You can use any node type.

Justin

Avatar

Level 7

Hi Sham,

I want to add an attribute domainName that stores the domain name (e.g. www.example.com) associated with a given sling:Mapping node under /etc/map (or /etc/map.publish).

Thanks.

Avatar

Level 7

Hi Justin,

Thanks for the reply. Could you please explain if there are any disadvantages to using another node type, e.g. nt:unstructured?

Thanks.

Avatar

Correct answer by
Level 10

LinearGradient wrote...

Hi Sham,

I want to add an attribute domainName that stores the domain name (e.g. www.example.com) associated with a given sling:Mapping node under /etc/map (or /etc/map.publish).

Thanks.

 

sling:Mapping already provides required matching and redirection properties (sling:match & sling:internalRedirect) for an domainname. What benefit you will achieve adding additional one.  I am still not clear of use case. 

Avatar

Level 7

Sham HC wrote...

LinearGradient wrote...

Hi Sham,

I want to add an attribute domainName that stores the domain name (e.g. www.example.com) associated with a given sling:Mapping node under /etc/map (or /etc/map.publish).

Thanks.

 

sling:Mapping already provides required matching and redirection properties (sling:match & sling:internalRedirect) for an domainname. What benefit you will achieve adding additional one.  I am still not clear of use case. 

 

When I delete a site, I want to delete all its sling:Mapping nodes too. Right now the query and the code that finds sling:Mapping nodes is not elegant. If I could add a domainName property to sling:Mapping nodes the query could become something like this:

    SELECT * FROM [sling:Mapping] WHERE domainName = "example.com"

Avatar

Level 10

LinearGradient wrote...

 

When I delete a site, I want to delete all its sling:Mapping nodes too. Right now the query and the code that finds sling:Mapping nodes is not elegant. If I could add a domainName property to sling:Mapping nodes the query could become something like this:

    SELECT * FROM [sling:Mapping] WHERE domainName = "example.com"

 

I was asking your usecase so that I can file enhancement request if it qualifies. IMO this should be handled easily at package with right design.  Regarding original question technical you can achieve by reregistering the node however it is not recommended and also creates some noice in support perspective.