In Event Handler, how to exclude the specific folder in path. | Community
Skip to main content
Level 5
October 4, 2018
Solved

In Event Handler, how to exclude the specific folder in path.

  • October 4, 2018
  • 5 replies
  • 3577 views

In Event Handler, how to exclude the specific folder in path.

Example: my path is "/content", after triggered the event handler my event path shouldn't contain the folder like "version".

Help me how to resolve this.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi,

With JCR events it is not possible. Either you swicth to Sling events or check path while act on event.

5 replies

arunpatidar
Community Advisor
Community Advisor
October 4, 2018

If you are using Sling Events then you can do with the help of Event_Filter and add exclude pattern

EventConstants.EVENT_FILTER prop­er­ty takes LDAP fil­ter syn­tax, and has a path attribute, so we can do e.g. (path=/content/my/root/*) or even (path=/content/my/root/*/myNode).

http://blogs.adobe.com/experiencedelivers/experience-management/using_event_filtersforhandlingjcreventsthroughaneventhan…

LDAP Filter Syntax

For JCR Events, you can't filter path based on regEx while listening events but can do while acting(onEvent)

aem63app-repo/SampleJCREvent.java at master · arunpatidar02/aem63app-repo · GitHub

Arun Patidar
aravindSAuthor
Level 5
October 4, 2018

final String[] types = { "nt:unstructured"};

                 final String path = "/content/dam/assets"; // define the path

                 observationManager.addEventListener(this, Event.PROPERTY_CHANGED, path, true, null, null, false);

in that path i need to restrict one folder like "versions"

arunpatidar
Community Advisor
Community Advisor
October 4, 2018

Hi,

For this you can't do while listening to event but restrict path while eating on event.

Please check.

Event listener for patterned path

Arun Patidar
aravindSAuthor
Level 5
October 5, 2018

Hi Arun,

     In my case i need to restrict the path starting itself (before triggering the event).

Thanks,

Aravind

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
October 5, 2018

Hi,

With JCR events it is not possible. Either you swicth to Sling events or check path while act on event.

Arun Patidar