diff --git a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/PlayActionHandler.java b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/PlayActionHandler.java index e572a4f323e..19c084fd045 100644 --- a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/PlayActionHandler.java +++ b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/PlayActionHandler.java @@ -61,7 +61,7 @@ public PlayActionHandler(Action module, AudioManager audioManager) { } @Override - public @Nullable Map execute(Map context) { + public @Nullable Map execute(Map context) { try { audioManager.playFile(sound, sink, volume); } catch (AudioException e) { diff --git a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SayActionHandler.java b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SayActionHandler.java index df489abf2df..811e4bddb07 100644 --- a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SayActionHandler.java +++ b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SayActionHandler.java @@ -56,7 +56,7 @@ public SayActionHandler(Action module, VoiceManager voiceManager) { } @Override - public @Nullable Map execute(Map context) { + public @Nullable Map execute(Map context) { voiceManager.say(text, null, sink, volume); return null; } diff --git a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SynthesizeActionHandler.java b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SynthesizeActionHandler.java index 9759b94fa19..453f8155092 100644 --- a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SynthesizeActionHandler.java +++ b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SynthesizeActionHandler.java @@ -54,7 +54,7 @@ public SynthesizeActionHandler(Action module, AudioManager audioManager) { } @Override - public @Nullable Map execute(Map context) { + public @Nullable Map execute(Map context) { audioManager.playMelody(melody, sink, volume); return null; } diff --git a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/delegates/SimpleActionHandlerDelegate.java b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/delegates/SimpleActionHandlerDelegate.java index 1ac98b26354..78e5a5dcb24 100644 --- a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/delegates/SimpleActionHandlerDelegate.java +++ b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/delegates/SimpleActionHandlerDelegate.java @@ -44,7 +44,7 @@ public void dispose() { } @Override - public @Nullable Map execute(Map inputs) { + public @Nullable Map execute(Map inputs) { Set keys = new HashSet<>(inputs.keySet()); Map extendedInputs = new HashMap<>(inputs); @@ -60,7 +60,7 @@ public void dispose() { } Object result = actionHandler.execute(module, extendedInputs); - Map resultMap = new HashMap<>(); + Map resultMap = new HashMap<>(); resultMap.put("result", result); return resultMap; } diff --git a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/handler/ScriptActionHandler.java b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/handler/ScriptActionHandler.java index a4e89e7ccf7..ef7881666a6 100644 --- a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/handler/ScriptActionHandler.java +++ b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/handler/ScriptActionHandler.java @@ -71,8 +71,8 @@ public void compile() throws ScriptException { } @Override - public @Nullable Map execute(final Map context) { - Map resultMap = new HashMap<>(); + public @Nullable Map execute(final Map context) { + Map resultMap = new HashMap<>(); if (script.isEmpty()) { return resultMap; diff --git a/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/ThingActionsResource.java b/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/ThingActionsResource.java index 4f81a493c95..000838c9d4b 100644 --- a/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/ThingActionsResource.java +++ b/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/ThingActionsResource.java @@ -254,7 +254,7 @@ public Response executeThingAction(@PathParam("thingUID") @Parameter(description } try { - Map returnValue = Objects.requireNonNullElse( + Map returnValue = Objects.requireNonNullElse( handler.execute(actionInputsHelper.mapSerializedInputsToActionInputs(actionType, actionInputs)), Map.of()); moduleHandlerFactory.ungetHandler(action, ruleUID, handler); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/ActionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/ActionHandler.java index 3de6c16bd70..2f2755df15e 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/ActionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/ActionHandler.java @@ -48,5 +48,5 @@ default void compile() throws Exception { * @return a map with the {@code outputs} which are the result of the {@link Action}'s execution (may be null). */ @Nullable - Map execute(Map context); + Map execute(Map context); } diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java index f83d9f6f4c5..e2aefbd3565 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java @@ -181,7 +181,7 @@ public class RuleEngineImpl implements RuleManager, RegistryChangeListener> contextMap = new ConcurrentHashMap<>(); + private final Map> contextMap = new ConcurrentHashMap<>(); /** * This field holds reference to {@link ModuleTypeRegistry}. The {@link RuleEngineImpl} needs it to auto-map @@ -1089,9 +1089,9 @@ protected void runRule(String ruleUID, TriggerHandlerCallbackImpl.TriggerData td } @Override - public Map runNow(String ruleUID, boolean considerConditions, + public Map runNow(String ruleUID, boolean considerConditions, @Nullable Map context) { - Map returnContext = new HashMap<>(); + Map returnContext = new HashMap<>(); final WrappedRule rule = getManagedRule(ruleUID); if (rule == null) { logger.warn("Failed to execute rule '{}': Invalid Rule UID", ruleUID); @@ -1129,7 +1129,7 @@ public Map runNow(String ruleUID, boolean considerConditions, } @Override - public Map runNow(String ruleUID) { + public Map runNow(String ruleUID) { return runNow(ruleUID, false, null); } @@ -1139,7 +1139,7 @@ public Map runNow(String ruleUID) { * @param ruleUID the UID of the rule whose context must be cleared. */ protected void clearContext(String ruleUID) { - Map context = contextMap.get(ruleUID); + Map context = contextMap.get(ruleUID); if (context != null) { context.clear(); } @@ -1163,7 +1163,7 @@ private void setTriggerOutputs(String ruleUID, TriggerData td) { * @param outputs new output values. */ private void updateContext(String ruleUID, String moduleUID, @Nullable Map outputs) { - Map context = getContext(ruleUID, null); + Map context = getContext(ruleUID, null); if (outputs != null) { for (Map.Entry entry : outputs.entrySet()) { String key = moduleUID + OUTPUT_SEPARATOR + entry.getKey(); @@ -1175,8 +1175,8 @@ private void updateContext(String ruleUID, String moduleUID, @Nullable Map getContext(String ruleUID, @Nullable Set connections) { - Map context = contextMap.computeIfAbsent(ruleUID, k -> new HashMap<>()); + private Map getContext(String ruleUID, @Nullable Set connections) { + Map context = contextMap.computeIfAbsent(ruleUID, k -> new HashMap<>()); if (context == null) { throw new IllegalStateException("context cannot be null at that point - please report a bug."); } @@ -1257,7 +1257,7 @@ private boolean calculateConditions(WrappedRule rule) { } final Condition condition = wrappedCondition.unwrap(); ConditionHandler tHandler = wrappedCondition.getModuleHandler(); - Map context = getContext(ruleUID, wrappedCondition.getConnections()); + Map context = getContext(ruleUID, wrappedCondition.getConnections()); if (tHandler != null && !tHandler.isSatisfied(Collections.unmodifiableMap(context))) { logger.debug("The condition '{}' of rule '{}' is unsatisfied.", condition.getId(), ruleUID); return false; @@ -1312,9 +1312,9 @@ private void executeActions(WrappedRule rule, boolean stopOnFirstFail) { final Action action = wrappedAction.unwrap(); ActionHandler aHandler = wrappedAction.getModuleHandler(); if (aHandler != null) { - Map context = getContext(ruleUID, wrappedAction.getConnections()); + Map context = getContext(ruleUID, wrappedAction.getConnections()); try { - Map outputs = aHandler.execute(Collections.unmodifiableMap(context)); + Map outputs = aHandler.execute(Collections.unmodifiableMap(context)); if (outputs != null) { context = getContext(ruleUID, null); updateContext(ruleUID, action.getId(), outputs); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/composite/CompositeActionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/composite/CompositeActionHandler.java index 05172c95f2d..ee3b15fab88 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/composite/CompositeActionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/composite/CompositeActionHandler.java @@ -64,16 +64,17 @@ public CompositeActionHandler(Action action, CompositeActionType mt, * @see org.openhab.core.automation.handler.ActionHandler#execute(java.util.Map) */ @Override - public @Nullable Map execute(Map context) { - final Map result = new HashMap<>(); + public @Nullable Map execute(Map context) { + final Map result = new HashMap<>(); final List children = getChildren(); final Map compositeContext = getCompositeContext(context); for (Action child : children) { ActionHandler childHandler = moduleHandlerMap.get(child); Map childContext = Collections.unmodifiableMap(getChildContext(child, compositeContext)); - Map childResults = childHandler == null ? null : childHandler.execute(childContext); + Map childResults = childHandler == null ? null + : childHandler.execute(childContext); if (childResults != null) { - for (Entry childResult : childResults.entrySet()) { + for (Entry childResult : childResults.entrySet()) { String childOuputName = child.getId() + "." + childResult.getKey(); Output output = compositeOutputs.get(childOuputName); if (output != null) { diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/AnnotationActionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/AnnotationActionHandler.java index 2f7c0e4636c..4d7a34edaa5 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/AnnotationActionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/AnnotationActionHandler.java @@ -70,8 +70,8 @@ public AnnotationActionHandler(Action module, ActionType mt, Method method, Obje } @Override - public @Nullable Map execute(Map context) { - Map output = new HashMap<>(); + public @Nullable Map execute(Map context) { + Map output = new HashMap<>(); Annotation[][] annotations = method.getParameterAnnotations(); List<@Nullable Object> args = new ArrayList<>(); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandActionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandActionHandler.java index 819d727d330..efa3470b7bc 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandActionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandActionHandler.java @@ -58,7 +58,7 @@ public ItemCommandActionHandler(Action module, EventPublisher eventPublisher, It } @Override - public @Nullable Map execute(Map inputs) { + public @Nullable Map execute(Map inputs) { String itemName = (String) module.getConfiguration().get(ITEM_NAME); String command = (String) module.getConfiguration().get(COMMAND); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateUpdateActionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateUpdateActionHandler.java index ca923b07fe1..5c83f31ac0c 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateUpdateActionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateUpdateActionHandler.java @@ -55,7 +55,7 @@ public ItemStateUpdateActionHandler(Action module, EventPublisher eventPublisher } @Override - public @Nullable Map execute(Map inputs) { + public @Nullable Map execute(Map inputs) { Configuration config = module.getConfiguration(); String itemName = (String) config.get(ITEM_NAME); String state = (String) config.get(STATE); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RuleEnablementActionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RuleEnablementActionHandler.java index af96538f5e8..735812d5a1f 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RuleEnablementActionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RuleEnablementActionHandler.java @@ -94,7 +94,7 @@ public RuleEnablementActionHandler(final Action module) { } @Override - public @Nullable Map execute(Map context) { + public @Nullable Map execute(Map context) { for (String uid : uids) { if (callback != null) { callback.setEnabled(uid, enable); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RunRuleActionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RunRuleActionHandler.java index 2732e332645..585b63f0142 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RunRuleActionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RunRuleActionHandler.java @@ -94,7 +94,7 @@ public RunRuleActionHandler(final Action module) { } @Override - public @Nullable Map execute(Map context) { + public @Nullable Map execute(Map context) { // execute each rule after the other; at the moment synchronously Object previousEvent = context.get("event"); Event event = AutomationEventFactory.createExecutionEvent(moduleId,