Rename Mgmt MetaData

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-04-21 14:36:00 +02:00
parent b7b0d9635e
commit 5d30ea3d09
8 changed files with 48 additions and 46 deletions

View File

@@ -19,7 +19,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
*/ */
@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class MetadataRest { public class MgmtMetadata {
@JsonProperty(required = true) @JsonProperty(required = true)
private String key; private String key;

View File

@@ -15,6 +15,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;
/** /**
@@ -22,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
*/ */
@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonRootName(value = "")
public class MgmtArtifact extends MgmtBaseEntity { public class MgmtArtifact extends MgmtBaseEntity {
@JsonProperty(required = true) @JsonProperty(required = true)

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.mgmt.rest.api;
import java.util.List; 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.PagedList;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet; 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.MgmtDistributionSetRequestBodyPost;
@@ -225,7 +225,7 @@ public interface MgmtDistributionSetRestApi {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/metadata", produces = { @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/metadata", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) 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_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_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @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 = { @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/metadata/{metadataKey}", produces = {
MediaType.APPLICATION_JSON_VALUE }) 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); @PathVariable("metadataKey") final String metadataKey);
/** /**
@@ -258,8 +258,8 @@ public interface MgmtDistributionSetRestApi {
*/ */
@RequestMapping(method = RequestMethod.PUT, value = "/{distributionSetId}/metadata/{metadataKey}", produces = { @RequestMapping(method = RequestMethod.PUT, value = "/{distributionSetId}/metadata/{metadataKey}", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
ResponseEntity<MetadataRest> updateMetadata(@PathVariable("distributionSetId") final Long distributionSetId, ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MetadataRest metadata); @PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata);
/** /**
* Deletes a single meta data entry from the distribution set. * 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 = { @RequestMapping(method = RequestMethod.POST, value = "/{distributionSetId}/metadata", consumes = {
MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE,
"application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) "application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
ResponseEntity<List<MetadataRest>> createMetadata(@PathVariable("distributionSetId") final Long distributionSetId, ResponseEntity<List<MgmtMetadata>> createMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
@RequestBody final List<MetadataRest> metadataRest); @RequestBody final List<MgmtMetadata> metadataRest);
/** /**
* Assigns a list of software modules to a distribution set. * Assigns a list of software modules to a distribution set.

View File

@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.mgmt.rest.api;
import java.util.List; 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.PagedList;
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact; import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact;
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule; import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
@@ -214,7 +214,7 @@ public interface MgmtSoftwareModuleRestApi {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/{softwareModuleId}/metadata", produces = { @RequestMapping(method = RequestMethod.GET, value = "/{softwareModuleId}/metadata", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) 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_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_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @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 = { @RequestMapping(method = RequestMethod.GET, value = "/{softwareModuleId}/metadata/{metadataKey}", produces = {
MediaType.APPLICATION_JSON_VALUE }) 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); @PathVariable("metadataKey") final String metadataKey);
/** /**
@@ -247,8 +247,8 @@ public interface MgmtSoftwareModuleRestApi {
*/ */
@RequestMapping(method = RequestMethod.PUT, value = "/{softwareModuleId}/metadata/{metadataKey}", produces = { @RequestMapping(method = RequestMethod.PUT, value = "/{softwareModuleId}/metadata/{metadataKey}", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
ResponseEntity<MetadataRest> updateMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId, ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MetadataRest metadata); @PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata);
/** /**
* Deletes a single meta data entry from the software module. * 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 = { @RequestMapping(method = RequestMethod.POST, value = "/{softwareModuleId}/metadata", consumes = {
MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE,
"application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) "application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
ResponseEntity<List<MetadataRest>> createMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId, ResponseEntity<List<MgmtMetadata>> createMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
@RequestBody final List<MetadataRest> metadataRest); @RequestBody final List<MgmtMetadata> metadataRest);
} }

View File

@@ -14,7 +14,7 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.MgmtDistributionSet;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSetRequestBodyPost; import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSetRequestBodyPost;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtTargetAssignmentResponseBody; 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 ds
* @param metadata * @param metadata
* @return * @return
*/ */
static List<DistributionSetMetadata> fromRequestDsMetadata(final DistributionSet ds, static List<DistributionSetMetadata> fromRequestDsMetadata(final DistributionSet ds,
final List<MetadataRest> metadata) { final List<MgmtMetadata> metadata) {
final List<DistributionSetMetadata> mappedList = new ArrayList<>(metadata.size()); final List<DistributionSetMetadata> mappedList = new ArrayList<>(metadata.size());
for (final MetadataRest metadataRest : metadata) { for (final MgmtMetadata metadataRest : metadata) {
if (metadataRest.getKey() == null) { if (metadataRest.getKey() == null) {
throw new IllegalArgumentException("the key of the metadata must be present"); throw new IllegalArgumentException("the key of the metadata must be present");
} }
@@ -204,16 +204,16 @@ public final class MgmtDistributionSetMapper {
return response; return response;
} }
static MetadataRest toResponseDsMetadata(final DistributionSetMetadata metadata) { static MgmtMetadata toResponseDsMetadata(final DistributionSetMetadata metadata) {
final MetadataRest metadataRest = new MetadataRest(); final MgmtMetadata metadataRest = new MgmtMetadata();
metadataRest.setKey(metadata.getId().getKey()); metadataRest.setKey(metadata.getId().getKey());
metadataRest.setValue(metadata.getValue()); metadataRest.setValue(metadata.getValue());
return metadataRest; 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) { for (final DistributionSetMetadata distributionSetMetadata : metadata) {
mappedList.add(toResponseDsMetadata(distributionSetMetadata)); mappedList.add(toResponseDsMetadata(distributionSetMetadata));
} }

View File

@@ -13,7 +13,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; 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.PagedList;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet; 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.MgmtDistributionSetRequestBodyPost;
@@ -238,7 +238,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
} }
@Override @Override
public ResponseEntity<PagedList<MetadataRest>> getMetadata( public ResponseEntity<PagedList<MgmtMetadata>> getMetadata(
@PathVariable("distributionSetId") final Long distributionSetId, @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_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_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@@ -272,7 +272,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
} }
@Override @Override
public ResponseEntity<MetadataRest> getMetadataValue( public ResponseEntity<MgmtMetadata> getMetadataValue(
@PathVariable("distributionSetId") final Long distributionSetId, @PathVariable("distributionSetId") final Long distributionSetId,
@PathVariable("metadataKey") final String metadataKey) { @PathVariable("metadataKey") final String metadataKey) {
// check if distribution set exists otherwise throw exception // check if distribution set exists otherwise throw exception
@@ -280,12 +280,12 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId); final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId);
final DistributionSetMetadata findOne = this.distributionSetManagement final DistributionSetMetadata findOne = this.distributionSetManagement
.findOne(new DsMetadataCompositeKey(ds, metadataKey)); .findOne(new DsMetadataCompositeKey(ds, metadataKey));
return ResponseEntity.<MetadataRest> ok(MgmtDistributionSetMapper.toResponseDsMetadata(findOne)); return ResponseEntity.<MgmtMetadata> ok(MgmtDistributionSetMapper.toResponseDsMetadata(findOne));
} }
@Override @Override
public ResponseEntity<MetadataRest> updateMetadata(@PathVariable("distributionSetId") final Long distributionSetId, public ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MetadataRest metadata) { @PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata) {
// check if distribution set exists otherwise throw exception // check if distribution set exists otherwise throw exception
// immediately // immediately
final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId); final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId);
@@ -305,9 +305,9 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
} }
@Override @Override
public ResponseEntity<List<MetadataRest>> createMetadata( public ResponseEntity<List<MgmtMetadata>> createMetadata(
@PathVariable("distributionSetId") final Long distributionSetId, @PathVariable("distributionSetId") final Long distributionSetId,
@RequestBody final List<MetadataRest> metadataRest) { @RequestBody final List<MgmtMetadata> metadataRest) {
// check if distribution set exists otherwise throw exception // check if distribution set exists otherwise throw exception
// immediately // immediately
final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId); final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId);

View File

@@ -14,7 +14,7 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.MgmtArtifact;
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifactHash; import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifactHash;
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule; import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
@@ -59,9 +59,9 @@ public final class MgmtSoftwareModuleMapper {
} }
static List<SoftwareModuleMetadata> fromRequestSwMetadata(final SoftwareModule sw, static List<SoftwareModuleMetadata> fromRequestSwMetadata(final SoftwareModule sw,
final List<MetadataRest> metadata) { final List<MgmtMetadata> metadata) {
final List<SoftwareModuleMetadata> mappedList = new ArrayList<>(metadata.size()); final List<SoftwareModuleMetadata> mappedList = new ArrayList<>(metadata.size());
for (final MetadataRest metadataRest : metadata) { for (final MgmtMetadata metadataRest : metadata) {
if (metadataRest.getKey() == null) { if (metadataRest.getKey() == null) {
throw new IllegalArgumentException("the key of the metadata must be present"); throw new IllegalArgumentException("the key of the metadata must be present");
} }
@@ -106,16 +106,16 @@ public final class MgmtSoftwareModuleMapper {
return response; return response;
} }
static List<MetadataRest> toResponseSwMetadata(final List<SoftwareModuleMetadata> metadata) { static List<MgmtMetadata> toResponseSwMetadata(final List<SoftwareModuleMetadata> metadata) {
final List<MetadataRest> mappedList = new ArrayList<>(metadata.size()); final List<MgmtMetadata> mappedList = new ArrayList<>(metadata.size());
for (final SoftwareModuleMetadata distributionSetMetadata : metadata) { for (final SoftwareModuleMetadata distributionSetMetadata : metadata) {
mappedList.add(toResponseSwMetadata(distributionSetMetadata)); mappedList.add(toResponseSwMetadata(distributionSetMetadata));
} }
return mappedList; return mappedList;
} }
static MetadataRest toResponseSwMetadata(final SoftwareModuleMetadata metadata) { static MgmtMetadata toResponseSwMetadata(final SoftwareModuleMetadata metadata) {
final MetadataRest metadataRest = new MetadataRest(); final MgmtMetadata metadataRest = new MgmtMetadata();
metadataRest.setKey(metadata.getId().getKey()); metadataRest.setKey(metadata.getId().getKey());
metadataRest.setValue(metadata.getValue()); metadataRest.setValue(metadata.getValue());
return metadataRest; return metadataRest;

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.mgmt.rest.resource;
import java.io.IOException; import java.io.IOException;
import java.util.List; 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.PagedList;
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact; import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact;
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule; import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
@@ -199,7 +199,7 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
} }
@Override @Override
public ResponseEntity<PagedList<MetadataRest>> getMetadata( public ResponseEntity<PagedList<MgmtMetadata>> getMetadata(
@PathVariable("softwareModuleId") final Long softwareModuleId, @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_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_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@@ -230,17 +230,17 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
} }
@Override @Override
public ResponseEntity<MetadataRest> getMetadataValue(@PathVariable("softwareModuleId") final Long softwareModuleId, public ResponseEntity<MgmtMetadata> getMetadataValue(@PathVariable("softwareModuleId") final Long softwareModuleId,
@PathVariable("metadataKey") final String metadataKey) { @PathVariable("metadataKey") final String metadataKey) {
final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null); final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
final SoftwareModuleMetadata findOne = softwareManagement final SoftwareModuleMetadata findOne = softwareManagement
.findSoftwareModuleMetadata(new SwMetadataCompositeKey(sw, metadataKey)); .findSoftwareModuleMetadata(new SwMetadataCompositeKey(sw, metadataKey));
return ResponseEntity.<MetadataRest> ok(MgmtSoftwareModuleMapper.toResponseSwMetadata(findOne)); return ResponseEntity.<MgmtMetadata> ok(MgmtSoftwareModuleMapper.toResponseSwMetadata(findOne));
} }
@Override @Override
public ResponseEntity<MetadataRest> updateMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId, public ResponseEntity<MgmtMetadata> updateMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
@PathVariable("metadataKey") final String metadataKey, @RequestBody final MetadataRest metadata) { @PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata) {
final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null); final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
final SoftwareModuleMetadata updated = softwareManagement final SoftwareModuleMetadata updated = softwareManagement
.updateSoftwareModuleMetadata(new SoftwareModuleMetadata(metadataKey, sw, metadata.getValue())); .updateSoftwareModuleMetadata(new SoftwareModuleMetadata(metadataKey, sw, metadata.getValue()));
@@ -256,9 +256,9 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
} }
@Override @Override
public ResponseEntity<List<MetadataRest>> createMetadata( public ResponseEntity<List<MgmtMetadata>> createMetadata(
@PathVariable("softwareModuleId") final Long softwareModuleId, @PathVariable("softwareModuleId") final Long softwareModuleId,
@RequestBody final List<MetadataRest> metadataRest) { @RequestBody final List<MgmtMetadata> metadataRest) {
final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null); final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
final List<SoftwareModuleMetadata> created = softwareManagement final List<SoftwareModuleMetadata> created = softwareManagement