HI All,
I have a requirement, where I have a large number of tags in my system under cq:tags example (/content/cq:tags/exampleTag), but these tags have only title property and description property in it, I need to add a new property as ID for it, a one similar to jcr:uuid (either this is also fine).
The id property should have unique values for each tag and should be created for all the tags and sub-tags of the selected tag.
Do we have any configuration settings for it, to create a ID property for a already existing tags, or any kind of code that we could run to create the ID's for the tags.
All suggestions are welcome.
Thanks,
Nirmal
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
As for my knowledge there is no ootb solution nor some utility out here that can do this.
But it sounds like an easy thing to achieve.
First, it seams this is a one time operation that you need to do on the existing tags.
Second, I assume from now on whenever you add a new tag, you will want to have this ID property being added automatically on it.
Me, I would go with a OSGi service that iterates through your tags and adds the unique ID property for each. You can use whatever algorithm to generate such IDs.
Then I would write a simple Sling servlet, that can afterwards be invoked in anyway you prefer afterwards, and that in its turn calls the service.
And last I would write a simple Sling listener that watch over newly created or copied tags and adds the ID property on them.
Of course that the logic to generate a unique ID can live in some utility class, and be reused in both service and listener.
I hope this helps.
As for my knowledge there is no ootb solution nor some utility out here that can do this.
But it sounds like an easy thing to achieve.
First, it seams this is a one time operation that you need to do on the existing tags.
Second, I assume from now on whenever you add a new tag, you will want to have this ID property being added automatically on it.
Me, I would go with a OSGi service that iterates through your tags and adds the unique ID property for each. You can use whatever algorithm to generate such IDs.
Then I would write a simple Sling servlet, that can afterwards be invoked in anyway you prefer afterwards, and that in its turn calls the service.
And last I would write a simple Sling listener that watch over newly created or copied tags and adds the ID property on them.
Of course that the logic to generate a unique ID can live in some utility class, and be reused in both service and listener.
I hope this helps.
Hi @Nirmal_Kumar1
You can try groovy script to update tags id in the content as well as add to tags.
Hi @Nirmal_Kumar1 ,
Either a groovy script or a MCP needs to be written for this. Iterate through all the tags and add a random number or alphanumeric value.
More about MCP - https://kiransg.com/tag/mcp/
Regards,
Anupam Patra
Views
Likes
Replies
Views
Likes
Replies