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

Apply data to models

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-04 13:20:26 +02:00
committed by GitHub
parent 47f20886c1
commit d220553157
51 changed files with 252 additions and 2020 deletions

View File

@@ -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<MgmtBaseEntity> {
@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<MgmtBaseEntity>
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<MgmtBaseEntity>
}
/**
* @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

View File

@@ -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;
}
}

View File

@@ -35,6 +35,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtActionId extends RepresentationModel<MgmtActionId> {
@JsonProperty("id")
private long actionId;
/**

View File

@@ -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;
}
}

View File

@@ -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<MgmtSoftwareModuleTypeAssigment> mandatorymodules;
@JsonProperty
private List<MgmtSoftwareModuleTypeAssigment> 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<MgmtSoftwareModuleTypeAssigment> getMandatorymodules() {
return mandatorymodules;
}
/**
* @param mandatorymodules
* the mandatory modules to set
*
* @return updated body
*/
public MgmtDistributionSetTypeRequestBodyPost setMandatorymodules(
final List<MgmtSoftwareModuleTypeAssigment> mandatorymodules) {
this.mandatorymodules = mandatorymodules;
return this;
}
/**
* @return the optional modules
*/
public List<MgmtSoftwareModuleTypeAssigment> getOptionalmodules() {
return optionalmodules;
}
/**
* @param optionalmodules
* the optional modules to set
*
* @return updated body
*/
public MgmtDistributionSetTypeRequestBodyPost setOptionalmodules(
final List<MgmtSoftwareModuleTypeAssigment> optionalmodules) {
this.optionalmodules = optionalmodules;
return this;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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<String, Long> 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<String, Long> 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;
}
}

View File

@@ -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<MgmtRolloutGroup> 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<MgmtRolloutGroup> getGroups() {
return groups;
}
/**
* @param groups
* List of {@link MgmtRolloutGroup}
*/
public void setGroups(final List<MgmtRolloutGroup> 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;
}
}

View File

@@ -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
}
}

View File

@@ -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;
}
}

View File

@@ -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<String, Long> 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<String, Long> 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);
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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<MgmtSystemTenantConfigurationValue> {
@@ -29,30 +35,19 @@ public class MgmtSystemTenantConfigurationValue extends RepresentationModel<Mgmt
@JsonInclude(Include.ALWAYS)
@Schema(example = "true")
private Object value;
@JsonInclude(Include.ALWAYS)
@Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE)
@Schema(example = "true")
private boolean isGlobal = true;
@Schema(example = "1623085150")
private Long lastModifiedAt;
@Schema(example = "example user")
private String lastModifiedBy;
@Schema(example = "1523085150")
private Long createdAt;
@Schema(example = "example user")
private String createdBy;
public Object getValue() {
return value;
}
public void setValue(final Object value) {
this.value = value;
}
public boolean isGlobal() {
return isGlobal;
}
@@ -60,37 +55,4 @@ public class MgmtSystemTenantConfigurationValue extends RepresentationModel<Mgmt
public void setGlobal(final boolean isGlobal) {
this.isGlobal = isGlobal;
}
public Long getLastModifiedAt() {
return lastModifiedAt;
}
public void setLastModifiedAt(final Long lastModifiedAt) {
this.lastModifiedAt = lastModifiedAt;
}
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setLastModifiedBy(final String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
public Long getCreatedAt() {
return createdAt;
}
public void setCreatedAt(final Long createdAt) {
this.createdAt = createdAt;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(final String createdBy) {
this.createdBy = createdBy;
}
}

View File

@@ -16,6 +16,7 @@ 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.Getter;
/**
* A json annotated rest model for System Configuration for PUT.
@@ -24,23 +25,11 @@ import io.swagger.v3.oas.annotations.media.Schema;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtSystemTenantConfigurationValueRequest {
@Getter
@JsonProperty(required = true)
@Schema(example = "exampleToken")
private Serializable value;
/**
*
* @return the value of the MgmtSystemTenantConfigurationValueRequest
*/
public Serializable getValue() {
return value;
}
/**
* Sets the value of the MgmtSystemTenantConfigurationValueRequest
*
* @param value
*/
public void setValue(final Object value) {
if (!(value instanceof Serializable)) {

View File

@@ -14,11 +14,12 @@ import java.util.Collection;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import lombok.Data;
/**
* Model representation of an Cache entry as json.
*
*/
@Data
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtSystemCache {
@@ -36,28 +37,4 @@ public class MgmtSystemCache {
this.name = name;
this.keys = cacheKeys;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @return the keys
*/
public Collection<String> getKeys() {
return keys;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "MgmtSystemCache [name=" + name + ", keys=" + keys + "]";
}
}

View File

@@ -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<MgmtSystemTenantServiceUsage> 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<MgmtSystemTenantServiceUsage> tenantStats) {
this.tenantStats = tenantStats;
}
public List<MgmtSystemTenantServiceUsage> getTenantStats() {
return tenantStats;
}
}

View File

@@ -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<String, String> 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<String, String> getUsageData() {
return usageData;
}
public void setUsageData(final Map<String, String> usageData) {
this.usageData = usageData;
}
}

View File

@@ -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;
}
}

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;
/**
* 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;
}
}

View File

@@ -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<MgmtDistributionSet> assignedDistributionSets;
@JsonProperty
private List<MgmtDistributionSet> unassignedDistributionSets;
public List<MgmtDistributionSet> getAssignedDistributionSets() {
return assignedDistributionSets;
}
public List<MgmtDistributionSet> getUnassignedDistributionSets() {
return unassignedDistributionSets;
}
public void setAssignedDistributionSets(final List<MgmtDistributionSet> assignedDistributionSets) {
this.assignedDistributionSets = assignedDistributionSets;
}
public void setUnassignedDistributionSets(final List<MgmtDistributionSet> unassignedDistributionSets) {
this.unassignedDistributionSets = unassignedDistributionSets;
}
}

View File

@@ -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;
}
}

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;
/**
* 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;
}
}

View File

@@ -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<MgmtTarget> assignedTargets;
@JsonProperty
private List<MgmtTarget> unassignedTargets;
public void setAssignedTargets(final List<MgmtTarget> assignedTargets) {
this.assignedTargets = assignedTargets;
}
public List<MgmtTarget> getAssignedTargets() {
return assignedTargets;
}
public void setUnassignedTargets(final List<MgmtTarget> unassignedTargets) {
this.unassignedTargets = unassignedTargets;
}
public List<MgmtTarget> getUnassignedTargets() {
return unassignedTargets;
}
}

View File

@@ -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;
}
}

View File

@@ -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<MgmtDistributionSetAssignment> {
@Serial
private static final long serialVersionUID = 1L;
/**
@@ -28,7 +31,7 @@ public class MgmtDistributionSetAssignments extends ArrayList<MgmtDistributionSe
*
*/
public MgmtDistributionSetAssignments() {
super();
}
/**
@@ -39,7 +42,6 @@ public class MgmtDistributionSetAssignments extends ArrayList<MgmtDistributionSe
* the assignment
*/
public MgmtDistributionSetAssignments(final MgmtDistributionSetAssignment assignment) {
super();
add(assignment);
}
@@ -53,5 +55,4 @@ public class MgmtDistributionSetAssignments extends ArrayList<MgmtDistributionSe
public MgmtDistributionSetAssignments(final List<MgmtDistributionSetAssignment> assignments) {
super(assignments);
}
}

View File

@@ -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<MgmtDistributionSetAssignments> {
@Serial
private static final long serialVersionUID = 1L;
/**

View File

@@ -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;
}
}

View File

@@ -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<String, String> {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -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<MgmtTargetAutoCon
@Schema(example = "1691065938576")
private Long activatedAt;
/**
* Constructor.
*/
public MgmtTargetAutoConfirm() {
// needed for json create.
}
public static MgmtTargetAutoConfirm active(final long activatedAt) {
final MgmtTargetAutoConfirm state = new MgmtTargetAutoConfirm();
state.setActive(true);
@@ -51,36 +48,4 @@ public class MgmtTargetAutoConfirm extends RepresentationModel<MgmtTargetAutoCon
public static MgmtTargetAutoConfirm disabled() {
return new MgmtTargetAutoConfirm();
}
public boolean isActive() {
return active;
}
public void setActive(final boolean active) {
this.active = active;
}
public Long getActivatedAt() {
return activatedAt;
}
public void setActivatedAt(final long activatedAt) {
this.activatedAt = activatedAt;
}
public String getInitiator() {
return initiator;
}
public void setInitiator(final String initiator) {
this.initiator = initiator;
}
public String getRemark() {
return remark;
}
public void setRemark(final String remark) {
this.remark = remark;
}
}

View File

@@ -12,15 +12,17 @@ package org.eclipse.hawkbit.mgmt.json.model.target;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* Payload to activate the auto-confirmation by given initiator and remark.
*/
@Data
public class MgmtTargetAutoConfirmUpdate {
@JsonProperty(required = false)
@Schema(example = "custom_initiator_value")
private final String initiator;
@JsonProperty(required = false)
@Schema(example = "custom_remark")
private final String remark;
@@ -28,10 +30,8 @@ public class MgmtTargetAutoConfirmUpdate {
/**
* Constructor.
*
* @param initiator
* can be null
* @param remark
* can be null
* @param initiator can be null
* @param remark can be null
*/
@JsonCreator
public MgmtTargetAutoConfirmUpdate(@JsonProperty(value = "initiator") final String initiator,
@@ -39,18 +39,4 @@ public class MgmtTargetAutoConfirmUpdate {
this.initiator = initiator;
this.remark = remark;
}
public String getInitiator() {
return initiator;
}
public String getRemark() {
return remark;
}
@Override
public String toString() {
return "MgmtTargetAutoConfirm [initiator=" + initiator + ", remark=" + remark + ", toString()="
+ super.toString() + "]";
}
}

View File

@@ -5,143 +5,34 @@ package org.eclipse.hawkbit.mgmt.json.model.target;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* Request body for target PUT/POST commands.
*
*/
@Data
@Accessors(chain = true)
public class MgmtTargetRequestBody {
@JsonProperty(required = true)
@Schema(example = "controllerName")
private String name;
@Schema(example = "Example description of a target")
private String description;
@JsonProperty(required = true)
@Schema(example = "12345")
private String controllerId;
@JsonProperty
@Schema(example = "https://192.168.0.1")
private String address;
@JsonProperty
@Schema(example = "2345678DGGDGFTDzztgf")
private String securityToken;
@JsonProperty
@Schema(example = "false")
private Boolean requestAttributes;
@JsonProperty
@Schema(example = "10")
private Long targetType;
/**
* @return Target type ID
*/
public Long getTargetType() {
return targetType;
}
/**
* @param targetType
* Target type ID
*/
public void setTargetType(Long targetType) {
this.targetType = targetType;
}
/**
* @return token
*/
public String getSecurityToken() {
return securityToken;
}
/**
* @param securityToken Token
*/
public void setSecurityToken(final String securityToken) {
this.securityToken = securityToken;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @return the controllerId
*/
public String getControllerId() {
return controllerId;
}
/**
* @param name
* the name to set
*/
public MgmtTargetRequestBody setName(final String name) {
this.name = name;
return this;
}
/**
* @param description
* the description to set
*/
public MgmtTargetRequestBody setDescription(final String description) {
this.description = description;
return this;
}
/**
* @param controllerId
* the controllerId to set
*/
public MgmtTargetRequestBody setControllerId(final String controllerId) {
this.controllerId = controllerId;
return this;
}
/**
* @return address
*/
public String getAddress() {
return address;
}
/**
* @param address
* Address
*/
public void setAddress(final String address) {
this.address = address;
}
/**
* @return boolean true or false
*/
public Boolean isRequestAttributes() {
return requestAttributes;
}
/**
* @param requestAttributes
* Attributes
*/
public void setRequestAttributes(final Boolean requestAttributes) {
this.requestAttributes = requestAttributes;
}
}

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.mgmt.json.model.targetfilter;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.eclipse.hawkbit.mgmt.json.model.MgmtId;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
@@ -18,38 +20,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Request Body of DistributionSet Id and Action Type for target filter auto
* assignment operation.
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class MgmtDistributionSetAutoAssignment extends MgmtId {
@JsonProperty(required = false)
@JsonProperty
private MgmtActionType type;
@JsonProperty(required = false)
@JsonProperty
private Integer weight;
@JsonProperty(required = false)
@JsonProperty
private Boolean confirmationRequired;
public MgmtActionType getType() {
return type;
}
public void setType(final MgmtActionType type) {
this.type = type;
}
public Integer getWeight() {
return weight;
}
public void setWeight(final Integer weight) {
this.weight = weight;
}
public Boolean isConfirmationRequired() {
return confirmationRequired;
}
public void setConfirmationRequired(final Boolean confirmationRequired) {
this.confirmationRequired = confirmationRequired;
}
}

View File

@@ -10,6 +10,8 @@
package org.eclipse.hawkbit.mgmt.json.model.targetfilter;
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.distributionset.MgmtActionType;
@@ -19,10 +21,10 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* A json annotated rest model for Target Filter Queries to RESTful API
* representation.
*
* A json annotated rest model for Target Filter Queries to RESTful API representation.
*/
@Data
@EqualsAndHashCode(callSuper = true)
@JsonInclude(Include.ALWAYS)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtTargetFilterQuery extends MgmtBaseEntity {
@@ -30,83 +32,21 @@ public class MgmtTargetFilterQuery extends MgmtBaseEntity {
@JsonProperty(value = "id", required = true)
@Schema(example = "2")
private Long filterId;
@JsonProperty
@Schema(example = "filterName")
private String name;
@JsonProperty
@Schema(example = "name==*")
private String query;
@JsonProperty
@Schema(example = "15")
private Long autoAssignDistributionSet;
@JsonProperty
private MgmtActionType autoAssignActionType;
@JsonProperty
@Schema(example = "")
private Integer autoAssignWeight;
@JsonProperty
@Schema(example = "false")
private Boolean confirmationRequired;
public Long getFilterId() {
return filterId;
}
public void setFilterId(final Long filterId) {
this.filterId = filterId;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public String getQuery() {
return query;
}
public void setQuery(final String query) {
this.query = query;
}
public Long getAutoAssignDistributionSet() {
return autoAssignDistributionSet;
}
public void setAutoAssignDistributionSet(final Long autoAssignDistributionSet) {
this.autoAssignDistributionSet = autoAssignDistributionSet;
}
public MgmtActionType getAutoAssignActionType() {
return autoAssignActionType;
}
public void setAutoAssignActionType(final MgmtActionType actionType) {
this.autoAssignActionType = actionType;
}
public Integer getAutoAssignWeight() {
return autoAssignWeight;
}
public void setAutoAssignWeight(final Integer autoAssignWeight) {
this.autoAssignWeight = autoAssignWeight;
}
public Boolean getConfirmationRequired() {
return confirmationRequired;
}
public void setConfirmationRequired(final Boolean confirmationRequired) {
this.confirmationRequired = confirmationRequired;
}
}

View File

@@ -11,33 +11,18 @@ package org.eclipse.hawkbit.mgmt.json.model.targetfilter;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* Request body for target PUT/POST commands.
*
*/
@Data
public class MgmtTargetFilterQueryRequestBody {
@JsonProperty(required = true)
@Schema(example = "filterName")
private String name;
@JsonProperty(required = true)
@Schema(example = "controllerId==example-target-*")
private String query;
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public String getQuery() {
return query;
}
public void setQuery(final String query) {
this.query = query;
}
}

View File

@@ -13,12 +13,16 @@ 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.Data;
import lombok.EqualsAndHashCode;
import org.eclipse.hawkbit.mgmt.json.model.MgmtTypeEntity;
/**
* A json annotated rest model for TargetType to RESTful API
* representation.
*/
@Data
@EqualsAndHashCode(callSuper = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtTargetType extends MgmtTypeEntity {
@@ -26,19 +30,4 @@ public class MgmtTargetType extends MgmtTypeEntity {
@JsonProperty(value = "id", required = true)
@Schema(example = "26")
private Long typeId;
/**
* @return target type ID
*/
public Long getTypeId() {
return typeId;
}
/**
* @param typeId
* Target type ID
*/
public void setTypeId(final Long typeId) {
this.typeId = typeId;
}
}

View File

@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModule
/**
* Request Body for TargetType POST.
*
*/
public class MgmtTargetTypeRequestBodyPost extends MgmtTargetTypeRequestBodyPut {

View File

@@ -11,11 +11,14 @@ package org.eclipse.hawkbit.mgmt.json.model.targettype;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* Request Body for TargetType PUT.
*
*/
@Data
@Accessors(chain = true)
public class MgmtTargetTypeRequestBodyPut {
@JsonProperty(required = true)
@@ -29,56 +32,4 @@ public class MgmtTargetTypeRequestBodyPut {
@JsonProperty
@Schema(example = "#aaafff")
private String colour;
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*
* @return updated body
*/
public MgmtTargetTypeRequestBodyPut setName(final String name) {
this.name = name;
return this;
}
/**
* @return description
*/
public String getDescription() {
return description;
}
/**
* @param description
* Description
* @return Updated body
*/
public MgmtTargetTypeRequestBodyPut setDescription(final String description) {
this.description = description;
return this;
}
/**
* @return Colour
*/
public String getColour() {
return colour;
}
/**
* @param colour
* Colour
* @return Updated body
*/
public MgmtTargetTypeRequestBodyPut setColour(final String colour) {
this.colour = colour;
return this;
}
}

View File

@@ -158,9 +158,9 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
rollout = rolloutManagement.create(create, rolloutGroups, rolloutGroupConditions);
} else if (rolloutRequestBody.getAmountGroups() != null) {
final boolean confirmationRequired = rolloutRequestBody.isConfirmationRequired() == null
final boolean confirmationRequired = rolloutRequestBody.getConfirmationRequired() == null
? confirmationFlowActive
: rolloutRequestBody.isConfirmationRequired();
: rolloutRequestBody.getConfirmationRequired();
rollout = rolloutManagement.create(create, rolloutRequestBody.getAmountGroups(), confirmationRequired,
rolloutGroupConditions);
@@ -173,10 +173,10 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
private Optional<Boolean> 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();
}

View File

@@ -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));
}

View File

@@ -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);

View File

@@ -146,8 +146,8 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
public ResponseEntity<MgmtTarget> 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<DeploymentRequest> 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());