Remove unnecessary JsonProperty annotations (#2296)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -71,5 +71,4 @@ public class DdiActionFeedback {
|
||||
public DdiActionFeedback(final DdiStatus status) {
|
||||
this(status, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,8 +16,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.Data;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
|
||||
/**
|
||||
@@ -30,31 +29,28 @@ import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
* </ol>
|
||||
* that were sent to server earlier by the controller using {@link DdiActionFeedback}.
|
||||
*/
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonPropertyOrder({ "status", "messages" })
|
||||
public class DdiActionHistory {
|
||||
|
||||
@JsonProperty("status")
|
||||
@Schema(description = "Status of the deployment based on previous feedback by the device", example = "RUNNING")
|
||||
private final String actionStatus;
|
||||
private final String status;
|
||||
|
||||
@JsonProperty("messages")
|
||||
@Schema(description = "Messages are previously sent to the feedback channel in LIFO order by the device. Note: The first status message is set by the system and describes the trigger of the deployment")
|
||||
private final List<String> messages;
|
||||
|
||||
/**
|
||||
* Parameterized constructor for creating {@link DdiActionHistory}.
|
||||
*
|
||||
* @param actionStatus is the current action status at the server
|
||||
* @param status is the current action status at the server
|
||||
* @param messages is a list of messages retrieved from action history.
|
||||
*/
|
||||
@JsonCreator
|
||||
public DdiActionHistory(
|
||||
@JsonProperty("status") final String actionStatus,
|
||||
@JsonProperty("messages") List<String> messages) {
|
||||
this.actionStatus = actionStatus;
|
||||
@JsonProperty("status") final String status,
|
||||
@JsonProperty("messages") final List<String> messages) {
|
||||
this.status = status;
|
||||
this.messages = messages;
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,10 @@ import lombok.Data;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DdiActivateAutoConfirmation {
|
||||
|
||||
@JsonProperty
|
||||
@Schema(description = "Individual value (e.g. username) stored as initiator and automatically used as confirmed" +
|
||||
" user in future actions", example = "exampleUser")
|
||||
private final String initiator;
|
||||
|
||||
@JsonProperty
|
||||
@Schema(description = "Individual value to attach a remark which will be persisted when automatically " +
|
||||
"confirming future actions", example = "exampleRemark")
|
||||
private final String remark;
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -59,15 +60,22 @@ import org.springframework.hateoas.RepresentationModel;
|
||||
public class DdiArtifact extends RepresentationModel<DdiArtifact> {
|
||||
|
||||
@NotNull
|
||||
@JsonProperty
|
||||
@Schema(description = "File name", example = "binary.tgz")
|
||||
private String filename;
|
||||
private final String filename;
|
||||
|
||||
@JsonProperty
|
||||
@Schema(description = "Artifact hashes")
|
||||
private DdiArtifactHash hashes;
|
||||
private final DdiArtifactHash hashes;
|
||||
|
||||
@JsonProperty
|
||||
@Schema(description = "Artifact size", example = "3")
|
||||
private Long size;
|
||||
private final Long size;
|
||||
|
||||
@JsonCreator
|
||||
public DdiArtifact(
|
||||
@JsonProperty("filename") final String filename,
|
||||
@JsonProperty("hashes") final DdiArtifactHash hashes,
|
||||
@JsonProperty("size") final Long size) {
|
||||
this.filename = filename;
|
||||
this.hashes = hashes;
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
@@ -9,38 +9,30 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Hashes for given Artifact
|
||||
*/
|
||||
@NoArgsConstructor // needed for json create
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DdiArtifactHash {
|
||||
|
||||
@JsonProperty
|
||||
@Schema(description = "SHA1 hash of the artifact in Base 16 format", example = "2d86c2a659e364e9abba49ea6ffcd53dd5559f05")
|
||||
private String sha1;
|
||||
private final String sha1;
|
||||
|
||||
@JsonProperty
|
||||
@Schema(description = "MD5 hash of the artifact", example = "0d1b08c34858921bc7c662b228acb7ba")
|
||||
private String md5;
|
||||
private final String md5;
|
||||
|
||||
@JsonProperty
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@Schema(description = "SHA-256 hash of the artifact in Base 16 format", example = "a03b221c6c6eae7122ca51695d456d5222e524889136394944b2f9763b483615")
|
||||
private String sha256;
|
||||
private final String sha256;
|
||||
|
||||
/**
|
||||
* Public constructor.
|
||||
@@ -49,7 +41,11 @@ public class DdiArtifactHash {
|
||||
* @param md5 md5 hash of the artifact
|
||||
* @param sha256 sha256 hash of the artifact
|
||||
*/
|
||||
public DdiArtifactHash(final String sha1, final String md5, final String sha256) {
|
||||
@JsonCreator
|
||||
public DdiArtifactHash(
|
||||
@JsonProperty("sha1") final String sha1,
|
||||
@JsonProperty("md5") final String md5,
|
||||
@JsonProperty ("sha256") final String sha256) {
|
||||
this.sha1 = sha1;
|
||||
this.md5 = md5;
|
||||
this.sha256 = sha256;
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Allow a target to declare running distribution set version
|
||||
@@ -41,9 +42,4 @@ public class DdiAssignedVersion {
|
||||
this.name = name;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DdiInstalledVersion{" + "name='" + name + '\'' + ", version='" + version + '\'' + '}';
|
||||
}
|
||||
}
|
||||
@@ -11,17 +11,17 @@ package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
||||
@NoArgsConstructor // needed for json create
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@@ -32,25 +32,26 @@ public class DdiAutoConfirmationState extends RepresentationModel<DdiAutoConfirm
|
||||
|
||||
@NotNull
|
||||
@Schema(example = "true")
|
||||
private boolean active;
|
||||
private final boolean active;
|
||||
|
||||
@Schema(example = "exampleUserId")
|
||||
private String initiator;
|
||||
private final String initiator;
|
||||
|
||||
@Schema(example = "exampleRemark")
|
||||
private String remark;
|
||||
private final String remark;
|
||||
|
||||
@Schema(example = "1691065895439")
|
||||
private Long activatedAt;
|
||||
private final Long activatedAt;
|
||||
|
||||
public static DdiAutoConfirmationState active(final long activatedAt) {
|
||||
final DdiAutoConfirmationState state = new DdiAutoConfirmationState();
|
||||
state.setActive(true);
|
||||
state.setActivatedAt(activatedAt);
|
||||
return state;
|
||||
}
|
||||
|
||||
public static DdiAutoConfirmationState disabled() {
|
||||
return new DdiAutoConfirmationState();
|
||||
@JsonCreator
|
||||
public DdiAutoConfirmationState(
|
||||
@JsonProperty("active") final boolean active,
|
||||
@JsonProperty("initiator") final String initiator,
|
||||
@JsonProperty("remark") final String remark,
|
||||
@JsonProperty("activatedAt") final Long activatedAt) {
|
||||
this.active = active;
|
||||
this.initiator = initiator;
|
||||
this.remark = remark;
|
||||
this.activatedAt = activatedAt;
|
||||
}
|
||||
}
|
||||
@@ -14,54 +14,43 @@ import java.util.List;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Deployment chunks.
|
||||
*/
|
||||
@NoArgsConstructor // needed for json create
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DdiChunk {
|
||||
|
||||
@JsonProperty("part")
|
||||
@NotNull
|
||||
@Schema(description = "Type of the chunk, e.g. firmware, bundle, app. In update server mapped to Software Module Type")
|
||||
private String part;
|
||||
private final String part;
|
||||
|
||||
@JsonProperty("version")
|
||||
@NotNull
|
||||
@Schema(description = "Software version of the chunk", example = "1.2.0")
|
||||
private String version;
|
||||
private final String version;
|
||||
|
||||
@JsonProperty("name")
|
||||
@NotNull
|
||||
@Schema(description = "Name of the chunk")
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
@JsonProperty("encrypted")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(description = "If encrypted")
|
||||
private Boolean encrypted;
|
||||
private final Boolean encrypted;
|
||||
|
||||
@JsonProperty("artifacts")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(description = "List of artifacts")
|
||||
private List<DdiArtifact> artifacts;
|
||||
private final List<DdiArtifact> artifacts;
|
||||
|
||||
@JsonProperty("metadata")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(description = "Meta data of the respective software module that has been marked with 'target visible'")
|
||||
private List<DdiMetadata> metadata;
|
||||
private final List<DdiMetadata> metadata;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -73,9 +62,14 @@ public class DdiChunk {
|
||||
* @param artifacts download information
|
||||
* @param metadata optional as additional information for the target/device
|
||||
*/
|
||||
@JsonCreator
|
||||
public DdiChunk(
|
||||
final String part, final String version, final String name, final Boolean encrypted,
|
||||
final List<DdiArtifact> artifacts, final List<DdiMetadata> metadata) {
|
||||
@JsonProperty("part") final String part,
|
||||
@JsonProperty("version") final String version,
|
||||
@JsonProperty("name") final String name,
|
||||
@JsonProperty("encrypted") final Boolean encrypted,
|
||||
@JsonProperty("artifacts") final List<DdiArtifact> artifacts,
|
||||
@JsonProperty("metadata") final List<DdiMetadata> metadata) {
|
||||
this.part = part;
|
||||
this.version = version;
|
||||
this.name = name;
|
||||
|
||||
@@ -9,37 +9,32 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Standard configuration for the target.
|
||||
*/
|
||||
@NoArgsConstructor // needed for json deserialization
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
@Data
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Schema(description = "DDI controller configuration")
|
||||
public class DdiConfig {
|
||||
|
||||
@JsonProperty
|
||||
private DdiPolling polling;
|
||||
private final DdiPolling polling;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param polling configuration of the polling for the target
|
||||
*/
|
||||
public DdiConfig(final DdiPolling polling) {
|
||||
@JsonCreator
|
||||
public DdiConfig(@JsonProperty("polling") final DdiPolling polling) {
|
||||
this.polling = polling;
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,13 @@ package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
||||
@@ -25,8 +25,7 @@ import org.springframework.hateoas.RepresentationModel;
|
||||
* Confirmation base response.
|
||||
* Set order to place links at last.
|
||||
*/
|
||||
@NoArgsConstructor // needed for json create
|
||||
@Getter
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@@ -54,11 +53,12 @@ import org.springframework.hateoas.RepresentationModel;
|
||||
}""")
|
||||
public class DdiConfirmationBase extends RepresentationModel<DdiConfirmationBase> {
|
||||
|
||||
@JsonProperty("autoConfirm")
|
||||
@NotNull
|
||||
private DdiAutoConfirmationState autoConfirm;
|
||||
private final DdiAutoConfirmationState autoConfirm;
|
||||
|
||||
public DdiConfirmationBase(final DdiAutoConfirmationState autoConfirmState) {
|
||||
this.autoConfirm = autoConfirmState;
|
||||
@JsonCreator
|
||||
public DdiConfirmationBase(
|
||||
@JsonProperty(value = "autoConfirm", required = true) final DdiAutoConfirmationState autoConfirm) {
|
||||
this.autoConfirm = autoConfirm;
|
||||
}
|
||||
}
|
||||
@@ -11,22 +11,22 @@ package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
||||
/**
|
||||
* Update action resource.
|
||||
*/
|
||||
@NoArgsConstructor // needed for json create
|
||||
@Getter
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@@ -201,27 +201,23 @@ import org.springframework.hateoas.RepresentationModel;
|
||||
}""")
|
||||
public class DdiConfirmationBaseAction extends RepresentationModel<DdiConfirmationBaseAction> {
|
||||
|
||||
@JsonProperty("id")
|
||||
@NotNull
|
||||
@Schema(description = "Id of the action", example = "6")
|
||||
private String id;
|
||||
private final String id;
|
||||
|
||||
@JsonProperty("confirmation")
|
||||
@NotNull
|
||||
@Schema(description = "Deployment confirmation operation")
|
||||
private DdiDeployment confirmation;
|
||||
private final DdiDeployment confirmation;
|
||||
|
||||
/**
|
||||
* Action history containing current action status and a list of feedback
|
||||
* messages received earlier from the controller.
|
||||
* Action history containing current action status and a list of feedback messages received earlier from the controller.
|
||||
*/
|
||||
@JsonProperty("actionHistory")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(description = """
|
||||
(Optional) GET parameter to retrieve a given number of messages which are previously
|
||||
provided by the device. Useful if the devices sent state information to the feedback channel and never
|
||||
stored them locally""")
|
||||
private DdiActionHistory actionHistory;
|
||||
private final DdiActionHistory actionHistory;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -230,7 +226,11 @@ public class DdiConfirmationBaseAction extends RepresentationModel<DdiConfirmati
|
||||
* @param confirmation chunk details
|
||||
* @param actionHistory containing current action status and a list of feedback messages received earlier from the controller.
|
||||
*/
|
||||
public DdiConfirmationBaseAction(final String id, final DdiDeployment confirmation, final DdiActionHistory actionHistory) {
|
||||
@JsonCreator
|
||||
public DdiConfirmationBaseAction(
|
||||
@JsonProperty(value = "id", required = true) @NonNull final String id,
|
||||
@JsonProperty(value = "confirmation", required = true) @NonNull final DdiDeployment confirmation,
|
||||
@JsonProperty("actionHistory") final DdiActionHistory actionHistory) {
|
||||
this.id = id;
|
||||
this.confirmation = confirmation;
|
||||
this.actionHistory = actionHistory;
|
||||
|
||||
@@ -9,22 +9,21 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
||||
/**
|
||||
* {@link DdiControllerBase} resource content.
|
||||
*/
|
||||
@NoArgsConstructor // needed for json deserialization
|
||||
@Getter
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@@ -56,15 +55,15 @@ import org.springframework.hateoas.RepresentationModel;
|
||||
}""")
|
||||
public class DdiControllerBase extends RepresentationModel<DdiControllerBase> {
|
||||
|
||||
@JsonProperty
|
||||
private DdiConfig config;
|
||||
private final DdiConfig config;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param config configuration of the SP target
|
||||
*/
|
||||
public DdiControllerBase(final DdiConfig config) {
|
||||
@JsonCreator
|
||||
public DdiControllerBase(@JsonProperty("config") final DdiConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
}
|
||||
@@ -14,23 +14,18 @@ import java.util.List;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Detailed update action information.
|
||||
*/
|
||||
@NoArgsConstructor // needed for json create
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DdiDeployment {
|
||||
@@ -38,22 +33,21 @@ public class DdiDeployment {
|
||||
@Schema(description = """
|
||||
Handling for the download part of the provisioning process ('skip': do not download yet, 'attempt': server asks
|
||||
to download, 'forced': server requests immediate download)""")
|
||||
private HandlingType download;
|
||||
private final HandlingType download;
|
||||
|
||||
@Schema(description = """
|
||||
Handling for the update part of the provisioning process ('skip': do not update yet,
|
||||
'attempt': server asks to update, 'forced': server requests immediate update)""")
|
||||
private HandlingType update;
|
||||
private final HandlingType update;
|
||||
|
||||
@JsonProperty("chunks")
|
||||
@NotNull
|
||||
@Schema(description = "Software chunks of an update. In server mapped by Software Module")
|
||||
private List<DdiChunk> chunks;
|
||||
private final List<DdiChunk> chunks;
|
||||
|
||||
@Schema(description = """
|
||||
Separation of download and installation by defining a maintenance window for the installation. Status shows if
|
||||
currently in a window""")
|
||||
private DdiMaintenanceWindowStatus maintenanceWindow;
|
||||
private final DdiMaintenanceWindowStatus maintenanceWindow;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -66,9 +60,12 @@ public class DdiDeployment {
|
||||
* and the update can progress) or 'unavailable' (implying that maintenance window is not available now and update should not
|
||||
* be attempted). If there is no maintenance schedule defined, the parameter is null.
|
||||
*/
|
||||
@JsonCreator
|
||||
public DdiDeployment(
|
||||
final HandlingType download, final HandlingType update, final List<DdiChunk> chunks,
|
||||
final DdiMaintenanceWindowStatus maintenanceWindow) {
|
||||
@JsonProperty("download") final HandlingType download,
|
||||
@JsonProperty("update") final HandlingType update,
|
||||
@JsonProperty(value = "chunks", required = true) final List<DdiChunk> chunks,
|
||||
@JsonProperty("maintenanceWindow") final DdiMaintenanceWindowStatus maintenanceWindow) {
|
||||
this.download = download;
|
||||
this.update = update;
|
||||
this.chunks = chunks;
|
||||
|
||||
@@ -11,22 +11,21 @@ package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
|
||||
/**
|
||||
* Update action resource.
|
||||
*/
|
||||
@NoArgsConstructor // needed for json create
|
||||
@Getter
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@@ -198,24 +197,21 @@ import org.springframework.hateoas.RepresentationModel;
|
||||
}""")
|
||||
public class DdiDeploymentBase extends RepresentationModel<DdiDeploymentBase> {
|
||||
|
||||
@JsonProperty("id")
|
||||
@NotNull
|
||||
@Schema(description = "Id of the action", example = "8")
|
||||
private String id;
|
||||
private final String id;
|
||||
|
||||
@JsonProperty("deployment")
|
||||
@NotNull
|
||||
@Schema(description = "Detailed deployment operation")
|
||||
private DdiDeployment deployment;
|
||||
private final DdiDeployment deployment;
|
||||
|
||||
/**
|
||||
* Action history containing current action status and a list of feedback
|
||||
* messages received earlier from the controller.
|
||||
*/
|
||||
@JsonProperty("actionHistory")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(description = "Current deployment state")
|
||||
private DdiActionHistory actionHistory;
|
||||
private final DdiActionHistory actionHistory;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -224,7 +220,11 @@ public class DdiDeploymentBase extends RepresentationModel<DdiDeploymentBase> {
|
||||
* @param deployment details
|
||||
* @param actionHistory containing current action status and a list of feedback messages received earlier from the controller.
|
||||
*/
|
||||
public DdiDeploymentBase(final String id, final DdiDeployment deployment, final DdiActionHistory actionHistory) {
|
||||
@JsonCreator
|
||||
public DdiDeploymentBase(
|
||||
@JsonProperty(value = "id", required = true) final String id,
|
||||
@JsonProperty(value = "deployment", required = true) final DdiDeployment deployment,
|
||||
@JsonProperty("actionHistory") final DdiActionHistory actionHistory) {
|
||||
this.id = id;
|
||||
this.deployment = deployment;
|
||||
this.actionHistory = actionHistory;
|
||||
|
||||
@@ -24,12 +24,10 @@ import lombok.Data;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DdiMetadata {
|
||||
|
||||
@JsonProperty
|
||||
@NotNull
|
||||
@Schema(description = "Key of meta data entry")
|
||||
private final String key;
|
||||
|
||||
@JsonProperty
|
||||
@NotNull
|
||||
@Schema(description = "Value of meta data entry")
|
||||
private final String value;
|
||||
|
||||
@@ -9,38 +9,33 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Polling interval for the SP target.
|
||||
*/
|
||||
@NoArgsConstructor // needed for json create
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
@Data
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Schema(description = "Suggested sleep time between polls")
|
||||
public class DdiPolling {
|
||||
|
||||
@JsonProperty
|
||||
@Schema(description = "Sleep time in HH:MM:SS notation", pattern = "HH:MM:SS", example = "12:00:00")
|
||||
private String sleep;
|
||||
private final String sleep;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param sleep between polls
|
||||
*/
|
||||
public DdiPolling(final String sleep) {
|
||||
@JsonCreator
|
||||
public DdiPolling(@JsonProperty("sleep") final String sleep) {
|
||||
this.sleep = sleep;
|
||||
}
|
||||
}
|
||||
@@ -39,10 +39,7 @@ class DdiArtifactTest {
|
||||
final DdiArtifactHash hashes = new DdiArtifactHash("123", "456", "789");
|
||||
final Long size = 12345L;
|
||||
|
||||
final DdiArtifact ddiArtifact = new DdiArtifact();
|
||||
ddiArtifact.setFilename(filename);
|
||||
ddiArtifact.setHashes(hashes);
|
||||
ddiArtifact.setSize(size);
|
||||
final DdiArtifact ddiArtifact = new DdiArtifact(filename, hashes, size);
|
||||
|
||||
// Test
|
||||
final String serializedDdiArtifact = OBJECT_MAPPER.writeValueAsString(ddiArtifact);
|
||||
|
||||
Reference in New Issue
Block a user