diff --git a/MIGRATION.md b/MIGRATION.md index eacce864d..8db1ee57c 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -7,3 +7,7 @@ - hawkbit.server.email.support has changed to hawkbit.server.ui.links.support - hawkbit.server.email.request.account has changed to hawkbit.server.ui.links.requestAccount - hawkbit.server.im.login.url has changed to hawkbit.server.ui.links.userManagement + +### REST API model changes for clients +- ENTITYPagedList classes have been removed; generic PagedList used instead (e.g. PagedList instead of TargetPagedList). +- ENTITYsrest classes have been removed; List used instead (e.g. List instead of TargetsRest) diff --git a/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/CreateStartedRolloutExample.java b/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/CreateStartedRolloutExample.java index 35b0f31ea..e92f81326 100644 --- a/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/CreateStartedRolloutExample.java +++ b/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/CreateStartedRolloutExample.java @@ -8,6 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.client.scenarios; +import java.util.List; + import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetResourceClient; import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetTypeResourceClient; import org.eclipse.hawkbit.mgmt.client.resource.RolloutResourceClient; @@ -21,10 +23,10 @@ import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleAssigmentB import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleBuilder; import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleTypeBuilder; import org.eclipse.hawkbit.mgmt.client.resource.builder.TargetBuilder; -import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; +import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutResponseBody; -import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulesRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest; +import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest; +import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -65,8 +67,9 @@ public class CreateStartedRolloutExample { public void run() { // create three SoftwareModuleTypes - final SoftwareModuleTypesRest createdSoftwareModuleTypes = softwareModuleTypeResource.createSoftwareModuleTypes( - new SoftwareModuleTypeBuilder().key(SM_MODULE_TYPE).name(SM_MODULE_TYPE).maxAssignments(1).build()) + final List createdSoftwareModuleTypes = softwareModuleTypeResource + .createSoftwareModuleTypes(new SoftwareModuleTypeBuilder().key(SM_MODULE_TYPE).name(SM_MODULE_TYPE) + .maxAssignments(1).build()) .getBody(); // create one DistributionSetType @@ -75,12 +78,12 @@ public class CreateStartedRolloutExample { .getBody(); // create one DistributionSet - final DistributionSetsRest distributionSetsRest = distributionSetResource.createDistributionSets( + final List distributionSetsRest = distributionSetResource.createDistributionSets( new DistributionSetBuilder().name("rollout-example").version("1.0.0").type(DS_MODULE_TYPE).build()) .getBody(); // create three SoftwareModules - final SoftwareModulesRest softwareModulesRest = softwareModuleResource + final List softwareModulesRest = softwareModuleResource .createSoftwareModules( new SoftwareModuleBuilder().name("firmware").version("1.0.0").type(SM_MODULE_TYPE).build()) .getBody(); diff --git a/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/GettingStartedDefaultScenario.java b/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/GettingStartedDefaultScenario.java index 5767ab9e7..d17048dea 100644 --- a/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/GettingStartedDefaultScenario.java +++ b/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/GettingStartedDefaultScenario.java @@ -8,6 +8,8 @@ */ package org.eclipse.hawkbit.mgmt.client.scenarios; +import java.util.List; + import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetResourceClient; import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetTypeResourceClient; import org.eclipse.hawkbit.mgmt.client.resource.SoftwareModuleResourceClient; @@ -17,9 +19,9 @@ import org.eclipse.hawkbit.mgmt.client.resource.builder.DistributionSetTypeBuild import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleAssigmentBuilder; import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleBuilder; import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleTypeBuilder; -import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulesRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest; +import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; +import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest; +import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -68,8 +70,9 @@ public class GettingStartedDefaultScenario { // create one SoftwareModuleTypes LOGGER.info("Creating software module type {}", SM_MODULE_TYPE); - final SoftwareModuleTypesRest createdSoftwareModuleTypes = softwareModuleTypeResource.createSoftwareModuleTypes( - new SoftwareModuleTypeBuilder().key(SM_MODULE_TYPE).name(SM_MODULE_TYPE).maxAssignments(1).build()) + final List createdSoftwareModuleTypes = softwareModuleTypeResource + .createSoftwareModuleTypes(new SoftwareModuleTypeBuilder().key(SM_MODULE_TYPE).name(SM_MODULE_TYPE) + .maxAssignments(1).build()) .getBody(); // create one DistributionSetType @@ -83,17 +86,17 @@ public class GettingStartedDefaultScenario { final String dsVersion3 = "2.1.0"; LOGGER.info("Creating distribution set {}:{}", DS_EXAMPLE_NAME, dsVersion1); - final DistributionSetsRest distributionSetsRest1 = distributionSetResource.createDistributionSets( + final List distributionSetsRest1 = distributionSetResource.createDistributionSets( new DistributionSetBuilder().name(DS_EXAMPLE_NAME).version(dsVersion1).type(DS_MODULE_TYPE).build()) .getBody(); LOGGER.info("Creating distribution set {}:{}", DS_EXAMPLE_NAME, dsVersion2); - final DistributionSetsRest distributionSetsRest2 = distributionSetResource.createDistributionSets( + final List distributionSetsRest2 = distributionSetResource.createDistributionSets( new DistributionSetBuilder().name(DS_EXAMPLE_NAME).version(dsVersion2).type(DS_MODULE_TYPE).build()) .getBody(); LOGGER.info("Creating distribution set {}:{}", DS_EXAMPLE_NAME, dsVersion3); - final DistributionSetsRest distributionSetsRest3 = distributionSetResource.createDistributionSets( + final List distributionSetsRest3 = distributionSetResource.createDistributionSets( new DistributionSetBuilder().name(DS_EXAMPLE_NAME).version(dsVersion3).type(DS_MODULE_TYPE).build()) .getBody(); @@ -103,15 +106,15 @@ public class GettingStartedDefaultScenario { final String swVersion3 = "3"; LOGGER.info("Creating distribution set {}:{}", SM_EXAMPLE_NAME, swVersion1); - final SoftwareModulesRest softwareModulesRest1 = softwareModuleResource.createSoftwareModules( + final List softwareModulesRest1 = softwareModuleResource.createSoftwareModules( new SoftwareModuleBuilder().name(SM_EXAMPLE_NAME).version(swVersion1).type(SM_MODULE_TYPE).build()) .getBody(); LOGGER.info("Creating distribution set {}:{}", SM_EXAMPLE_NAME, swVersion2); - final SoftwareModulesRest softwareModulesRest2 = softwareModuleResource.createSoftwareModules( + final List softwareModulesRest2 = softwareModuleResource.createSoftwareModules( new SoftwareModuleBuilder().name(SM_EXAMPLE_NAME).version(swVersion2).type(SM_MODULE_TYPE).build()) .getBody(); LOGGER.info("Creating distribution set {}:{}", SM_EXAMPLE_NAME, swVersion3); - final SoftwareModulesRest softwareModulesRest3 = softwareModuleResource.createSoftwareModules( + final List softwareModulesRest3 = softwareModuleResource.createSoftwareModules( new SoftwareModuleBuilder().name(SM_EXAMPLE_NAME).version(swVersion3).type(SM_MODULE_TYPE).build()) .getBody(); diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetRestApi.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetRestApi.java index 05d377950..f7e7a35b7 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetRestApi.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetRestApi.java @@ -14,16 +14,15 @@ import java.util.List; import org.eclipse.hawkbit.rest.resource.RestConstants; import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.MetadataRestPageList; -import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetPagedList; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; -import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentRequestBody; import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentResponseBody; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleAssigmentRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulePagedList; -import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList; +import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest; +import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -58,7 +57,7 @@ public interface DistributionSetRestApi { * JsonResponseExceptionHandler is handling the response. */ @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity getDistributionSets( + public ResponseEntity> getDistributionSets( @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @@ -93,7 +92,7 @@ public interface DistributionSetRestApi { */ @RequestMapping(method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity createDistributionSets( + public ResponseEntity> createDistributionSets( @RequestBody final List sets); /** @@ -148,7 +147,7 @@ public interface DistributionSetRestApi { */ @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/assignedTargets", produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) - public ResponseEntity getAssignedTargets( + public ResponseEntity> getAssignedTargets( @PathVariable("distributionSetId") final Long distributionSetId, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @@ -179,7 +178,7 @@ public interface DistributionSetRestApi { */ @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/installedTargets", produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) - public ResponseEntity getInstalledTargets( + public ResponseEntity> getInstalledTargets( @PathVariable("distributionSetId") final Long distributionSetId, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @@ -357,7 +356,7 @@ public interface DistributionSetRestApi { */ @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/assignedSM", produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity getAssignedSoftwareModules( + public ResponseEntity> getAssignedSoftwareModules( @PathVariable("distributionSetId") final Long distributionSetId, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetTagRestApi.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetTagRestApi.java index d99368dc2..d86b90d6a 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetTagRestApi.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetTagRestApi.java @@ -11,7 +11,7 @@ package org.eclipse.hawkbit.rest.resource.api; import java.util.List; import org.eclipse.hawkbit.rest.resource.RestConstants; -import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; +import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; import org.eclipse.hawkbit.rest.resource.model.tag.AssignedDistributionSetRequestBody; import org.eclipse.hawkbit.rest.resource.model.tag.DistributionSetTagAssigmentResultRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagPagedList; @@ -137,7 +137,7 @@ public interface DistributionSetTagRestApi { * exists. */ @RequestMapping(method = RequestMethod.GET, value = RestConstants.DISTRIBUTIONSET_REQUEST_MAPPING) - public ResponseEntity getAssignedDistributionSets( + public ResponseEntity> getAssignedDistributionSets( @PathVariable("distributionsetTagId") final Long distributionsetTagId); /** @@ -175,7 +175,7 @@ public interface DistributionSetTagRestApi { * exists. */ @RequestMapping(method = RequestMethod.POST, value = RestConstants.DISTRIBUTIONSET_REQUEST_MAPPING) - public ResponseEntity assignDistributionSets( + public ResponseEntity> assignDistributionSets( @PathVariable("distributionsetTagId") final Long distributionsetTagId, @RequestBody final List assignedDSRequestBodies); diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetTypeRestApi.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetTypeRestApi.java index 9bed7f4f8..1900d8d7d 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetTypeRestApi.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/DistributionSetTypeRestApi.java @@ -12,13 +12,11 @@ import java.util.List; import org.eclipse.hawkbit.rest.resource.RestConstants; import org.eclipse.hawkbit.rest.resource.model.IdRest; -import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypePagedList; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRest; -import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypesRest; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -57,7 +55,7 @@ public interface DistributionSetTypeRestApi { * response. */ @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity getDistributionSetTypes( + public ResponseEntity> getDistributionSetTypes( @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @@ -119,7 +117,7 @@ public interface DistributionSetTypeRestApi { */ @RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity createDistributionSetTypes( + public ResponseEntity> createDistributionSetTypes( @RequestBody final List distributionSetTypes); /** @@ -133,7 +131,7 @@ public interface DistributionSetTypeRestApi { @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetTypeId}/" + RestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULE_TYPES, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity getMandatoryModules( + public ResponseEntity> getMandatoryModules( @PathVariable("distributionSetTypeId") final Long distributionSetTypeId); /** @@ -181,7 +179,7 @@ public interface DistributionSetTypeRestApi { @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetTypeId}/" + RestConstants.DISTRIBUTIONSETTYPE_V1_OPTIONAL_MODULE_TYPES, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity getOptionalModules( + public ResponseEntity> getOptionalModules( @PathVariable("distributionSetTypeId") final Long distributionSetTypeId); /** diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/RolloutRestApi.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/RolloutRestApi.java index fe1c7caa5..5fcfd3b56 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/RolloutRestApi.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/RolloutRestApi.java @@ -9,12 +9,12 @@ package org.eclipse.hawkbit.rest.resource.api; import org.eclipse.hawkbit.rest.resource.RestConstants; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutPagedList; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutResponseBody; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutRestRequestBody; -import org.eclipse.hawkbit.rest.resource.model.rolloutgroup.RolloutGroupPagedList; import org.eclipse.hawkbit.rest.resource.model.rolloutgroup.RolloutGroupResponseBody; -import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList; +import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -154,7 +154,8 @@ public interface RolloutRestApi { */ @RequestMapping(method = RequestMethod.GET, value = "/{rolloutId}/deploygroups", produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) - public ResponseEntity getRolloutGroups(@PathVariable("rolloutId") final Long rolloutId, + public ResponseEntity> getRolloutGroups( + @PathVariable("rolloutId") final Long rolloutId, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @@ -200,7 +201,7 @@ public interface RolloutRestApi { */ @RequestMapping(method = RequestMethod.GET, value = "/{rolloutId}/deploygroups/{groupId}/targets", produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) - public ResponseEntity getRolloutGroupTargets(@PathVariable("rolloutId") final Long rolloutId, + public ResponseEntity> getRolloutGroupTargets(@PathVariable("rolloutId") final Long rolloutId, @PathVariable("groupId") final Long groupId, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/SoftwareModuleRestAPI.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/SoftwareModuleRestAPI.java index 0662c43ba..b68ea6086 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/SoftwareModuleRestAPI.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/SoftwareModuleRestAPI.java @@ -13,13 +13,11 @@ import java.util.List; import org.eclipse.hawkbit.rest.resource.RestConstants; import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.MetadataRestPageList; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactRest; -import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactsRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulePagedList; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulesRest; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -79,7 +77,8 @@ public interface SoftwareModuleRestAPI { @RequestMapping(method = RequestMethod.GET, value = "/{softwareModuleId}/artifacts", produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) @ResponseBody - public ResponseEntity getArtifacts(@PathVariable("softwareModuleId") final Long softwareModuleId); + public ResponseEntity> getArtifacts( + @PathVariable("softwareModuleId") final Long softwareModuleId); /** * Handles the GET request of retrieving a single Artifact meta data @@ -134,7 +133,7 @@ public interface SoftwareModuleRestAPI { * JsonResponseExceptionHandler is handling the response. */ @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity getSoftwareModules( + public ResponseEntity> getSoftwareModules( @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @@ -168,7 +167,7 @@ public interface SoftwareModuleRestAPI { */ @RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity createSoftwareModules( + public ResponseEntity> createSoftwareModules( @RequestBody final List softwareModules); /** @@ -187,7 +186,7 @@ public interface SoftwareModuleRestAPI { @RequestBody final SoftwareModuleRequestBodyPut restSoftwareModule); /** - * Handles the DELETE request for a single softwaremodule. + * Handles the DELETE request for a single software module. * * @param softwareModuleId * the ID of the module to retrieve diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/SoftwareModuleTypeRestApi.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/SoftwareModuleTypeRestApi.java index 0c4756a04..a98e35a32 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/SoftwareModuleTypeRestApi.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/SoftwareModuleTypeRestApi.java @@ -11,11 +11,10 @@ package org.eclipse.hawkbit.rest.resource.api; import java.util.List; import org.eclipse.hawkbit.rest.resource.RestConstants; -import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypePagedList; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -52,7 +51,7 @@ public interface SoftwareModuleTypeRestApi { * JsonResponseExceptionHandler is handling the response. */ @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity getTypes( + public ResponseEntity> getTypes( @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @@ -113,7 +112,7 @@ public interface SoftwareModuleTypeRestApi { */ @RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity createSoftwareModuleTypes( + public ResponseEntity> createSoftwareModuleTypes( @RequestBody final List softwareModuleTypes); } diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/TargetRestApi.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/TargetRestApi.java index 9d63a520f..48e242f81 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/TargetRestApi.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/TargetRestApi.java @@ -11,16 +11,14 @@ package org.eclipse.hawkbit.rest.resource.api; import java.util.List; import org.eclipse.hawkbit.rest.resource.RestConstants; -import org.eclipse.hawkbit.rest.resource.model.action.ActionPagedList; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.action.ActionRest; -import org.eclipse.hawkbit.rest.resource.model.action.ActionStatusPagedList; +import org.eclipse.hawkbit.rest.resource.model.action.ActionStatusRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; import org.eclipse.hawkbit.rest.resource.model.target.DistributionSetAssigmentRest; import org.eclipse.hawkbit.rest.resource.model.target.TargetAttributes; -import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList; import org.eclipse.hawkbit.rest.resource.model.target.TargetRequestBody; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; -import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -70,7 +68,7 @@ public interface TargetRestApi { */ @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity getTargets( + public ResponseEntity> getTargets( @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @@ -89,7 +87,7 @@ public interface TargetRestApi { */ @RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity createTargets(@RequestBody final List targets); + public ResponseEntity> createTargets(@RequestBody final List targets); /** * Handles the PUT request of updating a target. The ID is within the URL @@ -160,7 +158,7 @@ public interface TargetRestApi { */ @RequestMapping(method = RequestMethod.GET, value = "/{targetId}/actions", produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity getActionHistory(@PathVariable("targetId") final String targetId, + public ResponseEntity> getActionHistory(@PathVariable("targetId") final String targetId, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @@ -225,8 +223,8 @@ public interface TargetRestApi { */ @RequestMapping(method = RequestMethod.GET, value = "/{targetId}/actions/{actionId}/status", produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) - public ResponseEntity getActionStatusList(@PathVariable("targetId") final String targetId, - @PathVariable("actionId") final Long actionId, + public ResponseEntity> getActionStatusList( + @PathVariable("targetId") final String targetId, @PathVariable("actionId") final Long actionId, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam); diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/TargetTagRestApi.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/TargetTagRestApi.java index 59770db08..ac82fbd5c 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/TargetTagRestApi.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/api/TargetTagRestApi.java @@ -17,7 +17,7 @@ import org.eclipse.hawkbit.rest.resource.model.tag.TagRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.tag.TagRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagsRest; import org.eclipse.hawkbit.rest.resource.model.tag.TargetTagAssigmentResultRest; -import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest; +import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -129,7 +129,7 @@ public interface TargetTagRestApi { * in case the given {@code targetTagId} doesn't exists. */ @RequestMapping(method = RequestMethod.GET, value = RestConstants.TARGET_TAG_TAGERTS_REQUEST_MAPPING) - public ResponseEntity getAssignedTargets(@PathVariable("targetTagId") final Long targetTagId); + public ResponseEntity> getAssignedTargets(@PathVariable("targetTagId") final Long targetTagId); /** * Handles the POST request to toggle the assignment of targets by the given @@ -163,7 +163,7 @@ public interface TargetTagRestApi { * in case the given {@code targetTagId} doesn't exists. */ @RequestMapping(method = RequestMethod.POST, value = RestConstants.TARGET_TAG_TAGERTS_REQUEST_MAPPING) - public ResponseEntity assignTargets(@PathVariable("targetTagId") final Long targetTagId, + public ResponseEntity> assignTargets(@PathVariable("targetTagId") final Long targetTagId, @RequestBody final List assignedTargetRequestBodies); /** diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/PagedList.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/PagedList.java index 082015b5c..880ee0c16 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/PagedList.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/PagedList.java @@ -20,19 +20,18 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; /** * A list representation with meta data for pagination, e.g. containing the - * total elements. The content of the acutal list is stored in the - * {@link #content} field. + * total elements and size of content. The content of the actual list is stored + * in the {@link #content} field. * * @param * the type of elements in this list * - * - * */ @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(Include.NON_NULL) public class PagedList extends ResourceSupport { + private final List content; private final long totalElements; private final int size; @@ -50,6 +49,7 @@ public class PagedList extends ResourceSupport { public PagedList(@NotNull final List content, final long total) { this.size = content.size(); this.totalElements = total; + this.content = content; } /** @@ -65,4 +65,9 @@ public class PagedList extends ResourceSupport { public long getTotal() { return totalElements; } + + public List getContent() { + return content; + } + } diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionPagedList.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionPagedList.java deleted file mode 100644 index 27b36779a..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionPagedList.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.action; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.hawkbit.rest.resource.model.PagedList; - -/** - * Paged list rest model for {@link ErrorAction} to RESTful API representation. - * - */ -public class ActionPagedList extends PagedList { - - private final List content; - - /** - * Empty default constructor. - */ - public ActionPagedList() { - super(Collections.emptyList(), 0); - this.content = Collections.emptyList(); - } - - /** - * @param content - * @param total - */ - public ActionPagedList(final List content, final long total) { - super(content, total); - this.content = content; - } - - /** - * @return the content of the paged list. Never {@code null}. - */ - public List getContent() { - return content; - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionStatusPagedList.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionStatusPagedList.java deleted file mode 100644 index d9f19b98e..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionStatusPagedList.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.action; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.hawkbit.rest.resource.model.PagedList; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -/** - * Paged list rest model for ActionStatus to RESTful API representation. - * - * - * - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ActionStatusPagedList extends PagedList { - - private final List content; - - /** - * @param content - * @param total - */ - public ActionStatusPagedList(final List content, final long total) { - super(content, total); - this.content = content; - } - - /** - * Default constructor. - */ - public ActionStatusPagedList() { - super(Collections.emptyList(), 0); - this.content = Collections.emptyList(); - } - - /** - * @return the content of the paged list. Never {@code null}. - */ - public List getContent() { - return content; - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionStatusRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionStatusRest.java index 1f08afe49..e5af39bac 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionStatusRest.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionStatusRest.java @@ -18,9 +18,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** * A json annotated rest model for ActionStatus to RESTful API representation. * - * - * - * */ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionStatussRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionStatussRest.java deleted file mode 100644 index b3f3207b4..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/action/ActionStatussRest.java +++ /dev/null @@ -1,277 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.action; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.springframework.hateoas.ResourceSupport; - -/** - * A list representation of the ActionStatus because Spring MVC cannot handle - * plain lists interfaces as request body. - * - * - * - * - */ -public class ActionStatussRest extends ResourceSupport implements List { - - private final List delegate = new ArrayList<>(); - - /** - * @return - * @see java.util.List#size() - */ - @Override - public int size() { - return delegate.size(); - } - - /** - * @return - * @see java.util.List#isEmpty() - */ - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - /** - * @param o - * @return - * @see java.util.List#contains(java.lang.Object) - */ - @Override - public boolean contains(final Object o) { - return delegate.contains(o); - } - - /** - * @return - * @see java.util.List#iterator() - */ - @Override - public Iterator iterator() { - return delegate.iterator(); - } - - /** - * @return - * @see java.util.List#toArray() - */ - @Override - public Object[] toArray() { - return delegate.toArray(); - } - - /** - * @param a - * @return - * @see java.util.List#toArray(java.lang.Object[]) - */ - @Override - public T[] toArray(final T[] a) { - return delegate.toArray(a); - } - - /** - * @param e - * @return - * @see java.util.List#add(java.lang.Object) - */ - @Override - public boolean add(final ActionStatusRest e) { - return delegate.add(e); - } - - /** - * @param o - * @return - * @see java.util.List#remove(java.lang.Object) - */ - @Override - public boolean remove(final Object o) { - return delegate.remove(o); - } - - /** - * @param c - * @return - * @see java.util.List#containsAll(java.util.Collection) - */ - @Override - public boolean containsAll(final Collection c) { - return delegate.containsAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#addAll(java.util.Collection) - */ - @Override - public boolean addAll(final Collection c) { - return delegate.addAll(c); - } - - /** - * @param index - * @param c - * @return - * @see java.util.List#addAll(int, java.util.Collection) - */ - @Override - public boolean addAll(final int index, final Collection c) { - return delegate.addAll(index, c); - } - - /** - * @param c - * @return - * @see java.util.List#removeAll(java.util.Collection) - */ - @Override - public boolean removeAll(final Collection c) { - return delegate.removeAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#retainAll(java.util.Collection) - */ - @Override - public boolean retainAll(final Collection c) { - return delegate.retainAll(c); - } - - /** - * - * @see java.util.List#clear() - */ - @Override - public void clear() { - delegate.clear(); - } - - /** - * @param o - * @return - * @see java.util.List#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object o) { - return delegate.equals(o); - } - - /** - * @return - * @see java.util.List#hashCode() - */ - @Override - public int hashCode() { - return delegate.hashCode(); - } - - /** - * @param index - * @return - * @see java.util.List#get(int) - */ - @Override - public ActionStatusRest get(final int index) { - return delegate.get(index); - } - - /** - * @param index - * @param element - * @return - * @see java.util.List#set(int, java.lang.Object) - */ - @Override - public ActionStatusRest set(final int index, final ActionStatusRest element) { - return delegate.set(index, element); - } - - /** - * @param index - * @param element - * @see java.util.List#add(int, java.lang.Object) - */ - @Override - public void add(final int index, final ActionStatusRest element) { - delegate.add(index, element); - } - - /** - * @param index - * @return - * @see java.util.List#remove(int) - */ - @Override - public ActionStatusRest remove(final int index) { - return delegate.remove(index); - } - - /** - * @param o - * @return - * @see java.util.List#indexOf(java.lang.Object) - */ - @Override - public int indexOf(final Object o) { - return delegate.indexOf(o); - } - - /** - * @param o - * @return - * @see java.util.List#lastIndexOf(java.lang.Object) - */ - @Override - public int lastIndexOf(final Object o) { - return delegate.lastIndexOf(o); - } - - /** - * @return - * @see java.util.List#listIterator() - */ - @Override - public ListIterator listIterator() { - return delegate.listIterator(); - } - - /** - * @param index - * @return - * @see java.util.List#listIterator(int) - */ - @Override - public ListIterator listIterator(final int index) { - return delegate.listIterator(index); - } - - /** - * @param fromIndex - * @param toIndex - * @return - * @see java.util.List#subList(int, int) - */ - @Override - public List subList(final int fromIndex, final int toIndex) { - return delegate.subList(fromIndex, toIndex); - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/artifact/ArtifactsRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/artifact/ArtifactsRest.java deleted file mode 100644 index 172e4d315..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/artifact/ArtifactsRest.java +++ /dev/null @@ -1,273 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.artifact; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.springframework.hateoas.ResourceSupport; - -/** - * List representation of the {@link ArtifactRest}. - * - */ -public class ArtifactsRest extends ResourceSupport implements List { - - private final List delegate = new ArrayList<>(); - - /** - * @return - * @see java.util.List#size() - */ - @Override - public int size() { - return delegate.size(); - } - - /** - * @return - * @see java.util.List#isEmpty() - */ - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - /** - * @param o - * @return - * @see java.util.List#contains(java.lang.Object) - */ - @Override - public boolean contains(final Object o) { - return delegate.contains(o); - } - - /** - * @return - * @see java.util.List#iterator() - */ - @Override - public Iterator iterator() { - return delegate.iterator(); - } - - /** - * @return - * @see java.util.List#toArray() - */ - @Override - public Object[] toArray() { - return delegate.toArray(); - } - - /** - * @param a - * @return - * @see java.util.List#toArray(java.lang.Object[]) - */ - @Override - public T[] toArray(final T[] a) { - return delegate.toArray(a); - } - - /** - * @param e - * @return - * @see java.util.List#add(java.lang.Object) - */ - @Override - public boolean add(final ArtifactRest e) { - return delegate.add(e); - } - - /** - * @param o - * @return - * @see java.util.List#remove(java.lang.Object) - */ - @Override - public boolean remove(final Object o) { - return delegate.remove(o); - } - - /** - * @param c - * @return - * @see java.util.List#containsAll(java.util.Collection) - */ - @Override - public boolean containsAll(final Collection c) { - return delegate.containsAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#addAll(java.util.Collection) - */ - @Override - public boolean addAll(final Collection c) { - return delegate.addAll(c); - } - - /** - * @param index - * @param c - * @return - * @see java.util.List#addAll(int, java.util.Collection) - */ - @Override - public boolean addAll(final int index, final Collection c) { - return delegate.addAll(index, c); - } - - /** - * @param c - * @return - * @see java.util.List#removeAll(java.util.Collection) - */ - @Override - public boolean removeAll(final Collection c) { - return delegate.removeAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#retainAll(java.util.Collection) - */ - @Override - public boolean retainAll(final Collection c) { - return delegate.retainAll(c); - } - - /** - * - * @see java.util.List#clear() - */ - @Override - public void clear() { - delegate.clear(); - } - - /** - * @param o - * @return - * @see java.util.List#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object o) { - return delegate.equals(o); - } - - /** - * @return - * @see java.util.List#hashCode() - */ - @Override - public int hashCode() { - return delegate.hashCode(); - } - - /** - * @param index - * @return - * @see java.util.List#get(int) - */ - @Override - public ArtifactRest get(final int index) { - return delegate.get(index); - } - - /** - * @param index - * @param element - * @return - * @see java.util.List#set(int, java.lang.Object) - */ - @Override - public ArtifactRest set(final int index, final ArtifactRest element) { - return delegate.set(index, element); - } - - /** - * @param index - * @param element - * @see java.util.List#add(int, java.lang.Object) - */ - @Override - public void add(final int index, final ArtifactRest element) { - delegate.add(index, element); - } - - /** - * @param index - * @return - * @see java.util.List#remove(int) - */ - @Override - public ArtifactRest remove(final int index) { - return delegate.remove(index); - } - - /** - * @param o - * @return - * @see java.util.List#indexOf(java.lang.Object) - */ - @Override - public int indexOf(final Object o) { - return delegate.indexOf(o); - } - - /** - * @param o - * @return - * @see java.util.List#lastIndexOf(java.lang.Object) - */ - @Override - public int lastIndexOf(final Object o) { - return delegate.lastIndexOf(o); - } - - /** - * @return - * @see java.util.List#listIterator() - */ - @Override - public ListIterator listIterator() { - return delegate.listIterator(); - } - - /** - * @param index - * @return - * @see java.util.List#listIterator(int) - */ - @Override - public ListIterator listIterator(final int index) { - return delegate.listIterator(index); - } - - /** - * @param fromIndex - * @param toIndex - * @return - * @see java.util.List#subList(int, int) - */ - @Override - public List subList(final int fromIndex, final int toIndex) { - return delegate.subList(fromIndex, toIndex); - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionset/DistributionSetPagedList.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionset/DistributionSetPagedList.java deleted file mode 100644 index b7ad1eddb..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionset/DistributionSetPagedList.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.distributionset; - -import java.util.List; - -import org.eclipse.hawkbit.rest.resource.model.PagedList; - -/** - * Paged list for SoftwareModule. - * - */ -public class DistributionSetPagedList extends PagedList { - - private final List content; - - /** - * @param content - * @param total - */ - public DistributionSetPagedList(final List content, final long total) { - super(content, total); - this.content = content; - } - - /** - * @return the content of the paged list. Never {@code null}. - */ - public List getContent() { - return content; - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionset/DistributionSetsRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionset/DistributionSetsRest.java deleted file mode 100644 index ce7b4d1f1..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionset/DistributionSetsRest.java +++ /dev/null @@ -1,277 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.distributionset; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.springframework.hateoas.ResourceSupport; - -/** - * List representation of the {@link DistributionSetRest} because Spring MVC - * cannot handle plain lists interfaces as request body. - * - * - * - * - */ -public class DistributionSetsRest extends ResourceSupport implements List { - - private final List delegate = new ArrayList<>(); - - /** - * @return - * @see java.util.List#size() - */ - @Override - public int size() { - return delegate.size(); - } - - /** - * @return - * @see java.util.List#isEmpty() - */ - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - /** - * @param o - * @return - * @see java.util.List#contains(java.lang.Object) - */ - @Override - public boolean contains(final Object o) { - return delegate.contains(o); - } - - /** - * @return - * @see java.util.List#iterator() - */ - @Override - public Iterator iterator() { - return delegate.iterator(); - } - - /** - * @return - * @see java.util.List#toArray() - */ - @Override - public Object[] toArray() { - return delegate.toArray(); - } - - /** - * @param a - * @return - * @see java.util.List#toArray(java.lang.Object[]) - */ - @Override - public T[] toArray(final T[] a) { - return delegate.toArray(a); - } - - /** - * @param e - * @return - * @see java.util.List#add(java.lang.Object) - */ - @Override - public boolean add(final DistributionSetRest e) { - return delegate.add(e); - } - - /** - * @param o - * @return - * @see java.util.List#remove(java.lang.Object) - */ - @Override - public boolean remove(final Object o) { - return delegate.remove(o); - } - - /** - * @param c - * @return - * @see java.util.List#containsAll(java.util.Collection) - */ - @Override - public boolean containsAll(final Collection c) { - return delegate.containsAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#addAll(java.util.Collection) - */ - @Override - public boolean addAll(final Collection c) { - return delegate.addAll(c); - } - - /** - * @param index - * @param c - * @return - * @see java.util.List#addAll(int, java.util.Collection) - */ - @Override - public boolean addAll(final int index, final Collection c) { - return delegate.addAll(index, c); - } - - /** - * @param c - * @return - * @see java.util.List#removeAll(java.util.Collection) - */ - @Override - public boolean removeAll(final Collection c) { - return delegate.removeAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#retainAll(java.util.Collection) - */ - @Override - public boolean retainAll(final Collection c) { - return delegate.retainAll(c); - } - - /** - * - * @see java.util.List#clear() - */ - @Override - public void clear() { - delegate.clear(); - } - - /** - * @param o - * @return - * @see java.util.List#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object o) { - return delegate.equals(o); - } - - /** - * @return - * @see java.util.List#hashCode() - */ - @Override - public int hashCode() { - return delegate.hashCode(); - } - - /** - * @param index - * @return - * @see java.util.List#get(int) - */ - @Override - public DistributionSetRest get(final int index) { - return delegate.get(index); - } - - /** - * @param index - * @param element - * @return - * @see java.util.List#set(int, java.lang.Object) - */ - @Override - public DistributionSetRest set(final int index, final DistributionSetRest element) { - return delegate.set(index, element); - } - - /** - * @param index - * @param element - * @see java.util.List#add(int, java.lang.Object) - */ - @Override - public void add(final int index, final DistributionSetRest element) { - delegate.add(index, element); - } - - /** - * @param index - * @return - * @see java.util.List#remove(int) - */ - @Override - public DistributionSetRest remove(final int index) { - return delegate.remove(index); - } - - /** - * @param o - * @return - * @see java.util.List#indexOf(java.lang.Object) - */ - @Override - public int indexOf(final Object o) { - return delegate.indexOf(o); - } - - /** - * @param o - * @return - * @see java.util.List#lastIndexOf(java.lang.Object) - */ - @Override - public int lastIndexOf(final Object o) { - return delegate.lastIndexOf(o); - } - - /** - * @return - * @see java.util.List#listIterator() - */ - @Override - public ListIterator listIterator() { - return delegate.listIterator(); - } - - /** - * @param index - * @return - * @see java.util.List#listIterator(int) - */ - @Override - public ListIterator listIterator(final int index) { - return delegate.listIterator(index); - } - - /** - * @param fromIndex - * @param toIndex - * @return - * @see java.util.List#subList(int, int) - */ - @Override - public List subList(final int fromIndex, final int toIndex) { - return delegate.subList(fromIndex, toIndex); - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionsettype/DistributionSetTypePagedList.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionsettype/DistributionSetTypePagedList.java deleted file mode 100644 index 57b15f5e8..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionsettype/DistributionSetTypePagedList.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.distributionsettype; - -import java.util.List; - -import org.eclipse.hawkbit.rest.resource.model.PagedList; - -/** - * Paged list for DistributionSetType. - * - * - */ -public class DistributionSetTypePagedList extends PagedList { - - private final List content; - - /** - * @param content - * @param total - */ - public DistributionSetTypePagedList(final List content, final long total) { - super(content, total); - this.content = content; - } - - /** - * @return the content of the paged list. Never {@code null}. - */ - public List getContent() { - return content; - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionsettype/DistributionSetTypesRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionsettype/DistributionSetTypesRest.java deleted file mode 100644 index f3cd42a85..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/distributionsettype/DistributionSetTypesRest.java +++ /dev/null @@ -1,274 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.distributionsettype; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.springframework.hateoas.ResourceSupport; - -/** - * List representation of the {@link DistributionSetTypeRest} because Spring MVC - * cannot handle plain lists interfaces as request body. - * - */ -public class DistributionSetTypesRest extends ResourceSupport implements List { - - private final List delegate = new ArrayList<>(); - - /** - * @return - * @see java.util.List#size() - */ - @Override - public int size() { - return delegate.size(); - } - - /** - * @return - * @see java.util.List#isEmpty() - */ - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - /** - * @param o - * @return - * @see java.util.List#contains(java.lang.Object) - */ - @Override - public boolean contains(final Object o) { - return delegate.contains(o); - } - - /** - * @return - * @see java.util.List#iterator() - */ - @Override - public Iterator iterator() { - return delegate.iterator(); - } - - /** - * @return - * @see java.util.List#toArray() - */ - @Override - public Object[] toArray() { - return delegate.toArray(); - } - - /** - * @param a - * @return - * @see java.util.List#toArray(java.lang.Object[]) - */ - @Override - public T[] toArray(final T[] a) { - return delegate.toArray(a); - } - - /** - * @param e - * @return - * @see java.util.List#add(java.lang.Object) - */ - @Override - public boolean add(final DistributionSetTypeRest e) { - return delegate.add(e); - } - - /** - * @param o - * @return - * @see java.util.List#remove(java.lang.Object) - */ - @Override - public boolean remove(final Object o) { - return delegate.remove(o); - } - - /** - * @param c - * @return - * @see java.util.List#containsAll(java.util.Collection) - */ - @Override - public boolean containsAll(final Collection c) { - return delegate.containsAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#addAll(java.util.Collection) - */ - @Override - public boolean addAll(final Collection c) { - return delegate.addAll(c); - } - - /** - * @param index - * @param c - * @return - * @see java.util.List#addAll(int, java.util.Collection) - */ - @Override - public boolean addAll(final int index, final Collection c) { - return delegate.addAll(index, c); - } - - /** - * @param c - * @return - * @see java.util.List#removeAll(java.util.Collection) - */ - @Override - public boolean removeAll(final Collection c) { - return delegate.removeAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#retainAll(java.util.Collection) - */ - @Override - public boolean retainAll(final Collection c) { - return delegate.retainAll(c); - } - - /** - * - * @see java.util.List#clear() - */ - @Override - public void clear() { - delegate.clear(); - } - - /** - * @param o - * @return - * @see java.util.List#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object o) { - return delegate.equals(o); - } - - /** - * @return - * @see java.util.List#hashCode() - */ - @Override - public int hashCode() { - return delegate.hashCode(); - } - - /** - * @param index - * @return - * @see java.util.List#get(int) - */ - @Override - public DistributionSetTypeRest get(final int index) { - return delegate.get(index); - } - - /** - * @param index - * @param element - * @return - * @see java.util.List#set(int, java.lang.Object) - */ - @Override - public DistributionSetTypeRest set(final int index, final DistributionSetTypeRest element) { - return delegate.set(index, element); - } - - /** - * @param index - * @param element - * @see java.util.List#add(int, java.lang.Object) - */ - @Override - public void add(final int index, final DistributionSetTypeRest element) { - delegate.add(index, element); - } - - /** - * @param index - * @return - * @see java.util.List#remove(int) - */ - @Override - public DistributionSetTypeRest remove(final int index) { - return delegate.remove(index); - } - - /** - * @param o - * @return - * @see java.util.List#indexOf(java.lang.Object) - */ - @Override - public int indexOf(final Object o) { - return delegate.indexOf(o); - } - - /** - * @param o - * @return - * @see java.util.List#lastIndexOf(java.lang.Object) - */ - @Override - public int lastIndexOf(final Object o) { - return delegate.lastIndexOf(o); - } - - /** - * @return - * @see java.util.List#listIterator() - */ - @Override - public ListIterator listIterator() { - return delegate.listIterator(); - } - - /** - * @param index - * @return - * @see java.util.List#listIterator(int) - */ - @Override - public ListIterator listIterator(final int index) { - return delegate.listIterator(index); - } - - /** - * @param fromIndex - * @param toIndex - * @return - * @see java.util.List#subList(int, int) - */ - @Override - public List subList(final int fromIndex, final int toIndex) { - return delegate.subList(fromIndex, toIndex); - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/rolloutgroup/RolloutGroupPagedList.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/rolloutgroup/RolloutGroupPagedList.java deleted file mode 100644 index a341ac6ba..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/rolloutgroup/RolloutGroupPagedList.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.rolloutgroup; - -import java.util.List; - -import org.eclipse.hawkbit.rest.resource.model.PagedList; - -/** - * Paged list for Rollout. - * - */ -public class RolloutGroupPagedList extends PagedList { - - private final List content; - - public RolloutGroupPagedList(final List content, final long total) { - super(content, total); - this.content = content; - } - - /** - * @return the content of the paged list. Never {@code null}. - */ - public List getContent() { - return content; - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremodule/SoftwareModulePagedList.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremodule/SoftwareModulePagedList.java deleted file mode 100644 index a49f41dc9..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremodule/SoftwareModulePagedList.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.softwaremodule; - -import java.util.List; - -import org.eclipse.hawkbit.rest.resource.model.PagedList; - -/** - * Paged list for SoftwareModule. - * - */ -public class SoftwareModulePagedList extends PagedList { - - private final List content; - - /** - * @param content - * @param total - */ - public SoftwareModulePagedList(final List content, final long total) { - super(content, total); - this.content = content; - } - - /** - * @return the content of the paged list. Never {@code null}. - */ - public List getContent() { - return content; - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremodule/SoftwareModulesRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremodule/SoftwareModulesRest.java deleted file mode 100644 index b40c98d36..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremodule/SoftwareModulesRest.java +++ /dev/null @@ -1,277 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.softwaremodule; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.springframework.hateoas.ResourceSupport; - -/** - * List representation of the {@link SoftwareModuleRest} because Spring MVC - * cannot handle plain lists interfaces as request body. - * - * - * - * - */ -public class SoftwareModulesRest extends ResourceSupport implements List { - - private final List delegate = new ArrayList<>(); - - /** - * @return - * @see java.util.List#size() - */ - @Override - public int size() { - return delegate.size(); - } - - /** - * @return - * @see java.util.List#isEmpty() - */ - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - /** - * @param o - * @return - * @see java.util.List#contains(java.lang.Object) - */ - @Override - public boolean contains(final Object o) { - return delegate.contains(o); - } - - /** - * @return - * @see java.util.List#iterator() - */ - @Override - public Iterator iterator() { - return delegate.iterator(); - } - - /** - * @return - * @see java.util.List#toArray() - */ - @Override - public Object[] toArray() { - return delegate.toArray(); - } - - /** - * @param a - * @return - * @see java.util.List#toArray(java.lang.Object[]) - */ - @Override - public T[] toArray(final T[] a) { - return delegate.toArray(a); - } - - /** - * @param e - * @return - * @see java.util.List#add(java.lang.Object) - */ - @Override - public boolean add(final SoftwareModuleRest e) { - return delegate.add(e); - } - - /** - * @param o - * @return - * @see java.util.List#remove(java.lang.Object) - */ - @Override - public boolean remove(final Object o) { - return delegate.remove(o); - } - - /** - * @param c - * @return - * @see java.util.List#containsAll(java.util.Collection) - */ - @Override - public boolean containsAll(final Collection c) { - return delegate.containsAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#addAll(java.util.Collection) - */ - @Override - public boolean addAll(final Collection c) { - return delegate.addAll(c); - } - - /** - * @param index - * @param c - * @return - * @see java.util.List#addAll(int, java.util.Collection) - */ - @Override - public boolean addAll(final int index, final Collection c) { - return delegate.addAll(index, c); - } - - /** - * @param c - * @return - * @see java.util.List#removeAll(java.util.Collection) - */ - @Override - public boolean removeAll(final Collection c) { - return delegate.removeAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#retainAll(java.util.Collection) - */ - @Override - public boolean retainAll(final Collection c) { - return delegate.retainAll(c); - } - - /** - * - * @see java.util.List#clear() - */ - @Override - public void clear() { - delegate.clear(); - } - - /** - * @param o - * @return - * @see java.util.List#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object o) { - return delegate.equals(o); - } - - /** - * @return - * @see java.util.List#hashCode() - */ - @Override - public int hashCode() { - return delegate.hashCode(); - } - - /** - * @param index - * @return - * @see java.util.List#get(int) - */ - @Override - public SoftwareModuleRest get(final int index) { - return delegate.get(index); - } - - /** - * @param index - * @param element - * @return - * @see java.util.List#set(int, java.lang.Object) - */ - @Override - public SoftwareModuleRest set(final int index, final SoftwareModuleRest element) { - return delegate.set(index, element); - } - - /** - * @param index - * @param element - * @see java.util.List#add(int, java.lang.Object) - */ - @Override - public void add(final int index, final SoftwareModuleRest element) { - delegate.add(index, element); - } - - /** - * @param index - * @return - * @see java.util.List#remove(int) - */ - @Override - public SoftwareModuleRest remove(final int index) { - return delegate.remove(index); - } - - /** - * @param o - * @return - * @see java.util.List#indexOf(java.lang.Object) - */ - @Override - public int indexOf(final Object o) { - return delegate.indexOf(o); - } - - /** - * @param o - * @return - * @see java.util.List#lastIndexOf(java.lang.Object) - */ - @Override - public int lastIndexOf(final Object o) { - return delegate.lastIndexOf(o); - } - - /** - * @return - * @see java.util.List#listIterator() - */ - @Override - public ListIterator listIterator() { - return delegate.listIterator(); - } - - /** - * @param index - * @return - * @see java.util.List#listIterator(int) - */ - @Override - public ListIterator listIterator(final int index) { - return delegate.listIterator(index); - } - - /** - * @param fromIndex - * @param toIndex - * @return - * @see java.util.List#subList(int, int) - */ - @Override - public List subList(final int fromIndex, final int toIndex) { - return delegate.subList(fromIndex, toIndex); - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremoduletype/SoftwareModuleTypePagedList.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremoduletype/SoftwareModuleTypePagedList.java deleted file mode 100644 index 7e85cdca9..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremoduletype/SoftwareModuleTypePagedList.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.softwaremoduletype; - -import java.util.List; - -import org.eclipse.hawkbit.rest.resource.model.PagedList; - -/** - * Paged list for SoftwareModuleType. - * - */ -public class SoftwareModuleTypePagedList extends PagedList { - - private final List content; - - /** - * @param content - * @param total - */ - public SoftwareModuleTypePagedList(final List content, final long total) { - super(content, total); - this.content = content; - } - - /** - * @return the content of the paged list. Never {@code null}. - */ - public List getContent() { - return content; - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremoduletype/SoftwareModuleTypeRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremoduletype/SoftwareModuleTypeRest.java index 6478eb790..ed05c1ee4 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremoduletype/SoftwareModuleTypeRest.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremoduletype/SoftwareModuleTypeRest.java @@ -19,9 +19,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; * A json annotated rest model for SoftwareModuleType to RESTful API * representation. * - * - * - * */ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremoduletype/SoftwareModuleTypesRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremoduletype/SoftwareModuleTypesRest.java deleted file mode 100644 index 91f440187..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/softwaremoduletype/SoftwareModuleTypesRest.java +++ /dev/null @@ -1,274 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.softwaremoduletype; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.springframework.hateoas.ResourceSupport; - -/** - * List representation of the {@link SoftwareModuleTypeRest} because Spring MVC - * cannot handle plain lists interfaces as request body. - * - */ -public class SoftwareModuleTypesRest extends ResourceSupport implements List { - - private final List delegate = new ArrayList<>(); - - /** - * @return - * @see java.util.List#size() - */ - @Override - public int size() { - return delegate.size(); - } - - /** - * @return - * @see java.util.List#isEmpty() - */ - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - /** - * @param o - * @return - * @see java.util.List#contains(java.lang.Object) - */ - @Override - public boolean contains(final Object o) { - return delegate.contains(o); - } - - /** - * @return - * @see java.util.List#iterator() - */ - @Override - public Iterator iterator() { - return delegate.iterator(); - } - - /** - * @return - * @see java.util.List#toArray() - */ - @Override - public Object[] toArray() { - return delegate.toArray(); - } - - /** - * @param a - * @return - * @see java.util.List#toArray(java.lang.Object[]) - */ - @Override - public T[] toArray(final T[] a) { - return delegate.toArray(a); - } - - /** - * @param e - * @return - * @see java.util.List#add(java.lang.Object) - */ - @Override - public boolean add(final SoftwareModuleTypeRest e) { - return delegate.add(e); - } - - /** - * @param o - * @return - * @see java.util.List#remove(java.lang.Object) - */ - @Override - public boolean remove(final Object o) { - return delegate.remove(o); - } - - /** - * @param c - * @return - * @see java.util.List#containsAll(java.util.Collection) - */ - @Override - public boolean containsAll(final Collection c) { - return delegate.containsAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#addAll(java.util.Collection) - */ - @Override - public boolean addAll(final Collection c) { - return delegate.addAll(c); - } - - /** - * @param index - * @param c - * @return - * @see java.util.List#addAll(int, java.util.Collection) - */ - @Override - public boolean addAll(final int index, final Collection c) { - return delegate.addAll(index, c); - } - - /** - * @param c - * @return - * @see java.util.List#removeAll(java.util.Collection) - */ - @Override - public boolean removeAll(final Collection c) { - return delegate.removeAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#retainAll(java.util.Collection) - */ - @Override - public boolean retainAll(final Collection c) { - return delegate.retainAll(c); - } - - /** - * - * @see java.util.List#clear() - */ - @Override - public void clear() { - delegate.clear(); - } - - /** - * @param o - * @return - * @see java.util.List#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object o) { - return delegate.equals(o); - } - - /** - * @return - * @see java.util.List#hashCode() - */ - @Override - public int hashCode() { - return delegate.hashCode(); - } - - /** - * @param index - * @return - * @see java.util.List#get(int) - */ - @Override - public SoftwareModuleTypeRest get(final int index) { - return delegate.get(index); - } - - /** - * @param index - * @param element - * @return - * @see java.util.List#set(int, java.lang.Object) - */ - @Override - public SoftwareModuleTypeRest set(final int index, final SoftwareModuleTypeRest element) { - return delegate.set(index, element); - } - - /** - * @param index - * @param element - * @see java.util.List#add(int, java.lang.Object) - */ - @Override - public void add(final int index, final SoftwareModuleTypeRest element) { - delegate.add(index, element); - } - - /** - * @param index - * @return - * @see java.util.List#remove(int) - */ - @Override - public SoftwareModuleTypeRest remove(final int index) { - return delegate.remove(index); - } - - /** - * @param o - * @return - * @see java.util.List#indexOf(java.lang.Object) - */ - @Override - public int indexOf(final Object o) { - return delegate.indexOf(o); - } - - /** - * @param o - * @return - * @see java.util.List#lastIndexOf(java.lang.Object) - */ - @Override - public int lastIndexOf(final Object o) { - return delegate.lastIndexOf(o); - } - - /** - * @return - * @see java.util.List#listIterator() - */ - @Override - public ListIterator listIterator() { - return delegate.listIterator(); - } - - /** - * @param index - * @return - * @see java.util.List#listIterator(int) - */ - @Override - public ListIterator listIterator(final int index) { - return delegate.listIterator(index); - } - - /** - * @param fromIndex - * @param toIndex - * @return - * @see java.util.List#subList(int, int) - */ - @Override - public List subList(final int fromIndex, final int toIndex) { - return delegate.subList(fromIndex, toIndex); - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/tag/DistributionSetTagAssigmentResultRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/tag/DistributionSetTagAssigmentResultRest.java index 1d0b51e72..2078fe891 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/tag/DistributionSetTagAssigmentResultRest.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/tag/DistributionSetTagAssigmentResultRest.java @@ -8,7 +8,9 @@ */ package org.eclipse.hawkbit.rest.resource.model.tag; -import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; +import java.util.List; + +import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; @@ -25,24 +27,24 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class DistributionSetTagAssigmentResultRest { @JsonProperty - private DistributionSetsRest assignedDistributionSets; + private List assignedDistributionSets; @JsonProperty - private DistributionSetsRest unassignedDistributionSets; + private List unassignedDistributionSets; - public DistributionSetsRest getAssignedDistributionSets() { + public List getAssignedDistributionSets() { return assignedDistributionSets; } - public DistributionSetsRest getUnassignedDistributionSets() { + public List getUnassignedDistributionSets() { return unassignedDistributionSets; } - public void setAssignedDistributionSets(final DistributionSetsRest assignedDistributionSets) { + public void setAssignedDistributionSets(final List assignedDistributionSets) { this.assignedDistributionSets = assignedDistributionSets; } - public void setUnassignedDistributionSets(final DistributionSetsRest unassignedDistributionSets) { + public void setUnassignedDistributionSets(final List unassignedDistributionSets) { this.unassignedDistributionSets = unassignedDistributionSets; } diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/tag/TargetTagAssigmentResultRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/tag/TargetTagAssigmentResultRest.java index 928a72460..30d47cc90 100644 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/tag/TargetTagAssigmentResultRest.java +++ b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/tag/TargetTagAssigmentResultRest.java @@ -8,7 +8,9 @@ */ package org.eclipse.hawkbit.rest.resource.model.tag; -import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest; +import java.util.List; + +import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; @@ -25,24 +27,24 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class TargetTagAssigmentResultRest { @JsonProperty - private TargetsRest assignedTargets; + private List assignedTargets; @JsonProperty - private TargetsRest unassignedTargets; + private List unassignedTargets; - public void setAssignedTargets(final TargetsRest assignedTargets) { + public void setAssignedTargets(final List assignedTargets) { this.assignedTargets = assignedTargets; } - public TargetsRest getAssignedTargets() { + public List getAssignedTargets() { return assignedTargets; } - public void setUnassignedTargets(final TargetsRest unassignedTargets) { + public void setUnassignedTargets(final List unassignedTargets) { this.unassignedTargets = unassignedTargets; } - public TargetsRest getUnassignedTargets() { + public List getUnassignedTargets() { return unassignedTargets; } diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/target/TargetPagedList.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/target/TargetPagedList.java deleted file mode 100644 index d7bb5ccca..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/target/TargetPagedList.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2011-2015 Bosch Software Innovations GmbH, Germany. All rights reserved. - */ -package org.eclipse.hawkbit.rest.resource.model.target; - -import java.util.List; - -import org.eclipse.hawkbit.rest.resource.model.PagedList; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Paged list for targets. - * - */ -public class TargetPagedList extends PagedList { - - private final List content; - - /** - * @param content - * @param total - */ - @JsonCreator - public TargetPagedList(@JsonProperty("content") final List content, - @JsonProperty("total") final long total) { - super(content, total); - this.content = content; - } - - /** - * @return the content of the paged list. Never {@code null}. - */ - public List getContent() { - return content; - } - -} diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/target/TargetsRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/target/TargetsRest.java deleted file mode 100644 index 6344ee93b..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/target/TargetsRest.java +++ /dev/null @@ -1,269 +0,0 @@ -/** - * Copyright (c) 2011-2015 Bosch Software Innovations GmbH, Germany. All rights reserved. - */ -package org.eclipse.hawkbit.rest.resource.model.target; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.springframework.hateoas.ResourceSupport; - -/** - * A list representation of the {@link TargetRest} because Spring MVC cannot - * handle plain lists interfaces as request body. - * - */ -public class TargetsRest extends ResourceSupport implements List { - - private final List delegate = new ArrayList<>(); - - /** - * @return - * @see java.util.List#size() - */ - @Override - public int size() { - return delegate.size(); - } - - /** - * @return - * @see java.util.List#isEmpty() - */ - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - /** - * @param o - * @return - * @see java.util.List#contains(java.lang.Object) - */ - @Override - public boolean contains(final Object o) { - return delegate.contains(o); - } - - /** - * @return - * @see java.util.List#iterator() - */ - @Override - public Iterator iterator() { - return delegate.iterator(); - } - - /** - * @return - * @see java.util.List#toArray() - */ - @Override - public Object[] toArray() { - return delegate.toArray(); - } - - /** - * @param a - * @return - * @see java.util.List#toArray(java.lang.Object[]) - */ - @Override - public T[] toArray(final T[] a) { - return delegate.toArray(a); - } - - /** - * @param e - * @return - * @see java.util.List#add(java.lang.Object) - */ - @Override - public boolean add(final TargetRest e) { - return delegate.add(e); - } - - /** - * @param o - * @return - * @see java.util.List#remove(java.lang.Object) - */ - @Override - public boolean remove(final Object o) { - return delegate.remove(o); - } - - /** - * @param c - * @return - * @see java.util.List#containsAll(java.util.Collection) - */ - @Override - public boolean containsAll(final Collection c) { - return delegate.containsAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#addAll(java.util.Collection) - */ - @Override - public boolean addAll(final Collection c) { - return delegate.addAll(c); - } - - /** - * @param index - * @param c - * @return - * @see java.util.List#addAll(int, java.util.Collection) - */ - @Override - public boolean addAll(final int index, final Collection c) { - return delegate.addAll(index, c); - } - - /** - * @param c - * @return - * @see java.util.List#removeAll(java.util.Collection) - */ - @Override - public boolean removeAll(final Collection c) { - return delegate.removeAll(c); - } - - /** - * @param c - * @return - * @see java.util.List#retainAll(java.util.Collection) - */ - @Override - public boolean retainAll(final Collection c) { - return delegate.retainAll(c); - } - - /** - * - * @see java.util.List#clear() - */ - @Override - public void clear() { - delegate.clear(); - } - - /** - * @param o - * @return - * @see java.util.List#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object o) { - return delegate.equals(o); - } - - /** - * @return - * @see java.util.List#hashCode() - */ - @Override - public int hashCode() { - return delegate.hashCode(); - } - - /** - * @param index - * @return - * @see java.util.List#get(int) - */ - @Override - public TargetRest get(final int index) { - return delegate.get(index); - } - - /** - * @param index - * @param element - * @return - * @see java.util.List#set(int, java.lang.Object) - */ - @Override - public TargetRest set(final int index, final TargetRest element) { - return delegate.set(index, element); - } - - /** - * @param index - * @param element - * @see java.util.List#add(int, java.lang.Object) - */ - @Override - public void add(final int index, final TargetRest element) { - delegate.add(index, element); - } - - /** - * @param index - * @return - * @see java.util.List#remove(int) - */ - @Override - public TargetRest remove(final int index) { - return delegate.remove(index); - } - - /** - * @param o - * @return - * @see java.util.List#indexOf(java.lang.Object) - */ - @Override - public int indexOf(final Object o) { - return delegate.indexOf(o); - } - - /** - * @param o - * @return - * @see java.util.List#lastIndexOf(java.lang.Object) - */ - @Override - public int lastIndexOf(final Object o) { - return delegate.lastIndexOf(o); - } - - /** - * @return - * @see java.util.List#listIterator() - */ - @Override - public ListIterator listIterator() { - return delegate.listIterator(); - } - - /** - * @param index - * @return - * @see java.util.List#listIterator(int) - */ - @Override - public ListIterator listIterator(final int index) { - return delegate.listIterator(index); - } - - /** - * @param fromIndex - * @param toIndex - * @return - * @see java.util.List#subList(int, int) - */ - @Override - public List subList(final int fromIndex, final int toIndex) { - return delegate.subList(fromIndex, toIndex); - } - -} diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetMapper.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetMapper.java index 9ae133dd5..8051146a1 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetMapper.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetMapper.java @@ -27,7 +27,6 @@ import org.eclipse.hawkbit.rest.resource.api.DistributionSetTypeRestApi; import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; -import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentResponseBody; /** @@ -193,8 +192,8 @@ public final class DistributionSetMapper { return result; } - static DistributionSetsRest toResponseDistributionSets(final Iterable sets) { - final DistributionSetsRest response = new DistributionSetsRest(); + static List toResponseDistributionSets(final Iterable sets) { + final List response = new ArrayList<>(); if (sets != null) { for (final DistributionSet set : sets) { diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetResource.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetResource.java index a4c71378d..4d5f47612 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetResource.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetResource.java @@ -34,16 +34,15 @@ import org.eclipse.hawkbit.rest.resource.api.DistributionSetRestApi; import org.eclipse.hawkbit.rest.resource.helper.RestResourceConversionHelper; import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.MetadataRestPageList; -import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetPagedList; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; -import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentRequestBody; import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentResponseBody; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleAssigmentRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulePagedList; -import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList; +import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest; +import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; import org.eclipse.hawkbit.tenancy.TenantAware; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -81,7 +80,7 @@ public class DistributionSetResource implements DistributionSetRestApi { private DistributionSetManagement distributionSetManagement; @Override - public ResponseEntity getDistributionSets(final int pagingOffsetParam, + public ResponseEntity> getDistributionSets(final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) { final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); @@ -98,7 +97,7 @@ public class DistributionSetResource implements DistributionSetRestApi { } final List rest = DistributionSetMapper.toResponseFromDsList(findDsPage.getContent()); - return new ResponseEntity<>(new DistributionSetPagedList(rest, findDsPage.getTotalElements()), HttpStatus.OK); + return new ResponseEntity<>(new PagedList<>(rest, findDsPage.getTotalElements()), HttpStatus.OK); } @Override @@ -109,7 +108,7 @@ public class DistributionSetResource implements DistributionSetRestApi { } @Override - public ResponseEntity createDistributionSets( + public ResponseEntity> createDistributionSets( final List sets) { LOG.debug("creating {} distribution sets", sets.size()); @@ -155,8 +154,8 @@ public class DistributionSetResource implements DistributionSetRestApi { } @Override - public ResponseEntity getAssignedTargets(final Long distributionSetId, final int pagingOffsetParam, - final int pagingLimitParam, final String sortParam, final String rsqlParam) { + public ResponseEntity> getAssignedTargets(final Long distributionSetId, + final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) { // check if distribution set exists otherwise throw exception // immediately @@ -175,12 +174,12 @@ public class DistributionSetResource implements DistributionSetRestApi { targetsAssignedDS = this.targetManagement.findTargetByAssignedDistributionSet(distributionSetId, pageable); } - return new ResponseEntity<>(new TargetPagedList(TargetMapper.toResponse(targetsAssignedDS.getContent()), + return new ResponseEntity<>(new PagedList<>(TargetMapper.toResponse(targetsAssignedDS.getContent()), targetsAssignedDS.getTotalElements()), HttpStatus.OK); } @Override - public ResponseEntity getInstalledTargets(final Long distributionSetId, + public ResponseEntity> getInstalledTargets(final Long distributionSetId, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) { // check if distribution set exists otherwise throw exception // immediately @@ -200,7 +199,7 @@ public class DistributionSetResource implements DistributionSetRestApi { pageable); } - return new ResponseEntity<>(new TargetPagedList(TargetMapper.toResponse(targetsInstalledDS.getContent()), + return new ResponseEntity<>(new PagedList(TargetMapper.toResponse(targetsInstalledDS.getContent()), targetsInstalledDS.getTotalElements()), HttpStatus.OK); } @@ -323,7 +322,7 @@ public class DistributionSetResource implements DistributionSetRestApi { } @Override - public ResponseEntity getAssignedSoftwareModules(final Long distributionSetId, + public ResponseEntity> getAssignedSoftwareModules(final Long distributionSetId, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) { // check if distribution set exists otherwise throw exception // immediately @@ -334,10 +333,8 @@ public class DistributionSetResource implements DistributionSetRestApi { final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting); final Page softwaremodules = this.softwareManagement.findSoftwareModuleByAssignedTo(pageable, foundDs); - return new ResponseEntity<>( - new SoftwareModulePagedList(SoftwareModuleMapper.toResponse(softwaremodules.getContent()), - softwaremodules.getTotalElements()), - HttpStatus.OK); + return new ResponseEntity<>(new PagedList<>(SoftwareModuleMapper.toResponse(softwaremodules.getContent()), + softwaremodules.getTotalElements()), HttpStatus.OK); } private DistributionSet findDistributionSetWithExceptionIfNotFound(final Long distributionSetId) { diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTagResource.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTagResource.java index c395863ab..63b864758 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTagResource.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTagResource.java @@ -20,7 +20,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag; import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult; import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.rest.resource.api.DistributionSetTagRestApi; -import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; +import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; import org.eclipse.hawkbit.rest.resource.model.tag.AssignedDistributionSetRequestBody; import org.eclipse.hawkbit.rest.resource.model.tag.DistributionSetTagAssigmentResultRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagPagedList; @@ -121,7 +121,7 @@ public class DistributionSetTagResource implements DistributionSetTagRestApi { } @Override - public ResponseEntity getAssignedDistributionSets(final Long distributionsetTagId) { + public ResponseEntity> getAssignedDistributionSets(final Long distributionsetTagId) { final DistributionSetTag tag = findDistributionTagById(distributionsetTagId); return new ResponseEntity<>( DistributionSetMapper.toResponseDistributionSets(tag.getAssignedToDistributionSet()), HttpStatus.OK); @@ -151,7 +151,7 @@ public class DistributionSetTagResource implements DistributionSetTagRestApi { } @Override - public ResponseEntity assignDistributionSets(final Long distributionsetTagId, + public ResponseEntity> assignDistributionSets(final Long distributionsetTagId, final List assignedDSRequestBodies) { LOG.debug("Assign DistributionSet {} for ds tag {}", assignedDSRequestBodies.size(), distributionsetTagId); final DistributionSetTag tag = findDistributionTagById(distributionsetTagId); diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTypeMapper.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTypeMapper.java index b32302705..409caf01d 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTypeMapper.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTypeMapper.java @@ -21,15 +21,11 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.rest.resource.api.DistributionSetTypeRestApi; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRest; -import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypesRest; /** * A mapper which maps repository model to RESTful model representation and * back. * - * - * - * */ final class DistributionSetTypeMapper { @@ -63,7 +59,7 @@ final class DistributionSetTypeMapper { } return smType; - }).forEach(softmType -> result.addMandatoryModuleType(softmType)); + }).forEach(result::addMandatoryModuleType); // Add optional smsRest.getOptionalmodules().stream().map(opt -> { @@ -74,13 +70,13 @@ final class DistributionSetTypeMapper { } return smType; - }).forEach(softmType -> result.addOptionalModuleType(softmType)); + }).forEach(result::addOptionalModuleType); return result; } - static DistributionSetTypesRest toTypesResponse(final List types) { - final DistributionSetTypesRest response = new DistributionSetTypesRest(); + static List toTypesResponse(final List types) { + final List response = new ArrayList<>(); for (final DistributionSetType dsType : types) { response.add(toResponse(dsType)); } diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTypeResource.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTypeResource.java index a5c8544fb..f7346a6ff 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTypeResource.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/DistributionSetTypeResource.java @@ -21,13 +21,11 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.rest.resource.api.DistributionSetTypeRestApi; import org.eclipse.hawkbit.rest.resource.model.IdRest; -import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypePagedList; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRest; -import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypesRest; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -56,7 +54,7 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi { private DistributionSetManagement distributionSetManagement; @Override - public ResponseEntity getDistributionSetTypes( + public ResponseEntity> getDistributionSetTypes( @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @@ -81,7 +79,7 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi { final List rest = DistributionSetTypeMapper .toListResponse(findModuleTypessAll.getContent()); - return new ResponseEntity<>(new DistributionSetTypePagedList(rest, countModulesAll), HttpStatus.OK); + return new ResponseEntity<>(new PagedList<>(rest, countModulesAll), HttpStatus.OK); } @Override @@ -119,7 +117,7 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi { } @Override - public ResponseEntity createDistributionSetTypes( + public ResponseEntity> createDistributionSetTypes( @RequestBody final List distributionSetTypes) { final List createdSoftwareModules = distributionSetManagement.createDistributionSetTypes( @@ -139,14 +137,12 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi { } @Override - public ResponseEntity getMandatoryModules(@PathVariable final Long distributionSetTypeId) { + public ResponseEntity> getMandatoryModules( + @PathVariable final Long distributionSetTypeId) { final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId); - - final SoftwareModuleTypesRest rest = new SoftwareModuleTypesRest(); - - rest.addAll(SoftwareModuleTypeMapper.toListResponse(foundType.getMandatoryModuleTypes())); - return new ResponseEntity<>(rest, HttpStatus.OK); + return new ResponseEntity<>(SoftwareModuleTypeMapper.toListResponse(foundType.getMandatoryModuleTypes()), + HttpStatus.OK); } @Override @@ -182,14 +178,13 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi { } @Override - public ResponseEntity getOptionalModules(@PathVariable final Long distributionSetTypeId) { + public ResponseEntity> getOptionalModules( + @PathVariable final Long distributionSetTypeId) { final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId); - final SoftwareModuleTypesRest rest = new SoftwareModuleTypesRest(); - - rest.addAll(SoftwareModuleTypeMapper.toListResponse(foundType.getOptionalModuleTypes())); - return new ResponseEntity<>(rest, HttpStatus.OK); + return new ResponseEntity<>(SoftwareModuleTypeMapper.toListResponse(foundType.getOptionalModuleTypes()), + HttpStatus.OK); } @Override diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/RestModelMapper.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/RestModelMapper.java index 24f717004..9616d0e86 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/RestModelMapper.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/RestModelMapper.java @@ -8,8 +8,8 @@ */ package org.eclipse.hawkbit.rest.resource; -import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.NamedEntity; +import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.rest.resource.model.BaseEntityRest; import org.eclipse.hawkbit.rest.resource.model.NamedEntityRest; diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/RolloutResource.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/RolloutResource.java index e00d07191..2267cb836 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/RolloutResource.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/RolloutResource.java @@ -28,12 +28,11 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCond import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.rest.resource.api.RolloutRestApi; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutPagedList; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutResponseBody; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutRestRequestBody; -import org.eclipse.hawkbit.rest.resource.model.rolloutgroup.RolloutGroupPagedList; import org.eclipse.hawkbit.rest.resource.model.rolloutgroup.RolloutGroupResponseBody; -import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -168,8 +167,8 @@ public class RolloutResource implements RolloutRestApi { } @Override - public ResponseEntity getRolloutGroups(final Long rolloutId, final int pagingOffsetParam, - final int pagingLimitParam, final String sortParam, final String rsqlParam) { + public ResponseEntity> getRolloutGroups(final Long rolloutId, + final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) { final Rollout rollout = findRolloutOrThrowException(rolloutId); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); @@ -188,8 +187,7 @@ public class RolloutResource implements RolloutRestApi { final List rest = RolloutMapper .toResponseRolloutGroup(findRolloutGroupsAll.getContent()); - return new ResponseEntity<>(new RolloutGroupPagedList(rest, findRolloutGroupsAll.getTotalElements()), - HttpStatus.OK); + return new ResponseEntity<>(new PagedList<>(rest, findRolloutGroupsAll.getTotalElements()), HttpStatus.OK); } @Override @@ -200,7 +198,7 @@ public class RolloutResource implements RolloutRestApi { } @Override - public ResponseEntity getRolloutGroupTargets(final Long rolloutId, final Long groupId, + public ResponseEntity> getRolloutGroupTargets(final Long rolloutId, final Long groupId, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) { findRolloutOrThrowException(rolloutId); final RolloutGroup rolloutGroup = findRolloutGroupOrThrowException(groupId); @@ -222,7 +220,8 @@ public class RolloutResource implements RolloutRestApi { rolloutGroupTargets = pageTargets; } final List rest = TargetMapper.toResponse(rolloutGroupTargets.getContent()); - return new ResponseEntity<>(new TargetPagedList(rest, rolloutGroupTargets.getTotalElements()), HttpStatus.OK); + return new ResponseEntity<>(new PagedList(rest, rolloutGroupTargets.getTotalElements()), + HttpStatus.OK); } private Rollout findRolloutOrThrowException(final Long rolloutId) { diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleMapper.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleMapper.java index 1a3ce603f..01dfae9cd 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleMapper.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleMapper.java @@ -26,18 +26,13 @@ import org.eclipse.hawkbit.rest.resource.api.SoftwareModuleTypeRestApi; import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactHash; import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactRest; -import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactsRest; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulesRest; /** * A mapper which maps repository model to RESTful model representation and * back. * - * - * - * */ public final class SoftwareModuleMapper { private SoftwareModuleMapper() { @@ -102,8 +97,8 @@ public final class SoftwareModuleMapper { return mappedList; } - static SoftwareModulesRest toResponseSoftwareModules(final Iterable softwareModules) { - final SoftwareModulesRest response = new SoftwareModulesRest(); + static List toResponseSoftwareModules(final Iterable softwareModules) { + final List response = new ArrayList<>(); for (final SoftwareModule softwareModule : softwareModules) { response.add(toResponse(softwareModule)); } @@ -192,8 +187,8 @@ public final class SoftwareModuleMapper { return artifactRest; } - static ArtifactsRest artifactsToResponse(final List artifacts) { - final ArtifactsRest mappedList = new ArtifactsRest(); + static List artifactsToResponse(final List artifacts) { + final List mappedList = new ArrayList<>(); if (artifacts != null) { for (final Artifact artifact : artifacts) { diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleResource.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleResource.java index dfbac1a6f..e165fca20 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleResource.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleResource.java @@ -24,13 +24,11 @@ import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.rest.resource.api.SoftwareModuleRestAPI; import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.MetadataRestPageList; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactRest; -import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactsRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulePagedList; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulesRest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -93,7 +91,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI { } @Override - public ResponseEntity getArtifacts(@PathVariable final Long softwareModuleId) { + public ResponseEntity> getArtifacts(@PathVariable final Long softwareModuleId) { final SoftwareModule module = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null); return new ResponseEntity<>(SoftwareModuleMapper.artifactsToResponse(module.getArtifacts()), HttpStatus.OK); @@ -120,7 +118,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI { } @Override - public ResponseEntity getSoftwareModules( + public ResponseEntity> getSoftwareModules( @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @@ -144,7 +142,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI { } final List rest = SoftwareModuleMapper.toResponse(findModulesAll.getContent()); - return new ResponseEntity<>(new SoftwareModulePagedList(rest, countModulesAll), HttpStatus.OK); + return new ResponseEntity<>(new PagedList<>(rest, countModulesAll), HttpStatus.OK); } @Override @@ -155,7 +153,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI { } @Override - public ResponseEntity createSoftwareModules( + public ResponseEntity> createSoftwareModules( @RequestBody final List softwareModules) { LOG.debug("creating {} softwareModules", softwareModules.size()); final Iterable createdSoftwareModules = softwareManagement diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleTypeMapper.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleTypeMapper.java index bd2c5f1c1..b6525948c 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleTypeMapper.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleTypeMapper.java @@ -19,7 +19,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.rest.resource.api.SoftwareModuleTypeRestApi; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest; /** * A mapper which maps repository model to RESTful model representation and @@ -50,8 +49,8 @@ final class SoftwareModuleTypeMapper { smsRest.getMaxAssignments()); } - static SoftwareModuleTypesRest toTypesResponse(final List types) { - final SoftwareModuleTypesRest response = new SoftwareModuleTypesRest(); + static List toTypesResponse(final List types) { + final List response = new ArrayList<>(); for (final SoftwareModuleType softwareModule : types) { response.add(toResponse(softwareModule)); } diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleTypeResource.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleTypeResource.java index 4259dcc90..7dda79690 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleTypeResource.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleTypeResource.java @@ -18,11 +18,10 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.rest.resource.api.SoftwareModuleTypeRestApi; -import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypePagedList; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; -import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -43,8 +42,8 @@ public class SoftwareModuleTypeResource implements SoftwareModuleTypeRestApi { private SoftwareManagement softwareManagement; @Override - public ResponseEntity getTypes(final int pagingOffsetParam, final int pagingLimitParam, - final String sortParam, final String rsqlParam) { + public ResponseEntity> getTypes(final int pagingOffsetParam, + final int pagingLimitParam, final String sortParam, final String rsqlParam) { final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam); @@ -65,7 +64,7 @@ public class SoftwareModuleTypeResource implements SoftwareModuleTypeRestApi { final List rest = SoftwareModuleTypeMapper .toListResponse(findModuleTypessAll.getContent()); - return new ResponseEntity<>(new SoftwareModuleTypePagedList(rest, countModulesAll), HttpStatus.OK); + return new ResponseEntity<>(new PagedList<>(rest, countModulesAll), HttpStatus.OK); } @Override @@ -99,7 +98,7 @@ public class SoftwareModuleTypeResource implements SoftwareModuleTypeRestApi { } @Override - public ResponseEntity createSoftwareModuleTypes( + public ResponseEntity> createSoftwareModuleTypes( final List softwareModuleTypes) { final List createdSoftwareModules = this.softwareManagement diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetMapper.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetMapper.java index b6c6c1539..0cb3c72a3 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetMapper.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetMapper.java @@ -27,18 +27,16 @@ import org.eclipse.hawkbit.rest.resource.api.TargetRestApi; import org.eclipse.hawkbit.rest.resource.model.PollStatusRest; import org.eclipse.hawkbit.rest.resource.model.action.ActionRest; import org.eclipse.hawkbit.rest.resource.model.action.ActionStatusRest; -import org.eclipse.hawkbit.rest.resource.model.action.ActionStatussRest; import org.eclipse.hawkbit.rest.resource.model.action.ActionsRest; import org.eclipse.hawkbit.rest.resource.model.target.TargetRequestBody; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; -import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest; /** * A mapper which maps repository model to RESTful model representation and * back. * */ -final public class TargetMapper { +public final class TargetMapper { private TargetMapper() { // Utility class @@ -64,7 +62,7 @@ final public class TargetMapper { } /** - * Add the pollstatus to a target response. + * Add the poll status to a target response. * * @param target * the target @@ -91,8 +89,8 @@ final public class TargetMapper { * the targets * @return the response */ - public static TargetsRest toResponseWithLinksAndPollStatus(final Iterable targets) { - final TargetsRest mappedList = new TargetsRest(); + public static List toResponseWithLinksAndPollStatus(final Iterable targets) { + final List mappedList = new ArrayList<>(); if (targets != null) { for (final Target target : targets) { final TargetRest response = toResponse(target); @@ -111,8 +109,8 @@ final public class TargetMapper { * list of targets * @return the response */ - public static TargetsRest toResponse(final Iterable targets) { - final TargetsRest mappedList = new TargetsRest(); + public static List toResponse(final Iterable targets) { + final List mappedList = new ArrayList<>(); if (targets != null) { for (final Target target : targets) { final TargetRest response = toResponse(target); @@ -184,12 +182,12 @@ final public class TargetMapper { return target; } - static ActionStatussRest toActionStatusRestResponse(final Action action, final List actionStatus) { - final ActionStatussRest mappedList = new ActionStatussRest(); + static List toActionStatusRestResponse(final List actionStatus) { + final List mappedList = new ArrayList<>(); if (actionStatus != null) { for (final ActionStatus status : actionStatus) { - final ActionStatusRest response = toResponse(action, status); + final ActionStatusRest response = toResponse(status); mappedList.add(response); } } @@ -293,7 +291,7 @@ final public class TargetMapper { return result; } - private static ActionStatusRest toResponse(final Action action, final ActionStatus actionStatus) { + private static ActionStatusRest toResponse(final ActionStatus actionStatus) { final ActionStatusRest result = new ActionStatusRest(); result.setMessages(actionStatus.getMessages()); diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetResource.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetResource.java index faa31a7cc..3c79c936c 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetResource.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetResource.java @@ -29,16 +29,14 @@ import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.rest.resource.api.DistributionSetRestApi; import org.eclipse.hawkbit.rest.resource.api.TargetRestApi; import org.eclipse.hawkbit.rest.resource.helper.RestResourceConversionHelper; -import org.eclipse.hawkbit.rest.resource.model.action.ActionPagedList; +import org.eclipse.hawkbit.rest.resource.model.PagedList; import org.eclipse.hawkbit.rest.resource.model.action.ActionRest; -import org.eclipse.hawkbit.rest.resource.model.action.ActionStatusPagedList; +import org.eclipse.hawkbit.rest.resource.model.action.ActionStatusRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; import org.eclipse.hawkbit.rest.resource.model.target.DistributionSetAssigmentRest; import org.eclipse.hawkbit.rest.resource.model.target.TargetAttributes; -import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList; import org.eclipse.hawkbit.rest.resource.model.target.TargetRequestBody; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; -import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -77,7 +75,7 @@ public class TargetResource implements TargetRestApi { } @Override - public ResponseEntity getTargets(final int pagingOffsetParam, final int pagingLimitParam, + public ResponseEntity> getTargets(final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) { final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); @@ -98,11 +96,11 @@ public class TargetResource implements TargetRestApi { } final List rest = TargetMapper.toResponse(findTargetsAll.getContent()); - return new ResponseEntity<>(new TargetPagedList(rest, countTargetsAll), HttpStatus.OK); + return new ResponseEntity<>(new PagedList(rest, countTargetsAll), HttpStatus.OK); } @Override - public ResponseEntity createTargets(final List targets) { + public ResponseEntity> createTargets(final List targets) { LOG.debug("creating {} targets", targets.size()); final Iterable createdTargets = this.targetManagement.createTargets(TargetMapper.fromRequest(targets)); LOG.debug("{} targets created, return status {}", targets.size(), HttpStatus.CREATED); @@ -147,7 +145,7 @@ public class TargetResource implements TargetRestApi { } @Override - public ResponseEntity getActionHistory(final String targetId, final int pagingOffsetParam, + public ResponseEntity> getActionHistory(final String targetId, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) { final Target foundTarget = findTargetWithExceptionIfNotFound(targetId); @@ -169,7 +167,7 @@ public class TargetResource implements TargetRestApi { } return new ResponseEntity<>( - new ActionPagedList(TargetMapper.toResponse(targetId, activeActions.getContent()), totalActionCount), + new PagedList<>(TargetMapper.toResponse(targetId, activeActions.getContent()), totalActionCount), HttpStatus.OK); } @@ -220,7 +218,7 @@ public class TargetResource implements TargetRestApi { } @Override - public ResponseEntity getActionStatusList(final String targetId, final Long actionId, + public ResponseEntity> getActionStatusList(final String targetId, final Long actionId, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) { final Target target = findTargetWithExceptionIfNotFound(targetId); @@ -238,10 +236,8 @@ public class TargetResource implements TargetRestApi { final Page statusList = this.deploymentManagement.findActionStatusByAction( new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting), action, true); - return new ResponseEntity<>( - new ActionStatusPagedList(TargetMapper.toActionStatusRestResponse(action, statusList.getContent()), - statusList.getTotalElements()), - HttpStatus.OK); + return new ResponseEntity<>(new PagedList<>(TargetMapper.toActionStatusRestResponse(statusList.getContent()), + statusList.getTotalElements()), HttpStatus.OK); } diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetTagResource.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetTagResource.java index 76209a958..0e4bf9ec9 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetTagResource.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetTagResource.java @@ -26,7 +26,7 @@ import org.eclipse.hawkbit.rest.resource.model.tag.TagRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.tag.TagRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagsRest; import org.eclipse.hawkbit.rest.resource.model.tag.TargetTagAssigmentResultRest; -import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest; +import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -118,7 +118,7 @@ public class TargetTagResource implements TargetTagRestApi { } @Override - public ResponseEntity getAssignedTargets(final Long targetTagId) { + public ResponseEntity> getAssignedTargets(final Long targetTagId) { final TargetTag targetTag = findTargetTagById(targetTagId); return new ResponseEntity<>(TargetMapper.toResponseWithLinksAndPollStatus(targetTag.getAssignedToTargets()), HttpStatus.OK); @@ -140,7 +140,7 @@ public class TargetTagResource implements TargetTagRestApi { } @Override - public ResponseEntity assignTargets(final Long targetTagId, + public ResponseEntity> assignTargets(final Long targetTagId, final List assignedTargetRequestBodies) { LOG.debug("Assign Targets {} for target tag {}", assignedTargetRequestBodies.size(), targetTagId); final TargetTag targetTag = findTargetTagById(targetTagId);