DDI resource - remove dupplicated annotations (MgmtDistributionsSetTypeResource) (#2059)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -202,7 +203,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<MgmtDistributionSetType> updateDistributionSetType(
|
ResponseEntity<MgmtDistributionSetType> updateDistributionSetType(
|
||||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||||
MgmtDistributionSetTypeRequestBodyPut restDistributionSetType);
|
@RequestBody MgmtDistributionSetTypeRequestBodyPut restDistributionSetType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the POST request of creating new DistributionSetTypes. The request body must always be a list of types.
|
* Handles the POST request of creating new DistributionSetTypes. The request body must always be a list of types.
|
||||||
@@ -242,7 +243,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<List<MgmtDistributionSetType>> createDistributionSetTypes(
|
ResponseEntity<List<MgmtDistributionSetType>> createDistributionSetTypes(
|
||||||
List<MgmtDistributionSetTypeRequestBodyPost> distributionSetTypes);
|
@RequestBody List<MgmtDistributionSetTypeRequestBodyPost> distributionSetTypes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving the list of mandatory software module types in that distribution set type.
|
* Handles the GET request of retrieving the list of mandatory software module types in that distribution set type.
|
||||||
@@ -421,7 +422,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
})
|
})
|
||||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||||
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULE_TYPES + "/{softwareModuleTypeId}")
|
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULE_TYPES + "/{softwareModuleTypeId}")
|
||||||
ResponseEntity<Void> removeMandatoryModule(@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
ResponseEntity<Void> removeMandatoryModule(
|
||||||
|
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -457,7 +459,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
})
|
})
|
||||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||||
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_OPTIONAL_MODULE_TYPES + "/{softwareModuleTypeId}")
|
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_OPTIONAL_MODULE_TYPES + "/{softwareModuleTypeId}")
|
||||||
ResponseEntity<Void> removeOptionalModule(@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
ResponseEntity<Void> removeOptionalModule(
|
||||||
|
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -500,7 +503,9 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||||
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULE_TYPES,
|
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULE_TYPES,
|
||||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<Void> addMandatoryModule(@PathVariable("distributionSetTypeId") Long distributionSetTypeId, MgmtId smtId);
|
ResponseEntity<Void> addMandatoryModule(
|
||||||
|
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||||
|
@RequestBody MgmtId smtId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the POST request for adding an optional software module type to a distribution set type.
|
* Handles the POST request for adding an optional software module type to a distribution set type.
|
||||||
@@ -542,5 +547,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||||
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_OPTIONAL_MODULE_TYPES,
|
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_OPTIONAL_MODULE_TYPES,
|
||||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<Void> addOptionalModule(@PathVariable("distributionSetTypeId") Long distributionSetTypeId, MgmtId smtId);
|
ResponseEntity<Void> addOptionalModule(
|
||||||
|
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||||
|
@RequestBody MgmtId smtId);
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionS
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeRequestBodyPut;
|
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeRequestBodyPut;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleType;
|
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleType;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTypeRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTypeRestApi;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
@@ -35,9 +34,6 @@ import org.springframework.data.domain.Slice;
|
|||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,11 +56,10 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtDistributionSetType>> getDistributionSetTypes(
|
public ResponseEntity<PagedList<MgmtDistributionSetType>> getDistributionSetTypes(
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
|
final int pagingOffsetParam,
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
|
final int pagingLimitParam,
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
|
final String sortParam,
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false) final String rsqlParam) {
|
final String rsqlParam) {
|
||||||
|
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
||||||
final Sort sorting = PagingUtility.sanitizeDistributionSetTypeSortParam(sortParam);
|
final Sort sorting = PagingUtility.sanitizeDistributionSetTypeSortParam(sortParam);
|
||||||
@@ -86,8 +81,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<MgmtDistributionSetType> getDistributionSetType(
|
public ResponseEntity<MgmtDistributionSetType> getDistributionSetType(
|
||||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId) {
|
final Long distributionSetTypeId) {
|
||||||
|
|
||||||
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
|
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
|
||||||
|
|
||||||
final MgmtDistributionSetType response = MgmtDistributionSetTypeMapper.toResponse(foundType);
|
final MgmtDistributionSetType response = MgmtDistributionSetTypeMapper.toResponse(foundType);
|
||||||
@@ -97,7 +91,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Void> deleteDistributionSetType(@PathVariable("distributionSetTypeId") final Long distributionSetTypeId) {
|
public ResponseEntity<Void> deleteDistributionSetType(final Long distributionSetTypeId) {
|
||||||
distributionSetTypeManagement.delete(distributionSetTypeId);
|
distributionSetTypeManagement.delete(distributionSetTypeId);
|
||||||
|
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
@@ -105,8 +99,8 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<MgmtDistributionSetType> updateDistributionSetType(
|
public ResponseEntity<MgmtDistributionSetType> updateDistributionSetType(
|
||||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
|
final Long distributionSetTypeId,
|
||||||
@RequestBody final MgmtDistributionSetTypeRequestBodyPut restDistributionSetType) {
|
final MgmtDistributionSetTypeRequestBodyPut restDistributionSetType) {
|
||||||
final DistributionSetType updated = distributionSetTypeManagement.update(entityFactory.distributionSetType()
|
final DistributionSetType updated = distributionSetTypeManagement.update(entityFactory.distributionSetType()
|
||||||
.update(distributionSetTypeId).description(restDistributionSetType.getDescription())
|
.update(distributionSetTypeId).description(restDistributionSetType.getDescription())
|
||||||
.colour(restDistributionSetType.getColour()));
|
.colour(restDistributionSetType.getColour()));
|
||||||
@@ -119,7 +113,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<List<MgmtDistributionSetType>> createDistributionSetTypes(
|
public ResponseEntity<List<MgmtDistributionSetType>> createDistributionSetTypes(
|
||||||
@RequestBody final List<MgmtDistributionSetTypeRequestBodyPost> distributionSetTypes) {
|
final List<MgmtDistributionSetTypeRequestBodyPost> distributionSetTypes) {
|
||||||
final List<DistributionSetType> createdSoftwareModules = distributionSetTypeManagement
|
final List<DistributionSetType> createdSoftwareModules = distributionSetTypeManagement
|
||||||
.create(MgmtDistributionSetTypeMapper.smFromRequest(entityFactory, distributionSetTypes));
|
.create(MgmtDistributionSetTypeMapper.smFromRequest(entityFactory, distributionSetTypes));
|
||||||
|
|
||||||
@@ -129,15 +123,15 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<List<MgmtSoftwareModuleType>> getMandatoryModules(
|
public ResponseEntity<List<MgmtSoftwareModuleType>> getMandatoryModules(
|
||||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId) {
|
final Long distributionSetTypeId) {
|
||||||
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
|
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
|
||||||
return ResponseEntity.ok(MgmtSoftwareModuleTypeMapper.toTypesResponse(foundType.getMandatoryModuleTypes()));
|
return ResponseEntity.ok(MgmtSoftwareModuleTypeMapper.toTypesResponse(foundType.getMandatoryModuleTypes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<MgmtSoftwareModuleType> getMandatoryModule(
|
public ResponseEntity<MgmtSoftwareModuleType> getMandatoryModule(
|
||||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
|
final Long distributionSetTypeId,
|
||||||
@PathVariable("softwareModuleTypeId") final Long softwareModuleTypeId) {
|
final Long softwareModuleTypeId) {
|
||||||
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
|
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
|
||||||
final SoftwareModuleType foundSmType = findSoftwareModuleTypeWithExceptionIfNotFound(softwareModuleTypeId);
|
final SoftwareModuleType foundSmType = findSoftwareModuleTypeWithExceptionIfNotFound(softwareModuleTypeId);
|
||||||
|
|
||||||
@@ -150,8 +144,8 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<MgmtSoftwareModuleType> getOptionalModule(
|
public ResponseEntity<MgmtSoftwareModuleType> getOptionalModule(
|
||||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
|
final Long distributionSetTypeId,
|
||||||
@PathVariable("softwareModuleTypeId") final Long softwareModuleTypeId) {
|
final Long softwareModuleTypeId) {
|
||||||
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
|
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
|
||||||
final SoftwareModuleType foundSmType = findSoftwareModuleTypeWithExceptionIfNotFound(softwareModuleTypeId);
|
final SoftwareModuleType foundSmType = findSoftwareModuleTypeWithExceptionIfNotFound(softwareModuleTypeId);
|
||||||
|
|
||||||
@@ -164,15 +158,15 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<List<MgmtSoftwareModuleType>> getOptionalModules(
|
public ResponseEntity<List<MgmtSoftwareModuleType>> getOptionalModules(
|
||||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId) {
|
final Long distributionSetTypeId) {
|
||||||
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
|
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
|
||||||
return ResponseEntity.ok(MgmtSoftwareModuleTypeMapper.toTypesResponse(foundType.getOptionalModuleTypes()));
|
return ResponseEntity.ok(MgmtSoftwareModuleTypeMapper.toTypesResponse(foundType.getOptionalModuleTypes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Void> removeMandatoryModule(
|
public ResponseEntity<Void> removeMandatoryModule(
|
||||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
|
final Long distributionSetTypeId,
|
||||||
@PathVariable("softwareModuleTypeId") final Long softwareModuleTypeId) {
|
final Long softwareModuleTypeId) {
|
||||||
distributionSetTypeManagement.unassignSoftwareModuleType(distributionSetTypeId, softwareModuleTypeId);
|
distributionSetTypeManagement.unassignSoftwareModuleType(distributionSetTypeId, softwareModuleTypeId);
|
||||||
|
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
@@ -180,21 +174,20 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Void> removeOptionalModule(
|
public ResponseEntity<Void> removeOptionalModule(
|
||||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
|
final Long distributionSetTypeId,
|
||||||
@PathVariable("softwareModuleTypeId") final Long softwareModuleTypeId) {
|
final Long softwareModuleTypeId) {
|
||||||
return removeMandatoryModule(distributionSetTypeId, softwareModuleTypeId);
|
return removeMandatoryModule(distributionSetTypeId, softwareModuleTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Void> addMandatoryModule(
|
public ResponseEntity<Void> addMandatoryModule(final Long distributionSetTypeId, final MgmtId smtId) {
|
||||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId, @RequestBody final MgmtId smtId) {
|
|
||||||
distributionSetTypeManagement.assignMandatorySoftwareModuleTypes(distributionSetTypeId, Collections.singletonList(smtId.getId()));
|
distributionSetTypeManagement.assignMandatorySoftwareModuleTypes(distributionSetTypeId, Collections.singletonList(smtId.getId()));
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Void> addOptionalModule(
|
public ResponseEntity<Void> addOptionalModule(
|
||||||
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId, @RequestBody final MgmtId smtId) {
|
final Long distributionSetTypeId, final MgmtId smtId) {
|
||||||
distributionSetTypeManagement.assignOptionalSoftwareModuleTypes(distributionSetTypeId, Collections.singletonList(smtId.getId()));
|
distributionSetTypeManagement.assignOptionalSoftwareModuleTypes(distributionSetTypeId, Collections.singletonList(smtId.getId()));
|
||||||
|
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
|
|||||||
Reference in New Issue
Block a user