Class CustomEvent
- java.lang.Object
-
- com.novomind.ecom.api.iagent.common.event.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
TheCustomEvent
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 theCustomEventHandler.raiseEvent(CustomEvent)
method and processed by any appropriateCustomEventListener
even in a different process.- Since:
- 12.20
-
-
Constructor Summary
Constructors Constructor Description CustomEvent(java.lang.String name)
Constructs aCustomEvent
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 theDate
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()
-
-
-
Constructor Detail
-
CustomEvent
public CustomEvent(java.lang.String name)
Constructs aCustomEvent
with the given name. The name of the event is used to address the correspondingCustomEventListener
to process the event. The correspondingCustomEventListener
must be annotated with the annotationCustomEventFilter
and specify a list of names of the events theCustomEventListener
wants to listen to. TheCustomEventListener
will only be notified for events that are specified in the names attribute of the annotationCustomEventFilter
.- 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 attributevalue
- 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 interfacecom.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 theDate
when the event has occurred.- Specified by:
getEventDate
in interfaceEvent
- Returns:
- the
Date
of the event
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-