Class EventServiceImpl

    • Constructor Detail

      • EventServiceImpl

        public EventServiceImpl()
    • Method Detail

      • setThirdPartyConfiguration

        public void setThirdPartyConfiguration​(Map<String,​String> thirdPartyConfiguration)
      • setPredefinedEventTypeIds

        public void setPredefinedEventTypeIds​(Set<String> predefinedEventTypeIds)
      • setRestrictedEventTypeIds

        public void setRestrictedEventTypeIds​(Set<String> restrictedEventTypeIds)
      • setPersistenceService

        public void setPersistenceService​(PersistenceService persistenceService)
      • setDefinitionsService

        public void setDefinitionsService​(DefinitionsService definitionsService)
      • setBundleContext

        public void setBundleContext​(org.osgi.framework.BundleContext bundleContext)
      • isEventAllowed

        public boolean isEventAllowed​(Event event,
                                      String thirdPartyId)
        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 interface EventService
        Parameters:
        event - event to test
        thirdPartyId - third party id
        Returns:
        true if the event is allowed
      • authenticateThirdPartyServer

        public String authenticateThirdPartyServer​(String key,
                                                   String ip)
        Description copied from interface: EventService
        Get the third party server name, if the request is originated from a known peer
        Specified by:
        authenticateThirdPartyServer in interface EventService
        Parameters:
        key - the key
        ip - the ip
        Returns:
        server name
      • send

        public int send​(Event event)
        Description copied from interface: EventService
        Propagates the specified event in the context server, notifying EventListenerService instances if needed. If the event is persistent (Event.isPersistent(), it will be persisted appropriately. Once the event is propagated, any ActionPostExecutor the event defined will be executed and the user profile updated if needed.
        Specified by:
        send in interface EventService
        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
      • getEventTypeIds

        public Set<String> getEventTypeIds()
        Description copied from interface: EventService
        Retrieves the set of known event type identifiers.
        Specified by:
        getEventTypeIds in interface EventService
        Returns:
        the set of known event type identifiers.
      • searchEvents

        public PartialList<Event> searchEvents​(Condition condition,
                                               int offset,
                                               int size)
        Description copied from interface: EventService
        Retrieves Events matching the specified Condition. Events are ordered according to their time stamp (Event.getTimeStamp() and paged: only size of them are retrieved, starting with the offset-th one.
        Specified by:
        searchEvents in interface EventService
        Parameters:
        condition - the Condition we want the Events to match to be retrieved
        offset - zero or a positive integer specifying the position of the first event in the total ordered collection of matching events
        size - 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
        Retrieves Events for the Session identified by the provided session identifier, matching any of the provided event types, ordered according to the specified sortBy String and paged: only size of them are retrieved, starting with the offset-th one. If a query is provided, a full text search is performed on the matching events to further filter them.
        Specified by:
        searchEvents in interface EventService
        Parameters:
        sessionId - the identifier of the user session we're considering
        eventTypes - an array of event type names; the events to retrieve should at least match one of these
        query - a String to perform full text filtering on events matching the other conditions
        offset - zero or a positive integer specifying the position of the first event in the total ordered collection of matching events
        size - a positive integer specifying how many matching events should be retrieved or -1 if all of them should be retrieved
        sortBy - 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 or desc.
        Returns:
        a PartialList of matching events
      • getEvent

        public Event getEvent​(String id)
        Description copied from interface: EventService
        Retrieves the Event by its identifier.
        Specified by:
        getEvent in interface EventService
        Parameters:
        id - the identifier of the Event to retrieve
        Returns:
        the Event identified by the specified identifier or null if no such profile exists
      • hasEventAlreadyBeenRaised

        public boolean hasEventAlreadyBeenRaised​(Event event)
        Description copied from interface: EventService
        Checks whether the specified event has already been raised with the same itemId.
        Specified by:
        hasEventAlreadyBeenRaised in interface EventService
        Parameters:
        event - the event we want to check
        Returns:
        true if the event has already been raised, false otherwise
      • hasEventAlreadyBeenRaised

        public boolean hasEventAlreadyBeenRaised​(Event event,
                                                 boolean session)
        Description copied from interface: EventService
        Checks whether the specified event has already been raised either for the associated session or profile depending on the specified session parameter.
        Specified by:
        hasEventAlreadyBeenRaised in interface EventService
        Parameters:
        event - the event we want to check
        session - 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

        public void bind​(org.osgi.framework.ServiceReference<EventListenerService> serviceReference)
      • unbind

        public void unbind​(org.osgi.framework.ServiceReference<EventListenerService> serviceReference)
      • removeProfileEvents

        public void removeProfileEvents​(String profileId)
        Description copied from interface: EventService
        Removes all events of the specified profile
        Specified by:
        removeProfileEvents in interface EventService
        Parameters:
        profileId - identifier of the profile that we want to remove it's events