Class AutomationEventFactory
java.lang.Object
org.openhab.core.events.AbstractEventFactory
org.openhab.core.automation.events.AutomationEventFactory
- All Implemented Interfaces:
EventFactory
This class is a factory that creates Timer and Execution Events.
- Author:
- Jan N. Klug - Initial contribution
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Event
createEventByType
(String eventType, String topic, String payload, @Nullable String source) Create a new event instance based on the event type.static ExecutionEvent
Creates anExecutionEvent
static TimerEvent
Creates aTimerEvent
Methods inherited from class org.openhab.core.events.AbstractEventFactory
checkNotNull, checkNotNullOrEmpty, createEvent, deserializePayload, getSupportedEventTypes, getTopicElements, serializePayload
-
Constructor Details
-
AutomationEventFactory
public AutomationEventFactory()
-
-
Method Details
-
createEventByType
protected Event createEventByType(String eventType, String topic, String payload, @Nullable String source) throws Exception Description copied from class:AbstractEventFactory
Create a new event instance based on the event type.- Specified by:
createEventByType
in classAbstractEventFactory
- Parameters:
eventType
- the event typetopic
- the topicpayload
- the payloadsource
- the source, can be null- Returns:
- the created event instance
- Throws:
Exception
- if the creation of the event fails
-
createTimerEvent
public static TimerEvent createTimerEvent(String moduleId, @Nullable String label, Map<String, Object> configuration) Creates aTimerEvent
- Parameters:
moduleId
- the module type id of this eventlabel
- The label (or id) of this objectconfiguration
- the configuration of the trigger- Returns:
- the created event
-
createExecutionEvent
public static ExecutionEvent createExecutionEvent(String moduleId, @Nullable Map<String, Object> payload, String source) Creates anExecutionEvent
- Parameters:
moduleId
- the module type id of this eventpayload
- A map with additional information like preceding events when rules are called from other rules (optional)source
- The source of this event (e.g. "script" or "manual")- Returns:
- the created event
-