Remove unnecessary JsonProperty annotations (#2296)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.dmf.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;
|
||||
@@ -23,6 +24,10 @@ import lombok.Data;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfActionRequest {
|
||||
|
||||
@JsonProperty
|
||||
private Long actionId;
|
||||
private final Long actionId;
|
||||
|
||||
@JsonCreator
|
||||
public DmfActionRequest(@JsonProperty("actionId") final Long actionId) {
|
||||
this.actionId = actionId;
|
||||
}
|
||||
}
|
||||
@@ -9,20 +9,15 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.dmf.json.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
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 lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* JSON representation of action update status.
|
||||
@@ -35,31 +30,28 @@ public class DmfActionUpdateStatus {
|
||||
private final Long actionId;
|
||||
private final DmfActionStatus actionStatus;
|
||||
private final long timestamp;
|
||||
private final Long softwareModuleId;
|
||||
private final List<String> message;
|
||||
private final Integer code;
|
||||
|
||||
@JsonProperty
|
||||
private Long softwareModuleId;
|
||||
|
||||
@Setter(AccessLevel.NONE)
|
||||
@JsonProperty
|
||||
private List<String> message;
|
||||
|
||||
@JsonProperty
|
||||
private Integer code;
|
||||
|
||||
public DmfActionUpdateStatus(@JsonProperty(value = "actionId", required = true) final Long actionId,
|
||||
@JsonProperty(value = "actionStatus", required = true) final DmfActionStatus actionStatus, @JsonProperty(value = "timestamp") final Long timestamp) {
|
||||
@JsonCreator
|
||||
public DmfActionUpdateStatus(
|
||||
@JsonProperty(value = "actionId", required = true) final Long actionId,
|
||||
@JsonProperty(value = "actionStatus", required = true) final DmfActionStatus actionStatus,
|
||||
@JsonProperty(value = "timestamp") final Long timestamp,
|
||||
@JsonProperty("softwareModuleId") final Long softwareModuleId,
|
||||
@JsonProperty("message") final List<String> message,
|
||||
@JsonProperty("code") final Integer code) {
|
||||
this.actionId = actionId;
|
||||
this.actionStatus = actionStatus;
|
||||
this.timestamp = timestamp != null ? timestamp : System.currentTimeMillis();
|
||||
this.softwareModuleId = softwareModuleId;
|
||||
this.message = message;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public DmfActionUpdateStatus(final Long actionId, final DmfActionStatus actionStatus) {
|
||||
this(actionId, actionStatus, null);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Optional<Integer> getCode() {
|
||||
return Optional.ofNullable(code);
|
||||
this(actionId, actionStatus, null, null, null, 0);
|
||||
}
|
||||
|
||||
public List<String> getMessage() {
|
||||
@@ -69,25 +61,4 @@ public class DmfActionUpdateStatus {
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
public boolean addMessage(final String message) {
|
||||
if (this.message == null) {
|
||||
this.message = new ArrayList<>();
|
||||
}
|
||||
|
||||
return this.message.add(message);
|
||||
}
|
||||
|
||||
public boolean addMessage(final Collection<String> messages) {
|
||||
if (messages == null || messages.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (message == null) {
|
||||
message = new ArrayList<>(messages);
|
||||
return true;
|
||||
}
|
||||
|
||||
return message.addAll(messages);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.dmf.json.model;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
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;
|
||||
@@ -26,22 +27,23 @@ import lombok.Data;
|
||||
@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<String, String> urls;
|
||||
private final String filename;
|
||||
private final DmfArtifactHash hashes;
|
||||
private final long size;
|
||||
private final long lastModified;
|
||||
private final Map<String, String> urls;
|
||||
|
||||
public Map<String, String> getUrls() {
|
||||
if (urls == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableMap(urls);
|
||||
@JsonCreator
|
||||
public DmfArtifact(
|
||||
@JsonProperty("filename") final String filename,
|
||||
@JsonProperty("hashes") final DmfArtifactHash hashes,
|
||||
@JsonProperty("size") final long size,
|
||||
@JsonProperty("lastModified") final long lastModified,
|
||||
@JsonProperty("urls") final Map<String, String> urls) {
|
||||
this.filename = filename;
|
||||
this.hashes = hashes;
|
||||
this.size = size;
|
||||
this.lastModified = lastModified;
|
||||
this.urls = urls == null ? Collections.emptyMap() : Collections.unmodifiableMap(urls);
|
||||
}
|
||||
}
|
||||
@@ -19,10 +19,8 @@ import lombok.Data;
|
||||
@Data
|
||||
public class DmfArtifactHash {
|
||||
|
||||
@JsonProperty
|
||||
private String sha1;
|
||||
@JsonProperty
|
||||
private String md5;
|
||||
private final String sha1;
|
||||
private final String md5;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.dmf.json.model;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
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;
|
||||
@@ -26,9 +27,14 @@ import lombok.Data;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfAttributeUpdate {
|
||||
|
||||
@JsonProperty
|
||||
private final Map<String, String> attributes = new HashMap<>();
|
||||
private final Map<String, String> attributes;
|
||||
private final DmfUpdateMode mode;
|
||||
|
||||
@JsonProperty
|
||||
private DmfUpdateMode mode;
|
||||
@JsonCreator
|
||||
public DmfAttributeUpdate(
|
||||
@JsonProperty("attributes") final Map<String, String> attributes,
|
||||
@JsonProperty("mode") final DmfUpdateMode mode) {
|
||||
this.attributes = attributes == null ? Collections.emptyMap() : attributes;
|
||||
this.mode = mode;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.dmf.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;
|
||||
@@ -23,10 +24,17 @@ import lombok.Data;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfAutoConfirmation {
|
||||
|
||||
@JsonProperty
|
||||
private boolean enabled;
|
||||
@JsonProperty
|
||||
private String initiator;
|
||||
@JsonProperty
|
||||
private String remark;
|
||||
private final boolean enabled;
|
||||
private final String initiator;
|
||||
private final String remark;
|
||||
|
||||
@JsonCreator
|
||||
public DmfAutoConfirmation(
|
||||
@JsonProperty("enabled") final boolean enabled,
|
||||
@JsonProperty("initiator") final String initiator,
|
||||
@JsonProperty("remark") final String remark) {
|
||||
this.enabled = enabled;
|
||||
this.initiator = initiator;
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
@@ -17,78 +17,28 @@ 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.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* JSON representation of batch download and update request.
|
||||
*/
|
||||
@Data
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfBatchDownloadAndUpdateRequest {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonProperty
|
||||
private Long timestamp;
|
||||
private final Long timestamp;
|
||||
private final List<DmfTarget> targets;
|
||||
private final List<DmfSoftwareModule> softwareModules;
|
||||
|
||||
@JsonProperty
|
||||
private List<DmfTarget> targets;
|
||||
|
||||
@JsonProperty
|
||||
private List<DmfSoftwareModule> softwareModules;
|
||||
|
||||
public List<DmfSoftwareModule> getSoftwareModules() {
|
||||
if (softwareModules == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(softwareModules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Software module.
|
||||
*
|
||||
* @param createSoftwareModule the module
|
||||
*/
|
||||
public void addSoftwareModule(final DmfSoftwareModule createSoftwareModule) {
|
||||
if (softwareModules == null) {
|
||||
softwareModules = new ArrayList<>();
|
||||
}
|
||||
|
||||
softwareModules.add(createSoftwareModule);
|
||||
}
|
||||
|
||||
public List<DmfTarget> getTargets() {
|
||||
if (targets == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(targets);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Target.
|
||||
*
|
||||
* @param target the target
|
||||
*/
|
||||
public void addTarget(final DmfTarget target) {
|
||||
if (targets == null) {
|
||||
targets = new ArrayList<>();
|
||||
}
|
||||
|
||||
targets.add(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add multiple Targets.
|
||||
*
|
||||
* @param targets the target
|
||||
*/
|
||||
public void addTargets(final List<DmfTarget> targets) {
|
||||
if (this.targets == null) {
|
||||
this.targets = new ArrayList<>();
|
||||
}
|
||||
this.targets.addAll(targets);
|
||||
public DmfBatchDownloadAndUpdateRequest(
|
||||
@JsonProperty("timestamp") final Long timestamp,
|
||||
@JsonProperty("targets") final List<DmfTarget> targets,
|
||||
@JsonProperty("softwareModules") final List<DmfSoftwareModule> softwareModules) {
|
||||
this.timestamp = timestamp;
|
||||
this.targets = targets == null ? Collections.emptyList() : targets;
|
||||
this.softwareModules = softwareModules == null ? Collections.emptyList() : Collections.unmodifiableList(softwareModules);
|
||||
}
|
||||
}
|
||||
@@ -9,33 +9,41 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.dmf.json.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* JSON representation of confirm request.
|
||||
*/
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfConfirmRequest extends DmfActionRequest {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonProperty
|
||||
private String targetSecurityToken;
|
||||
private final String targetSecurityToken;
|
||||
private final List<DmfSoftwareModule> softwareModules;
|
||||
|
||||
@JsonProperty
|
||||
private List<DmfSoftwareModule> softwareModules;
|
||||
@JsonCreator
|
||||
public DmfConfirmRequest(
|
||||
@JsonProperty("actionId") final Long actionId,
|
||||
@JsonProperty("targetSecurityToken") final String targetSecurityToken,
|
||||
@JsonProperty("softwareModules") final List<DmfSoftwareModule> softwareModules) {
|
||||
super(actionId);
|
||||
this.targetSecurityToken = targetSecurityToken;
|
||||
this.softwareModules = softwareModules;
|
||||
}
|
||||
|
||||
public List<DmfSoftwareModule> getSoftwareModules() {
|
||||
if (softwareModules == null) {
|
||||
@@ -44,18 +52,4 @@ public class DmfConfirmRequest extends DmfActionRequest {
|
||||
|
||||
return Collections.unmodifiableList(softwareModules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Software module.
|
||||
*
|
||||
* @param createSoftwareModule the module
|
||||
*/
|
||||
public void addSoftwareModule(final DmfSoftwareModule createSoftwareModule) {
|
||||
if (softwareModules == null) {
|
||||
softwareModules = new ArrayList<>();
|
||||
}
|
||||
|
||||
softwareModules.add(createSoftwareModule);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.dmf.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;
|
||||
@@ -23,12 +24,17 @@ import lombok.Data;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfCreateThing {
|
||||
|
||||
@JsonProperty
|
||||
private String name;
|
||||
private final String name;
|
||||
private final String type;
|
||||
private final DmfAttributeUpdate attributeUpdate;
|
||||
|
||||
@JsonProperty
|
||||
private String type;
|
||||
|
||||
@JsonProperty
|
||||
private DmfAttributeUpdate attributeUpdate;
|
||||
@JsonCreator
|
||||
public DmfCreateThing(
|
||||
@JsonProperty("name") final String name,
|
||||
@JsonProperty("type") final String type,
|
||||
@JsonProperty("attributeUpdate") final DmfAttributeUpdate attributeUpdate) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.attributeUpdate = attributeUpdate;
|
||||
}
|
||||
}
|
||||
@@ -13,43 +13,35 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
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 lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* JSON representation of download and update request.
|
||||
*/
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfDownloadAndUpdateRequest extends DmfActionRequest {
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@JsonProperty
|
||||
private String targetSecurityToken;
|
||||
private final String targetSecurityToken;
|
||||
private final List<DmfSoftwareModule> softwareModules;
|
||||
|
||||
@JsonProperty
|
||||
private List<DmfSoftwareModule> softwareModules;
|
||||
|
||||
public List<DmfSoftwareModule> getSoftwareModules() {
|
||||
if (softwareModules == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(softwareModules);
|
||||
}
|
||||
|
||||
public void addSoftwareModule(final DmfSoftwareModule createSoftwareModule) {
|
||||
if (softwareModules == null) {
|
||||
softwareModules = new ArrayList<>();
|
||||
}
|
||||
|
||||
softwareModules.add(createSoftwareModule);
|
||||
@JsonCreator
|
||||
public DmfDownloadAndUpdateRequest(
|
||||
@JsonProperty("actionId") final Long actionId,
|
||||
@JsonProperty("targetSecurityToken") final String targetSecurityToken,
|
||||
@JsonProperty("softwareModules") final List<DmfSoftwareModule> softwareModules) {
|
||||
super(actionId);
|
||||
this.targetSecurityToken = targetSecurityToken;
|
||||
this.softwareModules = softwareModules == null ? Collections.emptyList() : Collections.unmodifiableList(softwareModules);
|
||||
}
|
||||
}
|
||||
@@ -24,10 +24,7 @@ import lombok.Data;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfMetadata {
|
||||
|
||||
@JsonProperty
|
||||
private final String key;
|
||||
|
||||
@JsonProperty
|
||||
private final String value;
|
||||
|
||||
@JsonCreator
|
||||
|
||||
@@ -22,18 +22,16 @@ import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
|
||||
|
||||
/**
|
||||
* JSON representation of a multi-action request.
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfMultiActionRequest {
|
||||
|
||||
private List<DmfMultiActionElement> elements;
|
||||
private final List<DmfMultiActionElement> elements;
|
||||
|
||||
@JsonCreator
|
||||
public DmfMultiActionRequest(final List<DmfMultiActionElement> elements) {
|
||||
@@ -45,41 +43,28 @@ public class DmfMultiActionRequest {
|
||||
return elements;
|
||||
}
|
||||
|
||||
public void addElement(final DmfMultiActionElement element) {
|
||||
if (elements == null) {
|
||||
elements = new ArrayList<>();
|
||||
}
|
||||
elements.add(element);
|
||||
}
|
||||
|
||||
public void addElement(final EventTopic topic, final DmfActionRequest action, final int weight) {
|
||||
final DmfMultiActionElement element = new DmfMultiActionElement();
|
||||
element.setTopic(topic);
|
||||
element.setAction(action);
|
||||
element.setWeight(weight);
|
||||
addElement(element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an element within a {@link DmfMultiActionRequest}.
|
||||
*/
|
||||
@Data
|
||||
public static class DmfMultiActionElement {
|
||||
|
||||
@JsonProperty
|
||||
private EventTopic topic;
|
||||
private final EventTopic topic;
|
||||
private final DmfActionRequest action;
|
||||
private final int weight;
|
||||
|
||||
@JsonProperty
|
||||
private DmfActionRequest action;
|
||||
|
||||
@JsonProperty
|
||||
private int weight;
|
||||
|
||||
@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) {
|
||||
@JsonCreator
|
||||
public DmfMultiActionElement(
|
||||
@JsonProperty("topic") final EventTopic topic,
|
||||
@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") })
|
||||
@JsonProperty("action") final DmfActionRequest action,
|
||||
@JsonProperty("weight") final int weight) {
|
||||
this.topic = topic;
|
||||
this.action = action;
|
||||
this.weight = weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.dmf.json.model;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
@@ -26,30 +27,26 @@ import lombok.Data;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfSoftwareModule {
|
||||
|
||||
@JsonProperty
|
||||
private Long moduleId;
|
||||
@JsonProperty
|
||||
private String moduleType;
|
||||
@JsonProperty
|
||||
private String moduleVersion;
|
||||
@JsonProperty
|
||||
private Boolean encrypted;
|
||||
@JsonProperty
|
||||
private List<DmfArtifact> artifacts;
|
||||
@JsonProperty
|
||||
private List<DmfMetadata> metadata;
|
||||
private final Long moduleId;
|
||||
private final String moduleType;
|
||||
private final String moduleVersion;
|
||||
private final Boolean encrypted;
|
||||
private final List<DmfArtifact> artifacts;
|
||||
private final List<DmfMetadata> metadata;
|
||||
|
||||
public List<DmfArtifact> getArtifacts() {
|
||||
if (artifacts == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(artifacts);
|
||||
}
|
||||
|
||||
public void setMetadata(final List<DmfMetadata> metadata) {
|
||||
if (metadata != null && !metadata.isEmpty()) {
|
||||
this.metadata = metadata;
|
||||
}
|
||||
@JsonCreator
|
||||
public DmfSoftwareModule(
|
||||
@JsonProperty("moduleId") final Long moduleId,
|
||||
@JsonProperty("moduleType") final String moduleType,
|
||||
@JsonProperty("moduleVersion") final String moduleVersion,
|
||||
@JsonProperty("encrypted") final Boolean encrypted,
|
||||
@JsonProperty("artifacts") final List<DmfArtifact> artifacts,
|
||||
@JsonProperty("metadata") final List<DmfMetadata> metadata) {
|
||||
this.moduleId = moduleId;
|
||||
this.moduleType = moduleType;
|
||||
this.moduleVersion = moduleVersion;
|
||||
this.encrypted = encrypted;
|
||||
this.artifacts = artifacts == null ? Collections.emptyList() : Collections.unmodifiableList(artifacts);
|
||||
this.metadata = metadata == null || metadata.isEmpty() ? null : metadata;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.dmf.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;
|
||||
@@ -24,11 +25,18 @@ import lombok.ToString;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DmfTarget {
|
||||
|
||||
@JsonProperty
|
||||
private Long actionId;
|
||||
@JsonProperty
|
||||
private String controllerId;
|
||||
private final Long actionId;
|
||||
private final String controllerId;
|
||||
@ToString.Exclude
|
||||
@JsonProperty
|
||||
private String targetSecurityToken;
|
||||
private final String targetSecurityToken;
|
||||
|
||||
@JsonCreator
|
||||
public DmfTarget(
|
||||
@JsonProperty("actionId") final Long actionId,
|
||||
@JsonProperty("controllerId") final String controllerId,
|
||||
@JsonProperty("targetSecurityToken") final String targetSecurityToken) {
|
||||
this.actionId = actionId;
|
||||
this.controllerId = controllerId;
|
||||
this.targetSecurityToken = targetSecurityToken;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user