Rename Mgmt MetaData
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -19,7 +19,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
*/
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class MetadataRest {
|
||||
public class MgmtMetadata {
|
||||
|
||||
@JsonProperty(required = true)
|
||||
private String key;
|
||||
@@ -15,6 +15,7 @@ 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 com.fasterxml.jackson.annotation.JsonRootName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
@@ -22,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
*/
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonRootName(value = "")
|
||||
public class MgmtArtifact extends MgmtBaseEntity {
|
||||
|
||||
@JsonProperty(required = true)
|
||||
|
||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MetadataRest;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MgmtMetadata;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.PagedList;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSetRequestBodyPost;
|
||||
@@ -225,7 +225,7 @@ public interface MgmtDistributionSetRestApi {
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/metadata", produces = {
|
||||
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||
ResponseEntity<PagedList<MetadataRest>> getMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
ResponseEntity<PagedList<MgmtMetadata>> getMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
|
||||
@@ -243,7 +243,7 @@ public interface MgmtDistributionSetRestApi {
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/metadata/{metadataKey}", produces = {
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MetadataRest> getMetadataValue(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
ResponseEntity<MgmtMetadata> getMetadataValue(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
@PathVariable("metadataKey") final String metadataKey);
|
||||
|
||||
/**
|
||||
@@ -258,8 +258,8 @@ public interface MgmtDistributionSetRestApi {
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/{distributionSetId}/metadata/{metadataKey}", produces = {
|
||||
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||
ResponseEntity<MetadataRest> updateMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MetadataRest metadata);
|
||||
ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata);
|
||||
|
||||
/**
|
||||
* Deletes a single meta data entry from the distribution set.
|
||||
@@ -287,8 +287,8 @@ public interface MgmtDistributionSetRestApi {
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/{distributionSetId}/metadata", consumes = {
|
||||
MediaType.APPLICATION_JSON_VALUE,
|
||||
"application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||
ResponseEntity<List<MetadataRest>> createMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
@RequestBody final List<MetadataRest> metadataRest);
|
||||
ResponseEntity<List<MgmtMetadata>> createMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
@RequestBody final List<MgmtMetadata> metadataRest);
|
||||
|
||||
/**
|
||||
* Assigns a list of software modules to a distribution set.
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MetadataRest;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MgmtMetadata;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.PagedList;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
|
||||
@@ -214,7 +214,7 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{softwareModuleId}/metadata", produces = {
|
||||
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||
ResponseEntity<PagedList<MetadataRest>> getMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
ResponseEntity<PagedList<MgmtMetadata>> getMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
|
||||
@@ -232,7 +232,7 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{softwareModuleId}/metadata/{metadataKey}", produces = {
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MetadataRest> getMetadataValue(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
ResponseEntity<MgmtMetadata> getMetadataValue(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("metadataKey") final String metadataKey);
|
||||
|
||||
/**
|
||||
@@ -247,8 +247,8 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/{softwareModuleId}/metadata/{metadataKey}", produces = {
|
||||
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||
ResponseEntity<MetadataRest> updateMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MetadataRest metadata);
|
||||
ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata);
|
||||
|
||||
/**
|
||||
* Deletes a single meta data entry from the software module.
|
||||
@@ -276,7 +276,7 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/{softwareModuleId}/metadata", consumes = {
|
||||
MediaType.APPLICATION_JSON_VALUE,
|
||||
"application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
|
||||
ResponseEntity<List<MetadataRest>> createMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@RequestBody final List<MetadataRest> metadataRest);
|
||||
ResponseEntity<List<MgmtMetadata>> createMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@RequestBody final List<MgmtMetadata> metadataRest);
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MetadataRest;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MgmtMetadata;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSetRequestBodyPost;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtTargetAssignmentResponseBody;
|
||||
@@ -128,16 +128,16 @@ public final class MgmtDistributionSetMapper {
|
||||
}
|
||||
|
||||
/**
|
||||
* From {@link MetadataRest} to {@link DistributionSetMetadata}.
|
||||
* From {@link MgmtMetadata} to {@link DistributionSetMetadata}.
|
||||
*
|
||||
* @param ds
|
||||
* @param metadata
|
||||
* @return
|
||||
*/
|
||||
static List<DistributionSetMetadata> fromRequestDsMetadata(final DistributionSet ds,
|
||||
final List<MetadataRest> metadata) {
|
||||
final List<MgmtMetadata> metadata) {
|
||||
final List<DistributionSetMetadata> mappedList = new ArrayList<>(metadata.size());
|
||||
for (final MetadataRest metadataRest : metadata) {
|
||||
for (final MgmtMetadata metadataRest : metadata) {
|
||||
if (metadataRest.getKey() == null) {
|
||||
throw new IllegalArgumentException("the key of the metadata must be present");
|
||||
}
|
||||
@@ -204,16 +204,16 @@ public final class MgmtDistributionSetMapper {
|
||||
return response;
|
||||
}
|
||||
|
||||
static MetadataRest toResponseDsMetadata(final DistributionSetMetadata metadata) {
|
||||
final MetadataRest metadataRest = new MetadataRest();
|
||||
static MgmtMetadata toResponseDsMetadata(final DistributionSetMetadata metadata) {
|
||||
final MgmtMetadata metadataRest = new MgmtMetadata();
|
||||
metadataRest.setKey(metadata.getId().getKey());
|
||||
metadataRest.setValue(metadata.getValue());
|
||||
return metadataRest;
|
||||
}
|
||||
|
||||
static List<MetadataRest> toResponseDsMetadata(final List<DistributionSetMetadata> metadata) {
|
||||
static List<MgmtMetadata> toResponseDsMetadata(final List<DistributionSetMetadata> metadata) {
|
||||
|
||||
final List<MetadataRest> mappedList = new ArrayList<>(metadata.size());
|
||||
final List<MgmtMetadata> mappedList = new ArrayList<>(metadata.size());
|
||||
for (final DistributionSetMetadata distributionSetMetadata : metadata) {
|
||||
mappedList.add(toResponseDsMetadata(distributionSetMetadata));
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MetadataRest;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MgmtMetadata;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.PagedList;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSetRequestBodyPost;
|
||||
@@ -238,7 +238,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PagedList<MetadataRest>> getMetadata(
|
||||
public ResponseEntity<PagedList<MgmtMetadata>> getMetadata(
|
||||
@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
|
||||
@@ -272,7 +272,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MetadataRest> getMetadataValue(
|
||||
public ResponseEntity<MgmtMetadata> getMetadataValue(
|
||||
@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
@PathVariable("metadataKey") final String metadataKey) {
|
||||
// check if distribution set exists otherwise throw exception
|
||||
@@ -280,12 +280,12 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId);
|
||||
final DistributionSetMetadata findOne = this.distributionSetManagement
|
||||
.findOne(new DsMetadataCompositeKey(ds, metadataKey));
|
||||
return ResponseEntity.<MetadataRest> ok(MgmtDistributionSetMapper.toResponseDsMetadata(findOne));
|
||||
return ResponseEntity.<MgmtMetadata> ok(MgmtDistributionSetMapper.toResponseDsMetadata(findOne));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MetadataRest> updateMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MetadataRest metadata) {
|
||||
public ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata) {
|
||||
// check if distribution set exists otherwise throw exception
|
||||
// immediately
|
||||
final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId);
|
||||
@@ -305,9 +305,9 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<MetadataRest>> createMetadata(
|
||||
public ResponseEntity<List<MgmtMetadata>> createMetadata(
|
||||
@PathVariable("distributionSetId") final Long distributionSetId,
|
||||
@RequestBody final List<MetadataRest> metadataRest) {
|
||||
@RequestBody final List<MgmtMetadata> metadataRest) {
|
||||
// check if distribution set exists otherwise throw exception
|
||||
// immediately
|
||||
final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId);
|
||||
|
||||
@@ -14,7 +14,7 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MetadataRest;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MgmtMetadata;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifactHash;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
|
||||
@@ -59,9 +59,9 @@ public final class MgmtSoftwareModuleMapper {
|
||||
}
|
||||
|
||||
static List<SoftwareModuleMetadata> fromRequestSwMetadata(final SoftwareModule sw,
|
||||
final List<MetadataRest> metadata) {
|
||||
final List<MgmtMetadata> metadata) {
|
||||
final List<SoftwareModuleMetadata> mappedList = new ArrayList<>(metadata.size());
|
||||
for (final MetadataRest metadataRest : metadata) {
|
||||
for (final MgmtMetadata metadataRest : metadata) {
|
||||
if (metadataRest.getKey() == null) {
|
||||
throw new IllegalArgumentException("the key of the metadata must be present");
|
||||
}
|
||||
@@ -106,16 +106,16 @@ public final class MgmtSoftwareModuleMapper {
|
||||
return response;
|
||||
}
|
||||
|
||||
static List<MetadataRest> toResponseSwMetadata(final List<SoftwareModuleMetadata> metadata) {
|
||||
final List<MetadataRest> mappedList = new ArrayList<>(metadata.size());
|
||||
static List<MgmtMetadata> toResponseSwMetadata(final List<SoftwareModuleMetadata> metadata) {
|
||||
final List<MgmtMetadata> mappedList = new ArrayList<>(metadata.size());
|
||||
for (final SoftwareModuleMetadata distributionSetMetadata : metadata) {
|
||||
mappedList.add(toResponseSwMetadata(distributionSetMetadata));
|
||||
}
|
||||
return mappedList;
|
||||
}
|
||||
|
||||
static MetadataRest toResponseSwMetadata(final SoftwareModuleMetadata metadata) {
|
||||
final MetadataRest metadataRest = new MetadataRest();
|
||||
static MgmtMetadata toResponseSwMetadata(final SoftwareModuleMetadata metadata) {
|
||||
final MgmtMetadata metadataRest = new MgmtMetadata();
|
||||
metadataRest.setKey(metadata.getId().getKey());
|
||||
metadataRest.setValue(metadata.getValue());
|
||||
return metadataRest;
|
||||
|
||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MetadataRest;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MgmtMetadata;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.PagedList;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
|
||||
@@ -199,7 +199,7 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PagedList<MetadataRest>> getMetadata(
|
||||
public ResponseEntity<PagedList<MgmtMetadata>> getMetadata(
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
|
||||
@@ -230,17 +230,17 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MetadataRest> getMetadataValue(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
public ResponseEntity<MgmtMetadata> getMetadataValue(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("metadataKey") final String metadataKey) {
|
||||
final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
|
||||
final SoftwareModuleMetadata findOne = softwareManagement
|
||||
.findSoftwareModuleMetadata(new SwMetadataCompositeKey(sw, metadataKey));
|
||||
return ResponseEntity.<MetadataRest> ok(MgmtSoftwareModuleMapper.toResponseSwMetadata(findOne));
|
||||
return ResponseEntity.<MgmtMetadata> ok(MgmtSoftwareModuleMapper.toResponseSwMetadata(findOne));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MetadataRest> updateMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MetadataRest metadata) {
|
||||
public ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata) {
|
||||
final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
|
||||
final SoftwareModuleMetadata updated = softwareManagement
|
||||
.updateSoftwareModuleMetadata(new SoftwareModuleMetadata(metadataKey, sw, metadata.getValue()));
|
||||
@@ -256,9 +256,9 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<MetadataRest>> createMetadata(
|
||||
public ResponseEntity<List<MgmtMetadata>> createMetadata(
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@RequestBody final List<MetadataRest> metadataRest) {
|
||||
@RequestBody final List<MgmtMetadata> metadataRest) {
|
||||
final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
|
||||
|
||||
final List<SoftwareModuleMetadata> created = softwareManagement
|
||||
|
||||
Reference in New Issue
Block a user