Class CustomEvent

  • All Implemented Interfaces:
    Event, com.novomind.ecom.common.api.attribute.Named

    public class CustomEvent
    extends java.lang.Object
    implements Event, com.novomind.ecom.common.api.attribute.Named
    The CustomEvent is an object that can be used to be sent as event between different apps and plugins even between different processes. CustomEvent can be raised by the CustomEventHandler.raiseEvent(CustomEvent) method and processed by any appropriate CustomEventListener even in a different process.
    Since:
    12.20
    • Constructor Summary

      Constructors 
      Constructor Description
      CustomEvent​(java.lang.String name)
      Constructs a CustomEvent with the given name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAttribute​(java.lang.String key)
      Get attributes of the event.
      java.util.Map<java.lang.String,​java.lang.String> getAttributes()
      Provides the attributes as map.
      java.util.Date getEventDate()
      Returns the Date when the event has occurred.
      java.lang.String getName()  
      CustomEvent setAttribute​(java.lang.String key, java.lang.String value)
      Set attributes of the event as key-value-pairs.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CustomEvent

        public CustomEvent​(java.lang.String name)
        Constructs a CustomEvent with the given name. The name of the event is used to address the corresponding CustomEventListener to process the event. The corresponding CustomEventListener must be annotated with the annotation CustomEventFilter and specify a list of names of the events the CustomEventListener wants to listen to. The CustomEventListener will only be notified for events that are specified in the names attribute of the annotation CustomEventFilter.
        Parameters:
        name - the name of the event
        Since:
        12.20
    • Method Detail

      • setAttribute

        public final CustomEvent setAttribute​(java.lang.String key,
                                              java.lang.String value)
        Set attributes of the event as key-value-pairs. Please note that the maximum size of all attribute values must not exceed a sum of 100 kilo bytes of characters.
        Parameters:
        key - the key of the attribute
        value - the value of the attribute
        Returns:
        the instance of CustomEvent
        Since:
        12.20
      • getAttribute

        public final java.lang.String getAttribute​(java.lang.String key)
        Get attributes of the event.
        Parameters:
        key - the key of the attribute
        Returns:
        the value of the attribute
        Since:
        12.20
      • getName

        public final java.lang.String getName()
        Specified by:
        getName in interface com.novomind.ecom.common.api.attribute.Named
      • getAttributes

        public final java.util.Map<java.lang.String,​java.lang.String> getAttributes()
        Provides the attributes as map.
        Returns:
        the attribute map
        Since:
        12.20
      • getEventDate

        public java.util.Date getEventDate()
        Description copied from interface: Event
        Returns the Date when the event has occurred.
        Specified by:
        getEventDate in interface Event
        Returns:
        the Date of the event
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object