[m-o] Fix @ActionOutput annotations (#17654)

Related to #17636

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
lolodomo 2024-10-29 06:53:48 +01:00 committed by Ciprian Pascu
parent 66e32d7fb7
commit 8836d213cf
6 changed files with 27 additions and 20 deletions

View File

@ -52,7 +52,7 @@ public class SendMailActions implements ThingActions {
private Map<String, String> headers = new HashMap<>(); private Map<String, String> headers = new HashMap<>();
@RuleAction(label = "@text/sendMessageActionLabel", description = "@text/sendMessageActionDescription") @RuleAction(label = "@text/sendMessageActionLabel", description = "@text/sendMessageActionDescription")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean sendMail( public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendMail(
@ActionInput(name = "recipient") @Nullable String recipient, @ActionInput(name = "recipient") @Nullable String recipient,
@ActionInput(name = "subject") @Nullable String subject, @ActionInput(name = "subject") @Nullable String subject,
@ActionInput(name = "text") @Nullable String text) { @ActionInput(name = "text") @Nullable String text) {
@ -60,7 +60,7 @@ public class SendMailActions implements ThingActions {
} }
@RuleAction(label = "@text/sendAttachmentMessageActionLabel", description = "@text/sendAttachmentMessageActionDescription") @RuleAction(label = "@text/sendAttachmentMessageActionLabel", description = "@text/sendAttachmentMessageActionDescription")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean sendMailWithAttachment( public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendMailWithAttachment(
@ActionInput(name = "recipient") @Nullable String recipient, @ActionInput(name = "recipient") @Nullable String recipient,
@ActionInput(name = "subject") @Nullable String subject, @ActionInput(name = "text") @Nullable String text, @ActionInput(name = "subject") @Nullable String subject, @ActionInput(name = "text") @Nullable String text,
@ActionInput(name = "url") @Nullable String url) { @ActionInput(name = "url") @Nullable String url) {
@ -72,7 +72,7 @@ public class SendMailActions implements ThingActions {
} }
@RuleAction(label = "@text/sendAttachmentsMessageActionLabel", description = "@text/sendAttachmentsMessageActionDescription") @RuleAction(label = "@text/sendAttachmentsMessageActionLabel", description = "@text/sendAttachmentsMessageActionDescription")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean sendMailWithAttachments( public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendMailWithAttachments(
@ActionInput(name = "recipient") @Nullable String recipient, @ActionInput(name = "recipient") @Nullable String recipient,
@ActionInput(name = "subject") @Nullable String subject, @ActionInput(name = "text") @Nullable String text, @ActionInput(name = "subject") @Nullable String subject, @ActionInput(name = "text") @Nullable String text,
@ActionInput(name = "urlList", type = "List<String>") @Nullable List<String> urlList) { @ActionInput(name = "urlList", type = "List<String>") @Nullable List<String> urlList) {
@ -141,7 +141,7 @@ public class SendMailActions implements ThingActions {
} }
@RuleAction(label = "@text/sendHTMLMessageActionLabel", description = "@text/sendHTMLMessageActionDescription") @RuleAction(label = "@text/sendHTMLMessageActionLabel", description = "@text/sendHTMLMessageActionDescription")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean sendHtmlMail( public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendHtmlMail(
@ActionInput(name = "recipient") @Nullable String recipient, @ActionInput(name = "recipient") @Nullable String recipient,
@ActionInput(name = "subject") @Nullable String subject, @ActionInput(name = "subject") @Nullable String subject,
@ActionInput(name = "htmlContent") @Nullable String htmlContent) { @ActionInput(name = "htmlContent") @Nullable String htmlContent) {
@ -149,7 +149,7 @@ public class SendMailActions implements ThingActions {
} }
@RuleAction(label = "@text/sendHTMLAttachmentMessageActionLabel", description = "@text/sendHTMLAttachmentMessageActionDescription") @RuleAction(label = "@text/sendHTMLAttachmentMessageActionLabel", description = "@text/sendHTMLAttachmentMessageActionDescription")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean sendHtmlMailWithAttachment( public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendHtmlMailWithAttachment(
@ActionInput(name = "recipient") @Nullable String recipient, @ActionInput(name = "recipient") @Nullable String recipient,
@ActionInput(name = "subject") @Nullable String subject, @ActionInput(name = "subject") @Nullable String subject,
@ActionInput(name = "htmlContent") @Nullable String htmlContent, @ActionInput(name = "htmlContent") @Nullable String htmlContent,
@ -162,7 +162,7 @@ public class SendMailActions implements ThingActions {
} }
@RuleAction(label = "@text/sendHTMLAttachmentsMessageActionLabel", description = "@text/sendHTMLAttachmentsMessageActionDescription") @RuleAction(label = "@text/sendHTMLAttachmentsMessageActionLabel", description = "@text/sendHTMLAttachmentsMessageActionDescription")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean sendHtmlMailWithAttachments( public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendHtmlMailWithAttachments(
@ActionInput(name = "recipient") @Nullable String recipient, @ActionInput(name = "recipient") @Nullable String recipient,
@ActionInput(name = "subject") @Nullable String subject, @ActionInput(name = "subject") @Nullable String subject,
@ActionInput(name = "htmlContent") @Nullable String htmlContent, @ActionInput(name = "htmlContent") @Nullable String htmlContent,
@ -244,7 +244,7 @@ public class SendMailActions implements ThingActions {
} }
@RuleAction(label = "@text/addHeaderActionLabel", description = "@text/addHeaderActionDescription") @RuleAction(label = "@text/addHeaderActionLabel", description = "@text/addHeaderActionDescription")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean addHeader( public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean addHeader(
@ActionInput(name = "name") @Nullable String name, @ActionInput(name = "value") @Nullable String value) { @ActionInput(name = "name") @Nullable String name, @ActionInput(name = "value") @Nullable String value) {
if (name != null && !name.isEmpty()) { if (name != null && !name.isEmpty()) {
if (value != null && !value.isEmpty()) { if (value != null && !value.isEmpty()) {

View File

@ -52,7 +52,7 @@ public class MaxCubeActions implements ThingActions {
} }
@RuleAction(label = "backup the Cube data", description = "Creates a backup of the MAX! Cube data.") @RuleAction(label = "backup the Cube data", description = "Creates a backup of the MAX! Cube data.")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean backup() { public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean backup() {
MaxCubeBridgeHandler actionsHandler = handler; MaxCubeBridgeHandler actionsHandler = handler;
if (actionsHandler == null) { if (actionsHandler == null) {
logger.info("MaxCubeActions: Action service ThingHandler is null!"); logger.info("MaxCubeActions: Action service ThingHandler is null!");
@ -67,7 +67,7 @@ public class MaxCubeActions implements ThingActions {
} }
@RuleAction(label = "reset the Cube configuration", description = "Resets the MAX! Cube room and device information. Devices will need to be included again!") @RuleAction(label = "reset the Cube configuration", description = "Resets the MAX! Cube room and device information. Devices will need to be included again!")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean resetConfig() { public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean resetConfig() {
MaxCubeBridgeHandler actionsHandler = handler; MaxCubeBridgeHandler actionsHandler = handler;
if (actionsHandler == null) { if (actionsHandler == null) {
logger.info("MaxCubeActions: Action service ThingHandler is null!"); logger.info("MaxCubeActions: Action service ThingHandler is null!");
@ -82,7 +82,7 @@ public class MaxCubeActions implements ThingActions {
} }
@RuleAction(label = "restart the Cube", description = "Restarts the MAX! Cube.") @RuleAction(label = "restart the Cube", description = "Restarts the MAX! Cube.")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean reboot() { public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean reboot() {
MaxCubeBridgeHandler actionsHandler = handler; MaxCubeBridgeHandler actionsHandler = handler;
if (actionsHandler == null) { if (actionsHandler == null) {
logger.info("MaxCubeActions: Action service ThingHandler is null!"); logger.info("MaxCubeActions: Action service ThingHandler is null!");

View File

@ -52,7 +52,7 @@ public class MaxDevicesActions implements ThingActions {
} }
@RuleAction(label = "delete the device from the Cube", description = "Deletes the device from the MAX! Cube. Device will need to be included again!") @RuleAction(label = "delete the device from the Cube", description = "Deletes the device from the MAX! Cube. Device will need to be included again!")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean deleteFromCube() { public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean deleteFromCube() {
MaxDevicesHandler actionsHandler = handler; MaxDevicesHandler actionsHandler = handler;
if (actionsHandler == null) { if (actionsHandler == null) {
logger.info("MaxDevicesActions: Action service ThingHandler is null!"); logger.info("MaxDevicesActions: Action service ThingHandler is null!");

View File

@ -21,6 +21,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.automation.annotation.ActionInput; import org.openhab.core.automation.annotation.ActionInput;
import org.openhab.core.automation.annotation.ActionOutput; import org.openhab.core.automation.annotation.ActionOutput;
import org.openhab.core.automation.annotation.ActionOutputs;
import org.openhab.core.automation.annotation.RuleAction; import org.openhab.core.automation.annotation.RuleAction;
import org.openhab.core.thing.binding.ThingActions; import org.openhab.core.thing.binding.ThingActions;
import org.openhab.core.thing.binding.ThingActionsScope; import org.openhab.core.thing.binding.ThingActionsScope;
@ -159,7 +160,7 @@ public class HeliosEasyControlsActions implements ThingActions {
} }
@RuleAction(label = "@text/action.getErrorMessages.label", description = "@text/action.getErrorMessages.description") @RuleAction(label = "@text/action.getErrorMessages.label", description = "@text/action.getErrorMessages.description")
public @ActionOutput(name = "errorMessages", type = "java.util.List<String>") List<String> getErrorMessages() { public @ActionOutput(label = "Error Messages", type = "java.util.List<String>") List<String> getErrorMessages() {
HeliosEasyControlsHandler handler = this.handler; HeliosEasyControlsHandler handler = this.handler;
return (handler != null) ? handler.getErrorMessages() : new ArrayList<>(); return (handler != null) ? handler.getErrorMessages() : new ArrayList<>();
} }
@ -169,7 +170,7 @@ public class HeliosEasyControlsActions implements ThingActions {
} }
@RuleAction(label = "@text/action.getWarningMessages.label", description = "@text/action.getWarningMessages.description") @RuleAction(label = "@text/action.getWarningMessages.label", description = "@text/action.getWarningMessages.description")
public @ActionOutput(name = "warningMessages", type = "java.util.List<String>") List<String> getWarningMessages() { public @ActionOutput(label = "Warning Messages", type = "java.util.List<String>") List<String> getWarningMessages() {
HeliosEasyControlsHandler handler = this.handler; HeliosEasyControlsHandler handler = this.handler;
return (handler != null) ? handler.getWarningMessages() : new ArrayList<>(); return (handler != null) ? handler.getWarningMessages() : new ArrayList<>();
} }
@ -179,7 +180,7 @@ public class HeliosEasyControlsActions implements ThingActions {
} }
@RuleAction(label = "@text/action.getInfoMessages.label", description = "@text/action.getInfoMessages.description") @RuleAction(label = "@text/action.getInfoMessages.label", description = "@text/action.getInfoMessages.description")
public @ActionOutput(name = "infoMessages", type = "java.util.List<String>") List<String> getInfoMessages() { public @ActionOutput(label = "Info Messages", type = "java.util.List<String>") List<String> getInfoMessages() {
HeliosEasyControlsHandler handler = this.handler; HeliosEasyControlsHandler handler = this.handler;
return (handler != null) ? handler.getInfoMessages() : new ArrayList<>(); return (handler != null) ? handler.getInfoMessages() : new ArrayList<>();
} }
@ -189,7 +190,7 @@ public class HeliosEasyControlsActions implements ThingActions {
} }
@RuleAction(label = "@text/action.getStatusMessages.label", description = "@text/action.getStatusMessages.description") @RuleAction(label = "@text/action.getStatusMessages.label", description = "@text/action.getStatusMessages.description")
public @ActionOutput(name = "statusMessages", type = "java.util.List<String>") List<String> getStatusMessages() { public @ActionOutput(label = "Status Messages", type = "java.util.List<String>") List<String> getStatusMessages() {
HeliosEasyControlsHandler handler = this.handler; HeliosEasyControlsHandler handler = this.handler;
return (handler != null) ? handler.getStatusMessages() : new ArrayList<>(); return (handler != null) ? handler.getStatusMessages() : new ArrayList<>();
} }
@ -199,7 +200,11 @@ public class HeliosEasyControlsActions implements ThingActions {
} }
@RuleAction(label = "@text/action.getMessages.label", description = "@text/action.getMessages.description") @RuleAction(label = "@text/action.getMessages.label", description = "@text/action.getMessages.description")
public @ActionOutput(name = "errorMessages", type = "java.util.List<String>") @ActionOutput(name = "warningMessages", type = "java.util.List<String>") @ActionOutput(name = "infoMessages", type = "java.util.List<String>") @ActionOutput(name = "statusMessages", type = "java.util.List<String>") Map<String, Object> getMessages() { public @ActionOutputs({
@ActionOutput(name = "errorMessages", label = "Error Messages", type = "java.util.List<String>"),
@ActionOutput(name = "warningMessages", label = "Warning Messages", type = "java.util.List<String>"),
@ActionOutput(name = "infoMessages", label = "Info Messages", type = "java.util.List<String>"),
@ActionOutput(name = "statusMessages", label = "Status Messages", type = "java.util.List<String>") }) Map<String, Object> getMessages() {
Map<String, Object> messages = new HashMap<>(); Map<String, Object> messages = new HashMap<>();
HeliosEasyControlsHandler handler = this.handler; HeliosEasyControlsHandler handler = this.handler;
if (handler != null) { if (handler != null) {

View File

@ -23,6 +23,7 @@ import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.openwebnet.internal.handler.OpenWebNetBridgeHandler; import org.openhab.binding.openwebnet.internal.handler.OpenWebNetBridgeHandler;
import org.openhab.core.automation.annotation.ActionInput; import org.openhab.core.automation.annotation.ActionInput;
import org.openhab.core.automation.annotation.ActionOutput; import org.openhab.core.automation.annotation.ActionOutput;
import org.openhab.core.automation.annotation.ActionOutputs;
import org.openhab.core.automation.annotation.RuleAction; import org.openhab.core.automation.annotation.RuleAction;
import org.openhab.core.thing.binding.ThingActions; import org.openhab.core.thing.binding.ThingActions;
import org.openhab.core.thing.binding.ThingActionsScope; import org.openhab.core.thing.binding.ThingActionsScope;
@ -61,7 +62,7 @@ public class OpenWebNetBridgeActions implements ThingActions {
} }
@RuleAction(label = "sendMessage", description = "@text/action.sendMessage.desc") @RuleAction(label = "sendMessage", description = "@text/action.sendMessage.desc")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean sendMessage( public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendMessage(
@ActionInput(name = "message", label = "message", description = "@text/action.sendMessage.input.message.desc") @Nullable String message) { @ActionInput(name = "message", label = "message", description = "@text/action.sendMessage.input.message.desc") @Nullable String message) {
@Nullable @Nullable
Boolean s = (Boolean) sendMessageInternal(message).get("success"); Boolean s = (Boolean) sendMessageInternal(message).get("success");
@ -73,8 +74,9 @@ public class OpenWebNetBridgeActions implements ThingActions {
} }
@RuleAction(label = "sendMessageWithResponse", description = "@text/action.sendMessageWithResponse.desc") @RuleAction(label = "sendMessageWithResponse", description = "@text/action.sendMessageWithResponse.desc")
public @ActionOutput(name = "success", type = "java.lang.Boolean") @ActionOutput(name = "responseMessages", type = "java.util.List<String>") Map<String, Object> sendMessageWithResponse( public @ActionOutputs({ @ActionOutput(name = "success", label = "Success", type = "java.lang.Boolean"),
@ActionInput(name = "message", label = "message", description = "@text/action.sendMessage.input.message.desc") @Nullable String message) { @ActionOutput(name = "responseMessages", label = "Response Messages", type = "java.util.List<String>") }) Map<String, Object> sendMessageWithResponse(
@ActionInput(name = "message", label = "message", description = "@text/action.sendMessage.input.message.desc") @Nullable String message) {
return sendMessageInternal(message); return sendMessageInternal(message);
} }

View File

@ -55,7 +55,7 @@ public class OpenWebNetCENActions implements ThingActions {
} }
@RuleAction(label = "virtualPress", description = "@text/action.virtualPress.desc") @RuleAction(label = "virtualPress", description = "@text/action.virtualPress.desc")
public @ActionOutput(name = "success", type = "java.lang.Boolean") Boolean virtualPress( public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean virtualPress(
@ActionInput(name = "press", label = "press", description = "@text/action.virtualPress.input.press.desc") @Nullable String press, @ActionInput(name = "press", label = "press", description = "@text/action.virtualPress.input.press.desc") @Nullable String press,
@ActionInput(name = "button", label = "button", description = "@text/action.virtualPress.input.button.desc") int button) { @ActionInput(name = "button", label = "button", description = "@text/action.virtualPress.input.button.desc") int button) {
OpenWebNetScenarioHandler handler = scenarioHandler; OpenWebNetScenarioHandler handler = scenarioHandler;