]> git.basschouten.com Git - openhab-addons.git/commitdiff
Rework ThingActions (#8755)
authorWouter Born <github@maindrain.net>
Thu, 15 Oct 2020 08:53:53 +0000 (10:53 +0200)
committerGitHub <noreply@github.com>
Thu, 15 Oct 2020 08:53:53 +0000 (10:53 +0200)
* Remove duplication by making use of default Java generated exceptions
* Make ThingActions labels/descriptions more consistent

Signed-off-by: Wouter Born <github@maindrain.net>
40 files changed:
bundles/org.openhab.binding.alarmdecoder/src/main/java/org/openhab/binding/alarmdecoder/internal/actions/BridgeActions.java
bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/action/AstroActions.java
bundles/org.openhab.binding.automower/src/main/java/org/openhab/binding/automower/internal/actions/AutomowerActions.java
bundles/org.openhab.binding.automower/src/main/resources/OH-INF/i18n/automower.properties
bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/actions/AVMFritzHeatingActions.java
bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/i18n/avmfritz.properties
bundles/org.openhab.binding.avmfritz/src/test/java/org/openhab/binding/avmfritz/internal/actions/AVMFritzHeatingActionsTest.java
bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/action/DmxActions.java
bundles/org.openhab.binding.doorbird/src/main/java/org/openhab/binding/doorbird/internal/action/DoorbirdActions.java
bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/action/EcobeeActions.java
bundles/org.openhab.binding.enigma2/src/main/java/org/openhab/binding/enigma2/internal/actions/Enigma2Actions.java
bundles/org.openhab.binding.enigma2/src/main/resources/OH-INF/i18n/enigma2.properties
bundles/org.openhab.binding.enigma2/src/test/java/org/openhab/binding/enigma2/internal/actions/Enigma2ActionsTest.java
bundles/org.openhab.binding.gce/src/main/java/org/openhab/binding/gce/internal/action/Ipx800Actions.java
bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/action/HeosActions.java
bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/action/LightActions.java
bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/IpCameraActions.java
bundles/org.openhab.binding.kaleidescape/src/main/java/org/openhab/binding/kaleidescape/internal/KaleidescapeThingActions.java
bundles/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/internal/LcnModuleActions.java
bundles/org.openhab.binding.lgwebos/src/main/java/org/openhab/binding/lgwebos/internal/action/LGWebOSActions.java
bundles/org.openhab.binding.lgwebos/src/main/resources/OH-INF/i18n/lgwebos.properties
bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/action/DimmerActions.java
bundles/org.openhab.binding.mail/src/main/java/org/openhab/binding/mail/internal/action/SendMailActions.java
bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/actions/MaxCubeActions.java
bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/actions/MaxDevicesActions.java
bundles/org.openhab.binding.modbus.helioseasycontrols/src/main/java/org/openhab/binding/modbus/helioseasycontrols/internal/HeliosEasyControlsActions.java
bundles/org.openhab.binding.mpd/src/main/java/org/openhab/binding/mpd/internal/action/MPDActions.java
bundles/org.openhab.binding.mqtt/src/main/java/org/openhab/binding/mqtt/internal/action/MQTTActions.java
bundles/org.openhab.binding.network/src/main/java/org/openhab/binding/network/internal/action/NetworkActions.java
bundles/org.openhab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/NuvoThingActions.java
bundles/org.openhab.binding.onkyo/src/main/java/org/openhab/binding/onkyo/internal/automation/modules/OnkyoThingActions.java
bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/action/PushbulletActions.java
bundles/org.openhab.binding.pushbullet/src/main/resources/OH-INF/i18n/pushbullet_en.properties
bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/RadioThermostatThingActions.java
bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/action/SatelEventLogActions.java
bundles/org.openhab.binding.satel/src/main/resources/OH-INF/i18n/satel.properties
bundles/org.openhab.binding.telegram/src/main/java/org/openhab/binding/telegram/internal/action/TelegramActions.java
bundles/org.openhab.binding.xmppclient/src/main/java/org/openhab/binding/xmppclient/internal/action/XMPPActions.java
bundles/org.openhab.binding.yioremote/src/main/java/org/openhab/binding/yioremote/internal/YIOremoteDockActions.java
bundles/org.openhab.binding.zoneminder/src/main/java/org/openhab/binding/zoneminder/internal/action/ZmActions.java

index 658f9781793cd2106b80b6cbe53811ecdd918126..06e4053f8c8b16f47928abc3d069cbad02cab544 100644 (file)
@@ -67,11 +67,7 @@ public class BridgeActions implements ThingActions {
     }
 
     // Static method for Rules DSL backward compatibility
-    public static void reboot(@Nullable ThingActions actions) {
-        if (actions instanceof BridgeActions) {
-            ((BridgeActions) actions).reboot();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of BridgeActions");
-        }
+    public static void reboot(ThingActions actions) {
+        ((BridgeActions) actions).reboot();
     }
 }
index f8415c5e67f5bfee3eb682ff9266504220c704c2..3216c50a3ec05dfb6c885e3d56756a0502bdbd4d 100644 (file)
@@ -112,34 +112,20 @@ public class AstroActions implements ThingActions {
         return null;
     }
 
-    public static @Nullable QuantityType<Angle> getElevation(@Nullable ThingActions actions,
-            @Nullable ZonedDateTime date) {
-        if (actions instanceof AstroActions) {
-            return ((AstroActions) actions).getElevation(date);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of AstroActions");
-        }
+    public static @Nullable QuantityType<Angle> getElevation(ThingActions actions, @Nullable ZonedDateTime date) {
+        return ((AstroActions) actions).getElevation(date);
     }
 
-    public static @Nullable QuantityType<Angle> getAzimuth(@Nullable ThingActions actions,
-            @Nullable ZonedDateTime date) {
-        if (actions instanceof AstroActions) {
-            return ((AstroActions) actions).getAzimuth(date);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of AstroActions");
-        }
+    public static @Nullable QuantityType<Angle> getAzimuth(ThingActions actions, @Nullable ZonedDateTime date) {
+        return ((AstroActions) actions).getAzimuth(date);
     }
 
-    public static @Nullable ZonedDateTime getEventTime(@Nullable ThingActions actions, @Nullable String phaseName,
+    public static @Nullable ZonedDateTime getEventTime(ThingActions actions, @Nullable String phaseName,
             @Nullable ZonedDateTime date, @Nullable String moment) {
-        if (actions instanceof AstroActions) {
-            if (phaseName != null) {
-                return ((AstroActions) actions).getEventTime(phaseName, date, moment);
-            } else {
-                throw new IllegalArgumentException("phaseName can not be null");
-            }
+        if (phaseName != null) {
+            return ((AstroActions) actions).getEventTime(phaseName, date, moment);
         } else {
-            throw new IllegalArgumentException("Actions is not an instance of AstroActions");
+            throw new IllegalArgumentException("phaseName can not be null");
         }
     }
 }
index 1086a0bfcaf1ef0c0e96afbbf1c3a1d190565ea3..31d2f4c6d5274e2feaa00af63329b1b268d0930f 100644 (file)
@@ -54,12 +54,8 @@ public class AutomowerActions implements ThingActions {
         }
     }
 
-    public static void start(@Nullable ThingActions actions, int durationMin) {
-        if (actions instanceof AutomowerActions) {
-            ((AutomowerActions) actions).start(durationMin);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
-        }
+    public static void start(ThingActions actions, int durationMin) {
+        ((AutomowerActions) actions).start(durationMin);
     }
 
     @RuleAction(label = "@text/action-pause-label", description = "@text/action-pause-desc")
@@ -72,12 +68,8 @@ public class AutomowerActions implements ThingActions {
         }
     }
 
-    public static void pause(@Nullable ThingActions actions) {
-        if (actions instanceof AutomowerActions) {
-            ((AutomowerActions) actions).pause();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
-        }
+    public static void pause(ThingActions actions) {
+        ((AutomowerActions) actions).pause();
     }
 
     @RuleAction(label = "@text/action-parkuntilnextschedule-label", description = "@text/action-parkuntilnextschedule-desc")
@@ -90,12 +82,8 @@ public class AutomowerActions implements ThingActions {
         }
     }
 
-    public static void parkUntilNextSchedule(@Nullable ThingActions actions) {
-        if (actions instanceof AutomowerActions) {
-            ((AutomowerActions) actions).parkUntilNextSchedule();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
-        }
+    public static void parkUntilNextSchedule(ThingActions actions) {
+        ((AutomowerActions) actions).parkUntilNextSchedule();
     }
 
     @RuleAction(label = "@text/action-parkuntilfurthernotice-label", description = "@text/action-parkuntilfurthernotice-desc")
@@ -108,12 +96,8 @@ public class AutomowerActions implements ThingActions {
         }
     }
 
-    public static void parkUntilFurtherNotice(@Nullable ThingActions actions) {
-        if (actions instanceof AutomowerActions) {
-            ((AutomowerActions) actions).parkUntilFurtherNotice();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
-        }
+    public static void parkUntilFurtherNotice(ThingActions actions) {
+        ((AutomowerActions) actions).parkUntilFurtherNotice();
     }
 
     @RuleAction(label = "@text/action-park-label", description = "@text/action-park-desc")
@@ -127,12 +111,8 @@ public class AutomowerActions implements ThingActions {
         }
     }
 
-    public static void park(@Nullable ThingActions actions, int durationMin) {
-        if (actions instanceof AutomowerActions) {
-            ((AutomowerActions) actions).park(durationMin);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
-        }
+    public static void park(ThingActions actions, int durationMin) {
+        ((AutomowerActions) actions).park(durationMin);
     }
 
     @RuleAction(label = "@text/action-resumeschedule-label", description = "@text/action-resumeschedule-desc")
@@ -145,11 +125,7 @@ public class AutomowerActions implements ThingActions {
         }
     }
 
-    public static void resumeSchedule(@Nullable ThingActions actions) {
-        if (actions instanceof AutomowerActions) {
-            ((AutomowerActions) actions).resumeSchedule();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of AutomowerActions");
-        }
+    public static void resumeSchedule(ThingActions actions) {
+        ((AutomowerActions) actions).resumeSchedule();
     }
 }
index a3855ee9722e9820dc8ef7a99e5d42710b7f1857..1f42b1aacae4f999a52a8b86d3a8d4859a89e0fa 100644 (file)
@@ -40,23 +40,23 @@ comm-error-send-mower-command-failed = Unable to send automower command
 
 comm-error-mower-not-connected-to-cloud = Automower not connected to the cloud
 
-action-start-label = Start
-action-start-desc = Starts the automower for a defined amount of time, overriding its schedule
+action-start-label = start the automower
+action-start-desc = Starts the automower for a defined amount of time, overriding its schedule.
 
-action-pause-label = Pause
-action-pause-desc = Pauses the automower wherever it currently is
+action-pause-label = pause the automower
+action-pause-desc = Pauses the automower wherever it currently is.
 
-action-parkuntilnextschedule-label = Park until next schedule
-action-parkuntilnextschedule-desc = Parks the automower until the next schedule
+action-parkuntilnextschedule-label = park until the next schedule
+action-parkuntilnextschedule-desc = Parks the automower until the next schedule.
 
-action-parkuntilfurthernotice-label = Park until further notice
-action-parkuntilfurthernotice-desc = Parks the automower until the schedule is resumed
+action-parkuntilfurthernotice-label = park until further notice
+action-parkuntilfurthernotice-desc = Parks the automower until the schedule is resumed.
 
-action-park-label = Park
-action-park-desc = Parks the automower for a defined amount of time, overriding its schedule
+action-park-label = park the automower
+action-park-desc = Parks the automower for a defined amount of time, overriding its schedule.
 
-action-resumeschedule-label = Resume schedule
-action-resumeschedule-desc = Resumes the schedule for the automower
+action-resumeschedule-label = resume the schedule
+action-resumeschedule-desc = Resumes the schedule for the automower.
 
 action-input-duration-label = Duration
 action-input-duration-desc = The duration of the automower command in minutes
index ef5530b48fc4e989d8b73dbfa85f766fa99f52fb..0c42928bea48fa4367c7d0cdbe92a6a41e02d436 100644 (file)
@@ -55,12 +55,8 @@ public class AVMFritzHeatingActions implements ThingActions {
         actionsHandler.setBoostMode(duration.longValue());
     }
 
-    public static void setBoostMode(@Nullable ThingActions actions, @Nullable Long duration) {
-        if (actions instanceof AVMFritzHeatingActions) {
-            ((AVMFritzHeatingActions) actions).setBoostMode(duration);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of AVMFritzHeatingActions");
-        }
+    public static void setBoostMode(ThingActions actions, @Nullable Long duration) {
+        ((AVMFritzHeatingActions) actions).setBoostMode(duration);
     }
 
     @RuleAction(label = "@text/setWindowOpenModeActionLabel", description = "@text/setWindowOpenModeActionDescription")
@@ -76,11 +72,7 @@ public class AVMFritzHeatingActions implements ThingActions {
         actionsHandler.setWindowOpenMode(duration.longValue());
     }
 
-    public static void setWindowOpenMode(@Nullable ThingActions actions, @Nullable Long duration) {
-        if (actions instanceof AVMFritzHeatingActions) {
-            ((AVMFritzHeatingActions) actions).setWindowOpenMode(duration);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of AVMFritzHeatingActions");
-        }
+    public static void setWindowOpenMode(ThingActions actions, @Nullable Long duration) {
+        ((AVMFritzHeatingActions) actions).setWindowOpenMode(duration);
     }
 }
index 33a8100d99f4d2d408d7ad7d273a88ff4b2c0f0d..1bb193760bce9e373ce2a3301c99d7968fc4731e 100644 (file)
@@ -1,10 +1,10 @@
 # thing actions
-setBoostModeModeActionLabel = Set Boost Mode
+setBoostModeModeActionLabel = set the Boost mode
 setBoostModeActionDescription = Activates the Boost mode of the heating thermostat.
 setBoostModeDurationInputLabel = Duration
 setBoostModeDurationInputDescription = Duration in seconds, min. 1, max. 86400, 0 for deactivation.
 
-setWindowOpenModeActionLabel = Set Window Open Mode
+setWindowOpenModeActionLabel = set the Window Open mode
 setWindowOpenModeActionDescription = Activates the Window Open mode of the heating thermostat.
 setWindowOpenModeDurationInputLabel = Duration
 setWindowOpenModeDurationInputDescription = Duration in seconds, min. 1, max. 86400, 0 for deactivation.
index f0f5865738278b28337d144d5c1bbd07497e9644..13f2ac520945a93ed0285d1ae47b3841589b8c54 100644 (file)
@@ -52,13 +52,8 @@ public class AVMFritzHeatingActionsTest {
     }
 
     @Test
-    public void testSetBoostModeThingActionsIsNull() {
-        assertThrows(IllegalArgumentException.class, () -> AVMFritzHeatingActions.setBoostMode(null, Long.valueOf(5L)));
-    }
-
-    @Test
-    public void testSetBoostModeThingActionsIsNotPushoverThingActions() {
-        assertThrows(IllegalArgumentException.class,
+    public void testSetBoostModeThingActionsIsNotAVMFritzHeatingActions() {
+        assertThrows(ClassCastException.class,
                 () -> AVMFritzHeatingActions.setBoostMode(thingActionsStub, Long.valueOf(5L)));
     }
 
@@ -81,14 +76,8 @@ public class AVMFritzHeatingActionsTest {
     }
 
     @Test
-    public void testSetWindowOpenModeThingActionsIsNull() {
-        assertThrows(IllegalArgumentException.class,
-                () -> AVMFritzHeatingActions.setWindowOpenMode(null, Long.valueOf(5L)));
-    }
-
-    @Test
-    public void testSetWindowOpenModeThingActionsIsNotPushoverThingActions() {
-        assertThrows(IllegalArgumentException.class,
+    public void testSetWindowOpenModeThingActionsIsNotAVMFritzHeatingActions() {
+        assertThrows(ClassCastException.class,
                 () -> AVMFritzHeatingActions.setWindowOpenMode(thingActionsStub, Long.valueOf(5L)));
     }
 
index 0e92e881a5c43833c8c80e7bba898f48fe622dbe..dc7e4151ea9e136478e500e3546e6d17b6ea2766 100644 (file)
@@ -66,13 +66,9 @@ public class DmxActions implements ThingActions {
         }
     }
 
-    public static void sendFade(@Nullable ThingActions actions, @Nullable String channels, @Nullable String fade,
+    public static void sendFade(ThingActions actions, @Nullable String channels, @Nullable String fade,
             @Nullable Boolean resumeAfter) {
-        if (actions instanceof DmxActions) {
-            ((DmxActions) actions).sendFade(channels, fade, resumeAfter);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of DmxActions");
-        }
+        ((DmxActions) actions).sendFade(channels, fade, resumeAfter);
     }
 
     @Override
index 389a7bd58d2436023c9440623e5cd505a2246bff..d7a8b78ef585044fa5d005e178bd9d3948f6f707 100644 (file)
@@ -61,12 +61,8 @@ public class DoorbirdActions implements ThingActions {
         }
     }
 
-    public static void restart(@Nullable ThingActions actions) {
-        if (actions instanceof DoorbirdActions) {
-            ((DoorbirdActions) actions).restart();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
-        }
+    public static void restart(ThingActions actions) {
+        ((DoorbirdActions) actions).restart();
     }
 
     @RuleAction(label = "hangup a SIP call", description = "Hangup SIP call.")
@@ -79,12 +75,8 @@ public class DoorbirdActions implements ThingActions {
         }
     }
 
-    public static void sipHangup(@Nullable ThingActions actions) {
-        if (actions instanceof DoorbirdActions) {
-            ((DoorbirdActions) actions).sipHangup();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
-        }
+    public static void sipHangup(ThingActions actions) {
+        ((DoorbirdActions) actions).sipHangup();
     }
 
     @RuleAction(label = "get the ring time limit", description = "Get the value of RING_TIME_LIMIT.")
@@ -98,12 +90,8 @@ public class DoorbirdActions implements ThingActions {
         }
     }
 
-    public static String getRingTimeLimit(@Nullable ThingActions actions) {
-        if (actions instanceof DoorbirdActions) {
-            return ((DoorbirdActions) actions).getRingTimeLimit();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
-        }
+    public static String getRingTimeLimit(ThingActions actions) {
+        return ((DoorbirdActions) actions).getRingTimeLimit();
     }
 
     @RuleAction(label = "get the call time limit", description = "Get the value of CALL_TIME_LIMIT.")
@@ -117,12 +105,8 @@ public class DoorbirdActions implements ThingActions {
         }
     }
 
-    public static String getCallTimeLimit(@Nullable ThingActions actions) {
-        if (actions instanceof DoorbirdActions) {
-            return ((DoorbirdActions) actions).getCallTimeLimit();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
-        }
+    public static String getCallTimeLimit(ThingActions actions) {
+        return ((DoorbirdActions) actions).getCallTimeLimit();
     }
 
     @RuleAction(label = "get the last error code", description = "Get the value of LASTERRORCODE.")
@@ -136,12 +120,8 @@ public class DoorbirdActions implements ThingActions {
         }
     }
 
-    public static String getLastErrorCode(@Nullable ThingActions actions) {
-        if (actions instanceof DoorbirdActions) {
-            return ((DoorbirdActions) actions).getLastErrorCode();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
-        }
+    public static String getLastErrorCode(ThingActions actions) {
+        return ((DoorbirdActions) actions).getLastErrorCode();
     }
 
     @RuleAction(label = "get the last error text", description = "Get the value of LASTERRORTEXT.")
@@ -155,11 +135,7 @@ public class DoorbirdActions implements ThingActions {
         }
     }
 
-    public static String getLastErrorText(@Nullable ThingActions actions) {
-        if (actions instanceof DoorbirdActions) {
-            return ((DoorbirdActions) actions).getLastErrorText();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of DoorbirdActions");
-        }
+    public static String getLastErrorText(ThingActions actions) {
+        return ((DoorbirdActions) actions).getLastErrorText();
     }
 }
index fbf788f119a1182ada7e52719980f81f77e97fef..a9ae8d4ebe9e96b79a596c6aa594b958f2aa7cce 100644 (file)
@@ -102,13 +102,9 @@ public class EcobeeActions implements ThingActions {
         return localHandler.actionPerformFunction(function);
     }
 
-    public static boolean acknowledge(@Nullable ThingActions actions, @Nullable String ackRef, @Nullable String ackType,
+    public static boolean acknowledge(ThingActions actions, @Nullable String ackRef, @Nullable String ackType,
             @Nullable Boolean remindMeLater) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).acknowledge(ackRef, ackType, remindMeLater);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+        return ((EcobeeActions) actions).acknowledge(ackRef, ackType, remindMeLater);
     }
 
     /**
@@ -137,15 +133,11 @@ public class EcobeeActions implements ThingActions {
         return localHandler.actionPerformFunction(function);
     }
 
-    public static boolean controlPlug(@Nullable ThingActions actions, @Nullable String plugName,
-            @Nullable String plugState, @Nullable Date startDateTime, @Nullable Date endDateTime,
-            @Nullable String holdType, @Nullable Number holdHours) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).controlPlug(plugName, plugState, startDateTime, endDateTime, holdType,
-                    holdHours);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static boolean controlPlug(ThingActions actions, @Nullable String plugName, @Nullable String plugState,
+            @Nullable Date startDateTime, @Nullable Date endDateTime, @Nullable String holdType,
+            @Nullable Number holdHours) {
+        return ((EcobeeActions) actions).controlPlug(plugName, plugState, startDateTime, endDateTime, holdType,
+                holdHours);
     }
 
     /**
@@ -175,16 +167,12 @@ public class EcobeeActions implements ThingActions {
         return localHandler.actionPerformFunction(function);
     }
 
-    public static boolean createVacation(@Nullable ThingActions actions, @Nullable String name,
+    public static boolean createVacation(ThingActions actions, @Nullable String name,
             @Nullable QuantityType<Temperature> coolHoldTemp, @Nullable QuantityType<Temperature> heatHoldTemp,
             @Nullable Date startDateTime, @Nullable Date endDateTime, @Nullable String fan,
             @Nullable Number fanMinOnTime) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).createVacation(name, coolHoldTemp, heatHoldTemp, startDateTime,
-                    endDateTime, fan, fanMinOnTime);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+        return ((EcobeeActions) actions).createVacation(name, coolHoldTemp, heatHoldTemp, startDateTime, endDateTime,
+                fan, fanMinOnTime);
     }
 
     /**
@@ -206,12 +194,8 @@ public class EcobeeActions implements ThingActions {
         return localHandler.actionPerformFunction(function);
     }
 
-    public static boolean deleteVacation(@Nullable ThingActions actions, @Nullable String name) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).deleteVacation(name);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static boolean deleteVacation(ThingActions actions, @Nullable String name) {
+        return ((EcobeeActions) actions).deleteVacation(name);
     }
 
     /**
@@ -232,12 +216,8 @@ public class EcobeeActions implements ThingActions {
         return localHandler.actionPerformFunction(function);
     }
 
-    public static boolean resetPreferences(@Nullable ThingActions actions) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).resetPreferences();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static boolean resetPreferences(ThingActions actions) {
+        return ((EcobeeActions) actions).resetPreferences();
     }
 
     /**
@@ -259,12 +239,8 @@ public class EcobeeActions implements ThingActions {
         return localHandler.actionPerformFunction(function);
     }
 
-    public static boolean resumeProgram(@Nullable ThingActions actions, @Nullable Boolean resumeAll) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).resumeProgram(resumeAll);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static boolean resumeProgram(ThingActions actions, @Nullable Boolean resumeAll) {
+        return ((EcobeeActions) actions).resumeProgram(resumeAll);
     }
 
     /**
@@ -286,12 +262,8 @@ public class EcobeeActions implements ThingActions {
         return localHandler.actionPerformFunction(function);
     }
 
-    public static boolean sendMessage(@Nullable ThingActions actions, @Nullable String text) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).sendMessage(text);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static boolean sendMessage(ThingActions actions, @Nullable String text) {
+        return ((EcobeeActions) actions).sendMessage(text);
     }
 
     /**
@@ -312,13 +284,9 @@ public class EcobeeActions implements ThingActions {
         return setHold(params, null, null, null, null);
     }
 
-    public static boolean setHold(@Nullable ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
+    public static boolean setHold(ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
             @Nullable QuantityType<Temperature> heatHoldTemp) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+        return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp);
     }
 
     /**
@@ -343,13 +311,9 @@ public class EcobeeActions implements ThingActions {
         return setHold(params, null, null, null, null);
     }
 
-    public static boolean setHold(@Nullable ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
+    public static boolean setHold(ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
             @Nullable QuantityType<Temperature> heatHoldTemp, @Nullable Number holdHours) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp, holdHours);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+        return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp, holdHours);
     }
 
     /**
@@ -371,12 +335,8 @@ public class EcobeeActions implements ThingActions {
         return setHold(params, null, null, null, null);
     }
 
-    public static boolean setHold(@Nullable ThingActions actions, @Nullable String holdClimateRef) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).setHold(holdClimateRef);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static boolean setHold(ThingActions actions, @Nullable String holdClimateRef) {
+        return ((EcobeeActions) actions).setHold(holdClimateRef);
     }
 
     /**
@@ -404,13 +364,8 @@ public class EcobeeActions implements ThingActions {
         return setHold(params, null, null, null, null);
     }
 
-    public static boolean setHold(@Nullable ThingActions actions, @Nullable String holdClimateRef,
-            @Nullable Number holdHours) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).setHold(holdClimateRef, holdHours);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static boolean setHold(ThingActions actions, @Nullable String holdClimateRef, @Nullable Number holdHours) {
+        return ((EcobeeActions) actions).setHold(holdClimateRef, holdHours);
     }
 
     /**
@@ -438,16 +393,12 @@ public class EcobeeActions implements ThingActions {
         return setHold(params, holdType, holdHours, startDateTime, endDateTime);
     }
 
-    public static boolean setHold(@Nullable ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
+    public static boolean setHold(ThingActions actions, @Nullable QuantityType<Temperature> coolHoldTemp,
             @Nullable QuantityType<Temperature> heatHoldTemp, @Nullable String holdClimateRef,
             @Nullable Date startDateTime, @Nullable Date endDateTime, @Nullable String holdType,
             @Nullable Number holdHours) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp, holdClimateRef, startDateTime,
-                    endDateTime, holdType, holdHours);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+        return ((EcobeeActions) actions).setHold(coolHoldTemp, heatHoldTemp, holdClimateRef, startDateTime, endDateTime,
+                holdType, holdHours);
     }
 
     /**
@@ -528,14 +479,9 @@ public class EcobeeActions implements ThingActions {
         return localHandler.actionPerformFunction(function);
     }
 
-    public static boolean setHold(@Nullable ThingActions actions, @Nullable Map<String, Object> params,
-            @Nullable String holdType, @Nullable Number holdHours, @Nullable Date startDateTime,
-            @Nullable Date endDateTime) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).setHold(params, holdType, holdHours, startDateTime, endDateTime);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static boolean setHold(ThingActions actions, @Nullable Map<String, Object> params, @Nullable String holdType,
+            @Nullable Number holdHours, @Nullable Date startDateTime, @Nullable Date endDateTime) {
+        return ((EcobeeActions) actions).setHold(params, holdType, holdHours, startDateTime, endDateTime);
     }
 
     /**
@@ -564,14 +510,9 @@ public class EcobeeActions implements ThingActions {
         return localHandler.actionPerformFunction(function);
     }
 
-    public static boolean setOccupied(@Nullable ThingActions actions, @Nullable Boolean occupied,
-            @Nullable Date startDateTime, @Nullable Date endDateTime, @Nullable String holdType,
-            @Nullable Number holdHours) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).setOccupied(occupied, startDateTime, endDateTime, holdType, holdHours);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static boolean setOccupied(ThingActions actions, @Nullable Boolean occupied, @Nullable Date startDateTime,
+            @Nullable Date endDateTime, @Nullable String holdType, @Nullable Number holdHours) {
+        return ((EcobeeActions) actions).setOccupied(occupied, startDateTime, endDateTime, holdType, holdHours);
     }
 
     /**
@@ -595,13 +536,9 @@ public class EcobeeActions implements ThingActions {
         return localHandler.actionPerformFunction(function);
     }
 
-    public static boolean updateSensor(@Nullable ThingActions actions, @Nullable String name, @Nullable String deviceId,
+    public static boolean updateSensor(ThingActions actions, @Nullable String name, @Nullable String deviceId,
             @Nullable String sensorId) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).updateSensor(name, deviceId, sensorId);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+        return ((EcobeeActions) actions).updateSensor(name, deviceId, sensorId);
     }
 
     /**
@@ -618,12 +555,8 @@ public class EcobeeActions implements ThingActions {
         return localHandler.getAlerts();
     }
 
-    public static @Nullable String getAlerts(@Nullable ThingActions actions) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).getAlerts();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static @Nullable String getAlerts(ThingActions actions) {
+        return ((EcobeeActions) actions).getAlerts();
     }
 
     /**
@@ -640,12 +573,8 @@ public class EcobeeActions implements ThingActions {
         return localHandler.getEvents();
     }
 
-    public static @Nullable String getEvents(@Nullable ThingActions actions) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).getEvents();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static @Nullable String getEvents(ThingActions actions) {
+        return ((EcobeeActions) actions).getEvents();
     }
 
     /**
@@ -662,11 +591,7 @@ public class EcobeeActions implements ThingActions {
         return localHandler.getClimates();
     }
 
-    public static @Nullable String getClimates(@Nullable ThingActions actions) {
-        if (actions instanceof EcobeeActions) {
-            return ((EcobeeActions) actions).getClimates();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of EcobeeActions");
-        }
+    public static @Nullable String getClimates(ThingActions actions) {
+        return ((EcobeeActions) actions).getClimates();
     }
 }
index 258fd239d5ae25395392cf5402d094cb8a9fb42d..821229183bef6e6a7495d38b2d8bb77e641f6a71 100644 (file)
@@ -111,75 +111,39 @@ public class Enigma2Actions implements ThingActions {
     }
 
     // delegation methods for "legacy" rule support
-    public static void sendRcCommand(@Nullable ThingActions actions, String rcButton) {
-        if (actions instanceof Enigma2Actions) {
-            ((Enigma2Actions) actions).sendRcCommand(rcButton);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
-        }
-    }
-
-    public static void sendInfo(@Nullable ThingActions actions, String info) {
-        if (actions instanceof Enigma2Actions) {
-            ((Enigma2Actions) actions).sendInfo(info);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
-        }
-    }
-
-    public static void sendInfo(@Nullable ThingActions actions, String info, int timeout) {
-        if (actions instanceof Enigma2Actions) {
-            ((Enigma2Actions) actions).sendInfo(info, timeout);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
-        }
-    }
-
-    public static void sendWarning(@Nullable ThingActions actions, String warning) {
-        if (actions instanceof Enigma2Actions) {
-            ((Enigma2Actions) actions).sendWarning(warning);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
-        }
-    }
-
-    public static void sendWarning(@Nullable ThingActions actions, String warning, int timeout) {
-        if (actions instanceof Enigma2Actions) {
-            ((Enigma2Actions) actions).sendWarning(warning, timeout);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
-        }
-    }
-
-    public static void sendError(@Nullable ThingActions actions, String error) {
-        if (actions instanceof Enigma2Actions) {
-            ((Enigma2Actions) actions).sendError(error);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
-        }
-    }
-
-    public static void sendError(@Nullable ThingActions actions, String error, int timeout) {
-        if (actions instanceof Enigma2Actions) {
-            ((Enigma2Actions) actions).sendError(error, timeout);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
-        }
-    }
-
-    public static void sendQuestion(@Nullable ThingActions actions, String text) {
-        if (actions instanceof Enigma2Actions) {
-            ((Enigma2Actions) actions).sendQuestion(text);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
-        }
-    }
-
-    public static void sendQuestion(@Nullable ThingActions actions, String text, int timeout) {
-        if (actions instanceof Enigma2Actions) {
-            ((Enigma2Actions) actions).sendQuestion(text, timeout);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of Enigma2Actions");
-        }
+    public static void sendRcCommand(ThingActions actions, String rcButton) {
+        ((Enigma2Actions) actions).sendRcCommand(rcButton);
+    }
+
+    public static void sendInfo(ThingActions actions, String info) {
+        ((Enigma2Actions) actions).sendInfo(info);
+    }
+
+    public static void sendInfo(ThingActions actions, String info, int timeout) {
+        ((Enigma2Actions) actions).sendInfo(info, timeout);
+    }
+
+    public static void sendWarning(ThingActions actions, String warning) {
+        ((Enigma2Actions) actions).sendWarning(warning);
+    }
+
+    public static void sendWarning(ThingActions actions, String warning, int timeout) {
+        ((Enigma2Actions) actions).sendWarning(warning, timeout);
+    }
+
+    public static void sendError(ThingActions actions, String error) {
+        ((Enigma2Actions) actions).sendError(error);
+    }
+
+    public static void sendError(ThingActions actions, String error, int timeout) {
+        ((Enigma2Actions) actions).sendError(error, timeout);
+    }
+
+    public static void sendQuestion(ThingActions actions, String text) {
+        ((Enigma2Actions) actions).sendQuestion(text);
+    }
+
+    public static void sendQuestion(ThingActions actions, String text, int timeout) {
+        ((Enigma2Actions) actions).sendQuestion(text, timeout);
     }
 }
index 3eca7bac7b98d9b906b85b980ff5a0a50a4e5617..b847c1109f699d2ad6aecb83e43fd3cc92b174fb 100644 (file)
@@ -17,19 +17,19 @@ channel-type.enigma2.power.label = Power
 channel-type.enigma2.power.description = Setting the power to on/off.
 
 # actions
-action.enigma2.send-rc-button.label=sendRcCommand
-action.enigma2.send-rc-button.description=Send an Remote Control Command
-action-input.enigma2.rc-button.label=rcButton
-action-input.enigma2.rc-button.description=The Remote Control Button
+action.enigma2.send-rc-button.label=send a remote control command
+action.enigma2.send-rc-button.description=Send a remote control command.
+action-input.enigma2.rc-button.label=Button
+action-input.enigma2.rc-button.description=The remote control button
 
-action.enigma2.send-info.label=sendInfo
-action.enigma2.send-info.description=Send an info message to the TV screen
-action.enigma2.send-warning.label=sendWarning
-action.enigma2.send-warning.description=Send an warning message to the TV screen
-action.enigma2.send-error.label=sendError
-action.enigma2.send-error.description=Send an error message to the TV screen
-action.enigma2.send-question.label=sendQuestion
-action.enigma2.send-question.description=Send a question message to the TV screen
+action.enigma2.send-info.label=send an info message
+action.enigma2.send-info.description=Send an info message to the TV screen.
+action.enigma2.send-warning.label=send a warning message
+action.enigma2.send-warning.description=Send a warning message to the TV screen.
+action.enigma2.send-error.label=send an error message
+action.enigma2.send-error.description=Send an error message to the TV screen.
+action.enigma2.send-question.label=send a question message
+action.enigma2.send-question.description=Send a question message to the TV screen.
 action-input.enigma2.text.label=text
 action-input.enigma2.text.description=The message text
 action-input.enigma2.timeout.label=timeout
index 2a9a7cf902fe337532c47ad58854897202a7da82..a5414bebb1115e914a06a97e8e1be797dbcd6c6d 100644 (file)
@@ -14,11 +14,9 @@ package org.openhab.binding.enigma2.internal.actions;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.mockito.Mockito.*;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.openhab.binding.enigma2.internal.Enigma2BindingConstants;
@@ -29,13 +27,10 @@ import org.openhab.binding.enigma2.internal.handler.Enigma2Handler;
  *
  * @author Guido Dolfen - Initial contribution
  */
-@SuppressWarnings("null")
 @NonNullByDefault
 public class Enigma2ActionsTest {
-    @Nullable
-    private Enigma2Actions enigma2Actions;
-    @Nullable
-    private Enigma2Handler enigma2Handler;
+    private @NonNullByDefault({}) Enigma2Actions enigma2Actions;
+    private @NonNullByDefault({}) Enigma2Handler enigma2Handler;
     public static final String SOME_TEXT = "some Text";
 
     @BeforeEach
@@ -110,11 +105,6 @@ public class Enigma2ActionsTest {
         verify(enigma2Handler).sendRcCommand("KEY_1");
     }
 
-    @Test
-    public void testSendRcCommandStaticWithException() {
-        assertThrows(IllegalArgumentException.class, () -> Enigma2Actions.sendRcCommand(null, "KEY_1"));
-    }
-
     @Test
     public void testSendInfoStatic() {
         Enigma2Actions.sendInfo(enigma2Actions, SOME_TEXT);
@@ -127,11 +117,6 @@ public class Enigma2ActionsTest {
         verify(enigma2Handler).sendInfo(10, SOME_TEXT);
     }
 
-    @Test
-    public void testSendInfoStaticWithException() {
-        assertThrows(IllegalArgumentException.class, () -> Enigma2Actions.sendInfo(null, SOME_TEXT));
-    }
-
     @Test
     public void testSendErrorStatic() {
         Enigma2Actions.sendError(enigma2Actions, SOME_TEXT);
@@ -144,11 +129,6 @@ public class Enigma2ActionsTest {
         verify(enigma2Handler).sendError(10, SOME_TEXT);
     }
 
-    @Test
-    public void testSendErrorStaticWithException() {
-        assertThrows(IllegalArgumentException.class, () -> Enigma2Actions.sendError(null, SOME_TEXT));
-    }
-
     @Test
     public void testSendWarningStatic() {
         Enigma2Actions.sendWarning(enigma2Actions, SOME_TEXT);
@@ -161,11 +141,6 @@ public class Enigma2ActionsTest {
         verify(enigma2Handler).sendWarning(10, SOME_TEXT);
     }
 
-    @Test
-    public void testSendWarningStaticWithException() {
-        assertThrows(IllegalArgumentException.class, () -> Enigma2Actions.sendWarning(null, SOME_TEXT));
-    }
-
     @Test
     public void testSendQuestionStatic() {
         Enigma2Actions.sendQuestion(enigma2Actions, SOME_TEXT);
@@ -177,9 +152,4 @@ public class Enigma2ActionsTest {
         Enigma2Actions.sendQuestion(enigma2Actions, SOME_TEXT, 10);
         verify(enigma2Handler).sendQuestion(10, SOME_TEXT);
     }
-
-    @Test
-    public void testSendQuestionStaticWithException() {
-        assertThrows(IllegalArgumentException.class, () -> Enigma2Actions.sendQuestion(null, SOME_TEXT));
-    }
 }
index d27f8494d75c41c3daba4f7490c98705d7aa1555..117bf5508129afe9429f85d2d19805c7c79630c1 100644 (file)
@@ -75,19 +75,11 @@ public class Ipx800Actions implements ThingActions {
         }
     }
 
-    public static void resetCounter(@Nullable ThingActions actions, Integer counter) {
-        if (actions instanceof Ipx800Actions) {
-            ((Ipx800Actions) actions).resetCounter(counter);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of Ipx800Actions");
-        }
+    public static void resetCounter(ThingActions actions, Integer counter) {
+        ((Ipx800Actions) actions).resetCounter(counter);
     }
 
-    public static void reset(@Nullable ThingActions actions, @Nullable Integer placeholder) {
-        if (actions instanceof Ipx800Actions) {
-            ((Ipx800Actions) actions).reset(placeholder);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of Ipx800Actions");
-        }
+    public static void reset(ThingActions actions, @Nullable Integer placeholder) {
+        ((Ipx800Actions) actions).reset(placeholder);
     }
 }
index 72dbe8e7b2278a1e14bcff2bf964aab9458137c9..e3ef32187964b089d0dd57fefb6e5feee310378a 100644 (file)
@@ -62,7 +62,7 @@ public class HeosActions implements ThingActions {
         return handler.getApiConnection();
     }
 
-    @RuleAction(label = "Play Input", description = "Play an input from another device")
+    @RuleAction(label = "play an input", description = "Play an input from another device.")
     public void playInputFromPlayer(
             @ActionInput(name = "source", label = "Source Player", description = "Player used for input") @Nullable Integer sourcePlayer,
             @ActionInput(name = "input", label = "Source Input", description = "Input source used") @Nullable String input,
@@ -88,12 +88,8 @@ public class HeosActions implements ThingActions {
         }
     }
 
-    public static void playInputFromPlayer(@Nullable ThingActions actions, @Nullable Integer sourcePlayer,
-            @Nullable String input, @Nullable Integer destinationPlayer) {
-        if (actions instanceof HeosActions) {
-            ((HeosActions) actions).playInputFromPlayer(sourcePlayer, input, destinationPlayer);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of HeosActions");
-        }
+    public static void playInputFromPlayer(ThingActions actions, @Nullable Integer sourcePlayer, @Nullable String input,
+            @Nullable Integer destinationPlayer) {
+        ((HeosActions) actions).playInputFromPlayer(sourcePlayer, input, destinationPlayer);
     }
 }
index 2e994368e772510569d623e524873d6aa1c388eb..302496309c80dcc7702b5d8eaba696fbd357bed6 100644 (file)
@@ -76,12 +76,8 @@ public class LightActions implements ThingActions {
         logger.debug("send LightAction to {} with {}ms of fadeTime", channel, fadeTime);
     }
 
-    public static void fadingLightCommand(@Nullable ThingActions actions, @Nullable String channel,
-            @Nullable Command command, @Nullable DecimalType fadeTime) {
-        if (actions instanceof LightActions) {
-            ((LightActions) actions).fadingLightCommand(channel, command, fadeTime);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LightActions");
-        }
+    public static void fadingLightCommand(ThingActions actions, @Nullable String channel, @Nullable Command command,
+            @Nullable DecimalType fadeTime) {
+        ((LightActions) actions).fadingLightCommand(channel, command, fadeTime);
     }
 }
index 2072becffc9dcfcb706740250d67928213ee54ee..1ea92adaf7c141b219aa31bcf311f3a6f76d1252 100644 (file)
@@ -45,7 +45,7 @@ public class IpCameraActions implements ThingActions {
         return handler;
     }
 
-    @RuleAction(label = "Record MP4", description = "Record MP4 to a set filename if given, or if filename is null to ipcamera.mp4")
+    @RuleAction(label = "record an MP4", description = "Record MP4 to a set filename if given, or if filename is null to ipcamera.mp4")
     public void recordMP4(
             @ActionInput(name = "filename", label = "Filename", description = "Name that the recording will have once created, don't include the .mp4.") @Nullable String filename,
             @ActionInput(name = "secondsToRecord", label = "Seconds to Record", description = "Enter a number of how many seconds to record.") int secondsToRecord) {
@@ -57,15 +57,11 @@ public class IpCameraActions implements ThingActions {
         }
     }
 
-    public static void recordMP4(@Nullable ThingActions actions, @Nullable String filename, int secondsToRecord) {
-        if (actions instanceof IpCameraActions) {
-            ((IpCameraActions) actions).recordMP4(filename, secondsToRecord);
-        } else {
-            throw new IllegalArgumentException("Instance is not a IpCamera class.");
-        }
+    public static void recordMP4(ThingActions actions, @Nullable String filename, int secondsToRecord) {
+        ((IpCameraActions) actions).recordMP4(filename, secondsToRecord);
     }
 
-    @RuleAction(label = "Record GIF", description = "Record GIF to a set filename if given, or if filename is null to ipcamera.gif")
+    @RuleAction(label = "record a GIF", description = "Record GIF to a set filename if given, or if filename is null to ipcamera.gif")
     public void recordGIF(
             @ActionInput(name = "filename", label = "Filename", description = "Name that the recording will have once created, don't include the .mp4.") @Nullable String filename,
             @ActionInput(name = "secondsToRecord", label = "Seconds to Record", description = "Enter a number of how many seconds to record.") int secondsToRecord) {
@@ -77,11 +73,7 @@ public class IpCameraActions implements ThingActions {
         }
     }
 
-    public static void recordGIF(@Nullable ThingActions actions, @Nullable String filename, int secondsToRecord) {
-        if (actions instanceof IpCameraActions) {
-            ((IpCameraActions) actions).recordGIF(filename, secondsToRecord);
-        } else {
-            throw new IllegalArgumentException("Instance is not a IpCamera class.");
-        }
+    public static void recordGIF(ThingActions actions, @Nullable String filename, int secondsToRecord) {
+        ((IpCameraActions) actions).recordGIF(filename, secondsToRecord);
     }
 }
index 6a5fad50bb925ecf2d8d4379058884840a31fcff..3f86492e0b67be01d92817fee5b4042038c5b1cd 100644 (file)
@@ -47,12 +47,8 @@ public class KaleidescapeThingActions implements ThingActions {
     }
 
     /** Static alias to support the old DSL rules engine and make the action available there. */
-    public static void sendKCommand(@Nullable ThingActions actions, String kCommand) throws IllegalArgumentException {
-        if (actions instanceof KaleidescapeThingActions) {
-            ((KaleidescapeThingActions) actions).sendKCommand(kCommand);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of KaleidescapeThingActions");
-        }
+    public static void sendKCommand(ThingActions actions, String kCommand) throws IllegalArgumentException {
+        ((KaleidescapeThingActions) actions).sendKCommand(kCommand);
     }
 
     @Override
index cad59e55746dbd9ae69dfd61c35580a3767f9fd5..9f98e14f1c6fbf352b473228083a09e665e52a66 100644 (file)
@@ -169,40 +169,23 @@ public class LcnModuleActions implements ThingActions {
     }
 
     /** Static alias to support the old DSL rules engine and make the action available there. */
-    public static void hitKey(@Nullable ThingActions actions, @Nullable String table, int key,
-            @Nullable String action) {
-        if (actions instanceof LcnModuleHandler) {
-            ((LcnModuleActions) actions).hitKey(table, key, action);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LcnModuleActions");
-        }
+    public static void hitKey(ThingActions actions, @Nullable String table, int key, @Nullable String action) {
+        ((LcnModuleActions) actions).hitKey(table, key, action);
     }
 
     /** Static alias to support the old DSL rules engine and make the action available there. */
-    public static void flickerOutput(@Nullable ThingActions actions, int output, int depth, int ramp, int count) {
-        if (actions instanceof LcnModuleHandler) {
-            ((LcnModuleActions) actions).flickerOutput(output, depth, ramp, count);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LcnModuleActions");
-        }
+    public static void flickerOutput(ThingActions actions, int output, int depth, int ramp, int count) {
+        ((LcnModuleActions) actions).flickerOutput(output, depth, ramp, count);
     }
 
     /** Static alias to support the old DSL rules engine and make the action available there. */
-    public static void sendDynamicText(@Nullable ThingActions actions, int row, @Nullable String text) {
-        if (actions instanceof LcnModuleHandler) {
-            ((LcnModuleActions) actions).sendDynamicText(row, text);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LcnModuleActions");
-        }
+    public static void sendDynamicText(ThingActions actions, int row, @Nullable String text) {
+        ((LcnModuleActions) actions).sendDynamicText(row, text);
     }
 
     /** Static alias to support the old DSL rules engine and make the action available there. */
-    public static void startRelayTimer(@Nullable ThingActions actions, int relaynumber, double duration) {
-        if (actions instanceof LcnModuleHandler) {
-            ((LcnModuleActions) actions).startRelayTimer(relaynumber, duration);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LcnModuleActions");
-        }
+    public static void startRelayTimer(ThingActions actions, int relaynumber, double duration) {
+        ((LcnModuleActions) actions).startRelayTimer(relaynumber, duration);
     }
 
     private LcnModuleHandler getHandler() throws LcnException {
index 954a09715c9a91d07ec8e0e670998a378416e924..219ab9076c8734e98a1db638a8ec8b74f42e1c37 100644 (file)
@@ -281,83 +281,43 @@ public class LGWebOSActions implements ThingActions {
 
     // delegation methods for "legacy" rule support
 
-    public static void showToast(@Nullable ThingActions actions, String text) throws IOException {
-        if (actions instanceof LGWebOSActions) {
-            ((LGWebOSActions) actions).showToast(text);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
-        }
+    public static void showToast(ThingActions actions, String text) throws IOException {
+        ((LGWebOSActions) actions).showToast(text);
     }
 
-    public static void showToast(@Nullable ThingActions actions, String icon, String text) throws IOException {
-        if (actions instanceof LGWebOSActions) {
-            ((LGWebOSActions) actions).showToast(icon, text);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
-        }
+    public static void showToast(ThingActions actions, String icon, String text) throws IOException {
+        ((LGWebOSActions) actions).showToast(icon, text);
     }
 
-    public static void launchBrowser(@Nullable ThingActions actions, String url) {
-        if (actions instanceof LGWebOSActions) {
-            ((LGWebOSActions) actions).launchBrowser(url);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
-        }
+    public static void launchBrowser(ThingActions actions, String url) {
+        ((LGWebOSActions) actions).launchBrowser(url);
     }
 
-    public static void launchApplication(@Nullable ThingActions actions, String appId) {
-        if (actions instanceof LGWebOSActions) {
-            ((LGWebOSActions) actions).launchApplication(appId);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
-        }
+    public static void launchApplication(ThingActions actions, String appId) {
+        ((LGWebOSActions) actions).launchApplication(appId);
     }
 
-    public static void launchApplication(@Nullable ThingActions actions, String appId, String param) {
-        if (actions instanceof LGWebOSActions) {
-            ((LGWebOSActions) actions).launchApplication(appId, param);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
-        }
+    public static void launchApplication(ThingActions actions, String appId, String param) {
+        ((LGWebOSActions) actions).launchApplication(appId, param);
     }
 
-    public static void sendText(@Nullable ThingActions actions, String text) {
-        if (actions instanceof LGWebOSActions) {
-            ((LGWebOSActions) actions).sendText(text);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
-        }
+    public static void sendText(ThingActions actions, String text) {
+        ((LGWebOSActions) actions).sendText(text);
     }
 
-    public static void sendButton(@Nullable ThingActions actions, String button) {
-        if (actions instanceof LGWebOSActions) {
-            ((LGWebOSActions) actions).sendButton(button);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
-        }
+    public static void sendButton(ThingActions actions, String button) {
+        ((LGWebOSActions) actions).sendButton(button);
     }
 
-    public static void increaseChannel(@Nullable ThingActions actions) {
-        if (actions instanceof LGWebOSActions) {
-            ((LGWebOSActions) actions).increaseChannel();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
-        }
+    public static void increaseChannel(ThingActions actions) {
+        ((LGWebOSActions) actions).increaseChannel();
     }
 
-    public static void decreaseChannel(@Nullable ThingActions actions) {
-        if (actions instanceof LGWebOSActions) {
-            ((LGWebOSActions) actions).decreaseChannel();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
-        }
+    public static void decreaseChannel(ThingActions actions) {
+        ((LGWebOSActions) actions).decreaseChannel();
     }
 
-    public static void sendRCButton(@Nullable ThingActions actions, String rcButton) {
-        if (actions instanceof LGWebOSActions) {
-            ((LGWebOSActions) actions).sendRCButton(rcButton);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of LGWebOSActions");
-        }
+    public static void sendRCButton(ThingActions actions, String rcButton) {
+        ((LGWebOSActions) actions).sendRCButton(rcButton);
     }
 }
index 17271fa2bafcd32284e8d54531329918ff575600..ebe5969fe1da8c57acb0996f9a00ef273ab9f29f 100644 (file)
@@ -1,45 +1,45 @@
-actionShowToastLabel=Show Toast
+actionShowToastLabel=show a toast message
 actionShowToastDesc=Sends a toast message to a WebOS device with openHAB icon.
 actionShowToastInputTextLabel=Text
 actionShowToastInputTextDesc=The text to display
 
-actionShowToastWithIconLabel=Show Toast with Icon
+actionShowToastWithIconLabel=show a toast message with icon
 actionShowToastWithIconLabel=Sends a toast message to a WebOS device with custom icon.
 actionShowToastInputIconLabel=Icon
 actionShowToastInputIconDesc=The URL to the icon to display
 
-actionLaunchBrowserLabel=Launch Browser
+actionLaunchBrowserLabel=launch the browser
 actionLaunchBrowserDesc=Opens the given URL in the TV's browser application.
 actionLaunchBrowserInputUrlLabel=URL
 actionLaunchBrowserInputUrlDesc=The URL to open
 
-actionLaunchApplicationLabel=Launch Application
+actionLaunchApplicationLabel=launch an application
 actionLaunchApplicationDesc=Opens the application with given Application ID.
 actionLaunchApplicationInputAppIDLabel=Application ID
 actionLaunchApplicationInputAppIDDesc=The Application ID
 
-actionLaunchApplicationWithParamsLabel=Launch Application with Parameters
+actionLaunchApplicationWithParamsLabel=launch an application with parameters
 actionLaunchApplicationWithParamsDesc=Opens the application with given Application ID and passes additional parameters.
 actionLaunchApplicationInputParamsLabel=JSON Parameters
 actionLaunchApplicationInputParamsDesc=The parameters to hand over to the application in JSON format
 
-actionSendTextLabel=Send Text
+actionSendTextLabel=send a text input
 actionSendTextDesc=Sends a text input to a WebOS device.
 actionSendTextInputTextLabel=Text
 actionSendTextInputTextDesc=The text to input
 
-actionSendButtonLabel=Send Button
+actionSendButtonLabel=send a button press
 actionSendButtonDesc=Sends a button press event to a WebOS device.
 actionSendButtonInputButtonLabel=Button
 actionSendButtonInputButtonDesc=Can be one of UP, DOWN, LEFT, RIGHT, BACK, DELETE, ENTER, HOME, or OK
 
-actionIncreaseChannelLabel=Channel Up
+actionIncreaseChannelLabel=switch one channel up
 actionIncreaseChannelDesc=TV will switch one channel up in the current channel list.
 
-actionDecreaseChannelLabel=Channel Down
+actionDecreaseChannelLabel=switch one channel down
 actionDecreaseChannelDesc=TV will switch one channel down in the current channel list.
 
-actionSendRCButtonLabel=Remote Control button press
+actionSendRCButtonLabel=simulate remote control button press
 actionSendRCButtonDesc=Simulates pressing of a Remote Control Button.
 actionSendRCButtonInputTextLabel=Remote Control button name
 actionSendRCButtonInputTextDesc=The Remote Control button name to send to the WebOS device.
index 48fb70eafce34f088d97052552b88265ce35f2cd..da7cdace66dfb9dc5a51c77c2212081c623c247f 100644 (file)
@@ -98,12 +98,8 @@ public class DimmerActions implements ThingActions {
     /**
      * Static setLevel method for Rules DSL backward compatibility
      */
-    public static void setLevel(@Nullable ThingActions actions, @Nullable Double level, @Nullable Double fadeTime,
+    public static void setLevel(ThingActions actions, @Nullable Double level, @Nullable Double fadeTime,
             @Nullable Double delayTime) {
-        if (actions instanceof DimmerActions) {
-            ((DimmerActions) actions).setLevel(level, fadeTime, delayTime);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of DimmerActions");
-        }
+        ((DimmerActions) actions).setLevel(level, fadeTime, delayTime);
     }
 }
index 2c86e18cefd6a87f12a88b8c342305590d041b2d..bc7ada427976bd0c3dc02429120d73dfd8a547c0 100644 (file)
@@ -103,12 +103,12 @@ public class SendMailActions implements ThingActions {
         }
     }
 
-    public static boolean sendMail(@Nullable ThingActions actions, @Nullable String recipient, @Nullable String subject,
+    public static boolean sendMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
             @Nullable String text) {
         return SendMailActions.sendMail(actions, recipient, subject, text, new ArrayList<>());
     }
 
-    public static boolean sendMail(@Nullable ThingActions actions, @Nullable String recipient, @Nullable String subject,
+    public static boolean sendMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
             @Nullable String text, @Nullable String urlString) {
         List<String> urlList = new ArrayList<>();
         if (urlString != null) {
@@ -117,13 +117,9 @@ public class SendMailActions implements ThingActions {
         return SendMailActions.sendMail(actions, recipient, subject, text, urlList);
     }
 
-    public static boolean sendMail(@Nullable ThingActions actions, @Nullable String recipient, @Nullable String subject,
+    public static boolean sendMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
             @Nullable String text, @Nullable List<String> urlStringList) {
-        if (actions instanceof SendMailActions) {
-            return ((SendMailActions) actions).sendMail(recipient, subject, text, urlStringList);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of SendMailActions");
-        }
+        return ((SendMailActions) actions).sendMail(recipient, subject, text, urlStringList);
     }
 
     @RuleAction(label = "send a HTML mail", description = "Sends a HTML mail.")
@@ -184,13 +180,13 @@ public class SendMailActions implements ThingActions {
         }
     }
 
-    public static boolean sendHtmlMail(@Nullable ThingActions actions, @Nullable String recipient,
-            @Nullable String subject, @Nullable String html) {
+    public static boolean sendHtmlMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
+            @Nullable String html) {
         return SendMailActions.sendHtmlMail(actions, recipient, subject, html, new ArrayList<>());
     }
 
-    public static boolean sendHtmlMail(@Nullable ThingActions actions, @Nullable String recipient,
-            @Nullable String subject, @Nullable String html, @Nullable String urlString) {
+    public static boolean sendHtmlMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
+            @Nullable String html, @Nullable String urlString) {
         List<String> urlList = new ArrayList<>();
         if (urlString != null) {
             urlList.add(urlString);
@@ -198,13 +194,9 @@ public class SendMailActions implements ThingActions {
         return SendMailActions.sendHtmlMail(actions, recipient, subject, html, urlList);
     }
 
-    public static boolean sendHtmlMail(@Nullable ThingActions actions, @Nullable String recipient,
-            @Nullable String subject, @Nullable String html, @Nullable List<String> urlStringList) {
-        if (actions instanceof SendMailActions) {
-            return ((SendMailActions) actions).sendHtmlMail(recipient, subject, html, urlStringList);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of SendMailActions");
-        }
+    public static boolean sendHtmlMail(ThingActions actions, @Nullable String recipient, @Nullable String subject,
+            @Nullable String html, @Nullable List<String> urlStringList) {
+        return ((SendMailActions) actions).sendHtmlMail(recipient, subject, html, urlStringList);
     }
 
     @Override
index 0814fe1e77438e1832731f00f9453a4b1750d0f9..5997f7c35438989e5d7bd7451f83d0e2fdc77186 100644 (file)
@@ -59,12 +59,8 @@ public class MaxCubeActions implements ThingActions {
         return true;
     }
 
-    public static boolean backup(@Nullable ThingActions actions) {
-        if (actions instanceof MaxCubeActions) {
-            return ((MaxCubeActions) actions).backup();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of MaxCubeActions");
-        }
+    public static boolean backup(ThingActions actions) {
+        return ((MaxCubeActions) actions).backup();
     }
 
     @RuleAction(label = "reset the Cube configuration", description = "Resets the MAX! Cube room and device information. Devices will need to be included again!")
@@ -78,12 +74,8 @@ public class MaxCubeActions implements ThingActions {
         return true;
     }
 
-    public static boolean reset(@Nullable ThingActions actions) {
-        if (actions instanceof MaxCubeActions) {
-            return ((MaxCubeActions) actions).resetConfig();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of MaxCubeActions");
-        }
+    public static boolean reset(ThingActions actions) {
+        return ((MaxCubeActions) actions).resetConfig();
     }
 
     @RuleAction(label = "restart the Cube", description = "Restarts the MAX! Cube.")
@@ -97,11 +89,7 @@ public class MaxCubeActions implements ThingActions {
         return true;
     }
 
-    public static boolean reboot(@Nullable ThingActions actions) {
-        if (actions instanceof MaxCubeActions) {
-            return ((MaxCubeActions) actions).reboot();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of MaxCubeActions");
-        }
+    public static boolean reboot(ThingActions actions) {
+        return ((MaxCubeActions) actions).reboot();
     }
 }
index f14fdbda9f592f417eacf93c04fe7676bc3ccfba..d5d6f200a99fc2b9c4d182bcd8fbe758298b6298 100644 (file)
@@ -59,11 +59,7 @@ public class MaxDevicesActions implements ThingActions {
         return true;
     }
 
-    public static boolean deleteFromCube(@Nullable ThingActions actions) {
-        if (actions instanceof MaxDevicesActions) {
-            return ((MaxDevicesActions) actions).deleteFromCube();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of MaxDevicesActions");
-        }
+    public static boolean deleteFromCube(ThingActions actions) {
+        return ((MaxDevicesActions) actions).deleteFromCube();
     }
 }
index ffa561ce94e6ef15880c8103703e9961e57bf4ac..8efc8bb174c447a2b1f628a781ee6e8c7c22b419 100644 (file)
@@ -47,67 +47,51 @@ public class HeliosEasyControlsActions implements ThingActions {
 
     private void triggerSwitch(String variableName) {
         try {
-            if (this.handler != null) {
-                this.handler.writeValue(variableName, "1");
+            if (handler != null) {
+                handler.writeValue(variableName, "1");
             }
         } catch (HeliosException e) {
             logger.warn("Error executing action 'resetFilterChangeTimer': {}", e.getMessage());
         }
     }
 
-    @RuleAction(label = "Reset filter change timer", description = "Sets the filter change timer back to the configured interval")
+    @RuleAction(label = "reset filter change timer", description = "Sets the filter change timer back to the configured interval.")
     public void resetFilterChangeTimer() {
-        this.triggerSwitch(HeliosEasyControlsBindingConstants.FILTER_CHANGE_RESET);
+        triggerSwitch(HeliosEasyControlsBindingConstants.FILTER_CHANGE_RESET);
     }
 
-    public static void resetFilterChangeTimer(@Nullable ThingActions actions) {
-        if (actions instanceof HeliosEasyControlsActions) {
-            ((HeliosEasyControlsActions) actions).resetFilterChangeTimer();
-        } else {
-            throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
-        }
+    public static void resetFilterChangeTimer(ThingActions actions) {
+        ((HeliosEasyControlsActions) actions).resetFilterChangeTimer();
     }
 
-    @RuleAction(label = "Reset error messages", description = "Reset error/warning/info messages")
+    @RuleAction(label = "reset error messages", description = "Reset error/warning/info messages.")
     public void resetErrors() {
-        this.triggerSwitch(HeliosEasyControlsBindingConstants.RESET_FLAG);
+        triggerSwitch(HeliosEasyControlsBindingConstants.RESET_FLAG);
     }
 
-    public static void resetErrors(@Nullable ThingActions actions) {
-        if (actions instanceof HeliosEasyControlsActions) {
-            ((HeliosEasyControlsActions) actions).resetErrors();
-        } else {
-            throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
-        }
+    public static void resetErrors(ThingActions actions) {
+        ((HeliosEasyControlsActions) actions).resetErrors();
     }
 
-    @RuleAction(label = "Reset to factory defaults", description = "Reset device to factory defaults")
+    @RuleAction(label = "reset to factory defaults", description = "Reset device to factory defaults.")
     public void resetToFactoryDefaults() {
-        this.triggerSwitch(HeliosEasyControlsBindingConstants.FACTORY_RESET);
+        triggerSwitch(HeliosEasyControlsBindingConstants.FACTORY_RESET);
     }
 
-    public static void resetToFactoryDefaults(@Nullable ThingActions actions) {
-        if (actions instanceof HeliosEasyControlsActions) {
-            ((HeliosEasyControlsActions) actions).resetToFactoryDefaults();
-        } else {
-            throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
-        }
+    public static void resetToFactoryDefaults(ThingActions actions) {
+        ((HeliosEasyControlsActions) actions).resetToFactoryDefaults();
     }
 
-    @RuleAction(label = "Reset individual switching times", description = "Reset individual switching times")
+    @RuleAction(label = "reset individual switching times", description = "Reset individual switching times.")
     public void resetSwitchingTimes() {
-        this.triggerSwitch(HeliosEasyControlsBindingConstants.FACTORY_SETTING_WZU);
+        triggerSwitch(HeliosEasyControlsBindingConstants.FACTORY_SETTING_WZU);
     }
 
-    public static void resetSwitchingTimes(@Nullable ThingActions actions) {
-        if (actions instanceof HeliosEasyControlsActions) {
-            ((HeliosEasyControlsActions) actions).resetSwitchingTimes();
-        } else {
-            throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
-        }
+    public static void resetSwitchingTimes(ThingActions actions) {
+        ((HeliosEasyControlsActions) actions).resetSwitchingTimes();
     }
 
-    @RuleAction(label = "Set system date and time", description = "Sets the device's system date and time based on OH's system date and time")
+    @RuleAction(label = "set system date and time", description = "Sets the device's system date and time based on OH's system date and time.")
     public void setSysDateTime() {
         HeliosEasyControlsHandler handler = this.handler;
         if (handler != null) {
@@ -115,12 +99,8 @@ public class HeliosEasyControlsActions implements ThingActions {
         }
     }
 
-    public static void setSysDateTime(@Nullable ThingActions actions) {
-        if (actions instanceof HeliosEasyControlsActions) {
-            ((HeliosEasyControlsActions) actions).setSysDateTime();
-        } else {
-            throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
-        }
+    public static void setSysDateTime(ThingActions actions) {
+        ((HeliosEasyControlsActions) actions).setSysDateTime();
     }
 
     private void setBypass(boolean from, int day, int month) {
@@ -130,33 +110,25 @@ public class HeliosEasyControlsActions implements ThingActions {
         }
     }
 
-    @RuleAction(label = "Set the bypass from day and month", description = "Sets the day and month from when the bypass should be active")
+    @RuleAction(label = "set the bypass from day and month", description = "Sets the day and month from when the bypass should be active.")
     public void setBypassFrom(
             @ActionInput(name = "day", label = "bypass from day", description = "The day from when the bypass should be active") int day,
             @ActionInput(name = "month", label = "bypass from month", description = "The month from when the bypass should be active") int month) {
-        this.setBypass(true, day, month);
+        setBypass(true, day, month);
     }
 
-    public static void setBypassFrom(@Nullable ThingActions actions, int day, int month) {
-        if (actions instanceof HeliosEasyControlsActions) {
-            ((HeliosEasyControlsActions) actions).setBypassFrom(day, month);
-        } else {
-            throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
-        }
+    public static void setBypassFrom(ThingActions actions, int day, int month) {
+        ((HeliosEasyControlsActions) actions).setBypassFrom(day, month);
     }
 
-    @RuleAction(label = "Set the bypass to day and month", description = "Sets the day and month until when the bypass should be active")
+    @RuleAction(label = "set the bypass to day and month", description = "Sets the day and month until when the bypass should be active.")
     public void setBypassTo(
             @ActionInput(name = "day", label = "bypass to day", description = "The day until when the bypass should be active") int day,
             @ActionInput(name = "month", label = "bypass to month", description = "The month until when the bypass should be active") int month) {
-        this.setBypass(false, day, month);
+        setBypass(false, day, month);
     }
 
-    public static void setBypassTo(@Nullable ThingActions actions, int day, int month) {
-        if (actions instanceof HeliosEasyControlsActions) {
-            ((HeliosEasyControlsActions) actions).setBypassTo(day, month);
-        } else {
-            throw new IllegalArgumentException("Instance is not an HeliosEasyControlsActions class.");
-        }
+    public static void setBypassTo(ThingActions actions, int day, int month) {
+        ((HeliosEasyControlsActions) actions).setBypassTo(day, month);
     }
 }
index 060ea6d37b9a382992f7835d4beb599fbfad2ead..6834b84be3e7c3870a51883262f6513e5f7cb6b3 100644 (file)
@@ -73,20 +73,11 @@ public class MPDActions implements ThingActions {
         }
     }
 
-    public static void sendCommand(@Nullable ThingActions actions, @Nullable String command,
-            @Nullable String parameter) {
-        if (actions instanceof MPDActions) {
-            ((MPDActions) actions).sendCommand(command, parameter);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of MPDActions");
-        }
+    public static void sendCommand(ThingActions actions, @Nullable String command, @Nullable String parameter) {
+        ((MPDActions) actions).sendCommand(command, parameter);
     }
 
-    public static void sendCommand(@Nullable ThingActions actions, @Nullable String command) {
-        if (actions instanceof MPDActions) {
-            ((MPDActions) actions).sendCommand(command);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of MPDActions");
-        }
+    public static void sendCommand(ThingActions actions, @Nullable String command) {
+        ((MPDActions) actions).sendCommand(command);
     }
 }
index 75b748c66b396ee4a51671b3181fe5b59cc91136..cd4928d082c8bedcf2d37139f97260d0e42f5ba7 100644 (file)
@@ -85,16 +85,12 @@ public class MQTTActions implements ThingActions {
                 });
     }
 
-    public static void publishMQTT(@Nullable ThingActions actions, @Nullable String topic, @Nullable String value) {
+    public static void publishMQTT(ThingActions actions, @Nullable String topic, @Nullable String value) {
         publishMQTT(actions, topic, value, null);
     }
 
-    public static void publishMQTT(@Nullable ThingActions actions, @Nullable String topic, @Nullable String value,
+    public static void publishMQTT(ThingActions actions, @Nullable String topic, @Nullable String value,
             @Nullable Boolean retain) {
-        if (actions instanceof MQTTActions) {
-            ((MQTTActions) actions).publishMQTT(topic, value, retain);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of MQTTActions");
-        }
+        ((MQTTActions) actions).publishMQTT(topic, value, retain);
     }
 }
index a28837f0232f55e9897a58e48510b2a930d5e0f0..409065a1f5830b11caea3d9a8d00f5c2e3a4c220 100644 (file)
@@ -57,11 +57,7 @@ public class NetworkActions implements ThingActions {
         }
     }
 
-    public static void sendWakeOnLanPacket(@Nullable ThingActions actions) {
-        if (actions instanceof NetworkActions) {
-            ((NetworkActions) actions).sendWakeOnLanPacket();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of NetworkActions");
-        }
+    public static void sendWakeOnLanPacket(ThingActions actions) {
+        ((NetworkActions) actions).sendWakeOnLanPacket();
     }
 }
index 59716555bbf923c88e496941e7a3222b3dcc5942..baeeb8c1f0770fdcae42a652cb96776406b950a6 100644 (file)
@@ -48,12 +48,8 @@ public class NuvoThingActions implements ThingActions {
     }
 
     /** Static alias to support the old DSL rules engine and make the action available there. */
-    public static void sendNuvoCommand(@Nullable ThingActions actions, String rawCommand) {
-        if (actions instanceof NuvoThingActions) {
-            ((NuvoThingActions) actions).sendNuvoCommand(rawCommand);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of NuvoThingActions");
-        }
+    public static void sendNuvoCommand(ThingActions actions, String rawCommand) {
+        ((NuvoThingActions) actions).sendNuvoCommand(rawCommand);
     }
 
     @Override
index 9c84aa7e6d851e17fc2cddccf3d86113e46035b2..780078e37058b99797b192c5b6bb20b9593ad5fa 100644 (file)
@@ -48,13 +48,8 @@ public class OnkyoThingActions implements ThingActions {
         handler.sendRawCommand(command, value);
     }
 
-    public static void sendRawCommand(@Nullable ThingActions actions, @Nullable String command,
-            @Nullable String value) {
-        if (actions instanceof OnkyoThingActions) {
-            ((OnkyoThingActions) actions).sendRawCommand(command, value);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of OnkyoThingActions");
-        }
+    public static void sendRawCommand(ThingActions actions, @Nullable String command, @Nullable String value) {
+        ((OnkyoThingActions) actions).sendRawCommand(command, value);
     }
 
     @Override
index 103828e3785e1caa434afdc8b4fa725493a5f2dc..db18f126cb01128f6471264bb4292255d64da8e9 100644 (file)
@@ -63,13 +63,9 @@ public class PushbulletActions implements ThingActions {
         return localHandler.sendPush(recipient, title, message, "note");
     }
 
-    public static boolean sendPushbulletNote(@Nullable ThingActions actions, @Nullable String recipient,
-            @Nullable String title, @Nullable String message) {
-        if (actions instanceof PushbulletActions) {
-            return ((PushbulletActions) actions).sendPushbulletNote(recipient, title, message);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of PushbulletActions");
-        }
+    public static boolean sendPushbulletNote(ThingActions actions, @Nullable String recipient, @Nullable String title,
+            @Nullable String message) {
+        return ((PushbulletActions) actions).sendPushbulletNote(recipient, title, message);
     }
 
     @RuleAction(label = "@text/actionSendPushbulletNoteLabel", description = "@text/actionSendPushbulletNoteDesc")
@@ -87,12 +83,8 @@ public class PushbulletActions implements ThingActions {
         return localHandler.sendPush(recipient, message, "note");
     }
 
-    public static boolean sendPushbulletNote(@Nullable ThingActions actions, @Nullable String recipient,
+    public static boolean sendPushbulletNote(ThingActions actions, @Nullable String recipient,
             @Nullable String message) {
-        if (actions instanceof PushbulletActions) {
-            return ((PushbulletActions) actions).sendPushbulletNote(recipient, message);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of PushbulletActions");
-        }
+        return ((PushbulletActions) actions).sendPushbulletNote(recipient, message);
     }
 }
index df79c02a7897bd3238905aa52935b4faa8b72d17..67da019db7d557c183f0ddc62b4aa5d57b7280b8 100644 (file)
@@ -3,7 +3,7 @@ binding.pushbullet.name = Pushbullet Binding
 binding.pushbullet.description = The Pushbullet binding allows you to send messages to other users of the Pushbullet service.
 
 # action
-actionSendPushbulletNoteLabel = publish an Pushbullet message
+actionSendPushbulletNoteLabel = publish a Pushbullet message
 actionSendPushbulletNoteDesc = Publishes a Title to the given Pushbullet Recipient.
 
 actionSendPushbulletNoteInputRecipientLabel = Pushbullet Recipient
index 997a71b27e7e5ebcf4b2c2f6f74bd9e7d567b494..abf37db70db33ea63cd5b5bbd17dc1396d435f68 100644 (file)
@@ -50,12 +50,8 @@ public class RadioThermostatThingActions implements ThingActions {
     }
 
     /** Static alias to support the old DSL rules engine and make the action available there. */
-    public static void sendRawCommand(@Nullable ThingActions actions, @Nullable String rawCommand) {
-        if (actions instanceof RadioThermostatThingActions) {
-            ((RadioThermostatThingActions) actions).sendRawCommand(rawCommand);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of RadioThermostatThingActions");
-        }
+    public static void sendRawCommand(ThingActions actions, @Nullable String rawCommand) {
+        ((RadioThermostatThingActions) actions).sendRawCommand(rawCommand);
     }
 
     @Override
index a2f49e1a0fe317ea184c2a391f8232014057e8f5..f3ea9699ecedf8ad36dba34a3ac4e47dee0d8d0c 100644 (file)
@@ -71,11 +71,7 @@ public class SatelEventLogActions implements ThingActions {
         return result;
     }
 
-    public static Map<String, Object> readEvent(@Nullable ThingActions actions, @Nullable Number index) {
-        if (actions instanceof SatelEventLogActions) {
-            return ((SatelEventLogActions) actions).readEvent(index);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of SatelEventLogActions");
-        }
+    public static Map<String, Object> readEvent(ThingActions actions, @Nullable Number index) {
+        return ((SatelEventLogActions) actions).readEvent(index);
     }
 }
index 7b4b8644da56d6074ac22e7a2593b78cad1fc6fb..619fdeea861f8534343703133905ef61adf7bc4f 100644 (file)
@@ -3,7 +3,7 @@ config-status.hostEmpty = Host name or IP of ETHM-1 must be provided.
 config-status.portEmpty = Serial port of INT-RS must be provided.
 
 # actions
-actionReadEventLabel = Read event
+actionReadEventLabel = read an event
 actionReadEventDesc = Reads a single record from the event log.
 actionInputIndexLabel = Event index
 actionInputIndexDesc = Index of the event to read
index 42ca057f1bbeb7f71a4394be7d83894cc885d5ec..e155d6b52a81e26ae9907fb76323ed55c9d35a48 100644 (file)
@@ -393,105 +393,58 @@ public class TelegramActions implements ThingActions {
 
     // legacy delegate methods
     /* APIs without chatId parameter */
-    public static boolean sendTelegram(@Nullable ThingActions actions, @Nullable String format,
-            @Nullable Object... args) {
-        if (actions instanceof TelegramActions) {
-            return ((TelegramActions) actions).sendTelegram(format, args);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
-        }
+    public static boolean sendTelegram(ThingActions actions, @Nullable String format, @Nullable Object... args) {
+        return ((TelegramActions) actions).sendTelegram(format, args);
     }
 
-    public static boolean sendTelegramQuery(@Nullable ThingActions actions, @Nullable String message,
-            @Nullable String replyId, @Nullable String... buttons) {
-        if (actions instanceof TelegramActions) {
-            return ((TelegramActions) actions).sendTelegramQuery(message, replyId, buttons);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
-        }
+    public static boolean sendTelegramQuery(ThingActions actions, @Nullable String message, @Nullable String replyId,
+            @Nullable String... buttons) {
+        return ((TelegramActions) actions).sendTelegramQuery(message, replyId, buttons);
     }
 
-    public static boolean sendTelegramPhoto(@Nullable ThingActions actions, @Nullable String photoURL,
-            @Nullable String caption) {
-        if (actions instanceof TelegramActions) {
-            return ((TelegramActions) actions).sendTelegramPhoto(photoURL, caption, null, null);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
-        }
+    public static boolean sendTelegramPhoto(ThingActions actions, @Nullable String photoURL, @Nullable String caption) {
+        return ((TelegramActions) actions).sendTelegramPhoto(photoURL, caption, null, null);
     }
 
-    public static boolean sendTelegramPhoto(@Nullable ThingActions actions, @Nullable String photoURL,
-            @Nullable String caption, @Nullable String username, @Nullable String password) {
-        if (actions instanceof TelegramActions) {
-            return ((TelegramActions) actions).sendTelegramPhoto(photoURL, caption, username, password);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
-        }
+    public static boolean sendTelegramPhoto(ThingActions actions, @Nullable String photoURL, @Nullable String caption,
+            @Nullable String username, @Nullable String password) {
+        return ((TelegramActions) actions).sendTelegramPhoto(photoURL, caption, username, password);
     }
 
-    public static boolean sendTelegramAnswer(@Nullable ThingActions actions, @Nullable String replyId,
-            @Nullable String message) {
-        if (actions instanceof TelegramActions) {
-            return ((TelegramActions) actions).sendTelegramAnswer(replyId, message);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
-        }
+    public static boolean sendTelegramAnswer(ThingActions actions, @Nullable String replyId, @Nullable String message) {
+        return ((TelegramActions) actions).sendTelegramAnswer(replyId, message);
     }
 
     /* APIs with chatId parameter */
 
-    public static boolean sendTelegram(@Nullable ThingActions actions, @Nullable Long chatId, @Nullable String format,
+    public static boolean sendTelegram(ThingActions actions, @Nullable Long chatId, @Nullable String format,
             @Nullable Object... args) {
-        if (actions instanceof TelegramActions) {
-            return ((TelegramActions) actions).sendTelegram(chatId, format, args);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
-        }
+        return ((TelegramActions) actions).sendTelegram(chatId, format, args);
     }
 
-    public static boolean sendTelegramQuery(@Nullable ThingActions actions, @Nullable Long chatId,
-            @Nullable String message, @Nullable String replyId, @Nullable String... buttons) {
-        if (actions instanceof TelegramActions) {
-            return ((TelegramActions) actions).sendTelegramQuery(chatId, message, replyId, buttons);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
-        }
+    public static boolean sendTelegramQuery(ThingActions actions, @Nullable Long chatId, @Nullable String message,
+            @Nullable String replyId, @Nullable String... buttons) {
+        return ((TelegramActions) actions).sendTelegramQuery(chatId, message, replyId, buttons);
     }
 
-    public static boolean sendTelegramPhoto(@Nullable ThingActions actions, @Nullable Long chatId,
-            @Nullable String photoURL, @Nullable String caption) {
-        if (actions instanceof TelegramActions) {
-            return ((TelegramActions) actions).sendTelegramPhoto(chatId, photoURL, caption, null, null);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
-        }
+    public static boolean sendTelegramPhoto(ThingActions actions, @Nullable Long chatId, @Nullable String photoURL,
+            @Nullable String caption) {
+        return ((TelegramActions) actions).sendTelegramPhoto(chatId, photoURL, caption, null, null);
     }
 
-    public static boolean sendTelegramPhoto(@Nullable ThingActions actions, @Nullable Long chatId,
-            @Nullable String photoURL, @Nullable String caption, @Nullable String username, @Nullable String password) {
-        if (actions instanceof TelegramActions) {
-            return ((TelegramActions) actions).sendTelegramPhoto(chatId, photoURL, caption, username, password);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
-        }
+    public static boolean sendTelegramPhoto(ThingActions actions, @Nullable Long chatId, @Nullable String photoURL,
+            @Nullable String caption, @Nullable String username, @Nullable String password) {
+        return ((TelegramActions) actions).sendTelegramPhoto(chatId, photoURL, caption, username, password);
     }
 
-    public static boolean sendTelegramAnswer(@Nullable ThingActions actions, @Nullable Long chatId,
-            @Nullable String replyId, @Nullable String message) {
-        if (actions instanceof TelegramActions) {
-            return ((TelegramActions) actions).sendTelegramAnswer(chatId, replyId, message);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
-        }
+    public static boolean sendTelegramAnswer(ThingActions actions, @Nullable Long chatId, @Nullable String replyId,
+            @Nullable String message) {
+        return ((TelegramActions) actions).sendTelegramAnswer(chatId, replyId, message);
     }
 
-    public static boolean sendTelegramAnswer(@Nullable ThingActions actions, @Nullable String chatId,
-            @Nullable String replyId, @Nullable String message) {
-        if (actions instanceof TelegramActions) {
-            return ((TelegramActions) actions).sendTelegramAnswer(Long.valueOf(chatId), replyId, message);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
-        }
+    public static boolean sendTelegramAnswer(ThingActions actions, @Nullable String chatId, @Nullable String replyId,
+            @Nullable String message) {
+        return ((TelegramActions) actions).sendTelegramAnswer(Long.valueOf(chatId), replyId, message);
     }
 
     @Override
index 7edf1c6e4d3711eeed9a47f94f89178af646683a..07d255f1b47d8324b9750269dc2273e9b51bc822 100644 (file)
@@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author Pavel Gololobov - Initial contribution
  */
-@ThingActionsScope(name = "xmpp")
+@ThingActionsScope(name = "xmppclient")
 @NonNullByDefault
 public class XMPPActions implements ThingActions {
     private static final Logger logger = LoggerFactory.getLogger(XMPPActions.class);
@@ -66,11 +66,7 @@ public class XMPPActions implements ThingActions {
         connection.sendMessage(to, text);
     }
 
-    public static void publishXMPP(@Nullable ThingActions actions, @Nullable String to, @Nullable String text) {
-        if (actions instanceof XMPPActions) {
-            ((XMPPActions) actions).publishXMPP(to, text);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of XMPPActions");
-        }
+    public static void publishXMPP(ThingActions actions, @Nullable String to, @Nullable String text) {
+        ((XMPPActions) actions).publishXMPP(to, text);
     }
 }
index 5a8277bf85e37bbe4b12b57e8c2feb6b8c359330..f8b81a07488bab3ad20c3732d4b74dffd5f25cf1 100644 (file)
@@ -50,11 +50,7 @@ public class YIOremoteDockActions implements ThingActions {
         }
     }
 
-    public static void sendIRCode(@Nullable ThingActions actions, @Nullable String irCode) {
-        if (actions instanceof YIOremoteDockActions) {
-            ((YIOremoteDockActions) actions).sendIRCode(irCode);
-        } else {
-            throw new IllegalArgumentException("Instance is not an YIOremoteDockActions class.");
-        }
+    public static void sendIRCode(ThingActions actions, @Nullable String irCode) {
+        ((YIOremoteDockActions) actions).sendIRCode(irCode);
     }
 }
index 8ca8809b022dc07beffe26a5f9ee3c821df2d65a..3a2bc581bae3de0c733b432bd73497f130f1a412 100644 (file)
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author Mark Hilbush - Initial contribution
  */
-@ThingActionsScope(name = "zm")
+@ThingActionsScope(name = "zoneminder")
 @NonNullByDefault
 public class ZmActions implements ThingActions {
     private final Logger logger = LoggerFactory.getLogger(ZmActions.class);
@@ -63,12 +63,8 @@ public class ZmActions implements ThingActions {
         localHandler.actionTriggerAlarm(duration);
     }
 
-    public static void triggerAlarm(@Nullable ThingActions actions, @Nullable Number alarmDuration) {
-        if (actions instanceof ZmActions) {
-            ((ZmActions) actions).triggerAlarm(alarmDuration);
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of ZmActions");
-        }
+    public static void triggerAlarm(ThingActions actions, @Nullable Number alarmDuration) {
+        ((ZmActions) actions).triggerAlarm(alarmDuration);
     }
 
     /**
@@ -86,12 +82,8 @@ public class ZmActions implements ThingActions {
         localHandler.actionTriggerAlarm();
     }
 
-    public static void triggerAlarm(@Nullable ThingActions actions) {
-        if (actions instanceof ZmActions) {
-            ((ZmActions) actions).triggerAlarm();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of ZmActions");
-        }
+    public static void triggerAlarm(ThingActions actions) {
+        ((ZmActions) actions).triggerAlarm();
     }
 
     /**
@@ -108,11 +100,7 @@ public class ZmActions implements ThingActions {
         localHandler.actionCancelAlarm();
     }
 
-    public static void cancelAlarm(@Nullable ThingActions actions) {
-        if (actions instanceof ZmActions) {
-            ((ZmActions) actions).cancelAlarm();
-        } else {
-            throw new IllegalArgumentException("Actions is not an instance of ZmActions");
-        }
+    public static void cancelAlarm(ThingActions actions) {
+        ((ZmActions) actions).cancelAlarm();
     }
 }