2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.astro.internal.job;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.astro.internal.AstroHandlerFactory;
17 import org.openhab.binding.astro.internal.handler.AstroThingHandler;
20 * Scheduled job to trigger events
22 * @author Gerhard Riegler - Initial contribution
23 * @author Amit Kumar Mondal - Implementation to be compliant with ESH Scheduler
26 public final class EventJob extends AbstractJob {
28 private final String channelID;
29 private final String event;
34 * @param thingUID thing UID
35 * @param channelID channel ID
36 * @param event Event name
37 * @throws IllegalArgumentException
38 * if any of the arguments is {@code null}
40 public EventJob(String thingUID, String channelID, String event) {
42 this.channelID = channelID;
48 AstroThingHandler astroHandler = AstroHandlerFactory.getHandler(getThingUID());
49 if (astroHandler != null) {
50 astroHandler.triggerEvent(channelID, event);
52 LOGGER.trace("AstroThingHandler is null");
57 public String toString() {
58 return "Event job " + getThingUID() + "/" + channelID + "/" + event;