Package org.apache.unomi.api.services
Interface EventService
-
- All Known Implementing Classes:
EventServiceImpl
public interface EventService
A service to publish events, notably issued from user interactions with tracked entities, in the context server.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ERROR
An error occurred while processing the event.static int
NO_CHANGE
No change occurred following an event being handled.static int
PROFILE_UPDATED
The associated profile was updated following an event being handled.static int
SESSION_UPDATED
The associated session was updated following an event being handled.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description String
authenticateThirdPartyServer(String key, String ip)
Get the third party server name, if the request is originated from a known peerEvent
getEvent(String id)
Retrieves theEvent
by its identifier.List<EventProperty>
getEventProperties()
Deprecated.use event types insteadSet<String>
getEventTypeIds()
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 profilePartialList<Event>
search(Query query)
PartialList<Event>
searchEvents(String sessionId, String[] eventTypes, String query, int offset, int size, String sortBy)
PartialList<Event>
searchEvents(Condition condition, int offset, int size)
int
send(Event event)
Propagates the specified event in the context server, notifyingEventListenerService
instances if needed.
-
-
-
Field Detail
-
NO_CHANGE
static final int NO_CHANGE
No change occurred following an event being handled.- See Also:
- Constant Field Values
-
ERROR
static final int ERROR
An error occurred while processing the event.- See Also:
- Constant Field Values
-
SESSION_UPDATED
static final int SESSION_UPDATED
The associated session was updated following an event being handled.- See Also:
- Constant Field Values
-
PROFILE_UPDATED
static final int PROFILE_UPDATED
The associated profile was updated following an event being handled.- See Also:
- Constant Field Values
-
-
Method Detail
-
send
int send(Event event)
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.- 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
-
isEventAllowed
boolean isEventAllowed(Event event, String thirdPartyId)
Check if the sender is allowed to sent the speecified event. Restricted event must be explicitely allowed for a sender.- Parameters:
event
- event to testthirdPartyId
- third party id- Returns:
- true if the event is allowed
-
authenticateThirdPartyServer
String authenticateThirdPartyServer(String key, String ip)
Get the third party server name, if the request is originated from a known peer- Parameters:
key
- the keyip
- the ip- Returns:
- server name
-
getEventProperties
List<EventProperty> getEventProperties()
Deprecated.use event types insteadRetrieves the list of available event properties.- Returns:
- a list of available event properties
-
getEventTypeIds
Set<String> getEventTypeIds()
Retrieves the set of known event type identifiers.- Returns:
- the set of known event type identifiers.
-
searchEvents
PartialList<Event> searchEvents(Condition condition, int offset, int size)
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.- 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
PartialList<Event> searchEvents(String sessionId, String[] eventTypes, String query, int offset, int size, String sortBy)
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.- 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
PartialList<Event> search(Query query)
- Parameters:
query
- aQuery
specifying which Events to retrieve- Returns:
- a
PartialList
ofEvent
instances matching the specified query
-
hasEventAlreadyBeenRaised
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.- 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
-
hasEventAlreadyBeenRaised
boolean hasEventAlreadyBeenRaised(Event event)
Checks whether the specified event has already been raised with the same itemId.- Parameters:
event
- the event we want to check- Returns:
true
if the event has already been raised,false
otherwise
-
removeProfileEvents
void removeProfileEvents(String profileId)
Removes all events of the specified profile- Parameters:
profileId
- identifier of the profile that we want to remove it's events
-
-