diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtBaseEntity.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtBaseEntity.java index 3f5c2be7e..73f5d4bb5 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtBaseEntity.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtBaseEntity.java @@ -10,6 +10,8 @@ package org.eclipse.hawkbit.mgmt.json.model; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.springframework.hateoas.Link; import org.springframework.hateoas.RepresentationModel; @@ -18,22 +20,20 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** * A json annotated rest model for BaseEntity to RESTful API representation. - * */ +@Data +@EqualsAndHashCode(callSuper = true) public abstract class MgmtBaseEntity extends RepresentationModel { @JsonProperty @Schema(example = "bumlux") private String createdBy; - @JsonProperty @Schema(example = "1691065905897") private Long createdAt; - @JsonProperty @Schema(example = "bumlux") private String lastModifiedBy; - @JsonProperty @Schema(example = "1691065906407") private Long lastModifiedAt; @@ -48,32 +48,13 @@ public abstract class MgmtBaseEntity extends RepresentationModel return this.getRequiredLink("self"); } - /** - * @return the createdBy - */ - public String getCreatedBy() { - return createdBy; - } - - /** - * @param createdBy - * the createdBy to set - */ @JsonIgnore public void setCreatedBy(final String createdBy) { this.createdBy = createdBy; } /** - * @return the createdAt - */ - public Long getCreatedAt() { - return createdAt; - } - - /** - * @param createdAt - * the createdAt to set + * @param createdAt the createdAt to set */ @JsonIgnore public void setCreatedAt(final Long createdAt) { @@ -81,28 +62,13 @@ public abstract class MgmtBaseEntity extends RepresentationModel } /** - * @return the lastModifiedBy - */ - public String getLastModifiedBy() { - return lastModifiedBy; - } - - /** - * @param lastModifiedBy - * the lastModifiedBy to set + * @param lastModifiedBy the lastModifiedBy to set */ @JsonIgnore public void setLastModifiedBy(final String lastModifiedBy) { this.lastModifiedBy = lastModifiedBy; } - /** - * @return the lastModifiedAt - */ - public Long getLastModifiedAt() { - return lastModifiedAt; - } - /** * @param lastModifiedAt * the lastModifiedAt to set @@ -111,4 +77,4 @@ public abstract class MgmtBaseEntity extends RepresentationModel public void setLastModifiedAt(final Long lastModifiedAt) { this.lastModifiedAt = lastModifiedAt; } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtNamedEntity.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtNamedEntity.java index e404051ed..b9affdd45 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtNamedEntity.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/MgmtNamedEntity.java @@ -11,49 +11,20 @@ package org.eclipse.hawkbit.mgmt.json.model; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; /** * A json annotated rest model for NamedEntity to RESTful API representation. - * */ +@Data +@EqualsAndHashCode(callSuper = true) public abstract class MgmtNamedEntity extends MgmtBaseEntity { @JsonProperty(required = true) @Schema(example = "Name of entity") private String name; - @JsonProperty @Schema(example = "Description of entity") private String description; - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - */ - public void setName(final String name) { - this.name = name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description - * the description to set - */ - public void setDescription(final String description) { - this.description = description; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtActionId.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtActionId.java index 34f45ea1f..fe3fbf40b 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtActionId.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionset/MgmtActionId.java @@ -35,6 +35,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtActionId extends RepresentationModel { + @JsonProperty("id") private long actionId; /** diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetType.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetType.java index 00af27af3..100253e88 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetType.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetType.java @@ -15,12 +15,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; +import lombok.EqualsAndHashCode; import org.eclipse.hawkbit.mgmt.json.model.MgmtTypeEntity; /** * A json annotated rest model for SoftwareModuleType to RESTful API * representation. */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtDistributionSetType extends MgmtTypeEntity { @@ -28,19 +32,4 @@ public class MgmtDistributionSetType extends MgmtTypeEntity { @JsonProperty(value = "id", required = true) @Schema(example = "99") private Long moduleId; - - /** - * @return the moduleId - */ - public Long getModuleId() { - return moduleId; - } - - /** - * @param moduleId - * the moduleId to set - */ - public void setModuleId(final Long moduleId) { - this.moduleId = moduleId; - } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetTypeRequestBodyPost.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetTypeRequestBodyPost.java index 8119eb506..db45d2810 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetTypeRequestBodyPost.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetTypeRequestBodyPost.java @@ -12,27 +12,29 @@ package org.eclipse.hawkbit.mgmt.json.model.distributionsettype; 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.softwaremoduletype.MgmtSoftwareModuleTypeAssigment; import com.fasterxml.jackson.annotation.JsonProperty; /** * Request Body for DistributionSetType POST. - * */ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) public class MgmtDistributionSetTypeRequestBodyPost extends MgmtDistributionSetTypeRequestBodyPut { @JsonProperty(required = true) @Schema(example = "Example type name") private String name; - @JsonProperty(required = true) @Schema(example = "Example key") private String key; - @JsonProperty private List mandatorymodules; - @JsonProperty private List optionalmodules; @@ -47,79 +49,4 @@ public class MgmtDistributionSetTypeRequestBodyPost extends MgmtDistributionSetT super.setColour(colour); return this; } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - * - * @return updated body - */ - public MgmtDistributionSetTypeRequestBodyPost setName(final String name) { - this.name = name; - return this; - } - - /** - * @return the key - */ - public String getKey() { - return key; - } - - /** - * @param key - * the key to set - * - * @return updated body - */ - public MgmtDistributionSetTypeRequestBodyPost setKey(final String key) { - this.key = key; - return this; - } - - /** - * @return the mandatory modules - */ - public List getMandatorymodules() { - return mandatorymodules; - } - - /** - * @param mandatorymodules - * the mandatory modules to set - * - * @return updated body - */ - public MgmtDistributionSetTypeRequestBodyPost setMandatorymodules( - final List mandatorymodules) { - this.mandatorymodules = mandatorymodules; - return this; - } - - /** - * @return the optional modules - */ - public List getOptionalmodules() { - return optionalmodules; - } - - /** - * @param optionalmodules - * the optional modules to set - * - * @return updated body - */ - public MgmtDistributionSetTypeRequestBodyPost setOptionalmodules( - final List optionalmodules) { - this.optionalmodules = optionalmodules; - return this; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetTypeRequestBodyPut.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetTypeRequestBodyPut.java index 3ac0247df..f0fcd8045 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetTypeRequestBodyPut.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/distributionsettype/MgmtDistributionSetTypeRequestBodyPut.java @@ -11,37 +11,20 @@ package org.eclipse.hawkbit.mgmt.json.model.distributionsettype; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.experimental.Accessors; /** * Request Body for DistributionSetType PUT, i.e. update. - * */ +@Data +@Accessors(chain = true) public class MgmtDistributionSetTypeRequestBodyPut { @JsonProperty @Schema(example = "Example description") private String description; - @JsonProperty @Schema(example = "rgb(86,37,99)") private String colour; - - public String getDescription() { - return description; - } - - public MgmtDistributionSetTypeRequestBodyPut setDescription(final String description) { - this.description = description; - return this; - } - - public String getColour() { - return colour; - } - - public MgmtDistributionSetTypeRequestBodyPut setColour(final String colour) { - this.colour = colour; - return this; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/AbstractMgmtRolloutConditionsEntity.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/AbstractMgmtRolloutConditionsEntity.java index 3f6195e93..0d42e3ad2 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/AbstractMgmtRolloutConditionsEntity.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/AbstractMgmtRolloutConditionsEntity.java @@ -9,6 +9,8 @@ */ package org.eclipse.hawkbit.mgmt.json.model.rollout; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.eclipse.hawkbit.mgmt.json.model.MgmtNamedEntity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -17,6 +19,8 @@ import com.fasterxml.jackson.annotation.JsonInclude; /** * Model for defining Conditions and Actions */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public abstract class AbstractMgmtRolloutConditionsEntity extends MgmtNamedEntity { @@ -25,37 +29,4 @@ public abstract class AbstractMgmtRolloutConditionsEntity extends MgmtNamedEntit private MgmtRolloutSuccessAction successAction; private MgmtRolloutCondition errorCondition; private MgmtRolloutErrorAction errorAction; - - public MgmtRolloutCondition getSuccessCondition() { - return successCondition; - } - - public void setSuccessCondition(final MgmtRolloutCondition successCondition) { - this.successCondition = successCondition; - } - - public MgmtRolloutSuccessAction getSuccessAction() { - return successAction; - } - - public void setSuccessAction(final MgmtRolloutSuccessAction successAction) { - this.successAction = successAction; - } - - public MgmtRolloutCondition getErrorCondition() { - return errorCondition; - } - - public void setErrorCondition(final MgmtRolloutCondition errorCondition) { - this.errorCondition = errorCondition; - } - - public MgmtRolloutErrorAction getErrorAction() { - return errorAction; - } - - public void setErrorAction(final MgmtRolloutErrorAction errorAction) { - this.errorAction = errorAction; - } - } diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutCondition.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutCondition.java index 014d3fd90..0e16f470d 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutCondition.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutCondition.java @@ -13,61 +13,25 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.NoArgsConstructor; -/** - * - */ +@NoArgsConstructor +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtRolloutCondition { + public enum Condition { + THRESHOLD + } + private Condition condition = Condition.THRESHOLD; @Schema(example = "50") private String expression = "100"; - /** - * - */ - public MgmtRolloutCondition() { - // needed for jackson json creator. - } - public MgmtRolloutCondition(final Condition condition, final String expression) { this.condition = condition; this.expression = expression; } - - /** - * @return the condition - */ - public Condition getCondition() { - return condition; - } - - /** - * @param condition - * the condition to set - */ - public void setCondition(final Condition condition) { - this.condition = condition; - } - - /** - * @return the expession - */ - public String getExpression() { - return expression; - } - - /** - * @param expession - * the expession to set - */ - public void setExpression(final String expession) { - this.expression = expession; - } - - public enum Condition { - THRESHOLD - } } diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutErrorAction.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutErrorAction.java index 1d727faf3..2bc4d4695 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutErrorAction.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutErrorAction.java @@ -13,14 +13,22 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.NoArgsConstructor; /** * An action that runs when the error condition is met */ +@NoArgsConstructor +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtRolloutErrorAction { + public enum ErrorAction { + PAUSE + } + private ErrorAction action = ErrorAction.PAUSE; @Schema(example = "80") private String expression; @@ -28,57 +36,11 @@ public class MgmtRolloutErrorAction { /** * Creates a rollout error action * - * @param action - * the action to run when th error condition is met - * @param expression - * the expression for the action + * @param action the action to run when th error condition is met + * @param expression the expression for the action */ public MgmtRolloutErrorAction(ErrorAction action, String expression) { this.action = action; this.expression = expression; } - - /** - * Default constructor - */ - public MgmtRolloutErrorAction() { - // Instantiate default error action - } - - /** - * @return the action - */ - public ErrorAction getAction() { - return action; - } - - /** - * @param action - * the action to set - */ - public void setAction(final ErrorAction action) { - this.action = action; - } - - /** - * @return the expression - */ - public String getExpression() { - return expression; - } - - /** - * @param expression - * the expression to set - */ - public void setExpression(final String expression) { - this.expression = expression; - } - - /** - * Possible actions - */ - public enum ErrorAction { - PAUSE - } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutResponseBody.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutResponseBody.java index 999028bcc..73249c5c3 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutResponseBody.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutResponseBody.java @@ -13,6 +13,10 @@ import java.util.HashMap; import java.util.Map; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AccessLevel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Setter; import org.eclipse.hawkbit.mgmt.json.model.MgmtNamedEntity; import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType; @@ -21,9 +25,8 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; -/** - * - */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtRolloutResponseBody extends MgmtNamedEntity { @@ -32,125 +35,45 @@ public class MgmtRolloutResponseBody extends MgmtNamedEntity { private String targetFilterQuery; @Schema(example = "2") private Long distributionSetId; - @JsonProperty(value = "id", required = true) @Schema(example = "2") private Long rolloutId; - @JsonProperty(required = true) @Schema(example = "ready") private String status; - @JsonProperty(required = true) @Schema(example = "20") private Long totalTargets; - + @Setter(AccessLevel.NONE) @JsonProperty private Map totalTargetsPerStatus; - @JsonProperty @Schema(example = "5") private Integer totalGroups; - @JsonProperty @Schema(example = "1691065753136") private Long startAt; - @JsonProperty @Schema(example = "1691065762496") private Long forcetime; - @JsonProperty @Schema(example = "false") private boolean deleted; - @JsonProperty private MgmtActionType type; - @JsonProperty @Schema(example = "400") private Integer weight; - @JsonProperty @Schema(example = "true") private boolean dynamic; - @JsonProperty @Schema(example = "Approved remark.") private String approvalRemark; - @JsonProperty @Schema(example = "exampleUsername") private String approveDecidedBy; - public boolean isDeleted() { - return deleted; - } - - public void setDeleted(final boolean deleted) { - this.deleted = deleted; - } - - public String getStatus() { - return status; - } - - public void setStatus(final String status) { - this.status = status; - } - - public Long getRolloutId() { - return rolloutId; - } - - public void setRolloutId(final Long rolloutId) { - this.rolloutId = rolloutId; - } - - public String getTargetFilterQuery() { - return targetFilterQuery; - } - - public void setTargetFilterQuery(final String targetFilterQuery) { - this.targetFilterQuery = targetFilterQuery; - } - - public Long getDistributionSetId() { - return distributionSetId; - } - - public void setDistributionSetId(final Long distributionSetId) { - this.distributionSetId = distributionSetId; - } - - public void setTotalTargets(final Long totalTargets) { - this.totalTargets = totalTargets; - } - - public Long getTotalTargets() { - return totalTargets; - } - - public void setStartAt(final Long startAt) { - this.startAt = startAt; - } - - public Long getStartAt() { - return startAt; - } - - public void setForcetime(final Long forcetime) { - this.forcetime = forcetime; - } - - public Long getForcetime() { - return forcetime; - } - - public Map getTotalTargetsPerStatus() { - return totalTargetsPerStatus; - } - public void addTotalTargetsPerStatus(final String status, final Long totalTargetCountByStatus) { if (totalTargetsPerStatus == null) { totalTargetsPerStatus = new HashMap<>(); @@ -158,52 +81,4 @@ public class MgmtRolloutResponseBody extends MgmtNamedEntity { totalTargetsPerStatus.put(status, totalTargetCountByStatus); } - - public void setType(final MgmtActionType type) { - this.type = type; - } - - public MgmtActionType getType() { - return type; - } - - public void setWeight(final Integer weight) { - this.weight = weight; - } - - public Integer getWeight() { - return weight; - } - - public void setDynamic(final boolean dynamic) { - this.dynamic = dynamic; - } - - public boolean isDynamic() { - return dynamic; - } - - public void setTotalGroups(final Integer totalGroups) { - this.totalGroups = totalGroups; - } - - public Integer getTotalGroups() { - return totalGroups; - } - - public void setApprovalRemark(final String approvalRemark) { - this.approvalRemark = approvalRemark; - } - - public String getApprovalRemark() { - return approvalRemark; - } - - public void setApproveDecidedBy(final String approveDecidedBy) { - this.approveDecidedBy = approveDecidedBy; - } - - public String getApproveDecidedBy(final String approveDecidedBy) { - return approveDecidedBy; - } } diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutRestRequestBody.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutRestRequestBody.java index 464ce0aff..d9e43f0f3 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutRestRequestBody.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutRestRequestBody.java @@ -13,6 +13,8 @@ import java.util.List; import java.util.Optional; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType; import org.eclipse.hawkbit.mgmt.json.model.rolloutgroup.MgmtRolloutGroup; @@ -25,6 +27,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Model for request containing a rollout body e.g. in a POST request of * creating a rollout via REST API. */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtRolloutRestRequestBody extends AbstractMgmtRolloutConditionsEntity { @@ -33,181 +37,21 @@ public class MgmtRolloutRestRequestBody extends AbstractMgmtRolloutConditionsEnt private String targetFilterQuery; @Schema(example = "6") private long distributionSetId; - @Schema(example = "5") private Integer amountGroups; - @Schema(example = "1691065781929") private Long forcetime; - @Schema(example = "1691065780929") private Long startAt; - - @JsonProperty(required = false) + @JsonProperty @Schema(example = "400") private Integer weight; - - @JsonProperty(required = false) + @JsonProperty @Schema(example = "true") private boolean dynamic; - - @JsonProperty(required = false) + @JsonProperty @Schema(example = "false") private Boolean confirmationRequired; - private MgmtActionType type; - private List groups; - - /** - * @return the targetFilterQuery - */ - public String getTargetFilterQuery() { - return targetFilterQuery; - } - - /** - * @param targetFilterQuery - * the targetFilterQuery to set - */ - public void setTargetFilterQuery(final String targetFilterQuery) { - this.targetFilterQuery = targetFilterQuery; - } - - /** - * @return the distributionSetId - */ - public long getDistributionSetId() { - return distributionSetId; - } - - /** - * @param distributionSetId - * the distributionSetId to set - */ - public void setDistributionSetId(final long distributionSetId) { - this.distributionSetId = distributionSetId; - } - - /** - * @return the groupSize - */ - public Integer getAmountGroups() { - return amountGroups; - } - - /** - * @param groupSize - * the groupSize to set - */ - public void setAmountGroups(final Integer groupSize) { - this.amountGroups = groupSize; - } - - /** - * @return the forcetime - */ - public Long getForcetime() { - return forcetime; - } - - /** - * @param forcetime - * the forcetime to set - */ - public void setForcetime(final Long forcetime) { - this.forcetime = forcetime; - } - - /** - * @return the type - */ - public MgmtActionType getType() { - return type; - } - - /** - * @param type - * the type to set - */ - public void setType(final MgmtActionType type) { - this.type = type; - } - - /** - * @return the List of defined Groups - */ - public List getGroups() { - return groups; - } - - /** - * @param groups - * List of {@link MgmtRolloutGroup} - */ - public void setGroups(final List groups) { - this.groups = groups; - } - - /** - * @return the start at timestamp in millis or null - */ - public Long getStartAt() { - return startAt; - } - - /** - * @param startAt - * the start at timestamp in millis or null - */ - public void setStartAt(final Long startAt) { - this.startAt = startAt; - } - - /** - * @return the priority of {@link Rollout} - */ - public Integer getWeight() { - return weight; - } - - /** - * @param weight - * the priority of {@link Rollout} - */ - public void setWeight(final Integer weight) { - this.weight = weight; - } - - /** - * @return if the {@link Rollout} shall be dynamic - */ - public boolean isDynamic() { - return dynamic; - } - - /** - * @param dynamic - * is the {@link Rollout} shall be dynamic - */ - public void setDynamic(final boolean dynamic) { - this.dynamic = dynamic; - } - - /** - * Only considered if confirmation flow active - * - * @return if the confirmation is required for this rollout - */ - public Boolean isConfirmationRequired() { - return confirmationRequired; - } - - /** - * @param confirmationRequired - * if the confirmation is required for this rollout - */ - public void setConfirmationRequired(final boolean confirmationRequired) { - this.confirmationRequired = confirmationRequired; - } } diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutSuccessAction.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutSuccessAction.java index 67e13ab69..f8b89f3ff 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutSuccessAction.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rollout/MgmtRolloutSuccessAction.java @@ -12,60 +12,24 @@ package org.eclipse.hawkbit.mgmt.json.model.rollout; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +import lombok.Data; +import lombok.NoArgsConstructor; -/** - * - */ +@NoArgsConstructor +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtRolloutSuccessAction { + public enum SuccessAction { + NEXTGROUP + } + private SuccessAction action = SuccessAction.NEXTGROUP; private String expression = null; - /** - * - */ - public MgmtRolloutSuccessAction() { - // needed for json creator - } - public MgmtRolloutSuccessAction(final SuccessAction action, final String expression) { this.action = action; this.expression = expression; } - - /** - * @return the action - */ - public SuccessAction getAction() { - return action; - } - - /** - * @param action - * the action to set - */ - public void setAction(final SuccessAction action) { - this.action = action; - } - - /** - * @return the expession - */ - public String getExpression() { - return expression; - } - - /** - * @param expession - * the expession to set - */ - public void setExpression(final String expession) { - this.expression = expession; - } - - public enum SuccessAction { - NEXTGROUP - } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroup.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroup.java index 378973ac3..bf23dfa63 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroup.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroup.java @@ -10,6 +10,8 @@ package org.eclipse.hawkbit.mgmt.json.model.rolloutgroup; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.eclipse.hawkbit.mgmt.json.model.rollout.AbstractMgmtRolloutConditionsEntity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -18,6 +20,8 @@ import com.fasterxml.jackson.annotation.JsonInclude; /** * Model for defining the Attributes of a Rollout Group */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtRolloutGroup extends AbstractMgmtRolloutConditionsEntity { @@ -28,28 +32,4 @@ public class MgmtRolloutGroup extends AbstractMgmtRolloutConditionsEntity { private Float targetPercentage; @Schema(example = "false") private Boolean confirmationRequired; - - public String getTargetFilterQuery() { - return targetFilterQuery; - } - - public void setTargetFilterQuery(final String targetFilterQuery) { - this.targetFilterQuery = targetFilterQuery; - } - - public Float getTargetPercentage() { - return targetPercentage; - } - - public void setTargetPercentage(Float targetPercentage) { - this.targetPercentage = targetPercentage; - } - - public Boolean isConfirmationRequired() { - return confirmationRequired; - } - - public void setConfirmationRequired(final Boolean confirmationRequired) { - this.confirmationRequired = confirmationRequired; - } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroupResponseBody.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroupResponseBody.java index 41ed75a79..7b8f5d3f9 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroupResponseBody.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/rolloutgroup/MgmtRolloutGroupResponseBody.java @@ -17,11 +17,17 @@ 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.AccessLevel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Setter; /** * Model for the rollout group annotated with json-annotations for easier * serialization and de-serialization. */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtRolloutGroupResponseBody extends MgmtRolloutGroup { @@ -29,44 +35,14 @@ public class MgmtRolloutGroupResponseBody extends MgmtRolloutGroup { @JsonProperty(value = "id", required = true) @Schema(example = "63") private Long rolloutGroupId; - @JsonProperty(required = true) @Schema(example = "ready") private String status; - @Schema(example = "4") private int totalTargets; - + @Setter(AccessLevel.NONE) private Map totalTargetsPerStatus; - public Long getRolloutGroupId() { - return rolloutGroupId; - } - - public void setRolloutGroupId(final Long rolloutGroupId) { - this.rolloutGroupId = rolloutGroupId; - } - - public String getStatus() { - return status; - } - - public void setStatus(final String status) { - this.status = status; - } - - public int getTotalTargets() { - return totalTargets; - } - - public void setTotalTargets(final int totalTargets) { - this.totalTargets = totalTargets; - } - - public Map getTotalTargetsPerStatus() { - return totalTargetsPerStatus; - } - public void addTotalTargetsPerStatus(final String status, final Long totalTargetCountByStatus) { if (totalTargetsPerStatus == null) { totalTargetsPerStatus = new HashMap<>(); @@ -74,5 +50,4 @@ public class MgmtRolloutGroupResponseBody extends MgmtRolloutGroup { totalTargetsPerStatus.put(status, totalTargetCountByStatus); } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModule.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModule.java index 1bbb39e13..68840e661 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModule.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModule.java @@ -10,6 +10,8 @@ package org.eclipse.hawkbit.mgmt.json.model.softwaremodule; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.eclipse.hawkbit.mgmt.json.model.MgmtNamedEntity; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -20,93 +22,31 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** * A json annotated rest model for SoftwareModule to RESTful API representation. - * */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtSoftwareModule extends MgmtNamedEntity { + @JsonProperty(value = "id", required = true) @Schema(example = "6") private Long moduleId; - @JsonProperty(required = true) @Schema(example = "1.0.0") private String version; - @JsonProperty(required = true) @Schema(example = "os") private String type; - @Schema(example = "OS") private String typeName; - @JsonProperty @Schema(example = "Vendor Limited, California") private String vendor; - @JsonProperty @Schema(example = "false") private boolean deleted; - @JsonProperty @Schema(example = "false") private boolean encrypted; - - public void setDeleted(final boolean deleted) { - this.deleted = deleted; - } - - public boolean isDeleted() { - return deleted; - } - - public Long getModuleId() { - return moduleId; - } - - @JsonIgnore - public void setModuleId(final Long moduleId) { - this.moduleId = moduleId; - } - - public String getVersion() { - return version; - } - - public void setVersion(final String version) { - this.version = version; - } - - 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 String getVendor() { - return vendor; - } - - public void setVendor(final String vendor) { - this.vendor = vendor; - } - - public void setEncrypted(final boolean encrypted) { - this.encrypted = encrypted; - } - - public boolean isEncrypted() { - return encrypted; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleMetadata.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleMetadata.java index 553ca9190..7f9d1db06 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleMetadata.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleMetadata.java @@ -14,11 +14,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; /** * The representation of SoftwareModuleMetadata in the REST API for POST/Create. - * */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtSoftwareModuleMetadata { @@ -32,29 +33,4 @@ public class MgmtSoftwareModuleMetadata { @JsonProperty @Schema(example = "false") private boolean targetVisible; - - public String getKey() { - return key; - } - - public void setKey(final String key) { - this.key = key; - } - - public String getValue() { - return value; - } - - public void setValue(final String value) { - this.value = value; - } - - public boolean isTargetVisible() { - return targetVisible; - } - - public void setTargetVisible(final boolean targetVisible) { - this.targetVisible = targetVisible; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleMetadataBodyPut.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleMetadataBodyPut.java index 1ea6080f8..1c5114ea2 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleMetadataBodyPut.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleMetadataBodyPut.java @@ -14,11 +14,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; /** * The representation of an meta data in the REST API for PUT/Update. - * */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtSoftwareModuleMetadataBodyPut { @@ -29,20 +30,4 @@ public class MgmtSoftwareModuleMetadataBodyPut { @JsonProperty @Schema(example = "true") private Boolean targetVisible; - - public String getValue() { - return value; - } - - public void setValue(final String value) { - this.value = value; - } - - public Boolean isTargetVisible() { - return targetVisible; - } - - public void setTargetVisible(final Boolean targetVisible) { - this.targetVisible = targetVisible; - } } diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleRequestBodyPost.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleRequestBodyPost.java index 11fdd841f..049d97947 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleRequestBodyPost.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleRequestBodyPost.java @@ -11,143 +11,32 @@ package org.eclipse.hawkbit.mgmt.json.model.softwaremodule; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.experimental.Accessors; /** * Request Body for SoftwareModule POST. - * */ +@Data +@Accessors(chain = true) public class MgmtSoftwareModuleRequestBodyPost { @JsonProperty(required = true) @Schema(example = "SM Name") private String name; - @JsonProperty(required = true) @Schema(example = "1.0.0") private String version; - @JsonProperty(required = true) @Schema(example = "os") private String type; - @JsonProperty @Schema(example = "SM Description") private String description; - @JsonProperty @Schema(example = "Vendor Limited, California") private String vendor; - @JsonProperty @Schema(example = "false") private boolean encrypted; - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - * - * @return updated body - */ - public MgmtSoftwareModuleRequestBodyPost setName(final String name) { - this.name = name; - return this; - } - - /** - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * @param version - * the version to set - * - * @return updated body - */ - public MgmtSoftwareModuleRequestBodyPost setVersion(final String version) { - this.version = version; - return this; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type - * the type to set - * - * @return updated body - */ - public MgmtSoftwareModuleRequestBodyPost setType(final String type) { - this.type = type; - return this; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description - * the description to set - * - * @return updated body - */ - public MgmtSoftwareModuleRequestBodyPost setDescription(final String description) { - this.description = description; - return this; - } - - /** - * @return the vendor - */ - public String getVendor() { - return vendor; - } - - /** - * @param vendor - * the vendor to set - * - * @return updated body - */ - public MgmtSoftwareModuleRequestBodyPost setVendor(final String vendor) { - this.vendor = vendor; - return this; - } - - /** - * @return if encrypted - */ - public boolean isEncrypted() { - return encrypted; - } - - /** - * @param encrypted - * if should be encrypted - * - * @return updated body - */ - public MgmtSoftwareModuleRequestBodyPost setEncrypted(final boolean encrypted) { - this.encrypted = encrypted; - return this; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleRequestBodyPut.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleRequestBodyPut.java index 75a136868..bf2d125cc 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleRequestBodyPut.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremodule/MgmtSoftwareModuleRequestBodyPut.java @@ -11,55 +11,20 @@ package org.eclipse.hawkbit.mgmt.json.model.softwaremodule; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.experimental.Accessors; /** * Request Body for SoftwareModule PUT. - * */ +@Data +@Accessors(chain = true) public class MgmtSoftwareModuleRequestBodyPut { @JsonProperty @Schema(example = "SM Description") private String description; - @JsonProperty @Schema(example = "SM Vendor Name") private String vendor; - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description - * the description to set - * - * @return updated body - */ - public MgmtSoftwareModuleRequestBodyPut setDescription(final String description) { - this.description = description; - return this; - } - - /** - * @return the vendor - */ - public String getVendor() { - return vendor; - } - - /** - * @param vendor - * the vendor to set - * - * @return updated body - */ - public MgmtSoftwareModuleRequestBodyPut setVendor(final String vendor) { - this.vendor = vendor; - return this; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleType.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleType.java index e5d888bda..e8c858341 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleType.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleType.java @@ -15,12 +15,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; +import lombok.EqualsAndHashCode; import org.eclipse.hawkbit.mgmt.json.model.MgmtTypeEntity; /** * A json annotated rest model for SoftwareModuleType to RESTful API * representation. */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtSoftwareModuleType extends MgmtTypeEntity { @@ -28,24 +32,7 @@ public class MgmtSoftwareModuleType extends MgmtTypeEntity { @JsonProperty(value = "id", required = true) @Schema(example = "83") private Long moduleId; - @JsonProperty @Schema(example = "1") private int maxAssignments; - - public Long getModuleId() { - return moduleId; - } - - public void setModuleId(final Long moduleId) { - this.moduleId = moduleId; - } - - public int getMaxAssignments() { - return maxAssignments; - } - - public void setMaxAssignments(final int maxAssignments) { - this.maxAssignments = maxAssignments; - } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleTypeRequestBodyPost.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleTypeRequestBodyPost.java index fcf1cd424..3b50b17d2 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleTypeRequestBodyPost.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleTypeRequestBodyPost.java @@ -11,21 +11,24 @@ package org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; /** * Request Body for SoftwareModuleType POST. - * */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) public class MgmtSoftwareModuleTypeRequestBodyPost extends MgmtSoftwareModuleTypeRequestBodyPut { @JsonProperty(required = true) @Schema(example = "Example name") private String name; - @JsonProperty(required = true) @Schema(example = "Example key") private String key; - @JsonProperty @Schema(example = "1") private int maxAssignments; @@ -41,58 +44,4 @@ public class MgmtSoftwareModuleTypeRequestBodyPost extends MgmtSoftwareModuleTyp super.setColour(colour); return this; } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - * - * @return updated body - */ - public MgmtSoftwareModuleTypeRequestBodyPost setName(final String name) { - this.name = name; - return this; - } - - /** - * @return the key - */ - public String getKey() { - return key; - } - - /** - * @param key - * the key to set - * @return updated body - */ - public MgmtSoftwareModuleTypeRequestBodyPost setKey(final String key) { - this.key = key; - return this; - } - - /** - * @return the maxAssignments - */ - public int getMaxAssignments() { - return maxAssignments; - } - - /** - * @param maxAssignments - * the maxAssignments to set - * - * @return updated body - */ - public MgmtSoftwareModuleTypeRequestBodyPost setMaxAssignments(final int maxAssignments) { - this.maxAssignments = maxAssignments; - return this; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleTypeRequestBodyPut.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleTypeRequestBodyPut.java index a1977eb5b..c29fa4976 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleTypeRequestBodyPut.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/softwaremoduletype/MgmtSoftwareModuleTypeRequestBodyPut.java @@ -11,37 +11,20 @@ package org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.experimental.Accessors; /** * Request Body for SoftwareModuleType PUT. - * */ +@Data +@Accessors(chain = true) public class MgmtSoftwareModuleTypeRequestBodyPut { @JsonProperty @Schema(example = "Example description") private String description; - @JsonProperty @Schema(example = "rgb(0,0,255") private String colour; - - public String getDescription() { - return description; - } - - public MgmtSoftwareModuleTypeRequestBodyPut setDescription(final String description) { - this.description = description; - return this; - } - - public String getColour() { - return colour; - } - - public MgmtSoftwareModuleTypeRequestBodyPut setColour(final String colour) { - this.colour = colour; - return this; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java index d51367838..f6aeeb99c 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/system/MgmtSystemTenantConfigurationValue.java @@ -11,6 +11,11 @@ package org.eclipse.hawkbit.mgmt.json.model.system; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AccessLevel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; import org.springframework.hateoas.RepresentationModel; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -20,8 +25,9 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; /** * A json annotated rest model for a tenant configuration value to RESTful API * representation. - * */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtSystemTenantConfigurationValue extends RepresentationModel { @@ -29,30 +35,19 @@ public class MgmtSystemTenantConfigurationValue extends RepresentationModel getKeys() { - return keys; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "MgmtSystemCache [name=" + name + ", keys=" + keys + "]"; - } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/systemmanagement/MgmtSystemStatisticsRest.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/systemmanagement/MgmtSystemStatisticsRest.java index 41eacc08e..984175d4b 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/systemmanagement/MgmtSystemStatisticsRest.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/systemmanagement/MgmtSystemStatisticsRest.java @@ -15,84 +15,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.experimental.Accessors; /** * Body for system statistics. - * */ +@Data +@Accessors(chain = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtSystemStatisticsRest { @JsonProperty private long overallTargets; - @JsonProperty private long overallArtifacts; - @JsonProperty private long overallArtifactVolumeInBytes; - @JsonProperty private long overallActions; - @JsonProperty private long overallTenants; - @JsonProperty private List tenantStats; - - public long getOverallTargets() { - return overallTargets; - } - - public MgmtSystemStatisticsRest setOverallTargets(final long overallTargets) { - this.overallTargets = overallTargets; - return this; - } - - public long getOverallArtifacts() { - return overallArtifacts; - } - - public MgmtSystemStatisticsRest setOverallArtifacts(final long overallArtifacts) { - this.overallArtifacts = overallArtifacts; - return this; - } - - public long getOverallArtifactVolumeInBytes() { - return overallArtifactVolumeInBytes; - } - - public MgmtSystemStatisticsRest setOverallArtifactVolumeInBytes(final long overallArtifactVolumeInBytes) { - this.overallArtifactVolumeInBytes = overallArtifactVolumeInBytes; - return this; - } - - public long getOverallActions() { - return overallActions; - } - - public MgmtSystemStatisticsRest setOverallActions(final long overallActions) { - this.overallActions = overallActions; - return this; - } - - public long getOverallTenants() { - return overallTenants; - } - - public MgmtSystemStatisticsRest setOverallTenants(final long overallTenants) { - this.overallTenants = overallTenants; - return this; - } - - public void setTenantStats(final List tenantStats) { - this.tenantStats = tenantStats; - } - - public List getTenantStats() { - return tenantStats; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/systemmanagement/MgmtSystemTenantServiceUsage.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/systemmanagement/MgmtSystemTenantServiceUsage.java index 52cf091e6..c62cbc799 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/systemmanagement/MgmtSystemTenantServiceUsage.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/systemmanagement/MgmtSystemTenantServiceUsage.java @@ -15,79 +15,26 @@ 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; /** * Response body for system usage report. - * */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtSystemTenantServiceUsage { @JsonProperty private String tenantName; - @JsonProperty private long targets; - @JsonProperty private long artifacts; - @JsonProperty private long actions; - @JsonProperty private long overallArtifactVolumeInBytes; - @JsonProperty private Map usageData; - - public void setTenantName(final String tenantName) { - this.tenantName = tenantName; - } - - public long getTargets() { - return targets; - } - - public void setTargets(final long targets) { - this.targets = targets; - } - - public long getArtifacts() { - return artifacts; - } - - public void setArtifacts(final long artifacts) { - this.artifacts = artifacts; - } - - public long getActions() { - return actions; - } - - public void setActions(final long actions) { - this.actions = actions; - } - - public long getOverallArtifactVolumeInBytes() { - return overallArtifactVolumeInBytes; - } - - public void setOverallArtifactVolumeInBytes(final long overallArtifactVolumeInBytes) { - this.overallArtifactVolumeInBytes = overallArtifactVolumeInBytes; - } - - public String getTenantName() { - return tenantName; - } - - public Map getUsageData() { - return usageData; - } - - public void setUsageData(final Map usageData) { - this.usageData = usageData; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtAssignedDistributionSetRequestBody.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtAssignedDistributionSetRequestBody.java index 20a406fe6..fafc336f1 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtAssignedDistributionSetRequestBody.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtAssignedDistributionSetRequestBody.java @@ -14,11 +14,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; /** * Request Body for PUT. - * */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtAssignedDistributionSetRequestBody { @@ -26,13 +27,4 @@ public class MgmtAssignedDistributionSetRequestBody { @JsonProperty(value = "id", required = true) @Schema(example = "24") private Long distributionSetId; - - public Long getDistributionSetId() { - return distributionSetId; - } - - public void setDistributionSetId(final Long distributionSetId) { - this.distributionSetId = distributionSetId; - } - } diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtAssignedTargetRequestBody.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtAssignedTargetRequestBody.java index 4879a7a92..01d45339a 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtAssignedTargetRequestBody.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtAssignedTargetRequestBody.java @@ -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; /** * Request Body for PUT. - * */ +@Data +@Accessors(chain = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtAssignedTargetRequestBody { @@ -26,14 +29,4 @@ public class MgmtAssignedTargetRequestBody { @JsonProperty(required = true) @Schema(example = "Target1") private String controllerId; - - public String getControllerId() { - return controllerId; - } - - public MgmtAssignedTargetRequestBody setControllerId(final String controllerId) { - this.controllerId = controllerId; - return this; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtDistributionSetTagAssigmentResult.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtDistributionSetTagAssigmentResult.java index b107b19e5..6e4f35eda 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtDistributionSetTagAssigmentResult.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtDistributionSetTagAssigmentResult.java @@ -11,6 +11,7 @@ package org.eclipse.hawkbit.mgmt.json.model.tag; import java.util.List; +import lombok.Data; import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -21,32 +22,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** * * A json annotated rest model for DSAssigmentResult to RESTful API * representation. - * */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtDistributionSetTagAssigmentResult { @JsonProperty private List assignedDistributionSets; - @JsonProperty private List unassignedDistributionSets; - - public List getAssignedDistributionSets() { - return assignedDistributionSets; - } - - public List getUnassignedDistributionSets() { - return unassignedDistributionSets; - } - - public void setAssignedDistributionSets(final List assignedDistributionSets) { - this.assignedDistributionSets = assignedDistributionSets; - } - - public void setUnassignedDistributionSets(final List unassignedDistributionSets) { - this.unassignedDistributionSets = unassignedDistributionSets; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTag.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTag.java index b7a598103..0adfd5a73 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTag.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTag.java @@ -10,6 +10,8 @@ package org.eclipse.hawkbit.mgmt.json.model.tag; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.eclipse.hawkbit.mgmt.json.model.MgmtNamedEntity; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -20,8 +22,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** * A json annotated rest model for Tag to RESTful API representation. - * */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtTag extends MgmtNamedEntity { @@ -29,25 +32,7 @@ public class MgmtTag extends MgmtNamedEntity { @JsonProperty(value = "id", required = true) @Schema(example = "2") private Long tagId; - @JsonProperty @Schema(example = "rgb(255,0,0)") private String colour; - - @JsonIgnore - public void setTagId(final Long tagId) { - this.tagId = tagId; - } - - public Long getTagId() { - return tagId; - } - - public void setColour(final String colour) { - this.colour = colour; - } - - public String getColour() { - return colour; - } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTagRequestBodyPut.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTagRequestBodyPut.java index 3cef3dfe7..985743ff2 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTagRequestBodyPut.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTagRequestBodyPut.java @@ -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; /** * Request Body for PUT/POST. - * */ +@Data +@Accessors(chain = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtTagRequestBodyPut { @@ -26,39 +29,10 @@ public class MgmtTagRequestBodyPut { @JsonProperty @Schema(example = "rgb(0,255,0)") private String colour; - @JsonProperty @Schema(example = "Example name") private String name; - @JsonProperty @Schema(example = "Example description") private String description; - - public String getName() { - return name; - } - - public MgmtTagRequestBodyPut setName(final String name) { - this.name = name; - return this; - } - - public String getDescription() { - return description; - } - - public MgmtTagRequestBodyPut setDescription(final String description) { - this.description = description; - return this; - } - - public MgmtTagRequestBodyPut setColour(final String colour) { - this.colour = colour; - return this; - } - - public String getColour() { - return colour; - } } diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTargetTagAssigmentResult.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTargetTagAssigmentResult.java index 96b931719..6a2669af1 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTargetTagAssigmentResult.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/tag/MgmtTargetTagAssigmentResult.java @@ -11,6 +11,7 @@ package org.eclipse.hawkbit.mgmt.json.model.tag; import java.util.List; +import lombok.Data; import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -21,32 +22,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** * * A json annotated rest model for TargetTagAssigmentResult to RESTful API * representation. - * */ +@Data @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtTargetTagAssigmentResult { @JsonProperty private List assignedTargets; - @JsonProperty private List unassignedTargets; - - public void setAssignedTargets(final List assignedTargets) { - this.assignedTargets = assignedTargets; - } - - public List getAssignedTargets() { - return assignedTargets; - } - - public void setUnassignedTargets(final List unassignedTargets) { - this.unassignedTargets = unassignedTargets; - } - - public List getUnassignedTargets() { - return unassignedTargets; - } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignment.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignment.java index f1d5ebab3..5f72a0d23 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignment.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignment.java @@ -4,6 +4,8 @@ package org.eclipse.hawkbit.mgmt.json.model.target; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.eclipse.hawkbit.mgmt.json.model.MgmtId; import org.eclipse.hawkbit.mgmt.json.model.MgmtMaintenanceWindowRequestBody; import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType; @@ -13,8 +15,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** * Request Body of DistributionSet for assignment operations (ID only). - * */ +@Data +@EqualsAndHashCode(callSuper = true) public class MgmtDistributionSetAssignment extends MgmtId { @Schema(example = "1691065930359") @@ -38,57 +41,4 @@ public class MgmtDistributionSetAssignment extends MgmtId { public MgmtDistributionSetAssignment(@JsonProperty(required = true, value = "id") final Long id) { super(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 int weight) { - this.weight = weight; - } - - /** - * Returns {@link MgmtMaintenanceWindowRequestBody} for distribution set - * assignment. - * - * @return {@link MgmtMaintenanceWindowRequestBody}. - */ - public MgmtMaintenanceWindowRequestBody getMaintenanceWindow() { - return maintenanceWindow; - } - - /** - * Sets {@link MgmtMaintenanceWindowRequestBody} for distribution set - * assignment. - * - * @param maintenanceWindow - * as {@link MgmtMaintenanceWindowRequestBody}. - */ - public void setMaintenanceWindow(final MgmtMaintenanceWindowRequestBody maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - } - - public Boolean isConfirmationRequired() { - return confirmationRequired; - } - - public void setConfirmationRequired(final Boolean confirmationRequired) { - this.confirmationRequired = confirmationRequired; - } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignments.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignments.java index 359b173be..42be5e807 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignments.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignments.java @@ -9,6 +9,7 @@ */ package org.eclipse.hawkbit.mgmt.json.model.target; +import java.io.Serial; import java.util.ArrayList; import java.util.List; @@ -21,6 +22,8 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; */ @JsonDeserialize(using = MgmtDistributionSetAssignmentsDeserializer.class) public class MgmtDistributionSetAssignments extends ArrayList { + + @Serial private static final long serialVersionUID = 1L; /** @@ -28,7 +31,7 @@ public class MgmtDistributionSetAssignments extends ArrayList assignments) { super(assignments); } - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignmentsDeserializer.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignmentsDeserializer.java index fb2672bb8..a9e600407 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignmentsDeserializer.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtDistributionSetAssignmentsDeserializer.java @@ -10,6 +10,7 @@ package org.eclipse.hawkbit.mgmt.json.model.target; import java.io.IOException; +import java.io.Serial; import java.util.Arrays; import com.fasterxml.jackson.core.JsonParser; @@ -23,6 +24,8 @@ import com.fasterxml.jackson.databind.deser.std.StdDeserializer; * {@link MgmtDistributionSetAssignment}s */ public class MgmtDistributionSetAssignmentsDeserializer extends StdDeserializer { + + @Serial private static final long serialVersionUID = 1L; /** @@ -49,4 +52,4 @@ public class MgmtDistributionSetAssignmentsDeserializer extends StdDeserializer< } return assignments; } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTarget.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTarget.java index ed7fa7cf8..ed1e031fd 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTarget.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTarget.java @@ -6,6 +6,9 @@ package org.eclipse.hawkbit.mgmt.json.model.target; import java.net.URI; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; import org.eclipse.hawkbit.mgmt.json.model.MgmtNamedEntity; import org.eclipse.hawkbit.mgmt.json.model.MgmtPollStatus; @@ -17,8 +20,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** * A json annotated rest model for Target to RESTful API representation. - * */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class MgmtTarget extends MgmtNamedEntity { @@ -26,223 +30,37 @@ public class MgmtTarget extends MgmtNamedEntity { @JsonProperty(required = true) @Schema(example = "123") private String controllerId; - @JsonProperty @Schema(example = "in_sync") private String updateStatus; - @JsonProperty @Schema(example = "1691065941102") private Long lastControllerRequestAt; - @JsonProperty @Schema(example = "1691065941155") private Long installedAt; - @JsonProperty @Schema(example = "192.168.0.1") private String ipAddress; - @JsonProperty @Schema(example = "http://192.168.0.1") private String address; - @JsonProperty private MgmtPollStatus pollStatus; - @JsonProperty @Schema(example = "38e6a19932b014040ba061795186514e") + @ToString.Exclude private String securityToken; - @JsonProperty @Schema(example = "true") private boolean requestAttributes; - @JsonProperty @Schema(example = "19") private Long targetType; - @JsonProperty @Schema(example = "defaultType") private String targetTypeName; - @JsonProperty @Schema(example = "false") private Boolean autoConfirmActive; - - /** - * @return Target type ID - */ - public Long getTargetType() { - return targetType; - } - - /** - * @param targetType - * Target type ID - */ - public void setTargetType(final Long targetType) { - this.targetType = targetType; - } - - /** - * @return Target type name - */ - public String getTargetTypeName() { - return targetTypeName; - } - - /** - * @param targetTypeName - * Target type name - */ - public void setTargetTypeName(final String targetTypeName) { - this.targetTypeName = targetTypeName; - } - - /** - * @return the controllerId - */ - public String getControllerId() { - return controllerId; - } - - /** - * @param controllerId - * the controllerId to set - */ - public void setControllerId(final String controllerId) { - this.controllerId = controllerId; - } - - /** - * @return the updateStatus - */ - public String getUpdateStatus() { - return updateStatus; - } - - /** - * @param updateStatus - * the updateStatus to set - */ - public void setUpdateStatus(final String updateStatus) { - this.updateStatus = updateStatus; - } - - /** - * @return the lastControllerRequestAt - */ - public Long getLastControllerRequestAt() { - return lastControllerRequestAt; - } - - /** - * @param lastControllerRequestAt - * the lastControllerRequestAt to set - */ - @JsonIgnore - public void setLastControllerRequestAt(final Long lastControllerRequestAt) { - this.lastControllerRequestAt = lastControllerRequestAt; - } - - /** - * @return the installedAt - */ - public Long getInstalledAt() { - return installedAt; - } - - /** - * @param installedAt - * the installedAt to set - */ - @JsonIgnore - public void setInstalledAt(final Long installedAt) { - this.installedAt = installedAt; - } - - /** - * @return the pollStatus - */ - public MgmtPollStatus getPollStatus() { - return pollStatus; - } - - /** - * @param pollStatus - * the pollStatus to set - */ - @JsonIgnore - public void setPollStatus(final MgmtPollStatus pollStatus) { - this.pollStatus = pollStatus; - } - - /** - * @return the ipAddress - */ - public String getIpAddress() { - return ipAddress; - } - - /** - * @param ipAddress - * the ipAddress to set - */ - @JsonIgnore - public void setIpAddress(final String ipAddress) { - this.ipAddress = ipAddress; - } - - /** - * @return the securityToken - */ - public String getSecurityToken() { - return securityToken; - } - - /** - * @return Address - */ - public String getAddress() { - return address; - } - - @JsonIgnore - public void setAddress(final String address) { - if (address != null) { - URI.create(address); - } - this.address = address; - } - - /** - * @param securityToken - * the securityToken to set - */ - @JsonIgnore - public void setSecurityToken(final String securityToken) { - this.securityToken = securityToken; - } - - /** - * @return boolean true or false - */ - public boolean isRequestAttributes() { - return requestAttributes; - } - - @JsonIgnore - public void setRequestAttributes(final boolean requestAttributes) { - this.requestAttributes = requestAttributes; - } - - public Boolean getAutoConfirmActive() { - return autoConfirmActive; - } - - @JsonIgnore - public void setAutoConfirmActive(final boolean autoConfirmActive) { - this.autoConfirmActive = autoConfirmActive; - } -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTargetAttributes.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTargetAttributes.java index ea01b87ca..654fd5983 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTargetAttributes.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTargetAttributes.java @@ -3,6 +3,7 @@ */ package org.eclipse.hawkbit.mgmt.json.model.target; +import java.io.Serial; import java.util.HashMap; import java.util.Map; @@ -11,6 +12,6 @@ import java.util.Map; */ public class MgmtTargetAttributes extends HashMap { + @Serial private static final long serialVersionUID = 1L; - -} +} \ No newline at end of file diff --git a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTargetAutoConfirm.java b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTargetAutoConfirm.java index 13fbbfac0..f4c778392 100644 --- a/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTargetAutoConfirm.java +++ b/hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target/MgmtTargetAutoConfirm.java @@ -13,6 +13,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.springframework.hateoas.RepresentationModel; import jakarta.validation.constraints.NotNull; @@ -20,6 +22,8 @@ import jakarta.validation.constraints.NotNull; /** * Response representing the current state of auto-confirmation for a specific target */ +@Data +@EqualsAndHashCode(callSuper = true) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) @JsonPropertyOrder({ "active", "initiator", "remark", "activatedAt" }) @@ -34,13 +38,6 @@ public class MgmtTargetAutoConfirm extends RepresentationModel isConfirmationRequiredForGroup(final MgmtRolloutGroup group, final MgmtRolloutRestRequestBody request) { - if (group.isConfirmationRequired() != null) { - return Optional.of(group.isConfirmationRequired()); - } else if (request.isConfirmationRequired() != null) { - return Optional.of(request.isConfirmationRequired()); + if (group.getConfirmationRequired() != null) { + return Optional.of(group.getConfirmationRequired()); + } else if (request.getConfirmationRequired() != null) { + return Optional.of(request.getConfirmationRequired()); } return Optional.empty(); } diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java index 135c406d9..1b7bd1ae6 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java @@ -313,7 +313,7 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi { @RequestBody final MgmtSoftwareModuleMetadataBodyPut metadata) { final SoftwareModuleMetadata updated = softwareModuleManagement .updateMetaData(entityFactory.softwareModuleMetadata().update(softwareModuleId, metadataKey) - .value(metadata.getValue()).targetVisible(metadata.isTargetVisible())); + .value(metadata.getValue()).targetVisible(metadata.getTargetVisible())); return ResponseEntity.ok(MgmtSoftwareModuleMapper.toResponseSwMetadata(updated)); } diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java index 41a3568ed..cbb016d0e 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java @@ -146,9 +146,9 @@ public class MgmtTargetFilterQueryResource implements MgmtTargetFilterQueryRestA @PathVariable("filterId") final Long filterId, @RequestBody final MgmtDistributionSetAutoAssignment autoAssignRequest) { - final boolean confirmationRequired = autoAssignRequest.isConfirmationRequired() == null + final boolean confirmationRequired = autoAssignRequest.getConfirmationRequired() == null ? tenantConfigHelper.isConfirmationFlowEnabled() - : autoAssignRequest.isConfirmationRequired(); + : autoAssignRequest.getConfirmationRequired(); final AutoAssignDistributionSetUpdate update = MgmtTargetFilterQueryMapper .fromRequest(entityFactory, filterId, autoAssignRequest).confirmationRequired(confirmationRequired); diff --git a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java index 71e034bc1..0d1b294d7 100644 --- a/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java +++ b/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java @@ -146,8 +146,8 @@ public class MgmtTargetResource implements MgmtTargetRestApi { public ResponseEntity updateTarget(@PathVariable("targetId") final String targetId, @RequestBody final MgmtTargetRequestBody targetRest) { - if (targetRest.isRequestAttributes() != null) { - if (targetRest.isRequestAttributes()) { + if (targetRest.getRequestAttributes() != null) { + if (targetRest.getRequestAttributes()) { targetManagement.requestControllerAttributes(targetId); } else { return ResponseEntity.badRequest().build(); @@ -162,13 +162,13 @@ public class MgmtTargetResource implements MgmtTargetRestApi { // update target without targetType here ... updateTarget = this.targetManagement.update(entityFactory.target().update(targetId) .name(targetRest.getName()).description(targetRest.getDescription()).address(targetRest.getAddress()) - .securityToken(targetRest.getSecurityToken()).requestAttributes(targetRest.isRequestAttributes())); + .securityToken(targetRest.getSecurityToken()).requestAttributes(targetRest.getRequestAttributes())); } else { updateTarget = this.targetManagement.update( entityFactory.target().update(targetId).name(targetRest.getName()).description(targetRest.getDescription()) .address(targetRest.getAddress()).targetType(targetRest.getTargetType()).securityToken(targetRest.getSecurityToken()) - .requestAttributes(targetRest.isRequestAttributes())); + .requestAttributes(targetRest.getRequestAttributes())); } @@ -339,9 +339,9 @@ public class MgmtTargetResource implements MgmtTargetRestApi { findTargetWithExceptionIfNotFound(targetId); final List deploymentRequests = dsAssignments.stream().map(dsAssignment -> { - final boolean isConfirmationRequired = dsAssignment.isConfirmationRequired() == null + final boolean isConfirmationRequired = dsAssignment.getConfirmationRequired() == null ? tenantConfigHelper.isConfirmationFlowEnabled() - : dsAssignment.isConfirmationRequired(); + : dsAssignment.getConfirmationRequired(); return MgmtDeploymentRequestMapper.createAssignmentRequestBuilder(dsAssignment, targetId) .setConfirmationRequired(isConfirmationRequired).build(); }).collect(Collectors.toList());