Skip to content

Commit

Permalink
Refactoring/Improving source: rest (lombok) (#1613)
Browse files Browse the repository at this point in the history
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
  • Loading branch information
avgustinmm authored Feb 4, 2024
1 parent c320a45 commit 47f2088
Show file tree
Hide file tree
Showing 33 changed files with 221 additions and 935 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
package org.eclipse.hawkbit.mgmt.json.model.action;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.eclipse.hawkbit.mgmt.json.model.MgmtBaseEntity;
import org.eclipse.hawkbit.mgmt.json.model.MgmtMaintenanceWindow;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
Expand All @@ -21,8 +23,9 @@

/**
* A json annotated rest model for Action to RESTful API representation.
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtAction extends MgmtBaseEntity {
Expand All @@ -31,17 +34,14 @@ public class MgmtAction extends MgmtBaseEntity {
* API definition for action in update mode.
*/
public static final String ACTION_UPDATE = "update";

/**
* API definition for action in canceling.
*/
public static final String ACTION_CANCEL = "cancel";

/**
* API definition for action completed.
*/
public static final String ACTION_FINISHED = "finished";

/**
* API definition for action still active.
*/
Expand All @@ -50,132 +50,33 @@ public class MgmtAction extends MgmtBaseEntity {
@JsonProperty("id")
@Schema(example = "7")
private Long actionId;

@JsonProperty
@Schema(example = "update")
private String type;

@JsonProperty
@Schema(example = "finished")
private String status;

@JsonProperty
@Schema(example = "finished")
private String detailStatus;

@JsonProperty
@Schema(example = "1691065903238")
private Long forceTime;

@JsonProperty(value = "forceType")
private MgmtActionType actionType;

@JsonProperty
@Schema(example = "600")
private Integer weight;

@JsonProperty
@Schema(hidden = true)
private MgmtMaintenanceWindow maintenanceWindow;

@JsonProperty
@Schema(example = "1")
private Long rollout;

@JsonProperty
@Schema(example = "rollout")
private String rolloutName;

@JsonProperty
@Schema(example = "200")
private Integer lastStatusCode;

public MgmtMaintenanceWindow getMaintenanceWindow() {
return maintenanceWindow;
}

public void setMaintenanceWindow(final MgmtMaintenanceWindow maintenanceWindow) {
this.maintenanceWindow = maintenanceWindow;
}

public Long getForceTime() {
return forceTime;
}

public void setForceTime(final Long forceTime) {
this.forceTime = forceTime;
}

public Integer getWeight() {
return weight;
}

public void setWeight(final Integer weight) {
this.weight = weight;
}

public MgmtActionType getActionType() {
return actionType;
}

public void setActionType(final MgmtActionType actionType) {
this.actionType = actionType;
}

public String getStatus() {
return status;
}

public void setStatus(final String status) {
this.status = status;
}

public Long getActionId() {
return actionId;
}

public void setActionId(final Long actionId) {
this.actionId = actionId;
}

public String getType() {
return type;
}

public void setType(final String type) {
this.type = type;
}

public Long getRollout() {
return rollout;
}

public void setRollout(final Long rollout) {
this.rollout = rollout;
}

public String getRolloutName() {
return rolloutName;
}

public void setRolloutName(final String rolloutName) {
this.rolloutName = rolloutName;
}

public String getDetailStatus() {
return detailStatus;
}

public void setDetailStatus(final String detailStatus) {
this.detailStatus = detailStatus;
}

public Integer getLastStatusCode() {
return lastStatusCode;
}

public void setLastStatusCode(final Integer lastStatusCode) {
this.lastStatusCode = lastStatusCode;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,17 @@
*/
package org.eclipse.hawkbit.mgmt.json.model.action;

import lombok.Data;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
* A json annotated model for Action updates in RESTful API representation.
*
*/
@Data
public class MgmtActionRequestBodyPut {

@JsonProperty(value="forceType")
private MgmtActionType actionType;

public MgmtActionType getActionType() {
return actionType;
}

public void setActionType(final MgmtActionType actionType) {
this.actionType = actionType;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,106 +16,28 @@
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
* A json annotated rest model for ActionStatus to RESTful API representation.
*
*/
@Data
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtActionStatus {

@JsonProperty("id")
@Schema(example = "21")
private Long statusId;

@JsonProperty
@Schema(example = "running")
private String type;

@JsonProperty
private List<String> messages;

@JsonProperty
@Schema(example = "1691065929524")
private Long reportedAt;

private Long reportedAt;
@JsonProperty
@Schema(example = "200")
private Integer code;

/**
* @return the statusId
*/
public Long getStatusId() {
return statusId;
}

/**
* @param statusId
* the statusId to set
*/
public void setStatusId(final Long statusId) {
this.statusId = statusId;
}

/**
* @return the type
*/
public String getType() {
return type;
}

/**
* @param type
* the type to set
*/
public void setType(final String type) {
this.type = type;
}

/**
* @return the messages
*/
public List<String> getMessages() {
return messages;
}

/**
* @param messages
* the messages to set
*/
public void setMessages(final List<String> messages) {
this.messages = messages;
}

/**
* @return the reportedAt
*/
public Long getReportedAt() {
return reportedAt;
}

/**
* @param reportedAt
* the reportedAt to set
*/
public void setReportedAt(final Long reportedAt) {
this.reportedAt = reportedAt;
}

/**
* @return the code
*/
public Integer getCode() {
return code;
}

/**
* @param code
* the reported code to set
*/
public void setCode(final Integer code) {
this.code = code;
}
}
}
Loading

0 comments on commit 47f2088

Please sign in to comment.