Class EventServiceImpl
java.lang.Object
org.apache.unomi.services.impl.events.EventServiceImpl
- All Implemented Interfaces:
EventService
-
Field Summary
Fields inherited from interface org.apache.unomi.api.services.EventService
ERROR, NO_CHANGE, PROFILE_UPDATED, SESSION_UPDATED
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticateThirdPartyServer
(String key, String ip) Get the third party server name, if the request is originated from a known peervoid
bind
(org.osgi.framework.ServiceReference<EventListenerService> serviceReference) Retrieves theEvent
by its identifier.Retrieves the list of available event properties.Retrieves the set of known event type identifiers.boolean
hasEventAlreadyBeenRaised
(Event event) Checks whether the specified event has already been raised with the same itemId.boolean
hasEventAlreadyBeenRaised
(Event event, boolean session) Checks whether the specified event has already been raised either for the associated session or profile depending on the specifiedsession
parameter.boolean
isEventAllowed
(Event event, String thirdPartyId) Check if the sender is allowed to sent the speecified event.void
removeProfileEvents
(String profileId) Removes all events of the specified profilesearchEvents
(String sessionId, String[] eventTypes, String query, int offset, int size, String sortBy) searchEvents
(Condition condition, int offset, int size) int
Propagates the specified event in the context server, notifyingEventListenerService
instances if needed.void
setBundleContext
(org.osgi.framework.BundleContext bundleContext) void
setDefinitionsService
(DefinitionsService definitionsService) void
setPersistenceService
(PersistenceService persistenceService) void
setPredefinedEventTypeIds
(Set<String> predefinedEventTypeIds) void
setRestrictedEventTypeIds
(Set<String> restrictedEventTypeIds) void
setThirdPartyConfiguration
(Map<String, String> thirdPartyConfiguration) void
unbind
(org.osgi.framework.ServiceReference<EventListenerService> serviceReference)
-
Constructor Details
-
EventServiceImpl
public EventServiceImpl()
-
-
Method Details
-
setThirdPartyConfiguration
-
setPredefinedEventTypeIds
-
setRestrictedEventTypeIds
-
setPersistenceService
-
setDefinitionsService
-
setBundleContext
public void setBundleContext(org.osgi.framework.BundleContext bundleContext) -
isEventAllowed
Description copied from interface:EventService
Check if the sender is allowed to sent the speecified event. Restricted event must be explicitely allowed for a sender.- Specified by:
isEventAllowed
in interfaceEventService
- Parameters:
event
- event to testthirdPartyId
- third party id- Returns:
- true if the event is allowed
-
authenticateThirdPartyServer
Description copied from interface:EventService
Get the third party server name, if the request is originated from a known peer- Specified by:
authenticateThirdPartyServer
in interfaceEventService
- Parameters:
key
- the keyip
- the ip- Returns:
- server name
-
send
Description copied from interface:EventService
Propagates the specified event in the context server, notifyingEventListenerService
instances if needed. If the event is persistent (Event.isPersistent()
, it will be persisted appropriately. Once the event is propagated, anyActionPostExecutor
the event defined will be executed and the user profile updated if needed.- Specified by:
send
in interfaceEventService
- Parameters:
event
- the Event to be propagated- Returns:
- the result of the event handling as combination of EventService flags, to be checked using bitwise AND (&) operator
-
getEventProperties
Description copied from interface:EventService
Retrieves the list of available event properties.- Specified by:
getEventProperties
in interfaceEventService
- Returns:
- a list of available event properties
-
getEventTypeIds
Description copied from interface:EventService
Retrieves the set of known event type identifiers.- Specified by:
getEventTypeIds
in interfaceEventService
- Returns:
- the set of known event type identifiers.
-
searchEvents
Description copied from interface:EventService
RetrievesEvent
s matching the specifiedCondition
. Events are ordered according to their time stamp (Event.getTimeStamp()
and paged: onlysize
of them are retrieved, starting with theoffset
-th one.- Specified by:
searchEvents
in interfaceEventService
- Parameters:
condition
- the Condition we want the Events to match to be retrievedoffset
- zero or a positive integer specifying the position of the first event in the total ordered collection of matching eventssize
- a positive integer specifying how many matching events should be retrieved or-1
if all of them should be retrieved- Returns:
- a
PartialList
of matching events
-
searchEvents
public PartialList<Event> searchEvents(String sessionId, String[] eventTypes, String query, int offset, int size, String sortBy) Description copied from interface:EventService
RetrievesEvent
s for theSession
identified by the provided session identifier, matching any of the provided event types, ordered according to the specifiedsortBy
String and paged: onlysize
of them are retrieved, starting with theoffset
-th one. If aquery
is provided, a full text search is performed on the matching events to further filter them.- Specified by:
searchEvents
in interfaceEventService
- Parameters:
sessionId
- the identifier of the user session we're consideringeventTypes
- an array of event type names; the events to retrieve should at least match one of thesequery
- a String to perform full text filtering on events matching the other conditionsoffset
- zero or a positive integer specifying the position of the first event in the total ordered collection of matching eventssize
- a positive integer specifying how many matching events should be retrieved or-1
if all of them should be retrievedsortBy
- an optional (null
if no sorting is required) String of comma (,
) separated property names on which ordering should be performed, ordering elements according to the property order in the String, considering each in turn and moving on to the next one in case of equality of all preceding ones. Each property name is optionally followed by a column (:
) and an order specifier:asc
ordesc
.- Returns:
- a
PartialList
of matching events
-
search
Description copied from interface:EventService
- Specified by:
search
in interfaceEventService
- Parameters:
query
- aQuery
specifying which Events to retrieve- Returns:
- a
PartialList
ofEvent
instances matching the specified query
-
getEvent
Description copied from interface:EventService
Retrieves theEvent
by its identifier.- Specified by:
getEvent
in interfaceEventService
- Parameters:
id
- the identifier of theEvent
to retrieve- Returns:
- the
Event
identified by the specified identifier ornull
if no such profile exists
-
hasEventAlreadyBeenRaised
Description copied from interface:EventService
Checks whether the specified event has already been raised with the same itemId.- Specified by:
hasEventAlreadyBeenRaised
in interfaceEventService
- Parameters:
event
- the event we want to check- Returns:
true
if the event has already been raised,false
otherwise
-
hasEventAlreadyBeenRaised
Description copied from interface:EventService
Checks whether the specified event has already been raised either for the associated session or profile depending on the specifiedsession
parameter.- Specified by:
hasEventAlreadyBeenRaised
in interfaceEventService
- Parameters:
event
- the event we want to checksession
-true
if we want to check if the specified event has already been raised for the associated session,false
if we want to check whether the event has already been raised for the associated profile- Returns:
true
if the event has already been raised,false
otherwise
-
bind
-
unbind
-
removeProfileEvents
Description copied from interface:EventService
Removes all events of the specified profile- Specified by:
removeProfileEvents
in interfaceEventService
- Parameters:
profileId
- identifier of the profile that we want to remove it's events
-