Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Sling Event Listener

Avatar

Avatar
Validate 10
Level 2
Murali89
Level 2

Likes

7 likes

Total Posts

25 posts

Correct Reply

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

Avatar
Validate 10
Level 2
Murali89
Level 2

Likes

7 likes

Total Posts

25 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
Murali89
Level 2

18-06-2018

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.

Replies

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

18-06-2018

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.

Screen Shot 2018-06-18 at 2.26.31 PM.png

Thanks

Arun

Avatar

Avatar
Boost 50
Level 6
Techaspect_Solu
Level 6

Likes

63 likes

Total Posts

150 posts

Correct Reply

79 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Boost 50
Level 6
Techaspect_Solu
Level 6

Likes

63 likes

Total Posts

150 posts

Correct Reply

79 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile
Techaspect_Solu
Level 6

18-06-2018

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,

TechAspect Solutions

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

18-06-2018

Great responses!