[#1509] Sync Target type with SW and DS types (REST Layer) (#1514)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2023-12-13 14:33:32 +02:00
committed by GitHub
parent 4b5a7d6e7d
commit 767a7e6b11
11 changed files with 117 additions and 154 deletions

View File

@@ -0,0 +1,56 @@
/**
* Copyright (c) 2023 Bosch.IO GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt.json.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* A json annotated rest model for Type to RESTful API representation.
*
*/
public abstract class MgmtTypeEntity extends MgmtNamedEntity {
@JsonProperty(required = true)
@Schema(example = "id.t23")
private String key;
@JsonProperty
@Schema(example = "brown")
private String colour;
@JsonProperty
@Schema(example = "false")
private boolean deleted;
public String getKey() {
return key;
}
public void setKey(final String key) {
this.key = key;
}
public String getColour() {
return colour;
}
public void setColour(String colour) {
this.colour = colour;
}
public boolean isDeleted() {
return deleted;
}
public void setDeleted(final boolean deleted) {
this.deleted = deleted;
}
}

View File

@@ -10,49 +10,25 @@
package org.eclipse.hawkbit.mgmt.json.model.distributionsettype;
import io.swagger.v3.oas.annotations.media.Schema;
import org.eclipse.hawkbit.mgmt.json.model.MgmtNamedEntity;
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 org.eclipse.hawkbit.mgmt.json.model.MgmtTypeEntity;
/**
* A json annotated rest model for SoftwareModuleType to RESTful API
* representation.
*
*
*
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtDistributionSetType extends MgmtNamedEntity {
public class MgmtDistributionSetType extends MgmtTypeEntity {
@JsonProperty(value = "id", required = true)
@Schema(example = "99")
private Long moduleId;
@JsonProperty(required = true)
@Schema(example = "os_app")
private String key;
@JsonProperty
@Schema(example = "false")
private boolean deleted;
@JsonProperty
@Schema(example = "black")
private String colour;
public boolean isDeleted() {
return deleted;
}
public void setDeleted(final boolean deleted) {
this.deleted = deleted;
}
/**
* @return the moduleId
*/
@@ -67,35 +43,4 @@ public class MgmtDistributionSetType extends MgmtNamedEntity {
public void setModuleId(final Long moduleId) {
this.moduleId = moduleId;
}
/**
* @return the key
*/
public String getKey() {
return key;
}
/**
* @param key
* the key to set
*/
public void setKey(final String key) {
this.key = key;
}
/**
* @return the colour
*/
public String getColour() {
return colour;
}
/**
* @param colour
* the colour to set
*/
public void setColour(String colour) {
this.colour = colour;
}
}

View File

@@ -10,50 +10,29 @@
package org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype;
import io.swagger.v3.oas.annotations.media.Schema;
import org.eclipse.hawkbit.mgmt.json.model.MgmtNamedEntity;
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 org.eclipse.hawkbit.mgmt.json.model.MgmtTypeEntity;
/**
* A json annotated rest model for SoftwareModuleType to RESTful API
* representation.
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtSoftwareModuleType extends MgmtNamedEntity {
public class MgmtSoftwareModuleType extends MgmtTypeEntity {
@JsonProperty(value = "id", required = true)
@Schema(example = "83")
private Long moduleId;
@JsonProperty(required = true)
@Schema(example = "OS")
private String key;
@JsonProperty
@Schema(example = "1")
private int maxAssignments;
@JsonProperty
@Schema(example = "false")
private boolean deleted;
@JsonProperty
@Schema(example = "brown")
private String colour;
public boolean isDeleted() {
return deleted;
}
public void setDeleted(final boolean deleted) {
this.deleted = deleted;
}
public Long getModuleId() {
return moduleId;
}
@@ -62,14 +41,6 @@ public class MgmtSoftwareModuleType extends MgmtNamedEntity {
this.moduleId = moduleId;
}
public String getKey() {
return key;
}
public void setKey(final String key) {
this.key = key;
}
public int getMaxAssignments() {
return maxAssignments;
}
@@ -77,12 +48,4 @@ public class MgmtSoftwareModuleType extends MgmtNamedEntity {
public void setMaxAssignments(final int maxAssignments) {
this.maxAssignments = maxAssignments;
}
public String getColour() {
return colour;
}
public void setColour(String colour) {
this.colour = colour;
}
}

View File

@@ -13,25 +13,20 @@ 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 org.eclipse.hawkbit.mgmt.json.model.MgmtNamedEntity;
import org.eclipse.hawkbit.mgmt.json.model.MgmtTypeEntity;
/**
* A json annotated rest model for TargetType to RESTful API
* representation.
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtTargetType extends MgmtNamedEntity {
public class MgmtTargetType extends MgmtTypeEntity {
@JsonProperty(value = "id", required = true)
@Schema(example = "26")
private Long typeId;
@JsonProperty
@Schema(example = "rgb(255,255,255")
private String colour;
/**
* @return target type ID
*/
@@ -46,20 +41,4 @@ public class MgmtTargetType extends MgmtNamedEntity {
public void setTypeId(final Long typeId) {
this.typeId = typeId;
}
/**
*
* @return the colour
*/
public String getColour() {
return colour;
}
/**
* @param colour
* the colour to set
*/
public void setColour(String colour) {
this.colour = colour;
}
}

View File

@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.mgmt.json.model.targettype;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeAssignment;
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeRequestBodyPost;
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeAssigment;
@@ -20,7 +21,11 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModule
* Request Body for TargetType POST.
*
*/
public class MgmtTargetTypeRequestBodyPost extends MgmtTargetTypeRequestBodyPut{
public class MgmtTargetTypeRequestBodyPost extends MgmtTargetTypeRequestBodyPut {
@JsonProperty
@Schema(example = "id.t23")
private String key;
@JsonProperty
private List<MgmtDistributionSetTypeAssignment> compatibledistributionsettypes;
@@ -42,6 +47,15 @@ public class MgmtTargetTypeRequestBodyPost extends MgmtTargetTypeRequestBodyPut{
return this;
}
public MgmtTargetTypeRequestBodyPost setKey(final String key) {
this.key = key;
return this;
}
public String getKey() {
return key;
}
@Override
public MgmtTargetTypeRequestBodyPost setColour(final String colour) {
super.setColour(colour);