In Event Handler, how to exclude the specific folder in path. | Community
Skip to main content
Level 5
Oct 4, 2018 9:22 AM UTC
Solved

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

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.
arunpatidar
arunpatidarAccepted solution
New Participant
Oct 5, 2018 9:06 AM UTC

Hi,

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

Arun Patidar

5 replies

arunpatidar
arunpatidarAccepted solution
New Participant
Oct 5, 2018 9:06 AM UTC

Hi,

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

Translate
Arun Patidar
aravindSAuthor
Level 5
Oct 5, 2018 5:45 AM UTC

Hi Arun,

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

Thanks,

Aravind

Translate
arunpatidar
New Participant
Oct 4, 2018 10:16 AM UTC

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

Translate
Arun Patidar
aravindSAuthor
Level 5
Oct 4, 2018 10:09 AM UTC

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"

Translate
arunpatidar
New Participant
Oct 4, 2018 9:41 AM UTC

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

Translate
Arun Patidar