From c320a45b558124c37864716306d100607720e85b Mon Sep 17 00:00:00 2001 From: Avgustin Marinov Date: Sun, 4 Feb 2024 11:46:43 +0200 Subject: [PATCH] Refactoring/Improving source: dmf 2 (#1612) Signed-off-by: Marinov Avgustin --- .../hawkbit/dmf/amqp/api/AmqpSettings.java | 15 ++--- .../hawkbit/dmf/amqp/api/EventTopic.java | 10 ---- .../dmf/amqp/api/MessageHeaderKey.java | 19 ++----- .../hawkbit/dmf/amqp/api/MessageType.java | 8 +-- .../dmf/json/model/DmfActionRequest.java | 14 ++--- .../dmf/json/model/DmfActionStatus.java | 16 +----- .../dmf/json/model/DmfActionUpdateStatus.java | 32 ++--------- .../hawkbit/dmf/json/model/DmfArtifact.java | 46 ++------------- .../dmf/json/model/DmfArtifactHash.java | 28 ++-------- .../dmf/json/model/DmfAttributeUpdate.java | 17 +----- .../dmf/json/model/DmfAutoConfirmation.java | 32 +---------- .../DmfBatchDownloadAndUpdateRequest.java | 20 ++----- .../dmf/json/model/DmfConfirmRequest.java | 12 +--- .../dmf/json/model/DmfCreateThing.java | 28 +--------- .../model/DmfDownloadAndUpdateRequest.java | 9 +-- .../dmf/json/model/DmfDownloadResponse.java | 44 ++------------- .../hawkbit/dmf/json/model/DmfMetadata.java | 56 +------------------ .../dmf/json/model/DmfMultiActionRequest.java | 28 ++-------- .../dmf/json/model/DmfSoftwareModule.java | 53 +----------------- .../hawkbit/dmf/json/model/DmfTarget.java | 41 ++------------ .../hawkbit/dmf/json/model/DmfUpdateMode.java | 5 +- .../AutoAssignDistributionSetUpdate.java | 2 + .../event/remote/RemoteIdEvent.java | 16 +++--- .../event/remote/RemoteTenantAwareEvent.java | 7 ++- .../TargetAssignDistributionSetEvent.java | 19 +++---- .../TargetAttributesRequestedEvent.java | 9 ++- .../event/remote/TargetDeletedEvent.java | 8 ++- .../event/remote/TargetPollEvent.java | 8 ++- .../TenantConfigurationDeletedEvent.java | 34 +++++------ .../org/eclipse/hawkbit/event/EventType.java | 4 +- 30 files changed, 135 insertions(+), 505 deletions(-) diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/AmqpSettings.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/AmqpSettings.java index 1e9bd42d5..58d643a97 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/AmqpSettings.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/AmqpSettings.java @@ -9,20 +9,15 @@ */ package org.eclipse.hawkbit.dmf.amqp.api; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + /** * Global constants for RabbitMQ settings. - * - * - * */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) public final class AmqpSettings { public static final String DMF_EXCHANGE = "dmf.exchange"; - public static final String AUTHENTICATION_EXCHANGE = "authentication.exchange"; - - private AmqpSettings() { - - } - -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/EventTopic.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/EventTopic.java index cde86cc13..32fdffbac 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/EventTopic.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/EventTopic.java @@ -18,52 +18,42 @@ public enum EventTopic { * Topic when sending and receiving a update status. */ UPDATE_ACTION_STATUS, - /** * Topic when sending and receiving a download and install task. */ DOWNLOAD_AND_INSTALL, - /** * Topic when sending and receiving a cancel download task. */ CANCEL_DOWNLOAD, - /** * Topic when updating device attributes. */ UPDATE_ATTRIBUTES, - /** * Topic when updating auto-confirmation state. */ UPDATE_AUTO_CONFIRM, - /** * Topic when sending a download only task, skipping the install. */ DOWNLOAD, - /** * Topic when an update of device attributes is requested. */ REQUEST_ATTRIBUTES_UPDATE, - /** * Topic to send multiple actions to the device. */ MULTI_ACTION, - /** * Topic when sending a download only action to multiple devices. */ BATCH_DOWNLOAD, - /** * Topic when sending a download and install action to multiple devices. */ BATCH_DOWNLOAD_AND_INSTALL, - /** * Topic when confirmation of an action is requested. */ diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/MessageHeaderKey.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/MessageHeaderKey.java index cbb636bd9..4c08e41de 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/MessageHeaderKey.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/MessageHeaderKey.java @@ -9,46 +9,37 @@ */ package org.eclipse.hawkbit.dmf.amqp.api; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + /** * The constant of all amqp message header. - * - * - * */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) public final class MessageHeaderKey { /** * The message type. */ public static final String TYPE = "type"; - /** * The used tenant. */ public static final String TENANT = "tenant"; - /** * The name of the thing/target. */ public static final String THING_ID = "thingId"; - /** * The name of the sender who has send the message. */ public static final String SENDER = "sender"; - /** * The topic to handle events different. */ public static final String TOPIC = "topic"; - /** * The content type. */ public static final String CONTENT_TYPE = "content-type"; - - private MessageHeaderKey() { - - } - -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/MessageType.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/MessageType.java index 9db13f48c..6c681e10d 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/MessageType.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/amqp/api/MessageType.java @@ -19,30 +19,24 @@ public enum MessageType { * The event type related to interaction with a thing. */ EVENT, - /** * The thing created type. */ THING_CREATED, - /** * The thing deleted type. */ THING_DELETED, - /** * The request to delete a target. */ THING_REMOVED, - /** * DMF receiver health check type. */ PING, - /** * DMF receiver health check response type. */ PING_RESPONSE - -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionRequest.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionRequest.java index 00335efd7..f2a0b9268 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionRequest.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionRequest.java @@ -13,22 +13,16 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; /** * JSON representation of an action related request. - * */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfActionRequest { + @JsonProperty private Long actionId; - - public Long getActionId() { - return actionId; - } - - public void setActionId(final Long correlator) { - this.actionId = correlator; - } -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionStatus.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionStatus.java index 9f9fddfc7..4c0991fac 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionStatus.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionStatus.java @@ -15,65 +15,53 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; /** * The json message action status. - * - * - * */ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public enum DmfActionStatus { + /** * Action requests download by this target which has now started. */ DOWNLOAD, - /** * Action has been send to the target. */ RETRIEVED, - /** * Action is still running for this target. */ RUNNING, - /** * Action is finished successfully for this target. */ FINISHED, - /** * Action has failed for this target. */ ERROR, - /** * Action is still running but with warnings. */ WARNING, - /** * Action has been canceled for this target. */ CANCELED, - /** * Cancellation has been rejected by the target.. */ CANCEL_REJECTED, - /** * Action has been downloaded for this target. */ DOWNLOADED, - /** * Action is confirmed by the target. */ CONFIRMED, - /** * Action has been denied by the target. */ DENIED -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionUpdateStatus.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionUpdateStatus.java index 1f3d4c4af..16df9ded8 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionUpdateStatus.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfActionUpdateStatus.java @@ -20,10 +20,14 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; /** * JSON representation of action update status. */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfActionUpdateStatus { @@ -34,6 +38,7 @@ public class DmfActionUpdateStatus { @JsonProperty private Long softwareModuleId; + @Setter(AccessLevel.NONE) @JsonProperty private List message; @@ -46,31 +51,11 @@ public class DmfActionUpdateStatus { this.actionStatus = actionStatus; } - public Long getActionId() { - return actionId; - } - - public Long getSoftwareModuleId() { - return softwareModuleId; - } - - public void setSoftwareModuleId(final Long softwareModuleId) { - this.softwareModuleId = softwareModuleId; - } - - public DmfActionStatus getActionStatus() { - return actionStatus; - } - @JsonIgnore public Optional getCode() { return Optional.ofNullable(code); } - public void setCode(final Integer code) { - this.code = code; - } - public List getMessage() { if (message == null) { return Collections.emptyList(); @@ -99,9 +84,4 @@ public class DmfActionUpdateStatus { return message.addAll(messages); } - - public void setCode(final int code) { - this.code = code; - } - -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfArtifact.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfArtifact.java index dcd24691b..d03390030 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfArtifact.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfArtifact.java @@ -16,25 +16,24 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; /** * JSON representation of artifact. */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfArtifact { + @JsonProperty private String filename; - @JsonProperty private DmfArtifactHash hashes; - @JsonProperty private long size; - @JsonProperty private long lastModified; - @JsonProperty private Map urls; @@ -45,41 +44,4 @@ public class DmfArtifact { return Collections.unmodifiableMap(urls); } - - public long getLastModified() { - return lastModified; - } - - public void setLastModified(final long lastModified) { - this.lastModified = lastModified; - } - - public void setUrls(final Map urls) { - this.urls = urls; - } - - public String getFilename() { - return filename; - } - - public void setFilename(final String filename) { - this.filename = filename; - } - - public DmfArtifactHash getHashes() { - return hashes; - } - - public void setHashes(final DmfArtifactHash hashes) { - this.hashes = hashes; - } - - public long getSize() { - return size; - } - - public void setSize(final long size) { - this.size = size; - } - -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfArtifactHash.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfArtifactHash.java index 2caab1315..3483e6542 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfArtifactHash.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfArtifactHash.java @@ -11,46 +11,28 @@ package org.eclipse.hawkbit.dmf.json.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; /** * JSON representation of artifact hash. */ +@Data public class DmfArtifactHash { @JsonProperty private String sha1; - @JsonProperty private String md5; /** * Constructor. * - * @param sha1 - * the sha1 hash - * @param md5 - * the md5 hash + * @param sha1 the sha1 hash + * @param md5 the md5 hash */ @JsonCreator public DmfArtifactHash(@JsonProperty("sha1") final String sha1, @JsonProperty("md5") final String md5) { this.sha1 = sha1; this.md5 = md5; } - - public void setSha1(final String sha1) { - this.sha1 = sha1; - } - - public void setMd5(final String md5) { - this.md5 = md5; - } - - public String getSha1() { - return sha1; - } - - public String getMd5() { - return md5; - } - -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfAttributeUpdate.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfAttributeUpdate.java index c3c6db54f..57b28c050 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfAttributeUpdate.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfAttributeUpdate.java @@ -16,10 +16,12 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; /** * JSON representation of the Attribute Update message. */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfAttributeUpdate { @@ -29,17 +31,4 @@ public class DmfAttributeUpdate { @JsonProperty private DmfUpdateMode mode; - - public DmfUpdateMode getMode() { - return mode; - } - - public void setMode(final DmfUpdateMode mode) { - this.mode = mode; - } - - public Map getAttributes() { - return attributes; - } - -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfAutoConfirmation.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfAutoConfirmation.java index 03c25c8bf..71a55a5c9 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfAutoConfirmation.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfAutoConfirmation.java @@ -13,46 +13,20 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; /** * JSON representation of auto confirmation config. */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfAutoConfirmation { @JsonProperty private boolean enabled; - @JsonProperty private String initiator; - @JsonProperty private String remark; - - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(final boolean enabled) { - this.enabled = enabled; - } - - public String getInitiator() { - return initiator; - } - - public void setInitiator(final String initiator) { - this.initiator = initiator; - } - - public String getRemark() { - return remark; - } - - public void setRemark(final String remark) { - this.remark = remark; - } - -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfBatchDownloadAndUpdateRequest.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfBatchDownloadAndUpdateRequest.java index 6c7ed2652..b10ce8edd 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfBatchDownloadAndUpdateRequest.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfBatchDownloadAndUpdateRequest.java @@ -13,6 +13,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; import java.util.ArrayList; import java.util.Collections; @@ -26,6 +28,7 @@ import java.util.List; @JsonIgnoreProperties(ignoreUnknown = true) public class DmfBatchDownloadAndUpdateRequest { + @Getter @Setter @JsonProperty private Long timestamp; @@ -35,14 +38,6 @@ public class DmfBatchDownloadAndUpdateRequest { @JsonProperty private List softwareModules; - public Long getTimestamp() { - return timestamp; - } - - public void setTimestamp(final Long timestamp) { - this.timestamp = timestamp; - } - public List getSoftwareModules() { if (softwareModules == null) { return Collections.emptyList(); @@ -54,8 +49,7 @@ public class DmfBatchDownloadAndUpdateRequest { /** * Add a Software module. * - * @param createSoftwareModule - * the module + * @param createSoftwareModule the module */ public void addSoftwareModule(final DmfSoftwareModule createSoftwareModule) { if (softwareModules == null) { @@ -73,7 +67,6 @@ public class DmfBatchDownloadAndUpdateRequest { return Collections.unmodifiableList(targets); } - /** * Add a Target. * @@ -91,8 +84,7 @@ public class DmfBatchDownloadAndUpdateRequest { /** * Add multiple Targets. * - * @param targets - * the target + * @param targets the target */ public void addTargets(final List targets) { if (this.targets == null) { @@ -100,4 +92,4 @@ public class DmfBatchDownloadAndUpdateRequest { } this.targets.addAll(targets); } -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfConfirmRequest.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfConfirmRequest.java index 2a6c106cb..2ceb842d9 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfConfirmRequest.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfConfirmRequest.java @@ -13,6 +13,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; import java.util.ArrayList; import java.util.Collections; @@ -20,26 +22,18 @@ import java.util.List; /** * JSON representation of confirm request. - * */ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfConfirmRequest extends DmfActionRequest { + @Getter @Setter @JsonProperty private String targetSecurityToken; @JsonProperty private List softwareModules; - public String getTargetSecurityToken() { - return targetSecurityToken; - } - - public void setTargetSecurityToken(final String targetSecurityToken) { - this.targetSecurityToken = targetSecurityToken; - } - public List getSoftwareModules() { if (softwareModules == null) { return Collections.emptyList(); diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfCreateThing.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfCreateThing.java index c5380bf84..819e14872 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfCreateThing.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfCreateThing.java @@ -13,10 +13,12 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; /** * JSON representation of the Attribute THING_CREATED message. */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfCreateThing { @@ -29,28 +31,4 @@ public class DmfCreateThing { @JsonProperty private DmfAttributeUpdate attributeUpdate; - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(final String type) { - this.type = type; - } - - public DmfAttributeUpdate getAttributeUpdate() { - return attributeUpdate; - } - - public void setAttributeUpdate(final DmfAttributeUpdate attributeUpdate) { - this.attributeUpdate = attributeUpdate; - } -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfDownloadAndUpdateRequest.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfDownloadAndUpdateRequest.java index 1234bc562..2e0b4ddc9 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfDownloadAndUpdateRequest.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfDownloadAndUpdateRequest.java @@ -17,25 +17,22 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; /** * JSON representation of download and update request. - * */ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfDownloadAndUpdateRequest extends DmfActionRequest { + @Getter @JsonProperty private String targetSecurityToken; @JsonProperty private List softwareModules; - public String getTargetSecurityToken() { - return targetSecurityToken; - } - public void setTargetSecurityToken(final String targetSecurityToken) { this.targetSecurityToken = targetSecurityToken; } @@ -62,4 +59,4 @@ public class DmfDownloadAndUpdateRequest extends DmfActionRequest { softwareModules.add(createSoftwareModule); } -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfDownloadResponse.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfDownloadResponse.java index ddf16b3f7..5a569efdd 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfDownloadResponse.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfDownloadResponse.java @@ -13,58 +13,22 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; /** - * The authentification response JSON representation. - * - * - * + * The download response JSON representation. */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfDownloadResponse { @JsonProperty private String downloadUrl; - @JsonProperty private DmfArtifact artifact; - @JsonProperty private int responseCode; - @JsonProperty private String message; - - public String getMessage() { - return message; - } - - public void setMessage(final String message) { - this.message = message; - } - - public int getResponseCode() { - return responseCode; - } - - public void setResponseCode(final int responseCode) { - this.responseCode = responseCode; - } - - public String getDownloadUrl() { - return downloadUrl; - } - - public void setDownloadUrl(final String downloadUrl) { - this.downloadUrl = downloadUrl; - } - - public DmfArtifact getArtifact() { - return artifact; - } - - public void setArtifact(final DmfArtifact artifact) { - this.artifact = artifact; - } -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfMetadata.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfMetadata.java index a0f2ed63f..186cdfcad 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfMetadata.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfMetadata.java @@ -14,11 +14,12 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; /** * Additional metadata to be provided for the target/device. - * */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfMetadata { @@ -33,55 +34,4 @@ public class DmfMetadata { this.key = key; this.value = value; } - - public String getKey() { - return key; - } - - public String getValue() { - return value; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((key == null) ? 0 : key.hashCode()); - result = prime * result + ((value == null) ? 0 : value.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final DmfMetadata other = (DmfMetadata) obj; - if (key == null) { - if (other.key != null) { - return false; - } - } else if (!key.equals(other.key)) { - return false; - } - if (value == null) { - if (other.value != null) { - return false; - } - } else if (!value.equals(other.value)) { - return false; - } - return true; - } - - @Override - public String toString() { - return String.format("DmfMetadata [key='%s', value='%s']", key, value); - } -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfMultiActionRequest.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfMultiActionRequest.java index d3541c4d3..c62e6530e 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfMultiActionRequest.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfMultiActionRequest.java @@ -12,6 +12,8 @@ package org.eclipse.hawkbit.dmf.json.model; import java.util.ArrayList; import java.util.List; +import lombok.Data; +import lombok.NoArgsConstructor; import org.eclipse.hawkbit.dmf.amqp.api.EventTopic; import com.fasterxml.jackson.annotation.JsonCreator; @@ -27,15 +29,13 @@ import com.fasterxml.jackson.annotation.JsonValue; /** * JSON representation of a multi-action request. */ +@NoArgsConstructor @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfMultiActionRequest { private List elements; - public DmfMultiActionRequest() { - } - @JsonCreator public DmfMultiActionRequest(final List elements) { this.elements = elements; @@ -64,6 +64,7 @@ public class DmfMultiActionRequest { /** * Represents an element within a {@link DmfMultiActionRequest}. */ + @Data public static class DmfMultiActionElement { @JsonProperty @@ -75,32 +76,11 @@ public class DmfMultiActionRequest { @JsonProperty private int weight; - public DmfActionRequest getAction() { - return action; - } - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = "topic", defaultImpl = DmfActionRequest.class) @JsonSubTypes({ @Type(value = DmfDownloadAndUpdateRequest.class, name = "DOWNLOAD"), @Type(value = DmfDownloadAndUpdateRequest.class, name = "DOWNLOAD_AND_INSTALL") }) public void setAction(final DmfActionRequest action) { this.action = action; } - - public EventTopic getTopic() { - return topic; - } - - public void setTopic(final EventTopic actionType) { - this.topic = actionType; - } - - public void setWeight(final int weight) { - this.weight = weight; - } - - public int getWeight() { - return weight; - } } - } diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfSoftwareModule.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfSoftwareModule.java index 5eb1d250d..ea4e9d8f9 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfSoftwareModule.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfSoftwareModule.java @@ -17,11 +17,12 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; /** * JSON representation of a software module. - * */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfSoftwareModule { @@ -39,22 +40,6 @@ public class DmfSoftwareModule { @JsonProperty private List metadata; - public String getModuleType() { - return moduleType; - } - - public void setModuleType(final String moduleType) { - this.moduleType = moduleType; - } - - public String getModuleVersion() { - return moduleVersion; - } - - public void setModuleVersion(final String moduleVersion) { - this.moduleVersion = moduleVersion; - } - public List getArtifacts() { if (artifacts == null) { return Collections.emptyList(); @@ -63,41 +48,9 @@ public class DmfSoftwareModule { return Collections.unmodifiableList(artifacts); } - public Long getModuleId() { - return moduleId; - } - - @JsonIgnore - public void setModuleId(final Long moduleId) { - this.moduleId = moduleId; - } - - public void setArtifacts(final List artifacts) { - this.artifacts = artifacts; - } - - public List getMetadata() { - return metadata; - } - public void setMetadata(final List metadata) { if (metadata != null && !metadata.isEmpty()) { this.metadata = metadata; } } - - public Boolean getEncrypted() { - return encrypted; - } - - public void setEncrypted(final Boolean encrypted) { - this.encrypted = encrypted; - } - - @Override - public String toString() { - return String.format( - "DmfSoftwareModule [moduleId=%d, moduleType='%s', moduleVersion='%s', encrypted='%s' artifacts=%s, metadata=%s]", - moduleId, moduleType, moduleVersion, encrypted, artifacts, metadata); - } -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfTarget.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfTarget.java index 8d015d5fd..a2fac0d20 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfTarget.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfTarget.java @@ -13,53 +13,22 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; - +import lombok.Data; +import lombok.ToString; /** * Json representation of Target used in batch download and update request. - * */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DmfTarget { @JsonProperty private Long actionId; - @JsonProperty private String controllerId; - + @ToString.Exclude @JsonProperty private String targetSecurityToken; - - public Long getActionId() { - return actionId; - } - - public void setActionId(final Long actionId) { - this.actionId = actionId; - } - - public String getControllerId() { - return controllerId; - } - - public void setControllerId(final String controllerId) { - this.controllerId = controllerId; - } - - public String getTargetSecurityToken() { - return targetSecurityToken; - } - - public void setTargetSecurityToken(final String targetSecurityToken) { - this.targetSecurityToken = targetSecurityToken; - } - - @Override - public String toString() { - return String.format( - "DmfTarget [actionId=%d controllerId='%s']", - actionId, controllerId); - } -} +} \ No newline at end of file diff --git a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfUpdateMode.java b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfUpdateMode.java index 909a2dfab..8c3fb2e58 100644 --- a/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfUpdateMode.java +++ b/hawkbit-dmf/hawkbit-dmf-api/src/main/java/org/eclipse/hawkbit/dmf/json/model/DmfUpdateMode.java @@ -21,15 +21,12 @@ public enum DmfUpdateMode { * Merge update strategy */ MERGE, - /** * Replacement update strategy */ REPLACE, - /** * Removal update strategy */ REMOVE - -} +} \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/builder/AutoAssignDistributionSetUpdate.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/builder/AutoAssignDistributionSetUpdate.java index f8e15139a..eb3495a42 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/builder/AutoAssignDistributionSetUpdate.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/builder/AutoAssignDistributionSetUpdate.java @@ -14,6 +14,7 @@ import jakarta.validation.constraints.Min; import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.ToString; import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action.ActionType; import org.eclipse.hawkbit.repository.model.DistributionSet; @@ -25,6 +26,7 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery; */ @Getter @EqualsAndHashCode +@ToString public class AutoAssignDistributionSetUpdate { private final long targetFilterId; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/RemoteIdEvent.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/RemoteIdEvent.java index 7a4e01881..66bcc9e36 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/RemoteIdEvent.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/RemoteIdEvent.java @@ -9,19 +9,26 @@ */ package org.eclipse.hawkbit.repository.event.remote; +import lombok.AccessLevel; import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.ToString; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; +import java.io.Serial; import java.util.Arrays; /** * An base definition class for an event which contains an id. */ +@NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = true) +@ToString public class RemoteIdEvent extends RemoteTenantAwareEvent { + @Serial private static final long serialVersionUID = 1L; private Long entityId; @@ -30,13 +37,6 @@ public class RemoteIdEvent extends RemoteTenantAwareEvent { private String interfaceClass; - /** - * Default constructor. - */ - protected RemoteIdEvent() { - // for serialization libs like jackson - } - /** * Constructor for json serialization. * diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/RemoteTenantAwareEvent.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/RemoteTenantAwareEvent.java index 933fd4de4..ddd772873 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/RemoteTenantAwareEvent.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/RemoteTenantAwareEvent.java @@ -11,20 +11,25 @@ package org.eclipse.hawkbit.repository.event.remote; import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.ToString; import org.eclipse.hawkbit.repository.event.TenantAwareEvent; import org.springframework.cloud.bus.event.RemoteApplicationEvent; import com.cronutils.utils.StringUtils; +import java.io.Serial; + /** * A distributed tenant aware event. It's the base class of the other * distributed events. All the necessary information of distributing events to * other nodes. */ @Getter -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = true) +@ToString public class RemoteTenantAwareEvent extends RemoteApplicationEvent implements TenantAwareEvent { + @Serial private static final long serialVersionUID = 1L; private String tenant; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetAssignDistributionSetEvent.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetAssignDistributionSetEvent.java index 99865bc29..1c6822a01 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetAssignDistributionSetEvent.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetAssignDistributionSetEvent.java @@ -9,35 +9,32 @@ */ package org.eclipse.hawkbit.repository.event.remote; +import java.io.Serial; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.ToString; import org.eclipse.hawkbit.repository.model.Action; /** - * TenantAwareEvent that gets sent when a distribution set gets assigned to a - * target. + * TenantAwareEvent that gets sent when a distribution set gets assigned to a target. */ +@NoArgsConstructor // for serialization libs like jackson @Getter -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = true) +@ToString public class TargetAssignDistributionSetEvent extends AbstractAssignmentEvent { + @Serial private static final long serialVersionUID = 1L; private long distributionSetId; - private boolean maintenanceWindowAvailable; - /** - * Default constructor. - */ - public TargetAssignDistributionSetEvent() { - // for serialization libs like jackson - } - /** * Constructor. * diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetAttributesRequestedEvent.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetAttributesRequestedEvent.java index c05f74eea..9c9536bc1 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetAttributesRequestedEvent.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetAttributesRequestedEvent.java @@ -11,16 +11,23 @@ package org.eclipse.hawkbit.repository.event.remote; import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.ToString; import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; +import java.io.Serial; + /** * Defines the remote event of triggering attribute updates of a {@link Target}. */ @Getter -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = true) +@ToString public class TargetAttributesRequestedEvent extends RemoteIdEvent { + + @Serial private static final long serialVersionUID = 1L; + private String controllerId; private String targetAddress; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetDeletedEvent.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetDeletedEvent.java index 52715c89a..5d5eacfc3 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetDeletedEvent.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetDeletedEvent.java @@ -11,18 +11,24 @@ package org.eclipse.hawkbit.repository.event.remote; import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.ToString; import org.eclipse.hawkbit.repository.event.entity.EntityDeletedEvent; import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; +import java.io.Serial; + /** * Defines the remote event of deleting a {@link Target}. */ @Getter -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = true) +@ToString public class TargetDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent { + @Serial private static final long serialVersionUID = 2L; + private String controllerId; private String targetAddress; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetPollEvent.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetPollEvent.java index 2799ee42f..7934cb909 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetPollEvent.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TargetPollEvent.java @@ -11,16 +11,22 @@ package org.eclipse.hawkbit.repository.event.remote; import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.ToString; import org.eclipse.hawkbit.repository.model.Target; +import java.io.Serial; + /** * Event is send in case a target polls either through DDI or DMF. */ @Getter -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = true) +@ToString public class TargetPollEvent extends RemoteTenantAwareEvent { + @Serial private static final long serialVersionUID = 1L; + private String controllerId; private String targetAdress; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TenantConfigurationDeletedEvent.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TenantConfigurationDeletedEvent.java index 31db94c07..e0fabca5d 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TenantConfigurationDeletedEvent.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/event/remote/TenantConfigurationDeletedEvent.java @@ -11,17 +11,23 @@ package org.eclipse.hawkbit.repository.event.remote; import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.ToString; import org.eclipse.hawkbit.repository.event.entity.EntityDeletedEvent; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; +import java.io.Serial; + /** * Defines the remote event of deleting a {@link org.eclipse.hawkbit.repository.model.TenantConfiguration}. */ +@NoArgsConstructor // for serialization libs like jackson @Getter -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = true) +@ToString public class TenantConfigurationDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent { + @Serial private static final long serialVersionUID = 2L; private String configKey; @@ -29,26 +35,12 @@ public class TenantConfigurationDeletedEvent extends RemoteIdEvent implements En private String configValue; /** - * Default constructor. - */ - public TenantConfigurationDeletedEvent() { - // for serialization libs like jackson - } - - /** - * - * @param tenant - * the tenant - * @param entityId - * the entity id - * @param configKey - * the config key - * @param configValue - * the config value - * @param entityClass - * the entity class - * @param applicationId - * the origin application id + * @param tenant the tenant + * @param entityId the entity id + * @param configKey the config key + * @param configValue the config value + * @param entityClass the entity class + * @param applicationId the origin application id */ public TenantConfigurationDeletedEvent(final String tenant, final Long entityId, final String configKey, final String configValue, final Class entityClass, diff --git a/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/event/EventType.java b/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/event/EventType.java index af71e0d15..508600565 100644 --- a/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/event/EventType.java +++ b/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/event/EventType.java @@ -18,6 +18,7 @@ import lombok.AccessLevel; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; +import lombok.ToString; import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent; import org.eclipse.hawkbit.repository.event.remote.DistributionSetTagDeletedEvent; import org.eclipse.hawkbit.repository.event.remote.DistributionSetTypeDeletedEvent; @@ -78,13 +79,14 @@ import org.eclipse.hawkbit.repository.event.remote.entity.TenantConfigurationUpd @NoArgsConstructor(access = AccessLevel.PUBLIC) @Getter @EqualsAndHashCode +@ToString public class EventType { private static final Map> TYPES = new HashMap<>(); /** * The associated event-type-value must remain the same as initially - * declared. Otherwise messages cannot correctly de-serialized. + * declared. Otherwise, messages cannot correctly de-serialized. */ static { // target