Expand my Community achievements bar.

SOLVED

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

Avatar

Level 4

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

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



Arun Patidar

View solution in original post

5 Replies

Avatar

Community Advisor

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_filtersforhandlingjcreve...

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

Avatar

Level 4

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"

Avatar

Community Advisor

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

Avatar

Level 4

Hi Arun,

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

Thanks,

Aravind

Avatar

Correct answer by
Community Advisor

Hi,

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



Arun Patidar