Is there way to listen to the Tag Move events? I could find there is one for Page move when we have event topic value as below
EventConstants.EVENT_TOPIC + "=com/day/cq/wcm/core/page"
But i want to do something when tags are moved around namespaces.
Views
Replies
Total Likes
Hi,
like page move , there is no special event for Tag move. When we move Tags it will create events like CHANGED and ADDED wrt to destination and source of tag.
e.g. if I move /etc/tags/we-retail/activity/biking tag to we-retail root(/etc/tags/we-retail/), following events are captured.
Thanks
Arun
Views
Replies
Total Likes
Hi,
There is no specific EVENT for the 'tags', instead of EVENT_TOPIC we can use EVENT_FILTER. The following code snippet can be used for the event to be triggered when tag is moved from one namespace to other.
@Component(
immediate = true,
service = EventHandler.class,
property = {
EventConstants.EVENT_FILTER + "=(path=/etc/tags/*)",
EventConstants.EVENT_TOPIC + "=" + SlingConstants.TOPIC_RESOURCE_ADDED,
EventConstants.EVENT_TOPIC + "=" + SlingConstants.TOPIC_RESOURCE_CHANGED,
EventConstants.EVENT_TOPIC + "=" + SlingConstants.TOPIC_RESOURCE_REMOVED
}
)
public class EventHandlerDemo implements EventHandler {
@Override
public void handleEvent(Event event) {
String topic = event.getTopic();
Object path = event.getProperty(SlingConstants.PROPERTY_PATH);
logger.info("Path of the asset and topic of the event:" + topic + ":::path:" + path);
}
}
Hope this helps.
Regards,
Views
Replies
Total Likes
Great responses!
Views
Replies
Total Likes
Views
Likes
Replies