Merge pull request #104 from bsinno/remove-boilerplate-code
Remove boilerplate code
This commit is contained in:
@@ -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<DistributionSet> sets) {
|
||||
final DistributionSetsRest response = new DistributionSetsRest();
|
||||
static List<DistributionSetRest> toResponseDistributionSets(final Iterable<DistributionSet> sets) {
|
||||
final List<DistributionSetRest> response = new ArrayList<>();
|
||||
if (sets != null) {
|
||||
|
||||
for (final DistributionSet set : sets) {
|
||||
|
||||
@@ -33,17 +33,15 @@ import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
|
||||
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 +79,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
|
||||
private DistributionSetManagement distributionSetManagement;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DistributionSetPagedList> getDistributionSets(final int pagingOffsetParam,
|
||||
public ResponseEntity<PagedList<DistributionSetRest>> getDistributionSets(final int pagingOffsetParam,
|
||||
final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
||||
|
||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
||||
@@ -98,7 +96,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
|
||||
}
|
||||
|
||||
final List<DistributionSetRest> 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 +107,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DistributionSetsRest> createDistributionSets(
|
||||
public ResponseEntity<List<DistributionSetRest>> createDistributionSets(
|
||||
final List<DistributionSetRequestBodyPost> sets) {
|
||||
|
||||
LOG.debug("creating {} distribution sets", sets.size());
|
||||
@@ -155,8 +153,8 @@ public class DistributionSetResource implements DistributionSetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TargetPagedList> getAssignedTargets(final Long distributionSetId, final int pagingOffsetParam,
|
||||
final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
||||
public ResponseEntity<PagedList<TargetRest>> 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 +173,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<TargetPagedList> getInstalledTargets(final Long distributionSetId,
|
||||
public ResponseEntity<PagedList<TargetRest>> 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 +198,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
|
||||
pageable);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(new TargetPagedList(TargetMapper.toResponse(targetsInstalledDS.getContent()),
|
||||
return new ResponseEntity<>(new PagedList<TargetRest>(TargetMapper.toResponse(targetsInstalledDS.getContent()),
|
||||
targetsInstalledDS.getTotalElements()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -219,8 +217,8 @@ public class DistributionSetResource implements DistributionSetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MetadataRestPageList> getMetadata(final Long distributionSetId, final int pagingOffsetParam,
|
||||
final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
||||
public ResponseEntity<PagedList<MetadataRest>> getMetadata(final Long distributionSetId,
|
||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
||||
|
||||
// check if distribution set exists otherwise throw exception
|
||||
// immediately
|
||||
@@ -242,7 +240,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new MetadataRestPageList(DistributionSetMapper.toResponseDsMetadata(metaDataPage.getContent()),
|
||||
new PagedList<>(DistributionSetMapper.toResponseDsMetadata(metaDataPage.getContent()),
|
||||
metaDataPage.getTotalElements()),
|
||||
HttpStatus.OK);
|
||||
|
||||
@@ -323,7 +321,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<SoftwareModulePagedList> getAssignedSoftwareModules(final Long distributionSetId,
|
||||
public ResponseEntity<PagedList<SoftwareModuleRest>> getAssignedSoftwareModules(final Long distributionSetId,
|
||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||
// check if distribution set exists otherwise throw exception
|
||||
// immediately
|
||||
@@ -334,10 +332,8 @@ public class DistributionSetResource implements DistributionSetRestApi {
|
||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
||||
final Page<SoftwareModule> 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) {
|
||||
|
||||
@@ -20,10 +20,10 @@ 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.PagedList;
|
||||
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;
|
||||
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;
|
||||
@@ -53,8 +53,8 @@ public class DistributionSetTagResource implements DistributionSetTagRestApi {
|
||||
private DistributionSetManagement distributionSetManagement;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TagPagedList> getDistributionSetTags(final int pagingOffsetParam, final int pagingLimitParam,
|
||||
final String sortParam, final String rsqlParam) {
|
||||
public ResponseEntity<PagedList<TagRest>> getDistributionSetTags(final int pagingOffsetParam,
|
||||
final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
||||
|
||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
||||
@@ -76,7 +76,7 @@ public class DistributionSetTagResource implements DistributionSetTagRestApi {
|
||||
}
|
||||
|
||||
final List<TagRest> rest = TagMapper.toResponseDistributionSetTag(findTargetsAll.getContent());
|
||||
return new ResponseEntity<>(new TagPagedList(rest, countTargetsAll), HttpStatus.OK);
|
||||
return new ResponseEntity<>(new PagedList<>(rest, countTargetsAll), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,7 +121,7 @@ public class DistributionSetTagResource implements DistributionSetTagRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DistributionSetsRest> getAssignedDistributionSets(final Long distributionsetTagId) {
|
||||
public ResponseEntity<List<DistributionSetRest>> 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<DistributionSetsRest> assignDistributionSets(final Long distributionsetTagId,
|
||||
public ResponseEntity<List<DistributionSetRest>> assignDistributionSets(final Long distributionsetTagId,
|
||||
final List<AssignedDistributionSetRequestBody> assignedDSRequestBodies) {
|
||||
LOG.debug("Assign DistributionSet {} for ds tag {}", assignedDSRequestBodies.size(), distributionsetTagId);
|
||||
final DistributionSetTag tag = findDistributionTagById(distributionsetTagId);
|
||||
|
||||
@@ -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<DistributionSetType> types) {
|
||||
final DistributionSetTypesRest response = new DistributionSetTypesRest();
|
||||
static List<DistributionSetTypeRest> toTypesResponse(final List<DistributionSetType> types) {
|
||||
final List<DistributionSetTypeRest> response = new ArrayList<>();
|
||||
for (final DistributionSetType dsType : types) {
|
||||
response.add(toResponse(dsType));
|
||||
}
|
||||
|
||||
@@ -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<DistributionSetTypePagedList> getDistributionSetTypes(
|
||||
public ResponseEntity<PagedList<DistributionSetTypeRest>> 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<DistributionSetTypeRest> 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<DistributionSetTypesRest> createDistributionSetTypes(
|
||||
public ResponseEntity<List<DistributionSetTypeRest>> createDistributionSetTypes(
|
||||
@RequestBody final List<DistributionSetTypeRequestBodyPost> distributionSetTypes) {
|
||||
|
||||
final List<DistributionSetType> createdSoftwareModules = distributionSetManagement.createDistributionSetTypes(
|
||||
@@ -139,14 +137,12 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<SoftwareModuleTypesRest> getMandatoryModules(@PathVariable final Long distributionSetTypeId) {
|
||||
public ResponseEntity<List<SoftwareModuleTypeRest>> 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<SoftwareModuleTypesRest> getOptionalModules(@PathVariable final Long distributionSetTypeId) {
|
||||
public ResponseEntity<List<SoftwareModuleTypeRest>> 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
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.rest.resource;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
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;
|
||||
|
||||
@@ -28,7 +28,7 @@ final class RestModelMapper {
|
||||
|
||||
}
|
||||
|
||||
static void mapBaseToBase(final BaseEntityRest response, final BaseEntity base) {
|
||||
static void mapBaseToBase(final BaseEntityRest response, final TenantAwareBaseEntity base) {
|
||||
response.setCreatedBy(base.getCreatedBy());
|
||||
response.setLastModifiedBy(base.getLastModifiedBy());
|
||||
if (base.getCreatedAt() != null) {
|
||||
|
||||
@@ -28,12 +28,10 @@ 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.rollout.RolloutPagedList;
|
||||
import org.eclipse.hawkbit.rest.resource.model.PagedList;
|
||||
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;
|
||||
@@ -64,8 +62,8 @@ public class RolloutResource implements RolloutRestApi {
|
||||
private DistributionSetManagement distributionSetManagement;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<RolloutPagedList> getRollouts(final int pagingOffsetParam, final int pagingLimitParam,
|
||||
final String sortParam, final String rsqlParam) {
|
||||
public ResponseEntity<PagedList<RolloutResponseBody>> getRollouts(final int pagingOffsetParam,
|
||||
final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
||||
|
||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
||||
@@ -82,7 +80,7 @@ public class RolloutResource implements RolloutRestApi {
|
||||
}
|
||||
|
||||
final List<RolloutResponseBody> rest = RolloutMapper.toResponseRollout(findModulesAll.getContent());
|
||||
return new ResponseEntity<>(new RolloutPagedList(rest, findModulesAll.getTotalElements()), HttpStatus.OK);
|
||||
return new ResponseEntity<>(new PagedList<>(rest, findModulesAll.getTotalElements()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -168,8 +166,8 @@ public class RolloutResource implements RolloutRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<RolloutGroupPagedList> getRolloutGroups(final Long rolloutId, final int pagingOffsetParam,
|
||||
final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
||||
public ResponseEntity<PagedList<RolloutGroupResponseBody>> 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 +186,7 @@ public class RolloutResource implements RolloutRestApi {
|
||||
|
||||
final List<RolloutGroupResponseBody> 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 +197,7 @@ public class RolloutResource implements RolloutRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TargetPagedList> getRolloutGroupTargets(final Long rolloutId, final Long groupId,
|
||||
public ResponseEntity<PagedList<TargetRest>> 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 +219,8 @@ public class RolloutResource implements RolloutRestApi {
|
||||
rolloutGroupTargets = pageTargets;
|
||||
}
|
||||
final List<TargetRest> rest = TargetMapper.toResponse(rolloutGroupTargets.getContent());
|
||||
return new ResponseEntity<>(new TargetPagedList(rest, rolloutGroupTargets.getTotalElements()), HttpStatus.OK);
|
||||
return new ResponseEntity<>(new PagedList<TargetRest>(rest, rolloutGroupTargets.getTotalElements()),
|
||||
HttpStatus.OK);
|
||||
}
|
||||
|
||||
private Rollout findRolloutOrThrowException(final Long rolloutId) {
|
||||
|
||||
@@ -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<SoftwareModule> softwareModules) {
|
||||
final SoftwareModulesRest response = new SoftwareModulesRest();
|
||||
static List<SoftwareModuleRest> toResponseSoftwareModules(final Iterable<SoftwareModule> softwareModules) {
|
||||
final List<SoftwareModuleRest> 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<Artifact> artifacts) {
|
||||
final ArtifactsRest mappedList = new ArtifactsRest();
|
||||
static List<ArtifactRest> artifactsToResponse(final List<Artifact> artifacts) {
|
||||
final List<ArtifactRest> mappedList = new ArrayList<>();
|
||||
|
||||
if (artifacts != null) {
|
||||
for (final Artifact artifact : artifacts) {
|
||||
|
||||
@@ -23,14 +23,11 @@ import org.eclipse.hawkbit.repository.model.SwMetadataCompositeKey;
|
||||
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 +90,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<ArtifactsRest> getArtifacts(@PathVariable final Long softwareModuleId) {
|
||||
public ResponseEntity<List<ArtifactRest>> getArtifacts(@PathVariable final Long softwareModuleId) {
|
||||
final SoftwareModule module = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
|
||||
|
||||
return new ResponseEntity<>(SoftwareModuleMapper.artifactsToResponse(module.getArtifacts()), HttpStatus.OK);
|
||||
@@ -120,7 +117,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<SoftwareModulePagedList> getSoftwareModules(
|
||||
public ResponseEntity<PagedList<SoftwareModuleRest>> 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 +141,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
|
||||
}
|
||||
|
||||
final List<SoftwareModuleRest> 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 +152,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<SoftwareModulesRest> createSoftwareModules(
|
||||
public ResponseEntity<List<SoftwareModuleRest>> createSoftwareModules(
|
||||
@RequestBody final List<SoftwareModuleRequestBodyPost> softwareModules) {
|
||||
LOG.debug("creating {} softwareModules", softwareModules.size());
|
||||
final Iterable<SoftwareModule> createdSoftwareModules = softwareManagement
|
||||
@@ -193,7 +190,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MetadataRestPageList> getMetadata(@PathVariable final Long softwareModuleId,
|
||||
public ResponseEntity<PagedList<MetadataRest>> getMetadata(@PathVariable final Long softwareModuleId,
|
||||
@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,
|
||||
@@ -217,7 +214,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new MetadataRestPageList(SoftwareModuleMapper.toResponseSwMetadata(metaDataPage.getContent()),
|
||||
new PagedList<>(SoftwareModuleMapper.toResponseSwMetadata(metaDataPage.getContent()),
|
||||
metaDataPage.getTotalElements()),
|
||||
HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -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<SoftwareModuleType> types) {
|
||||
final SoftwareModuleTypesRest response = new SoftwareModuleTypesRest();
|
||||
static List<SoftwareModuleTypeRest> toTypesResponse(final List<SoftwareModuleType> types) {
|
||||
final List<SoftwareModuleTypeRest> response = new ArrayList<>();
|
||||
for (final SoftwareModuleType softwareModule : types) {
|
||||
response.add(toResponse(softwareModule));
|
||||
}
|
||||
|
||||
@@ -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<SoftwareModuleTypePagedList> getTypes(final int pagingOffsetParam, final int pagingLimitParam,
|
||||
final String sortParam, final String rsqlParam) {
|
||||
public ResponseEntity<PagedList<SoftwareModuleTypeRest>> 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<SoftwareModuleTypeRest> 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<SoftwareModuleTypesRest> createSoftwareModuleTypes(
|
||||
public ResponseEntity<List<SoftwareModuleTypeRest>> createSoftwareModuleTypes(
|
||||
final List<SoftwareModuleTypeRequestBodyPost> softwareModuleTypes) {
|
||||
|
||||
final List<SoftwareModuleType> createdSoftwareModules = this.softwareManagement
|
||||
|
||||
@@ -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<Target> targets) {
|
||||
final TargetsRest mappedList = new TargetsRest();
|
||||
public static List<TargetRest> toResponseWithLinksAndPollStatus(final Iterable<Target> targets) {
|
||||
final List<TargetRest> 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<Target> targets) {
|
||||
final TargetsRest mappedList = new TargetsRest();
|
||||
public static List<TargetRest> toResponse(final Iterable<Target> targets) {
|
||||
final List<TargetRest> 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> actionStatus) {
|
||||
final ActionStatussRest mappedList = new ActionStatussRest();
|
||||
static List<ActionStatusRest> toActionStatusRestResponse(final List<ActionStatus> actionStatus) {
|
||||
final List<ActionStatusRest> 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());
|
||||
|
||||
@@ -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<TargetPagedList> getTargets(final int pagingOffsetParam, final int pagingLimitParam,
|
||||
public ResponseEntity<PagedList<TargetRest>> 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<TargetRest> rest = TargetMapper.toResponse(findTargetsAll.getContent());
|
||||
return new ResponseEntity<>(new TargetPagedList(rest, countTargetsAll), HttpStatus.OK);
|
||||
return new ResponseEntity<>(new PagedList<TargetRest>(rest, countTargetsAll), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TargetsRest> createTargets(final List<TargetRequestBody> targets) {
|
||||
public ResponseEntity<List<TargetRest>> createTargets(final List<TargetRequestBody> targets) {
|
||||
LOG.debug("creating {} targets", targets.size());
|
||||
final Iterable<Target> 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<ActionPagedList> getActionHistory(final String targetId, final int pagingOffsetParam,
|
||||
public ResponseEntity<PagedList<ActionRest>> 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<ActionStatusPagedList> getActionStatusList(final String targetId, final Long actionId,
|
||||
public ResponseEntity<PagedList<ActionStatusRest>> 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<ActionStatus> 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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
|
||||
import org.eclipse.hawkbit.rest.resource.api.TargetTagRestApi;
|
||||
import org.eclipse.hawkbit.rest.resource.model.PagedList;
|
||||
import org.eclipse.hawkbit.rest.resource.model.tag.AssignedTargetRequestBody;
|
||||
import org.eclipse.hawkbit.rest.resource.model.tag.TagPagedList;
|
||||
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;
|
||||
@@ -54,7 +54,7 @@ public class TargetTagResource implements TargetTagRestApi {
|
||||
private TargetManagement targetManagement;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TagPagedList> getTargetTags(final int pagingOffsetParam, final int pagingLimitParam,
|
||||
public ResponseEntity<PagedList<TagRest>> getTargetTags(final int pagingOffsetParam, final int pagingLimitParam,
|
||||
final String sortParam, final String rsqlParam) {
|
||||
|
||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
||||
@@ -77,7 +77,7 @@ public class TargetTagResource implements TargetTagRestApi {
|
||||
}
|
||||
|
||||
final List<TagRest> rest = TagMapper.toResponse(findTargetsAll.getContent());
|
||||
return new ResponseEntity<>(new TagPagedList(rest, countTargetsAll), HttpStatus.OK);
|
||||
return new ResponseEntity<>(new PagedList<>(rest, countTargetsAll), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,7 +118,7 @@ public class TargetTagResource implements TargetTagRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TargetsRest> getAssignedTargets(final Long targetTagId) {
|
||||
public ResponseEntity<List<TargetRest>> 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<TargetsRest> assignTargets(final Long targetTagId,
|
||||
public ResponseEntity<List<TargetRest>> assignTargets(final Long targetTagId,
|
||||
final List<AssignedTargetRequestBody> assignedTargetRequestBodies) {
|
||||
LOG.debug("Assign Targets {} for target tag {}", assignedTargetRequestBodies.size(), targetTagId);
|
||||
final TargetTag targetTag = findTargetTagById(targetTagId);
|
||||
|
||||
Reference in New Issue
Block a user