Interface Event


  • public interface Event
    A recorded event that occurred at some point in the wiki.

    Events are identified by:

    Events contain: Events are categorized into:
    1. the the application that created them, like blog, user statuses, or the general wiki
    2. an eventual sub-stream inside the application, for example a space for wiki events, or a certain group for user statuses
    3. the particular type of event, like adding a comment, updating an attachment, setting a new user status
    Events target:
    1. the wiki,
    2. the space,
    3. and the document affected by the event,
    4. and an eventual entity inside the document, for example an individual attachment for attachment events, or an individual object for comment events.
    Events can store some more information about the context in which they occur:
    • the user that caused the event
    • the version of the target document at the time that the event occurred
    • the display title of the target document at the time that the event occurred
    • the requested URL that caused the event
    Use EventFactory to create a new Event instance.
    Since:
    3.0M2
    Version:
    $Id: 8cd712c8a54c6deeadd91da01c41b2e5dc862637 $
    • Method Detail

      • getId

        String getId()
        Each event has a unique ID.
        Returns:
        the unique ID of the event
      • setId

        void setId​(String id)
        Parameters:
        id - the unique ID of the event to set
        See Also:
        getId()
      • getGroupId

        String getGroupId()
        Multiple events can correspond to the same activity, so events can be grouped under the same GroupID.
        Returns:
        the event group ID
      • setGroupId

        void setGroupId​(String id)
        Parameters:
        id - the event group ID
        See Also:
        getGroupId()
      • getDate

        Date getDate()
        An event happens at a precise date.
        Returns:
        the event date
      • setDate

        void setDate​(Date date)
        Parameters:
        date - the event date
        See Also:
        getDate()
      • getImportance

        Event.Importance getImportance()
        Different events can have a different importance. This allows to determine which events are more or less important in the same event group, or which events are important in the stream. For example, annotation automatic updates are less important in a group of changes triggered by a document update, while a major version is more important than a minor version.
        Returns:
        the importance of the event
      • getTitle

        String getTitle()
        A name for the event.
        Returns:
        the title of the event
      • setTitle

        void setTitle​(String title)
        Parameters:
        title - the title of the event
        See Also:
        getTitle()
      • getBody

        String getBody()
        A larger section of text where the event can store some data.
        Returns:
        the body of the event
      • setBody

        void setBody​(String body)
        Parameters:
        body - the body of the event
        See Also:
        getBody()
      • getApplication

        String getApplication()
        Events can be triggered by different applications, not only the main wiki update events: user statuses, blog pingbacks, new extension added...
        Returns:
        the application name
      • setApplication

        void setApplication​(String application)
        Parameters:
        application - the application Name
        See Also:
        getApplication()
      • getStream

        String getStream()
        Events can happen in different contexts; for example, wiki activity events happen in different spaces, user statuses are targeted to different groups.
        Returns:
        the stream name
      • setStream

        void setStream​(String stream)
        Parameters:
        stream - the stream Name
        See Also:
        getStream()
      • getType

        String getType()
        Events have different types: adding a comment, updating an attachment, importing an application, etc.
        Returns:
        The type of the event
      • setType

        void setType​(String type)
        Parameters:
        type - The type of the event
        See Also:
        getType()
      • getWiki

        WikiReference getWiki()
        In a wiki farm, each event happens in one of the wikis.
        Returns:
        the wiki name in which the event was created
      • setWiki

        void setWiki​(WikiReference wiki)
        Parameters:
        wiki - the wiki name in which the event was created
        See Also:
        getWiki()
      • getSpace

        SpaceReference getSpace()
        Document-related events target a certain document, and documents belong to a space; this is the space of the target document.
        Returns:
        the space in which the event was created
      • setSpace

        void setSpace​(SpaceReference space)
        Parameters:
        space - the space in which the event was created
        See Also:
        getSpace()
      • getDocument

        DocumentReference getDocument()
        Document-related events target a certain document.
        Returns:
        the document related to the event
      • getDocumentVersion

        String getDocumentVersion()
        For events related to documents, this field records the version of the document at the time when the event occurred.
        Returns:
        the document version when the event occurred
      • setDocumentVersion

        void setDocumentVersion​(String version)
        Parameters:
        version - the document version when the event occurred
        See Also:
        getDocumentVersion()
      • getRelatedEntity

        EntityReference getRelatedEntity()
        Some events may be related to a more specific entity in the target document, like an attachment or an object, or may relate to another document besides the main related document. The result of this method depends on the actual event type.
        Returns:
        the eventual entity related to the event, may be null
      • getUser

        DocumentReference getUser()
        Event usually occur as the result of a registered user activity.
        Returns:
        the user creating the event
      • getUrl

        URL getUrl()
        If an event happens in an URL-accessible location (a document), or if the event itself can be seen at a given URL, this field stores that URL.
        Returns:
        the URL related to the event
      • setUrl

        void setUrl​(URL url)
        Parameters:
        url - the URL related to the event
        See Also:
        getUrl()
      • getDocumentTitle

        String getDocumentTitle()
        The document title is usually more important than the document name. Since getting the title of a document version is a difficult task, store it in the event for faster and safer access.
        Returns:
        the title of the related document when the event occurred.
      • setDocumentTitle

        void setDocumentTitle​(String title)
        Parameters:
        title - the title of the related document when the event occurred.
        See Also:
        getDocumentTitle()
      • getCustom

        default Map<String,​Object> getCustom()
        Returns:
        the custom properties associated with this event
        Since:
        14.2RC1
      • setCustom

        default void setCustom​(Map<String,​?> custom)
        Associate the event with custom named values.

        The exactly list of supported types can vary depending on the EventStore implementation but it's expected that at least the following are supported:

        • String
        • All standard primitive wrappers (Boolean, Integer, etc)
        • java.util.Date
        • Iterable and arrays of other supported types
        Parameters:
        custom - the custom properties associated with this event
        Since:
        14.2RC1
      • setTarget

        default void setTarget​(Set<String> target)
        Parameters:
        target - a list of entities (users, groups) that are interested by this event
        Since:
        9.2RC1
      • getTarget

        default Set<String> getTarget()
        Returns:
        a list of entities (users, groups) that are interested by this event
        Since:
        9.2RC1
      • getHidden

        default boolean getHidden()
        Returns:
        if the event should be hidden or not
        Since:
        11.1RC1
      • setHidden

        default void setHidden​(boolean isHidden)
        Parameters:
        isHidden - if the event should be hidden or not
        Since:
        11.1RC1
      • isPrefiltered

        default boolean isPrefiltered()
        Returns:
        true if the event has already been prefiltered
        Since:
        11.5RC1
      • setPrefiltered

        default void setPrefiltered​(boolean prefiltered)
        Parameters:
        prefiltered - true if the event has already been prefiltered
        Since:
        11.5RC1
      • getRemoteObservationId

        @Unstable
        default String getRemoteObservationId()
        Returns:
        the unique identifier of the instance in the cluster, or null if the event was produced in a version of XWiki older than 14.7
        Since:
        14.7RC1