Methods are deprecated in 6.2 | Community
Skip to main content
New Participant
March 22, 2017
Solved

Methods are deprecated in 6.2

  • March 22, 2017
  • 3 replies
  • 970 views

HI All,


We are checking an condition for triggering the event using the method EventUtil.isLocal(event) which is deprecated in 6.2 could you let us know if any alternates are available.

Thanks in advance.

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 CarstenZi

Hi,

the combination of the two proposed solutions helps when registering a event handler service:

import org.osgi.service.event.EventConstants;
import org.apache.sling.event.dea.DEAConstants;

 

@Property(name = EventConstants.EVENT_FILTER, value = "(!(" + DEAConstants.PROPERTY_APPLICATION + "=*))");

3 replies

CarstenZiAccepted solution
Employee
March 27, 2017

Hi,

the combination of the two proposed solutions helps when registering a event handler service:

import org.osgi.service.event.EventConstants;
import org.apache.sling.event.dea.DEAConstants;

 

@Property(name = EventConstants.EVENT_FILTER, value = "(!(" + DEAConstants.PROPERTY_APPLICATION + "=*))");

kautuk_sahni
Employee
March 27, 2017

Hi 

Replaced 
EventUtil.isLocal(evt) 
with 
evt.getProperty(DEAConstants.PROPERTY_APPLICATION) == null ? true : false)

~kautuk

Kautuk Sahni
MC_Stuff
New Participant
March 24, 2017

Hi Girish,

Use the property filter.  Some thing like 

@Property(name = EventConstants.EVENT_FILTER, value = "(!(propertyName=*))") 

Thanks,