public interface CustomEventBuilder
EventManager.
For this one needs an already authenticated classic connector:
EventManager manager = EventManager.newEventManager(myClassicConnector);
...
After that one can obtain a CustomEventBuilder from the EventManager by
specifying the events name:
...
CustomEventBuilder builder = manager.newCustomEvent("my.name");
...
Now one may give as many attributes as necessary to the event. This may happen attribute by attribute:
...
builder.setAttribute("key1", "value1");
builder.setAttribute("key2", "value2");
builder.setAttribute("key3", "value3");
builder.setAttribute("key4", "value4");
...
Alternatively one may add an already prepared map of strings:
...
Map<String, String> myStringMap = getMyPreparedAttributes();
builder.addAll(myStringMap);
...
One may also add the attributes as an instance of java.util.Properties:
...
Properties properties = new Properties();
properties.load(myFileReader);
builder.addAll(properties);
...
Finally the event can be fired:
...
builder.fire();
This may also be done fluently:
EventManager.newEventManager(myClassicConnector).newCustomEvent("my.name")
.setAttribute("myFirstKey", "myFirstValue").setAttribute("mySecondKey", "mySecondValue").fire();
| Modifier and Type | Method and Description |
|---|---|
CustomEventBuilder |
addAll(Map<String,String> attributes)
Adds every entry of the given map as an attribute
|
CustomEventBuilder |
addAll(Properties properties)
Convenience method to add a properties object as attributes.
|
void |
fire()
Fires the custom event defined by this builder.
|
CustomEventBuilder |
setAttribute(String key,
String value)
Sets an attribute.
|
<SerializableMap extends Map<String,String>,Serializable> |
setAttributes(SerializableMap map)
Discards the attributes given already and uses the given ones instead.
|
CustomEventBuilder setAttribute(String key, String value)
key - the key to store the attribute asvalue - the value of the attributeCustomEventBuilder addAll(Map<String,String> attributes)
attributes - the attributes to addCustomEventBuilder addAll(Properties properties)
properties - The properties to add<SerializableMap extends Map<String,String>,Serializable> CustomEventBuilder setAttributes(SerializableMap map)
map - The attributes to use. Note that they have to be given in a map that implements both
Map and Serializablevoid fire() throws SaAuthenticationException, SaSystemException
Copyright © 2020 Hyland Software Germany GmbH. All rights reserved.