Refactoring/Improving source: rest (lombok) (#1613)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-04 12:26:21 +02:00
committed by GitHub
parent c320a45b55
commit 47f20886c1
33 changed files with 221 additions and 935 deletions

View File

@@ -10,6 +10,8 @@
package org.eclipse.hawkbit.mgmt.json.model.action;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.eclipse.hawkbit.mgmt.json.model.MgmtBaseEntity;
import org.eclipse.hawkbit.mgmt.json.model.MgmtMaintenanceWindow;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
@@ -21,8 +23,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
/**
* A json annotated rest model for Action to RESTful API representation.
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtAction extends MgmtBaseEntity {
@@ -31,17 +34,14 @@ public class MgmtAction extends MgmtBaseEntity {
* API definition for action in update mode.
*/
public static final String ACTION_UPDATE = "update";
/**
* API definition for action in canceling.
*/
public static final String ACTION_CANCEL = "cancel";
/**
* API definition for action completed.
*/
public static final String ACTION_FINISHED = "finished";
/**
* API definition for action still active.
*/
@@ -50,132 +50,33 @@ public class MgmtAction extends MgmtBaseEntity {
@JsonProperty("id")
@Schema(example = "7")
private Long actionId;
@JsonProperty
@Schema(example = "update")
private String type;
@JsonProperty
@Schema(example = "finished")
private String status;
@JsonProperty
@Schema(example = "finished")
private String detailStatus;
@JsonProperty
@Schema(example = "1691065903238")
private Long forceTime;
@JsonProperty(value = "forceType")
private MgmtActionType actionType;
@JsonProperty
@Schema(example = "600")
private Integer weight;
@JsonProperty
@Schema(hidden = true)
private MgmtMaintenanceWindow maintenanceWindow;
@JsonProperty
@Schema(example = "1")
private Long rollout;
@JsonProperty
@Schema(example = "rollout")
private String rolloutName;
@JsonProperty
@Schema(example = "200")
private Integer lastStatusCode;
public MgmtMaintenanceWindow getMaintenanceWindow() {
return maintenanceWindow;
}
public void setMaintenanceWindow(final MgmtMaintenanceWindow maintenanceWindow) {
this.maintenanceWindow = maintenanceWindow;
}
public Long getForceTime() {
return forceTime;
}
public void setForceTime(final Long forceTime) {
this.forceTime = forceTime;
}
public Integer getWeight() {
return weight;
}
public void setWeight(final Integer weight) {
this.weight = weight;
}
public MgmtActionType getActionType() {
return actionType;
}
public void setActionType(final MgmtActionType actionType) {
this.actionType = actionType;
}
public String getStatus() {
return status;
}
public void setStatus(final String status) {
this.status = status;
}
public Long getActionId() {
return actionId;
}
public void setActionId(final Long actionId) {
this.actionId = actionId;
}
public String getType() {
return type;
}
public void setType(final String type) {
this.type = type;
}
public Long getRollout() {
return rollout;
}
public void setRollout(final Long rollout) {
this.rollout = rollout;
}
public String getRolloutName() {
return rolloutName;
}
public void setRolloutName(final String rolloutName) {
this.rolloutName = rolloutName;
}
public String getDetailStatus() {
return detailStatus;
}
public void setDetailStatus(final String detailStatus) {
this.detailStatus = detailStatus;
}
public Integer getLastStatusCode() {
return lastStatusCode;
}
public void setLastStatusCode(final Integer lastStatusCode) {
this.lastStatusCode = lastStatusCode;
}
}
}

View File

@@ -9,25 +9,17 @@
*/
package org.eclipse.hawkbit.mgmt.json.model.action;
import lombok.Data;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* A json annotated model for Action updates in RESTful API representation.
*
*/
@Data
public class MgmtActionRequestBodyPut {
@JsonProperty(value="forceType")
private MgmtActionType actionType;
public MgmtActionType getActionType() {
return actionType;
}
public void setActionType(final MgmtActionType actionType) {
this.actionType = actionType;
}
}
}

View File

@@ -16,11 +16,12 @@ 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;
/**
* A json annotated rest model for ActionStatus to RESTful API representation.
*
*/
@Data
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtActionStatus {
@@ -28,94 +29,15 @@ public class MgmtActionStatus {
@JsonProperty("id")
@Schema(example = "21")
private Long statusId;
@JsonProperty
@Schema(example = "running")
private String type;
@JsonProperty
private List<String> messages;
@JsonProperty
@Schema(example = "1691065929524")
private Long reportedAt;
private Long reportedAt;
@JsonProperty
@Schema(example = "200")
private Integer code;
/**
* @return the statusId
*/
public Long getStatusId() {
return statusId;
}
/**
* @param statusId
* the statusId to set
*/
public void setStatusId(final Long statusId) {
this.statusId = statusId;
}
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @param type
* the type to set
*/
public void setType(final String type) {
this.type = type;
}
/**
* @return the messages
*/
public List<String> getMessages() {
return messages;
}
/**
* @param messages
* the messages to set
*/
public void setMessages(final List<String> messages) {
this.messages = messages;
}
/**
* @return the reportedAt
*/
public Long getReportedAt() {
return reportedAt;
}
/**
* @param reportedAt
* the reportedAt to set
*/
public void setReportedAt(final Long reportedAt) {
this.reportedAt = reportedAt;
}
/**
* @return the code
*/
public Integer getCode() {
return code;
}
/**
* @param code
* the reported code to set
*/
public void setCode(final Integer code) {
this.code = code;
}
}
}

View File

@@ -10,6 +10,8 @@
package org.eclipse.hawkbit.mgmt.json.model.artifact;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.eclipse.hawkbit.mgmt.json.model.MgmtBaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -21,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
/**
* A json annotated rest model for Artifact to RESTful API representation.
*/
@Data
@EqualsAndHashCode(callSuper = true)
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtArtifact extends MgmtBaseEntity {
@@ -28,84 +32,12 @@ public class MgmtArtifact extends MgmtBaseEntity {
@JsonProperty("id")
@Schema(example = "3")
private Long artifactId;
@JsonProperty
private MgmtArtifactHash hashes;
@JsonProperty
@Schema(example = "file1")
private String providedFilename;
@JsonProperty
@Schema(example = "3")
private Long size;
public MgmtArtifact() {
// need for json encoder
}
/**
* @param hashes
* the hashes to set
*/
@JsonIgnore
public void setHashes(final MgmtArtifactHash hashes) {
this.hashes = hashes;
}
/**
* @param artifactId
* the artifactId to set
*/
@JsonIgnore
public void setArtifactId(final Long artifactId) {
this.artifactId = artifactId;
}
/**
* @return the artifactId
*/
public Long getArtifactId() {
return artifactId;
}
/**
* @return the hashes
*/
public MgmtArtifactHash getHashes() {
return hashes;
}
/**
* @return the providedFilename
*/
public String getProvidedFilename() {
return providedFilename;
}
/**
* @param providedFilename
* the providedFilename to set
*/
@JsonIgnore
public void setProvidedFilename(final String providedFilename) {
this.providedFilename = providedFilename;
}
/**
* @return the size
*/
public Long getSize() {
return size;
}
/**
* @param size
* the size to set
*/
@JsonIgnore
public void setSize(final Long size) {
this.size = size;
}
}
}

View File

@@ -11,33 +11,28 @@ package org.eclipse.hawkbit.mgmt.json.model.artifact;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
/**
* Hashes for given Artifact.
*
*
*/
@NoArgsConstructor // used for jackson to instantiate
@Getter
@EqualsAndHashCode
public class MgmtArtifactHash {
@JsonProperty
@Schema(example = "2d86c2a659e364e9abba49ea6ffcd53dd5559f05")
private String sha1;
@JsonProperty
@Schema(example = "0d1b08c34858921bc7c662b228acb7ba")
private String md5;
@JsonProperty
@Schema(example = "a03b221c6c6eae7122ca51695d456d5222e524889136394944b2f9763b483615")
private String sha256;
/**
* Default constructor.
*/
public MgmtArtifactHash() {
// used for jackson to instantiate
}
/**
* Public constructor.
*/
@@ -46,17 +41,4 @@ public class MgmtArtifactHash {
this.md5 = md5;
this.sha256 = sha256;
}
public String getSha1() {
return sha1;
}
public String getMd5() {
return md5;
}
public String getSha256() {
return sha256;
}
}
}

View File

@@ -9,41 +9,14 @@
*/
package org.eclipse.hawkbit.mgmt.json.model.auth;
import lombok.Data;
/**
* A json annotated rest model for Userinfo to RESTful API representation.
*
*/
@Data
public class MgmtUserInfo {
private String username;
private String tenant;
/**
* @return Username
*/
public String getUsername() {
return username;
}
/**
* @param username Username
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @return Tenant
*/
public String getTenant() {
return tenant;
}
/**
* @param tenant Tenant
*/
public void setTenant(String tenant) {
this.tenant = tenant;
}
}

View File

@@ -14,6 +14,9 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
import java.util.Objects;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetRestApi;
import org.springframework.hateoas.RepresentationModel;
@@ -25,44 +28,23 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Representation of an Action Id as a Json Object with link to the Action
* resource
*/
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtActionId extends RepresentationModel<MgmtActionId> {
private long actionId;
public MgmtActionId() {
}
/**
* Constructor
*
* @param actionId
* the actionId
* @param controllerId
* the controller Id
* @param actionId the actionId
* @param controllerId the controller Id
*/
public MgmtActionId(final String controllerId, final long actionId) {
this.actionId = actionId;
add(linkTo(methodOn(MgmtTargetRestApi.class).getAction(controllerId, actionId)).withSelfRel().expand());
}
@JsonProperty("id")
public long getActionId() {
return actionId;
}
public void setActionId(final long actionId) {
this.actionId = actionId;
}
@Override
public boolean equals(final Object obj) {
return super.equals(obj) && this.getClass().isInstance(obj) && actionId == ((MgmtActionId) obj).getActionId();
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), actionId);
}
}
}

View File

@@ -13,24 +13,21 @@ import com.fasterxml.jackson.annotation.JsonValue;
/**
* Definition of the Action type for the REST management API.
*
*/
public enum MgmtActionType {
/**
* The soft action type.
*/
SOFT("soft"),
/**
* The forced action type.
*/
FORCED("forced"),
/**
* The time forced action type.
*/
TIMEFORCED("timeforced"),
/**
* The Download-Only action type.
*/
@@ -38,7 +35,7 @@ public enum MgmtActionType {
private final String name;
private MgmtActionType(final String name) {
MgmtActionType(final String name) {
this.name = name;
}
@@ -46,5 +43,4 @@ public enum MgmtActionType {
public String getName() {
return name;
}
}
}

View File

@@ -17,16 +17,15 @@ import com.fasterxml.jackson.annotation.JsonValue;
*
*/
public enum MgmtCancelationType {
/**
* Actions will be soft canceled.
*/
SOFT("soft"),
/**
* Actions will be force quit.
*/
FORCE("force"),
/**
* No actions will be canceled.
*/
@@ -34,7 +33,7 @@ public enum MgmtCancelationType {
private final String name;
private MgmtCancelationType(final String name) {
MgmtCancelationType(final String name) {
this.name = name;
}
@@ -42,4 +41,4 @@ public enum MgmtCancelationType {
public String getName() {
return name;
}
}
}

View File

@@ -13,6 +13,8 @@ import java.util.ArrayList;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.eclipse.hawkbit.mgmt.json.model.MgmtNamedEntity;
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
@@ -26,6 +28,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* A json annotated rest model for DistributionSet to RESTful API
* representation.
*/
@Data
@EqualsAndHashCode(callSuper = true)
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtDistributionSet extends MgmtNamedEntity {
@@ -33,109 +37,27 @@ public class MgmtDistributionSet extends MgmtNamedEntity {
@JsonProperty(value = "id", required = true)
@Schema(example = "51")
private Long dsId;
@JsonProperty
@Schema(example = "1.4.2")
private String version;
@JsonProperty
private List<MgmtSoftwareModule> modules = new ArrayList<>();
@JsonProperty
@Schema(example = "false")
private boolean requiredMigrationStep;
@JsonProperty
@Schema(example = "test_default_ds_type")
private String type;
@JsonProperty
@Schema(example = "OS (FW) mandatory, runtime (FW) and app (SW) optional")
private String typeName;
@JsonProperty
@Schema(example = "true")
private Boolean complete;
@JsonProperty
@Schema(example = "false")
private boolean deleted;
@JsonProperty
@Schema(example = "true")
private boolean valid;
public boolean isValid() {
return valid;
}
public void setValid(final boolean valid) {
this.valid = valid;
}
public boolean isDeleted() {
return deleted;
}
public void setDeleted(final boolean deleted) {
this.deleted = deleted;
}
public Long getDsId() {
return dsId;
}
@JsonIgnore
public void setDsId(final Long id) {
dsId = id;
}
public String getVersion() {
return version;
}
public void setVersion(final String version) {
this.version = version;
}
public boolean isRequiredMigrationStep() {
return requiredMigrationStep;
}
public void setRequiredMigrationStep(final boolean requiredMigrationStep) {
this.requiredMigrationStep = requiredMigrationStep;
}
public List<MgmtSoftwareModule> getModules() {
return modules;
}
public void setModules(final List<MgmtSoftwareModule> modules) {
this.modules = modules;
}
public String getType() {
return type;
}
public void setType(final String type) {
this.type = type;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(final String typeName) {
this.typeName = typeName;
}
public Boolean getComplete() {
return complete;
}
public void setComplete(final Boolean complete) {
this.complete = complete;
}
}
}

View File

@@ -12,6 +12,9 @@ package org.eclipse.hawkbit.mgmt.json.model.distributionset;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleAssigment;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -21,8 +24,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
/**
* A json annotated rest model for DistributionSet for POST.
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtDistributionSetRequestBodyPost extends MgmtDistributionSetRequestBodyPut {
@@ -32,115 +37,16 @@ public class MgmtDistributionSetRequestBodyPost extends MgmtDistributionSetReque
@JsonProperty
@Schema(hidden = true)
private MgmtSoftwareModuleAssigment os;
@JsonProperty
@Schema(hidden = true)
private MgmtSoftwareModuleAssigment runtime;
@JsonProperty
@Schema(hidden = true)
private MgmtSoftwareModuleAssigment application;
// deprecated format - END
@JsonProperty
private List<MgmtSoftwareModuleAssigment> modules;
@JsonProperty
@Schema(example = "test_default_ds_type")
private String type;
/**
* @return the os
*/
public MgmtSoftwareModuleAssigment getOs() {
return os;
}
/**
* @param os
* the os to set
*
* @return updated body
*/
public MgmtDistributionSetRequestBodyPost setOs(final MgmtSoftwareModuleAssigment os) {
this.os = os;
return this;
}
/**
* @return the runtime
*/
public MgmtSoftwareModuleAssigment getRuntime() {
return runtime;
}
/**
* @param runtime
* the runtime to set
*
* @return updated body
*/
public MgmtDistributionSetRequestBodyPost setRuntime(final MgmtSoftwareModuleAssigment runtime) {
this.runtime = runtime;
return this;
}
/**
* @return the application
*/
public MgmtSoftwareModuleAssigment getApplication() {
return application;
}
/**
* @param application
* the application to set
*
* @return updated body
*/
public MgmtDistributionSetRequestBodyPost setApplication(final MgmtSoftwareModuleAssigment application) {
this.application = application;
return this;
}
/**
* @return the modules
*/
public List<MgmtSoftwareModuleAssigment> getModules() {
return modules;
}
/**
* @param modules
* the modules to set
*
* @return updated body
*/
public MgmtDistributionSetRequestBodyPost setModules(final List<MgmtSoftwareModuleAssigment> modules) {
this.modules = modules;
return this;
}
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @param type
* the type to set
*
* @return updated body
*/
public MgmtDistributionSetRequestBodyPost setType(final String type) {
this.type = type;
return this;
}
}
}

View File

@@ -14,11 +14,14 @@ 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.experimental.Accessors;
/**
* A json annotated rest model for DistributionSet for PUT/POST.
*
*/
@Data
@Accessors(chain = true)
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtDistributionSetRequestBodyPut {
@@ -26,91 +29,13 @@ public class MgmtDistributionSetRequestBodyPut {
@JsonProperty
@Schema(example = "dsOne")
private String name;
@JsonProperty
@Schema(example = "Description of the distribution set.")
private String description;
@JsonProperty
@Schema(example = "1.0.0")
private String version;
@JsonProperty
@Schema(example = "false")
private Boolean requiredMigrationStep;
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*
* @return updated body
*/
public MgmtDistributionSetRequestBodyPut setName(final String name) {
this.name = name;
return this;
}
/**
* @return the requiredMigrationStep
*/
public Boolean isRequiredMigrationStep() {
return requiredMigrationStep;
}
/**
* @param requiredMigrationStep
* the requiredMigrationStep to set
*
* @return updated body
*/
public MgmtDistributionSetRequestBodyPut setRequiredMigrationStep(final Boolean requiredMigrationStep) {
this.requiredMigrationStep = requiredMigrationStep;
return this;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description
* the description to set
*
* @return updated body
*/
public MgmtDistributionSetRequestBodyPut setDescription(final String description) {
this.description = description;
return this;
}
/**
* @return the version
*/
public String getVersion() {
return version;
}
/**
* @param version
* the version to set
*
* @return updated body
*/
public MgmtDistributionSetRequestBodyPut setVersion(final String version) {
this.version = version;
return this;
}
}

View File

@@ -14,40 +14,32 @@ 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.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.Map;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
@EqualsAndHashCode
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtDistributionSetStatistics {
private static final String TOTAL = "total";
@JsonProperty("actions")
private Map<String, Long> totalActionsPerStatus;
@JsonProperty("rollouts")
private Map<String, Long> totalRolloutsPerStatus;
@JsonProperty
private Long totalAutoAssignments;
private MgmtDistributionSetStatistics() {
// Private constructor to enforce the use of the builder pattern
}
public Map<String, Long> getTotalActionsPerStatus() {
return totalActionsPerStatus;
}
public Map<String, Long> getTotalRolloutsPerStatus() {
return totalRolloutsPerStatus;
}
public Long getTotalAutoAssignments() {
return totalAutoAssignments;
}
public static class Builder {
private final Map<String, Long> totalActionsPerStatus;
private final Map<String, Long> totalRolloutsPerStatus;
private Long totalAutoAssignments;
@@ -100,5 +92,4 @@ public class MgmtDistributionSetStatistics {
return totalAutoAssignments;
}
}
}
}

View File

@@ -13,11 +13,14 @@ import jakarta.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* A json annotated rest model for invalidate DistributionSet requests.
*
*/
@Data
@Accessors(chain = true)
public class MgmtInvalidateDistributionSetRequestBody {
@NotNull
@@ -26,21 +29,4 @@ public class MgmtInvalidateDistributionSetRequestBody {
@JsonProperty
@Schema(example = "true")
private boolean cancelRollouts;
public MgmtCancelationType getActionCancelationType() {
return actionCancelationType;
}
public void setActionCancelationType(final MgmtCancelationType actionCancelationType) {
this.actionCancelationType = actionCancelationType;
}
public boolean isCancelRollouts() {
return cancelRollouts;
}
public void setCancelRollouts(final boolean cancelRollouts) {
this.cancelRollouts = cancelRollouts;
}
}
}

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.mgmt.json.model.distributionset;
import lombok.Data;
import lombok.experimental.Accessors;
import org.eclipse.hawkbit.mgmt.json.model.MgmtMaintenanceWindowRequestBody;
import com.fasterxml.jackson.annotation.JsonCreator;
@@ -17,8 +19,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Request Body of Target for assignment operations (ID only).
*
*/
@Data
@Accessors(chain = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtTargetAssignmentRequestBody {
@@ -32,59 +35,10 @@ public class MgmtTargetAssignmentRequestBody {
/**
* JsonCreator Constructor
*
* @param id
* Mandatory ID of the target that should be assigned
* @param id Mandatory ID of the target that should be assigned
*/
@JsonCreator
public MgmtTargetAssignmentRequestBody(@JsonProperty(required = true, value = "id") final String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setId(final String id) {
this.id = id;
}
public MgmtActionType getType() {
return type;
}
public void setType(final MgmtActionType type) {
this.type = type;
}
public long getForcetime() {
return forcetime;
}
public void setForcetime(final long forcetime) {
this.forcetime = forcetime;
}
public Integer getWeight() {
return weight;
}
public void setWeight(final Integer weight) {
this.weight = weight;
}
public MgmtMaintenanceWindowRequestBody getMaintenanceWindow() {
return maintenanceWindow;
}
public void setMaintenanceWindow(final MgmtMaintenanceWindowRequestBody maintenanceWindow) {
this.maintenanceWindow = maintenanceWindow;
}
public Boolean isConfirmationRequired() {
return confirmationRequired;
}
public void setConfirmationRequired(final boolean confirmationRequired) {
this.confirmationRequired = confirmationRequired;
}
}

View File

@@ -10,9 +10,9 @@
package org.eclipse.hawkbit.mgmt.json.model.distributionset;
import java.util.List;
import java.util.Objects;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.hateoas.RepresentationModel;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -22,10 +22,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Response Body of Target for assignment operations.
*
*
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtTargetAssignmentResponseBody extends RepresentationModel<MgmtTargetAssignmentResponseBody> {
@@ -41,21 +40,6 @@ public class MgmtTargetAssignmentResponseBody extends RepresentationModel<MgmtTa
return assignedActions == null ? 0 : assignedActions.size();
}
/**
* @return the alreadyAssigned
*/
public int getAlreadyAssigned() {
return alreadyAssigned;
}
/**
* @param alreadyAssigned
* the alreadyAssigned to set
*/
public void setAlreadyAssigned(final int alreadyAssigned) {
this.alreadyAssigned = alreadyAssigned;
}
/**
* @return the total
*/
@@ -63,31 +47,4 @@ public class MgmtTargetAssignmentResponseBody extends RepresentationModel<MgmtTa
public int getTotal() {
return getAssigned() + alreadyAssigned;
}
/**
* @return the assignedActions
*/
public List<MgmtActionId> getAssignedActions() {
return assignedActions;
}
/**
* @param assignedActions
* the assigned actions to set
*/
public void setAssignedActions(final List<MgmtActionId> assignedActions) {
this.assignedActions = assignedActions;
}
@Override
public boolean equals(final Object obj) {
return super.equals(obj) && this.getClass().isInstance(obj)
&& ((MgmtTargetAssignmentResponseBody) obj).getAlreadyAssigned() == alreadyAssigned
&& Objects.equals(((MgmtTargetAssignmentResponseBody) obj).getAssignedActions(), assignedActions);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), alreadyAssigned, assignedActions);
}
}
}