Class Event

  • All Implemented Interfaces:
    Serializable

    public class Event
    extends Object
    implements Serializable
    This holds all the settings related to an event in the system.
    Author:
    Aaron Zeckoski (azeckoski @ gmail.com)
    See Also:
    Serialized Form
    • Constructor Detail

      • Event

        public Event​(String name)
        Create a new event with the given name. Will default to a read event (instead of modify event) and to the current user and local/cluster scope.
        Parameters:
        name - an event name (e.g. collection.read, item.modify)
      • Event

        public Event​(String name,
                     String resourceReference,
                     boolean modify)
        Create a new event with the given name for the given resource (item, collection, etc.). Defaults to the current user and local/cluster scope.
        Parameters:
        name - an event name (e.g. collection.read, item.modify)
        resourceReference - the reference (identifier) for the resource affected by this event
        modify - if true then this is a modify event, if false it is just a read event
      • Event

        public Event​(String name,
                     String resourceReference,
                     boolean modify,
                     boolean localOnly)
        Create a new event with the given name for the given resource (item, collection, etc.). Defaults to the current user and local/cluster scope.
        Parameters:
        name - an event name (e.g. collection.read, item.modify)
        resourceReference - the reference (identifier) for the resource affected by this event
        modify - if true then this is a modify event, if false it is just a read event
        localOnly - if true then this is a local event only, otherwise it defaults to local/cluster
      • Event

        public Event​(String name,
                     String resourceReference,
                     String userId,
                     boolean modify)
        Create a new event with the given name for the given user on the given resource (item, collection, etc.).
        Parameters:
        name - an event name (e.g. collection.read, item.modify)
        resourceReference - the reference (identifier) for the resource affected by this event
        userId - the internal user id for the user who caused this event
        modify - if true then this is a modify event, if false it is just a read event
      • Event

        public Event​(String name,
                     String resourceReference,
                     String userId,
                     Map<String,​String> properties,
                     Event.Scope[] scopes,
                     boolean modify)
        Create a new event with the given name for the given user on the given resource (item, collection, etc.).
        Parameters:
        name - an event name (e.g. collection.read, item.modify)
        resourceReference - the reference (identifier) for the resource affected by this event
        userId - the internal user id for the user who caused this event
        properties - additional properties to send along with this event
        scopes - the scopes to send this event to
        modify - if true then this is a modify event, if false it is just a read event
    • Method Detail

      • getId

        public String getId()
        Returns:
        the unique identifier for this event (generated by the system)
      • setId

        public void setId​(String id)
      • getName

        public String getName()
        Returns:
        the name of this event (e.g. collection.modify, item.delete)
      • setName

        public void setName​(String name)
      • getUserId

        public String getUserId()
        Returns:
        the internal user id for the user who caused this event
      • setUserId

        public void setUserId​(String userId)
      • getResourceReference

        public String getResourceReference()
        Reference the resource affected by this event.
        Returns:
        the reference (identifier) for the resource affected by this event OR null if none specified
      • setResourceReference

        public void setResourceReference​(String resourceReference)
      • isModify

        public boolean isModify()
        Did this event modify something in the system?
        Returns:
        true if this event modified soemthing in the system, false if it was read only
      • setModify

        public void setModify​(boolean modify)
      • getProperties

        public Map<String,​String> getProperties()
        Returns:
        the additional properties included with this event if there are any
      • setProperties

        public void setProperties​(Map<String,​String> properties)
      • getScopes

        public Event.Scope[] getScopes()
        Returns:
        the scopes the this event is sent to
      • setScopes

        public void setScopes​(Event.Scope[] scopes)