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

Methods are deprecated in 6.2

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.
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 + "=*))");

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 + "=*))");

Translate
kautuk_sahni
Employee
March 27, 2017

Hi 

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

~kautuk

Translate
Kautuk Sahni
MC_Stuff
Level 10
March 24, 2017

Hi Girish,

Use the property filter.  Some thing like 

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

Thanks,

Translate