Refactoring/simplifying rest resources code (#2443)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -261,11 +261,11 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
* Handles the GET request of retrieving assigned targets to a specific distribution set.
|
* Handles the GET request of retrieving assigned targets to a specific distribution set.
|
||||||
*
|
*
|
||||||
* @param distributionSetId the ID of the distribution set to retrieve the assigned targets
|
* @param distributionSetId the ID of the distribution set to retrieve the assigned targets
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
||||||
* be applied
|
* be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return status OK if get request is successful with the paged list of targets
|
* @return status OK if get request is successful with the paged list of targets
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "Return assigned targets to a specific distribution set", description = "Handles the GET " +
|
@Operation(summary = "Return assigned targets to a specific distribution set", description = "Handles the GET " +
|
||||||
@@ -294,7 +294,11 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
||||||
@PathVariable("distributionSetId") Long distributionSetId,
|
@PathVariable("distributionSetId") Long distributionSetId,
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -310,22 +314,17 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving installed targets to a specific distribution set.
|
* Handles the GET request of retrieving installed targets to a specific distribution set.
|
||||||
*
|
*
|
||||||
* @param distributionSetId the ID of the distribution set to retrieve the assigned targets
|
* @param distributionSetId the ID of the distribution set to retrieve the assigned targets
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
||||||
* be applied
|
* be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return status OK if get request is successful with the paged list of targets
|
* @return status OK if get request is successful with the paged list of targets
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "Return installed targets to a specific distribution set", description = "Handles the GET " +
|
@Operation(summary = "Return installed targets to a specific distribution set", description = "Handles the GET " +
|
||||||
@@ -354,7 +353,11 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtTarget>> getInstalledTargets(
|
ResponseEntity<PagedList<MgmtTarget>> getInstalledTargets(
|
||||||
@PathVariable("distributionSetId") Long distributionSetId,
|
@PathVariable("distributionSetId") Long distributionSetId,
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -370,22 +373,17 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request to retrieve target filter queries that have the given distribution set as auto assign DS.
|
* Handles the GET request to retrieve target filter queries that have the given distribution set as auto assign DS.
|
||||||
*
|
*
|
||||||
* @param distributionSetId the ID of the distribution set to retrieve the assigned targets
|
* @param distributionSetId the ID of the distribution set to retrieve the assigned targets
|
||||||
|
* @param rsqlParam the search name parameter in the request URL, syntax {@code q=myFilter}
|
||||||
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
||||||
* be applied
|
* be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search name parameter in the request URL, syntax {@code q=myFilter}
|
|
||||||
* @return status OK if get request is successful with the paged list of targets
|
* @return status OK if get request is successful with the paged list of targets
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "Return target filter queries that have the given distribution set as auto assign DS",
|
@Operation(summary = "Return target filter queries that have the given distribution set as auto assign DS",
|
||||||
@@ -414,7 +412,11 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtTargetFilterQuery>> getAutoAssignTargetFilterQueries(
|
ResponseEntity<PagedList<MgmtTargetFilterQuery>> getAutoAssignTargetFilterQueries(
|
||||||
@PathVariable("distributionSetId") Long distributionSetId,
|
@PathVariable("distributionSetId") Long distributionSetId,
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -430,12 +432,7 @@ public interface MgmtDistributionSetRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the POST request of assigning multiple targets to a single distribution set.
|
* Handles the POST request of assigning multiple targets to a single distribution set.
|
||||||
|
|||||||
@@ -50,11 +50,11 @@ public interface MgmtDistributionSetTagRestApi {
|
|||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving all DistributionSet tags.
|
* Handles the GET request of retrieving all DistributionSet tags.
|
||||||
*
|
*
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of DistributionSet tags for pagination, might not be present in the rest request then default
|
* @param pagingOffsetParam the offset of list of DistributionSet tags for pagination, might not be present in the rest request then default
|
||||||
* value will be applied
|
* value will be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return a list of all target tags for a defined or default page request with status OK. The response is always paged. In any failure the
|
* @return a list of all target tags for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||||
* JsonResponseExceptionHandler is handling the response.
|
* JsonResponseExceptionHandler is handling the response.
|
||||||
*/
|
*/
|
||||||
@@ -81,7 +81,11 @@ public interface MgmtDistributionSetTagRestApi {
|
|||||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING,
|
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING,
|
||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtTag>> getDistributionSetTags(
|
ResponseEntity<PagedList<MgmtTag>> getDistributionSetTags(
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -97,12 +101,7 @@ public interface MgmtDistributionSetTagRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving a single distribution set tag.
|
* Handles the GET request of retrieving a single distribution set tag.
|
||||||
@@ -257,11 +256,11 @@ public interface MgmtDistributionSetTagRestApi {
|
|||||||
* Handles the GET request of retrieving all assigned distribution sets by the given tag id.
|
* Handles the GET request of retrieving all assigned distribution sets by the given tag id.
|
||||||
*
|
*
|
||||||
* @param distributionsetTagId the ID of the distribution set tag
|
* @param distributionsetTagId the ID of the distribution set tag
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of target tags for pagination, might not be present in the rest request then default value
|
* @param pagingOffsetParam the offset of list of target tags for pagination, might not be present in the rest request then default value
|
||||||
* will be applied
|
* will be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return the list of assigned distribution sets.
|
* @return the list of assigned distribution sets.
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "Return all assigned distribution sets by given tag Id",
|
@Operation(summary = "Return all assigned distribution sets by given tag Id",
|
||||||
@@ -290,7 +289,11 @@ public interface MgmtDistributionSetTagRestApi {
|
|||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtDistributionSet>> getAssignedDistributionSets(
|
ResponseEntity<PagedList<MgmtDistributionSet>> getAssignedDistributionSets(
|
||||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -306,12 +309,7 @@ public interface MgmtDistributionSetTagRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the POST request to assign distribution sets to the given tag id.
|
* Handles the POST request to assign distribution sets to the given tag id.
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving all DistributionSetTypes.
|
* Handles the GET request of retrieving all DistributionSetTypes.
|
||||||
*
|
*
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of modules for pagination, might not be present in the rest request then default value will
|
* @param pagingOffsetParam the offset of list of modules for pagination, might not be present in the rest request then default value will
|
||||||
* be applied
|
* be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return a list of all DistributionSetType for a defined or default page request with status OK. The response is always paged. In any
|
* @return a list of all DistributionSetType for a defined or default page request with status OK. The response is always paged. In any
|
||||||
* failure the JsonResponseExceptionHandler is handling the response.
|
* failure the JsonResponseExceptionHandler is handling the response.
|
||||||
*/
|
*/
|
||||||
@@ -83,7 +83,11 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING,
|
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING,
|
||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtDistributionSetType>> getDistributionSetTypes(
|
ResponseEntity<PagedList<MgmtDistributionSetType>> getDistributionSetTypes(
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -99,12 +103,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving a single DistributionSetType within.
|
* Handles the GET request of retrieving a single DistributionSetType within.
|
||||||
|
|||||||
@@ -209,11 +209,11 @@ public interface MgmtSoftwareModuleRestApi {
|
|||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving all software modules.
|
* Handles the GET request of retrieving all software modules.
|
||||||
*
|
*
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of modules for pagination, might not be present in the rest request then default value will
|
* @param pagingOffsetParam the offset of list of modules for pagination, might not be present in the rest request then default value will
|
||||||
* be applied
|
* be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return a list of all modules for a defined or default page request with status OK. The response is always paged. In any failure the
|
* @return a list of all modules for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||||
* JsonResponseExceptionHandler is handling the response.
|
* JsonResponseExceptionHandler is handling the response.
|
||||||
*/
|
*/
|
||||||
@@ -239,7 +239,11 @@ public interface MgmtSoftwareModuleRestApi {
|
|||||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING,
|
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING,
|
||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtSoftwareModule>> getSoftwareModules(
|
ResponseEntity<PagedList<MgmtSoftwareModule>> getSoftwareModules(
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -255,12 +259,7 @@ public interface MgmtSoftwareModuleRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving a single software module.
|
* Handles the GET request of retrieving a single software module.
|
||||||
|
|||||||
@@ -51,11 +51,11 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
|||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving all SoftwareModuleTypes .
|
* Handles the GET request of retrieving all SoftwareModuleTypes .
|
||||||
*
|
*
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of modules for pagination, might not be present in the rest request then default value will
|
* @param pagingOffsetParam the offset of list of modules for pagination, might not be present in the rest request then default value will
|
||||||
* be applied
|
* be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return a list of all module type for a defined or default page request with status OK. The response is always paged. In any failure the
|
* @return a list of all module type for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||||
* JsonResponseExceptionHandler is handling the response.
|
* JsonResponseExceptionHandler is handling the response.
|
||||||
*/
|
*/
|
||||||
@@ -82,7 +82,11 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
|||||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING,
|
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING,
|
||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtSoftwareModuleType>> getTypes(
|
ResponseEntity<PagedList<MgmtSoftwareModuleType>> getTypes(
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -98,12 +102,7 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving a single software module type .
|
* Handles the GET request of retrieving a single software module type .
|
||||||
|
|||||||
@@ -82,11 +82,11 @@ public interface MgmtTargetFilterQueryRestApi {
|
|||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving all filters.
|
* Handles the GET request of retrieving all filters.
|
||||||
*
|
*
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
||||||
* be applied
|
* be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return a list of all targets for a defined or default page reque status OK. The response is always paged. In any failure the
|
* @return a list of all targets for a defined or default page reque status OK. The response is always paged. In any failure the
|
||||||
* JsonResponseExceptionHandler is handling the response.
|
* JsonResponseExceptionHandler is handling the response.
|
||||||
*/
|
*/
|
||||||
@@ -112,7 +112,11 @@ public interface MgmtTargetFilterQueryRestApi {
|
|||||||
@GetMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING,
|
@GetMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING,
|
||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtTargetFilterQuery>> getFilters(
|
ResponseEntity<PagedList<MgmtTargetFilterQuery>> getFilters(
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -129,11 +133,6 @@ public interface MgmtTargetFilterQueryRestApi {
|
|||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam,
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam,
|
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT) String representationModeParam);
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT) String representationModeParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -99,11 +99,11 @@ public interface MgmtTargetRestApi {
|
|||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving all targets.
|
* Handles the GET request of retrieving all targets.
|
||||||
*
|
*
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
||||||
* be applied
|
* be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return a list of all targets for a defined or default page request with status OK. The response is always paged. In any failure the
|
* @return a list of all targets for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||||
* JsonResponseExceptionHandler is handling the response.
|
* JsonResponseExceptionHandler is handling the response.
|
||||||
*/
|
*/
|
||||||
@@ -129,7 +129,11 @@ public interface MgmtTargetRestApi {
|
|||||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING,
|
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING,
|
||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtTarget>> getTargets(
|
ResponseEntity<PagedList<MgmtTarget>> getTargets(
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -145,12 +149,7 @@ public interface MgmtTargetRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the POST request of creating new targets. The request body must always be a list of targets.
|
* Handles the POST request of creating new targets. The request body must always be a list of targets.
|
||||||
@@ -350,11 +349,11 @@ public interface MgmtTargetRestApi {
|
|||||||
* Handles the GET request of retrieving the Actions of a specific target.
|
* Handles the GET request of retrieving the Actions of a specific target.
|
||||||
*
|
*
|
||||||
* @param targetId to load actions for
|
* @param targetId to load actions for
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=status==pending}
|
||||||
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
* @param pagingOffsetParam the offset of list of targets for pagination, might not be present in the rest request then default value will
|
||||||
* be applied
|
* be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=status==pending}
|
|
||||||
* @return a list of all Actions for a defined or default page request with status OK. The response is always paged. In any failure the
|
* @return a list of all Actions for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||||
* JsonResponseExceptionHandler is handling the response.
|
* JsonResponseExceptionHandler is handling the response.
|
||||||
*/
|
*/
|
||||||
@@ -382,7 +381,11 @@ public interface MgmtTargetRestApi {
|
|||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtAction>> getActionHistory(
|
ResponseEntity<PagedList<MgmtAction>> getActionHistory(
|
||||||
@PathVariable("targetId") String targetId,
|
@PathVariable("targetId") String targetId,
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -398,12 +401,7 @@ public interface MgmtTargetRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving a specific Actions of a specific Target.
|
* Handles the GET request of retrieving a specific Actions of a specific Target.
|
||||||
|
|||||||
@@ -50,11 +50,11 @@ public interface MgmtTargetTagRestApi {
|
|||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving all target tags.
|
* Handles the GET request of retrieving all target tags.
|
||||||
*
|
*
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of target tags for pagination, might not be present in the rest request then default value
|
* @param pagingOffsetParam the offset of list of target tags for pagination, might not be present in the rest request then default value
|
||||||
* will be applied
|
* will be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return a list of all target tags for a defined or default page request with status OK. The response is always paged. In any failure the
|
* @return a list of all target tags for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||||
* JsonResponseExceptionHandler is handling the response.
|
* JsonResponseExceptionHandler is handling the response.
|
||||||
*/
|
*/
|
||||||
@@ -75,7 +75,11 @@ public interface MgmtTargetTagRestApi {
|
|||||||
@GetMapping(value = MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING,
|
@GetMapping(value = MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING,
|
||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtTag>> getTargetTags(
|
ResponseEntity<PagedList<MgmtTag>> getTargetTags(
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -91,12 +95,7 @@ public interface MgmtTargetTagRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving a single target tag.
|
* Handles the GET request of retrieving a single target tag.
|
||||||
@@ -216,11 +215,11 @@ public interface MgmtTargetTagRestApi {
|
|||||||
* Handles the GET request of retrieving all assigned targets by the given tag id.
|
* Handles the GET request of retrieving all assigned targets by the given tag id.
|
||||||
*
|
*
|
||||||
* @param targetTagId the ID of the target tag to retrieve
|
* @param targetTagId the ID of the target tag to retrieve
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of target tags for pagination, might not be present in the rest request then default value
|
* @param pagingOffsetParam the offset of list of target tags for pagination, might not be present in the rest request then default value
|
||||||
* will be applied
|
* will be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return the list of assigned targets.
|
* @return the list of assigned targets.
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "Return assigned targets for tag",
|
@Operation(summary = "Return assigned targets for tag",
|
||||||
@@ -243,7 +242,11 @@ public interface MgmtTargetTagRestApi {
|
|||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
||||||
@PathVariable("targetTagId") Long targetTagId,
|
@PathVariable("targetTagId") Long targetTagId,
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -259,12 +262,7 @@ public interface MgmtTargetTagRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the PUT request to assign targets to the given tag id.
|
* Handles the PUT request to assign targets to the given tag id.
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ public interface MgmtTargetTypeRestApi {
|
|||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving all TargetTypes.
|
* Handles the GET request of retrieving all TargetTypes.
|
||||||
*
|
*
|
||||||
|
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
||||||
* @param pagingOffsetParam the offset of list of target types for pagination, might not be present in the rest request then default value
|
* @param pagingOffsetParam the offset of list of target types for pagination, might not be present in the rest request then default value
|
||||||
* will be applied
|
* will be applied
|
||||||
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
* @param pagingLimitParam the limit of the paged request, might not be present in the rest request then default value will be applied
|
||||||
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
* @param sortParam the sorting parameter in the request URL, syntax {@code field:direction, field:direction}
|
||||||
* @param rsqlParam the search parameter in the request URL, syntax {@code q=name==abc}
|
|
||||||
* @return a list of all TargetTypes for a defined or default page request with status OK. The response is always paged. In any failure the
|
* @return a list of all TargetTypes for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||||
* JsonResponseExceptionHandler is handling the response.
|
* JsonResponseExceptionHandler is handling the response.
|
||||||
*/
|
*/
|
||||||
@@ -82,7 +82,11 @@ public interface MgmtTargetTypeRestApi {
|
|||||||
@GetMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING,
|
@GetMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING,
|
||||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<PagedList<MgmtTargetType>> getTargetTypes(
|
ResponseEntity<PagedList<MgmtTargetType>> getTargetTypes(
|
||||||
@RequestParam(
|
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||||
|
@Schema(description = """
|
||||||
|
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||||
|
available fields.""")
|
||||||
|
String rsqlParam, @RequestParam(
|
||||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||||
@Schema(description = "The paging offset (default is 0)")
|
@Schema(description = "The paging offset (default is 0)")
|
||||||
@@ -98,12 +102,7 @@ public interface MgmtTargetTypeRestApi {
|
|||||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||||
in the result.""")
|
in the result.""")
|
||||||
String sortParam,
|
String sortParam);
|
||||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
|
||||||
@Schema(description = """
|
|
||||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
|
||||||
available fields.""")
|
|
||||||
String rsqlParam);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving a single TargetType.
|
* Handles the GET request of retrieving a single TargetType.
|
||||||
|
|||||||
@@ -9,20 +9,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeActionSortParam;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.PagedList;
|
import org.eclipse.hawkbit.mgmt.json.model.PagedList;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.action.MgmtAction;
|
import org.eclipse.hawkbit.mgmt.json.model.action.MgmtAction;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtActionRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtActionRestApi;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRepresentationMode;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRepresentationMode;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtActionMapper;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Slice;
|
import org.springframework.data.domain.Slice;
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -41,10 +42,7 @@ public class MgmtActionResource implements MgmtActionRestApi {
|
|||||||
public ResponseEntity<PagedList<MgmtAction>> getActions(
|
public ResponseEntity<PagedList<MgmtAction>> getActions(
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam,
|
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam,
|
||||||
final String representationModeParam) {
|
final String representationModeParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeActionSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeActionSortParam(sortParam);
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
|
|
||||||
final Slice<Action> actions;
|
final Slice<Action> actions;
|
||||||
final long totalActionCount;
|
final long totalActionCount;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeDistributionSetSortParam;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.AbstractMap.SimpleEntry;
|
import java.util.AbstractMap.SimpleEntry;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -38,13 +40,18 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleAssi
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQuery;
|
import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQuery;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetRestApi;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtDeploymentRequestMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtDistributionSetMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtRestModelMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtSoftwareModuleMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtTargetFilterQueryMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtTargetMapper;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetInvalidationManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetInvalidationManagement;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||||
@@ -64,7 +71,6 @@ import org.eclipse.hawkbit.utils.TenantConfigHelper;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Slice;
|
import org.springframework.data.domain.Slice;
|
||||||
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.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -113,11 +119,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
|||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtDistributionSet>> getDistributionSets(
|
public ResponseEntity<PagedList<MgmtDistributionSet>> getDistributionSets(
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeDistributionSetSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeDistributionSetSortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
final Slice<DistributionSet> findDsPage;
|
final Slice<DistributionSet> findDsPage;
|
||||||
final long countModulesAll;
|
final long countModulesAll;
|
||||||
if (rsqlParam != null) {
|
if (rsqlParam != null) {
|
||||||
@@ -193,39 +195,27 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
public ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
||||||
final Long distributionSetId,
|
final Long distributionSetId, final String rsqlParam,
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeDistributionSetSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeTargetSortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
final Page<Target> targetsAssignedDS;
|
final Page<Target> targetsAssignedDS;
|
||||||
if (rsqlParam != null) {
|
if (rsqlParam != null) {
|
||||||
targetsAssignedDS = this.targetManagement.findByAssignedDistributionSetAndRsql(pageable, distributionSetId,
|
targetsAssignedDS = this.targetManagement.findByAssignedDistributionSetAndRsql(pageable, distributionSetId, rsqlParam);
|
||||||
rsqlParam);
|
|
||||||
} else {
|
} else {
|
||||||
targetsAssignedDS = this.targetManagement.findByAssignedDistributionSet(pageable, distributionSetId);
|
targetsAssignedDS = this.targetManagement.findByAssignedDistributionSet(pageable, distributionSetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity
|
return ResponseEntity.ok(new PagedList<>(
|
||||||
.ok(new PagedList<>(MgmtTargetMapper.toResponse(targetsAssignedDS.getContent(), tenantConfigHelper),
|
MgmtTargetMapper.toResponse(targetsAssignedDS.getContent(), tenantConfigHelper), targetsAssignedDS.getTotalElements()));
|
||||||
targetsAssignedDS.getTotalElements()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtTarget>> getInstalledTargets(
|
public ResponseEntity<PagedList<MgmtTarget>> getInstalledTargets(
|
||||||
final Long distributionSetId,
|
final Long distributionSetId, final String rsqlParam,
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
// check if distribution set exists otherwise throw exception
|
// check if distribution set exists otherwise throw exception immediately
|
||||||
// immediately
|
|
||||||
distributionSetManagement.getOrElseThrowException(distributionSetId);
|
distributionSetManagement.getOrElseThrowException(distributionSetId);
|
||||||
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeDistributionSetSortParam(sortParam));
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeTargetSortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
final Page<Target> targetsInstalledDS;
|
final Page<Target> targetsInstalledDS;
|
||||||
if (rsqlParam != null) {
|
if (rsqlParam != null) {
|
||||||
targetsInstalledDS = this.targetManagement.findByInstalledDistributionSetAndRsql(pageable, distributionSetId, rsqlParam);
|
targetsInstalledDS = this.targetManagement.findByInstalledDistributionSetAndRsql(pageable, distributionSetId, rsqlParam);
|
||||||
@@ -233,26 +223,21 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
|||||||
targetsInstalledDS = this.targetManagement.findByInstalledDistributionSet(pageable, distributionSetId);
|
targetsInstalledDS = this.targetManagement.findByInstalledDistributionSet(pageable, distributionSetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity
|
return ResponseEntity.ok(new PagedList<>(
|
||||||
.ok(new PagedList<>(MgmtTargetMapper.toResponse(targetsInstalledDS.getContent(), tenantConfigHelper),
|
MgmtTargetMapper.toResponse(targetsInstalledDS.getContent(), tenantConfigHelper), targetsInstalledDS.getTotalElements()));
|
||||||
targetsInstalledDS.getTotalElements()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtTargetFilterQuery>> getAutoAssignTargetFilterQueries(
|
public ResponseEntity<PagedList<MgmtTargetFilterQuery>> getAutoAssignTargetFilterQueries(
|
||||||
final Long distributionSetId,
|
final Long distributionSetId, final String rsqlParam,
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeDistributionSetSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeTargetFilterQuerySortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
final Page<TargetFilterQuery> targetFilterQueries = targetFilterQueryManagement
|
final Page<TargetFilterQuery> targetFilterQueries = targetFilterQueryManagement
|
||||||
.findByAutoAssignDSAndRsql(pageable, distributionSetId, rsqlParam);
|
.findByAutoAssignDSAndRsql(pageable, distributionSetId, rsqlParam);
|
||||||
|
|
||||||
return ResponseEntity
|
return ResponseEntity.ok(new PagedList<>(
|
||||||
.ok(new PagedList<>(MgmtTargetFilterQueryMapper.toResponse(targetFilterQueries.getContent(),
|
MgmtTargetFilterQueryMapper.toResponse(targetFilterQueries.getContent(), tenantConfigHelper.isConfirmationFlowEnabled(), false),
|
||||||
tenantConfigHelper.isConfirmationFlowEnabled(), false), targetFilterQueries.getTotalElements()));
|
targetFilterQueries.getTotalElements()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -309,7 +294,8 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Void> assignSoftwareModules(final Long distributionSetId, final List<MgmtSoftwareModuleAssignment> softwareModuleIDs) {
|
public ResponseEntity<Void> assignSoftwareModules(final Long distributionSetId,
|
||||||
|
final List<MgmtSoftwareModuleAssignment> softwareModuleIDs) {
|
||||||
distributionSetManagement.assignSoftwareModules(
|
distributionSetManagement.assignSoftwareModules(
|
||||||
distributionSetId,
|
distributionSetId,
|
||||||
softwareModuleIDs.stream()
|
softwareModuleIDs.stream()
|
||||||
@@ -329,13 +315,10 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
|||||||
public ResponseEntity<PagedList<MgmtSoftwareModule>> getAssignedSoftwareModules(
|
public ResponseEntity<PagedList<MgmtSoftwareModule>> getAssignedSoftwareModules(
|
||||||
final Long distributionSetId,
|
final Long distributionSetId,
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeDistributionSetSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
final Page<SoftwareModule> softwareModules = softwareModuleManagement.findByAssignedTo(distributionSetId, pageable);
|
||||||
final Sort sorting = PagingUtility.sanitizeSoftwareModuleSortParam(sortParam);
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
final Page<SoftwareModule> softwaremodules = softwareModuleManagement.findByAssignedTo(distributionSetId, pageable);
|
|
||||||
return ResponseEntity.ok(new PagedList<>(MgmtSoftwareModuleMapper.toResponse(
|
return ResponseEntity.ok(new PagedList<>(MgmtSoftwareModuleMapper.toResponse(
|
||||||
softwaremodules.getContent()), softwaremodules.getTotalElements()));
|
softwareModules.getContent()), softwareModules.getTotalElements()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeTagSortParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -18,11 +20,12 @@ import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet;
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTag;
|
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTag;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
|
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTagRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTagRestApi;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtDistributionSetMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtTagMapper;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||||
@@ -31,7 +34,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Slice;
|
import org.springframework.data.domain.Slice;
|
||||||
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.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -57,12 +59,8 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtTag>> getDistributionSetTags(
|
public ResponseEntity<PagedList<MgmtTag>> getDistributionSetTags(
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final String rsqlParam, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeTagSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeTagSortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
final Slice<DistributionSetTag> distributionSetTags;
|
final Slice<DistributionSetTag> distributionSetTags;
|
||||||
final long count;
|
final long count;
|
||||||
if (rsqlParam == null) {
|
if (rsqlParam == null) {
|
||||||
@@ -79,8 +77,7 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<MgmtTag> getDistributionSetTag(
|
public ResponseEntity<MgmtTag> getDistributionSetTag(final Long distributionsetTagId) {
|
||||||
final Long distributionsetTagId) {
|
|
||||||
final DistributionSetTag distributionSetTag = findDistributionTagById(distributionsetTagId);
|
final DistributionSetTag distributionSetTag = findDistributionTagById(distributionsetTagId);
|
||||||
|
|
||||||
final MgmtTag response = MgmtTagMapper.toResponse(distributionSetTag);
|
final MgmtTag response = MgmtTagMapper.toResponse(distributionSetTag);
|
||||||
@@ -90,23 +87,19 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<List<MgmtTag>> createDistributionSetTags(
|
public ResponseEntity<List<MgmtTag>> createDistributionSetTags(final List<MgmtTagRequestBodyPut> tags) {
|
||||||
final List<MgmtTagRequestBodyPut> tags) {
|
|
||||||
log.debug("creating {} ds tags", tags.size());
|
log.debug("creating {} ds tags", tags.size());
|
||||||
|
|
||||||
final List<DistributionSetTag> createdTags = distributionSetTagManagement.create(MgmtTagMapper.mapTagFromRequest(entityFactory, tags));
|
final List<DistributionSetTag> createdTags = distributionSetTagManagement.create(MgmtTagMapper.mapTagFromRequest(entityFactory, tags));
|
||||||
|
|
||||||
return new ResponseEntity<>(MgmtTagMapper.toResponseDistributionSetTag(createdTags), HttpStatus.CREATED);
|
return new ResponseEntity<>(MgmtTagMapper.toResponseDistributionSetTag(createdTags), HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, description = "Update Distribution Set Tag")
|
@AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, description = "Update Distribution Set Tag")
|
||||||
public ResponseEntity<MgmtTag> updateDistributionSetTag(
|
public ResponseEntity<MgmtTag> updateDistributionSetTag(final Long distributionSetTagId, final MgmtTagRequestBodyPut restDSTagRest) {
|
||||||
final Long distributionsetTagId,
|
|
||||||
final MgmtTagRequestBodyPut restDSTagRest) {
|
|
||||||
|
|
||||||
final DistributionSetTag distributionSetTag = distributionSetTagManagement
|
final DistributionSetTag distributionSetTag = distributionSetTagManagement
|
||||||
.update(entityFactory.tag().update(distributionsetTagId).name(restDSTagRest.getName())
|
.update(entityFactory.tag().update(distributionSetTagId).name(restDSTagRest.getName())
|
||||||
.description(restDSTagRest.getDescription()).colour(restDSTagRest.getColour()));
|
.description(restDSTagRest.getDescription()).colour(restDSTagRest.getColour()));
|
||||||
|
|
||||||
final MgmtTag response = MgmtTagMapper.toResponse(distributionSetTag);
|
final MgmtTag response = MgmtTagMapper.toResponse(distributionSetTag);
|
||||||
@@ -117,8 +110,7 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.DELETE, description = "Delete Distribution Set Tag")
|
@AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.DELETE, description = "Delete Distribution Set Tag")
|
||||||
public ResponseEntity<Void> deleteDistributionSetTag(
|
public ResponseEntity<Void> deleteDistributionSetTag(final Long distributionsetTagId) {
|
||||||
final Long distributionsetTagId) {
|
|
||||||
log.debug("Delete {} distribution set tag", distributionsetTagId);
|
log.debug("Delete {} distribution set tag", distributionsetTagId);
|
||||||
final DistributionSetTag tag = findDistributionTagById(distributionsetTagId);
|
final DistributionSetTag tag = findDistributionTagById(distributionsetTagId);
|
||||||
|
|
||||||
@@ -129,37 +121,31 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtDistributionSet>> getAssignedDistributionSets(
|
public ResponseEntity<PagedList<MgmtDistributionSet>> getAssignedDistributionSets(
|
||||||
final Long distributionsetTagId,
|
final Long distributionSetTagId, final String rsqlParam,
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeTagSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
final Page<DistributionSet> distributionSets;
|
||||||
final Sort sorting = PagingUtility.sanitizeTagSortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
Page<DistributionSet> findDistrAll;
|
|
||||||
if (rsqlParam == null) {
|
if (rsqlParam == null) {
|
||||||
findDistrAll = distributionSetManagement.findByTag(distributionsetTagId, pageable);
|
distributionSets = distributionSetManagement.findByTag(distributionSetTagId, pageable);
|
||||||
} else {
|
} else {
|
||||||
findDistrAll = distributionSetManagement.findByRsqlAndTag(rsqlParam, distributionsetTagId, pageable);
|
distributionSets = distributionSetManagement.findByRsqlAndTag(rsqlParam, distributionSetTagId, pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<MgmtDistributionSet> rest = MgmtDistributionSetMapper.toResponseFromDsList(findDistrAll.getContent());
|
final List<MgmtDistributionSet> rest = MgmtDistributionSetMapper.toResponseFromDsList(distributionSets.getContent());
|
||||||
return ResponseEntity.ok(new PagedList<>(rest, findDistrAll.getTotalElements()));
|
return ResponseEntity.ok(new PagedList<>(rest, distributionSets.getTotalElements()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Void> assignDistributionSet(
|
public ResponseEntity<Void> assignDistributionSet(final Long distributionSetTagId, final Long distributionSetId) {
|
||||||
final Long distributionsetTagId,
|
log.debug("Assign ds {} for ds tag {}", distributionSetId, distributionSetTagId);
|
||||||
final Long distributionsetId) {
|
this.distributionSetManagement.assignTag(List.of(distributionSetId), distributionSetTagId);
|
||||||
log.debug("Assign ds {} for ds tag {}", distributionsetId, distributionsetTagId);
|
|
||||||
this.distributionSetManagement.assignTag(List.of(distributionsetId), distributionsetTagId);
|
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Void> assignDistributionSets(final Long distributionsetTagId, final List<Long> distributionsetIds) {
|
public ResponseEntity<Void> assignDistributionSets(final Long distributionSetTagId, final List<Long> distributionSetIds) {
|
||||||
log.debug("Assign DistributionSet {} for ds tag {}", distributionsetIds.size(), distributionsetTagId);
|
log.debug("Assign DistributionSet {} for ds tag {}", distributionSetIds.size(), distributionSetTagId);
|
||||||
final List<DistributionSet> assignedDs = this.distributionSetManagement.assignTag(distributionsetIds, distributionsetTagId);
|
final List<DistributionSet> assignedDs = this.distributionSetManagement.assignTag(distributionSetIds, distributionSetTagId);
|
||||||
log.debug("Assigned DistributionSet {}", assignedDs.size());
|
log.debug("Assigned DistributionSet {}", assignedDs.size());
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
}
|
}
|
||||||
@@ -173,9 +159,7 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, description = "Unassign Distribution Set From Tag")
|
@AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, description = "Unassign Distribution Set From Tag")
|
||||||
public ResponseEntity<Void> unassignDistributionSet(
|
public ResponseEntity<Void> unassignDistributionSet(final Long distributionsetTagId, final Long distributionsetId) {
|
||||||
final Long distributionsetTagId,
|
|
||||||
final Long distributionsetId) {
|
|
||||||
log.debug("Unassign ds {} for ds tag {}", distributionsetId, distributionsetTagId);
|
log.debug("Unassign ds {} for ds tag {}", distributionsetId, distributionsetTagId);
|
||||||
this.distributionSetManagement.unassignTag(List.of(distributionsetId), distributionsetTagId);
|
this.distributionSetManagement.unassignTag(List.of(distributionsetId), distributionsetTagId);
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
@@ -183,9 +167,7 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, description = "Unassign Distribution Sets From Tag")
|
@AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, description = "Unassign Distribution Sets From Tag")
|
||||||
public ResponseEntity<Void> unassignDistributionSets(
|
public ResponseEntity<Void> unassignDistributionSets(final Long distributionsetTagId, final List<Long> distributionsetIds) {
|
||||||
final Long distributionsetTagId,
|
|
||||||
final List<Long> distributionsetIds) {
|
|
||||||
log.debug("Unassign DistributionSet {} for ds tag {}", distributionsetIds.size(), distributionsetTagId);
|
log.debug("Unassign DistributionSet {} for ds tag {}", distributionsetIds.size(), distributionsetTagId);
|
||||||
final List<DistributionSet> assignedDs = this.distributionSetManagement.unassignTag(distributionsetIds, distributionsetTagId);
|
final List<DistributionSet> assignedDs = this.distributionSetManagement.unassignTag(distributionsetIds, distributionsetTagId);
|
||||||
log.debug("Unassigned DistributionSet {}", assignedDs.size());
|
log.debug("Unassigned DistributionSet {}", assignedDs.size());
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeDistributionSetTypeSortParam;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -20,10 +22,11 @@ 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.resource.mapper.MgmtDistributionSetTypeMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtSoftwareModuleTypeMapper;
|
||||||
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;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.exception.SoftwareModuleTypeNotInDistributionSetTypeException;
|
import org.eclipse.hawkbit.repository.exception.SoftwareModuleTypeNotInDistributionSetTypeException;
|
||||||
@@ -32,7 +35,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Slice;
|
import org.springframework.data.domain.Slice;
|
||||||
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.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -57,12 +59,8 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtDistributionSetType>> getDistributionSetTypes(
|
public ResponseEntity<PagedList<MgmtDistributionSetType>> getDistributionSetTypes(
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final String rsqlParam, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeDistributionSetTypeSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeDistributionSetTypeSortParam(sortParam);
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
|
|
||||||
final Slice<DistributionSetType> findModuleTypessAll;
|
final Slice<DistributionSetType> findModuleTypessAll;
|
||||||
long countModulesAll;
|
long countModulesAll;
|
||||||
if (rsqlParam != null) {
|
if (rsqlParam != null) {
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeRolloutSortParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -26,6 +28,8 @@ import org.eclipse.hawkbit.mgmt.json.model.rolloutgroup.MgmtRolloutGroupResponse
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRepresentationMode;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRepresentationMode;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRolloutRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRolloutRestApi;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtRolloutMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtTargetMapper;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
@@ -83,7 +87,7 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
|||||||
public ResponseEntity<PagedList<MgmtRolloutResponseBody>> getRollouts(
|
public ResponseEntity<PagedList<MgmtRolloutResponseBody>> getRollouts(
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam,
|
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam,
|
||||||
final String representationModeParam) {
|
final String representationModeParam) {
|
||||||
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sortParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeRolloutSortParam(sortParam));
|
||||||
final boolean isFullMode = parseRepresentationMode(representationModeParam) == MgmtRepresentationMode.FULL;
|
final boolean isFullMode = parseRepresentationMode(representationModeParam) == MgmtRepresentationMode.FULL;
|
||||||
|
|
||||||
final Page<Rollout> rollouts;
|
final Page<Rollout> rollouts;
|
||||||
@@ -205,7 +209,7 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
|||||||
final Long rolloutId,
|
final Long rolloutId,
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam,
|
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam,
|
||||||
final String representationModeParam) {
|
final String representationModeParam) {
|
||||||
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sortParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeRolloutSortParam(sortParam));
|
||||||
final boolean isFullMode = parseRepresentationMode(representationModeParam) == MgmtRepresentationMode.FULL;
|
final boolean isFullMode = parseRepresentationMode(representationModeParam) == MgmtRepresentationMode.FULL;
|
||||||
|
|
||||||
final Page<RolloutGroup> rolloutGroups;
|
final Page<RolloutGroup> rolloutGroups;
|
||||||
@@ -247,8 +251,7 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
|||||||
final Long rolloutId, final Long groupId,
|
final Long rolloutId, final Long groupId,
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
||||||
findRolloutOrThrowException(rolloutId);
|
findRolloutOrThrowException(rolloutId);
|
||||||
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sortParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeRolloutSortParam(sortParam));
|
||||||
|
|
||||||
final Page<Target> rolloutGroupTargets;
|
final Page<Target> rolloutGroupTargets;
|
||||||
if (rsqlParam == null) {
|
if (rsqlParam == null) {
|
||||||
rolloutGroupTargets = this.rolloutGroupManagement.findTargetsOfRolloutGroup(groupId, pageable);
|
rolloutGroupTargets = this.rolloutGroupManagement.findTargetsOfRolloutGroup(groupId, pageable);
|
||||||
|
|||||||
@@ -9,12 +9,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeSoftwareModuleSortParam;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import jakarta.validation.ValidationException;
|
import jakarta.validation.ValidationException;
|
||||||
@@ -31,10 +32,10 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequ
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPut;
|
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPut;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRepresentationMode;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRepresentationMode;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtSoftwareModuleMapper;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||||
@@ -48,7 +49,6 @@ import org.eclipse.hawkbit.rest.json.model.ResponseList;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Slice;
|
import org.springframework.data.domain.Slice;
|
||||||
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.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -137,8 +137,7 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
|
|||||||
final MgmtArtifact response = MgmtSoftwareModuleMapper.toResponse(module.getArtifact(artifactId).get());
|
final MgmtArtifact response = MgmtSoftwareModuleMapper.toResponse(module.getArtifact(artifactId).get());
|
||||||
if (!module.isDeleted()) {
|
if (!module.isDeleted()) {
|
||||||
if (Boolean.TRUE.equals(useArtifactUrlHandler)) {
|
if (Boolean.TRUE.equals(useArtifactUrlHandler)) {
|
||||||
MgmtSoftwareModuleMapper.addLinks(module.getArtifact(artifactId).get(), response, artifactUrlHandler,
|
MgmtSoftwareModuleMapper.addLinks(module.getArtifact(artifactId).get(), response, artifactUrlHandler, systemManagement);
|
||||||
systemManagement);
|
|
||||||
} else {
|
} else {
|
||||||
MgmtSoftwareModuleMapper.addLinks(module.getArtifact(artifactId).get(), response);
|
MgmtSoftwareModuleMapper.addLinks(module.getArtifact(artifactId).get(), response);
|
||||||
}
|
}
|
||||||
@@ -158,13 +157,8 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtSoftwareModule>> getSoftwareModules(
|
public ResponseEntity<PagedList<MgmtSoftwareModule>> getSoftwareModules(
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final String rsqlParam, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeSoftwareModuleSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeSoftwareModuleSortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
|
|
||||||
final Slice<SoftwareModule> findModulesAll;
|
final Slice<SoftwareModule> findModulesAll;
|
||||||
final long countModulesAll;
|
final long countModulesAll;
|
||||||
if (rsqlParam != null) {
|
if (rsqlParam != null) {
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeSoftwareModuleTypeSortParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.audit.AuditLog;
|
import org.eclipse.hawkbit.audit.AuditLog;
|
||||||
@@ -17,16 +19,15 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModule
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeRequestBodyPost;
|
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeRequestBodyPost;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeRequestBodyPut;
|
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeRequestBodyPut;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtSoftwareModuleTypeMapper;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Slice;
|
import org.springframework.data.domain.Slice;
|
||||||
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.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -47,13 +48,8 @@ public class MgmtSoftwareModuleTypeResource implements MgmtSoftwareModuleTypeRes
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtSoftwareModuleType>> getTypes(
|
public ResponseEntity<PagedList<MgmtSoftwareModuleType>> getTypes(
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final String rsqlParam, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeSoftwareModuleTypeSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeSoftwareModuleTypeSortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
|
|
||||||
final Slice<SoftwareModuleType> findModuleTypessAll;
|
final Slice<SoftwareModuleType> findModuleTypessAll;
|
||||||
final long countModulesAll;
|
final long countModulesAll;
|
||||||
if (rsqlParam != null) {
|
if (rsqlParam != null) {
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeTargetFilterQuerySortParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -20,9 +22,10 @@ import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQuery;
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQueryRequestBody;
|
import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQueryRequestBody;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRepresentationMode;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRepresentationMode;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetFilterQueryRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetFilterQueryRestApi;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtDistributionSetMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtTargetFilterQueryMapper;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
import org.eclipse.hawkbit.repository.builder.AutoAssignDistributionSetUpdate;
|
import org.eclipse.hawkbit.repository.builder.AutoAssignDistributionSetUpdate;
|
||||||
@@ -34,7 +37,6 @@ import org.eclipse.hawkbit.utils.TenantConfigHelper;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Slice;
|
import org.springframework.data.domain.Slice;
|
||||||
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.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -72,13 +74,9 @@ public class MgmtTargetFilterQueryResource implements MgmtTargetFilterQueryRestA
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtTargetFilterQuery>> getFilters(
|
public ResponseEntity<PagedList<MgmtTargetFilterQuery>> getFilters(
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam,
|
final String rsqlParam, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam,
|
||||||
final String representationModeParam) {
|
final String representationModeParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeTargetFilterQuerySortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeTargetFilterQuerySortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
final Slice<TargetFilterQuery> findTargetFiltersAll;
|
final Slice<TargetFilterQuery> findTargetFiltersAll;
|
||||||
final long countTargetsAll;
|
final long countTargetsAll;
|
||||||
if (rsqlParam != null) {
|
if (rsqlParam != null) {
|
||||||
@@ -98,22 +96,18 @@ public class MgmtTargetFilterQueryResource implements MgmtTargetFilterQueryRestA
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<MgmtTargetFilterQuery> createFilter(
|
public ResponseEntity<MgmtTargetFilterQuery> createFilter(final MgmtTargetFilterQueryRequestBody filter) {
|
||||||
final MgmtTargetFilterQueryRequestBody filter) {
|
final TargetFilterQuery createdTarget = filterManagement.create(MgmtTargetFilterQueryMapper.fromRequest(entityFactory, filter));
|
||||||
final TargetFilterQuery createdTarget = filterManagement
|
|
||||||
.create(MgmtTargetFilterQueryMapper.fromRequest(entityFactory, filter));
|
|
||||||
|
|
||||||
final MgmtTargetFilterQuery response = MgmtTargetFilterQueryMapper.toResponse(createdTarget,
|
final MgmtTargetFilterQuery response = MgmtTargetFilterQueryMapper.toResponse(
|
||||||
tenantConfigHelper.isConfirmationFlowEnabled(), false);
|
createdTarget, tenantConfigHelper.isConfirmationFlowEnabled(), false);
|
||||||
MgmtTargetFilterQueryMapper.addLinks(response);
|
MgmtTargetFilterQueryMapper.addLinks(response);
|
||||||
|
|
||||||
return new ResponseEntity<>(response, HttpStatus.CREATED);
|
return new ResponseEntity<>(response, HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<MgmtTargetFilterQuery> updateFilter(
|
public ResponseEntity<MgmtTargetFilterQuery> updateFilter(final Long filterId, final MgmtTargetFilterQueryRequestBody targetFilterRest) {
|
||||||
final Long filterId,
|
|
||||||
final MgmtTargetFilterQueryRequestBody targetFilterRest) {
|
|
||||||
log.debug("updating target filter query {}", filterId);
|
log.debug("updating target filter query {}", filterId);
|
||||||
|
|
||||||
final TargetFilterQuery updateFilter = filterManagement
|
final TargetFilterQuery updateFilter = filterManagement
|
||||||
@@ -153,7 +147,6 @@ public class MgmtTargetFilterQueryResource implements MgmtTargetFilterQueryRestA
|
|||||||
@Override
|
@Override
|
||||||
public ResponseEntity<MgmtTargetFilterQuery> postAssignedDistributionSet(
|
public ResponseEntity<MgmtTargetFilterQuery> postAssignedDistributionSet(
|
||||||
final Long filterId, final MgmtDistributionSetAutoAssignment autoAssignRequest) {
|
final Long filterId, final MgmtDistributionSetAutoAssignment autoAssignRequest) {
|
||||||
|
|
||||||
final boolean confirmationRequired = autoAssignRequest.getConfirmationRequired() == null
|
final boolean confirmationRequired = autoAssignRequest.getConfirmationRequired() == null
|
||||||
? tenantConfigHelper.isConfirmationFlowEnabled()
|
? tenantConfigHelper.isConfirmationFlowEnabled()
|
||||||
: autoAssignRequest.getConfirmationRequired();
|
: autoAssignRequest.getConfirmationRequired();
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeActionSortParam;
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeActionStatusSortParam;
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeTargetSortParam;
|
||||||
|
|
||||||
import java.util.AbstractMap.SimpleEntry;
|
import java.util.AbstractMap.SimpleEntry;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -43,11 +47,14 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetAutoConfirm;
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetAutoConfirmUpdate;
|
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetAutoConfirmUpdate;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetRequestBody;
|
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetRequestBody;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetRestApi;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtDeploymentRequestMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtDistributionSetMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtTagMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtTargetMapper;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
||||||
import org.eclipse.hawkbit.repository.ConfirmationManagement;
|
import org.eclipse.hawkbit.repository.ConfirmationManagement;
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
@@ -63,7 +70,6 @@ import org.eclipse.hawkbit.utils.TenantConfigHelper;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Slice;
|
import org.springframework.data.domain.Slice;
|
||||||
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.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -107,12 +113,8 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtTarget>> getTargets(
|
public ResponseEntity<PagedList<MgmtTarget>> getTargets(
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final String rsqlParam, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeTargetSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeTargetSortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
final Slice<Target> findTargetsAll;
|
final Slice<Target> findTargetsAll;
|
||||||
final long countTargetsAll;
|
final long countTargetsAll;
|
||||||
if (rsqlParam != null) {
|
if (rsqlParam != null) {
|
||||||
@@ -130,11 +132,9 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
|||||||
@Override
|
@Override
|
||||||
public ResponseEntity<List<MgmtTarget>> createTargets(final List<MgmtTargetRequestBody> targets) {
|
public ResponseEntity<List<MgmtTarget>> createTargets(final List<MgmtTargetRequestBody> targets) {
|
||||||
log.debug("creating {} targets", targets.size());
|
log.debug("creating {} targets", targets.size());
|
||||||
final Collection<Target> createdTargets = this.targetManagement
|
final Collection<Target> createdTargets = this.targetManagement.create(MgmtTargetMapper.fromRequest(entityFactory, targets));
|
||||||
.create(MgmtTargetMapper.fromRequest(entityFactory, targets));
|
|
||||||
log.debug("{} targets created, return status {}", targets.size(), HttpStatus.CREATED);
|
log.debug("{} targets created, return status {}", targets.size(), HttpStatus.CREATED);
|
||||||
return new ResponseEntity<>(MgmtTargetMapper.toResponse(createdTargets, tenantConfigHelper),
|
return new ResponseEntity<>(MgmtTargetMapper.toResponse(createdTargets, tenantConfigHelper), HttpStatus.CREATED);
|
||||||
HttpStatus.CREATED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -156,7 +156,6 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
|||||||
updateTarget = this.targetManagement.update(entityFactory.target().update(targetId)
|
updateTarget = this.targetManagement.update(entityFactory.target().update(targetId)
|
||||||
.name(targetRest.getName()).description(targetRest.getDescription()).address(targetRest.getAddress())
|
.name(targetRest.getName()).description(targetRest.getDescription()).address(targetRest.getAddress())
|
||||||
.securityToken(targetRest.getSecurityToken()).requestAttributes(targetRest.getRequestAttributes()));
|
.securityToken(targetRest.getSecurityToken()).requestAttributes(targetRest.getRequestAttributes()));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
updateTarget = this.targetManagement.update(
|
updateTarget = this.targetManagement.update(
|
||||||
entityFactory.target().update(targetId).name(targetRest.getName()).description(targetRest.getDescription())
|
entityFactory.target().update(targetId).name(targetRest.getName()).description(targetRest.getDescription())
|
||||||
@@ -209,15 +208,11 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtAction>> getActionHistory(
|
public ResponseEntity<PagedList<MgmtAction>> getActionHistory(
|
||||||
final String targetId,
|
final String targetId, final String rsqlParam,
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
findTargetWithExceptionIfNotFound(targetId);
|
findTargetWithExceptionIfNotFound(targetId);
|
||||||
|
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeActionSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeActionSortParam(sortParam);
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
|
|
||||||
final Slice<Action> activeActions;
|
final Slice<Action> activeActions;
|
||||||
final long totalActionCount;
|
final long totalActionCount;
|
||||||
if (rsqlParam != null) {
|
if (rsqlParam != null) {
|
||||||
@@ -264,8 +259,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
|||||||
} else {
|
} else {
|
||||||
this.deploymentManagement.cancelAction(actionId);
|
this.deploymentManagement.cancelAction(actionId);
|
||||||
}
|
}
|
||||||
// both functions will throw an exception, when action is in wrong
|
// both functions will throw an exception, when action is in wrong state, which is mapped by MgmtResponseExceptionHandler.
|
||||||
// state, which is mapped by MgmtResponseExceptionHandler.
|
|
||||||
|
|
||||||
return ResponseEntity.noContent().build();
|
return ResponseEntity.noContent().build();
|
||||||
}
|
}
|
||||||
@@ -273,7 +267,6 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
|||||||
@Override
|
@Override
|
||||||
@AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Update Target Action")
|
@AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Update Target Action")
|
||||||
public ResponseEntity<MgmtAction> updateAction(final String targetId, final Long actionId, final MgmtActionRequestBodyPut actionUpdate) {
|
public ResponseEntity<MgmtAction> updateAction(final String targetId, final Long actionId, final MgmtActionRequestBodyPut actionUpdate) {
|
||||||
|
|
||||||
Action action = deploymentManagement.findAction(actionId)
|
Action action = deploymentManagement.findAction(actionId)
|
||||||
.orElseThrow(() -> new EntityNotFoundException(Action.class, actionId));
|
.orElseThrow(() -> new EntityNotFoundException(Action.class, actionId));
|
||||||
if (!action.getTarget().getControllerId().equals(targetId)) {
|
if (!action.getTarget().getControllerId().equals(targetId)) {
|
||||||
@@ -292,8 +285,8 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Cancel Target Action Confirmation")
|
@AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Cancel Target Action Confirmation")
|
||||||
public ResponseEntity<Void> updateActionConfirmation(final String targetId, final Long actionId,
|
public ResponseEntity<Void> updateActionConfirmation(
|
||||||
final MgmtActionConfirmationRequestBodyPut actionConfirmation) {
|
final String targetId, final Long actionId, final MgmtActionConfirmationRequestBodyPut actionConfirmation) {
|
||||||
log.debug("updateActionConfirmation with data [targetId={}, actionId={}]: {}", targetId, actionId, actionConfirmation);
|
log.debug("updateActionConfirmation with data [targetId={}, actionId={}]: {}", targetId, actionId, actionConfirmation);
|
||||||
|
|
||||||
return getValidatedAction(targetId, actionId)
|
return getValidatedAction(targetId, actionId)
|
||||||
@@ -346,13 +339,8 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
|||||||
log.warn(ACTION_TARGET_MISSING_ASSIGN_WARN, action.getId(), target.getId());
|
log.warn(ACTION_TARGET_MISSING_ASSIGN_WARN, action.getId(), target.getId());
|
||||||
return ResponseEntity.notFound().build();
|
return ResponseEntity.notFound().build();
|
||||||
}
|
}
|
||||||
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeActionStatusSortParam(sortParam));
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Page<ActionStatus> statusList = this.deploymentManagement.findActionStatusByAction(pageable, action.getId());
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeActionStatusSortParam(sortParam);
|
|
||||||
|
|
||||||
final Page<ActionStatus> statusList = this.deploymentManagement.findActionStatusByAction(
|
|
||||||
new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting), action.getId());
|
|
||||||
|
|
||||||
return ResponseEntity.ok(new PagedList<>(
|
return ResponseEntity.ok(new PagedList<>(
|
||||||
MgmtTargetMapper.toActionStatusRestResponse(statusList.getContent(), deploymentManagement),
|
MgmtTargetMapper.toActionStatusRestResponse(statusList.getContent(), deploymentManagement),
|
||||||
@@ -365,14 +353,14 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
|||||||
.map(ds -> {
|
.map(ds -> {
|
||||||
final MgmtDistributionSet response = MgmtDistributionSetMapper.toResponse(ds);
|
final MgmtDistributionSet response = MgmtDistributionSetMapper.toResponse(ds);
|
||||||
MgmtDistributionSetMapper.addLinks(ds, response);
|
MgmtDistributionSetMapper.addLinks(ds, response);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}).orElse(null);
|
}).orElse(null);
|
||||||
|
|
||||||
if (distributionSetRest == null) {
|
if (distributionSetRest == null) {
|
||||||
return ResponseEntity.noContent().build();
|
return ResponseEntity.noContent().build();
|
||||||
|
} else {
|
||||||
|
return ResponseEntity.ok(distributionSetRest);
|
||||||
}
|
}
|
||||||
return ResponseEntity.ok(distributionSetRest);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeTagSortParam;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
@@ -20,9 +22,10 @@ import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTag;
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
|
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTagRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTagRestApi;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtTagMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtTargetMapper;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
@@ -33,7 +36,6 @@ import org.eclipse.hawkbit.security.SystemSecurityContext;
|
|||||||
import org.eclipse.hawkbit.utils.TenantConfigHelper;
|
import org.eclipse.hawkbit.utils.TenantConfigHelper;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
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.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -62,12 +64,8 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtTag>> getTargetTags(
|
public ResponseEntity<PagedList<MgmtTag>> getTargetTags(
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final String rsqlParam, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeTagSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeTagSortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
final Page<TargetTag> findTargetsAll;
|
final Page<TargetTag> findTargetsAll;
|
||||||
if (rsqlParam == null) {
|
if (rsqlParam == null) {
|
||||||
findTargetsAll = this.tagManagement.findAll(pageable);
|
findTargetsAll = this.tagManagement.findAll(pageable);
|
||||||
@@ -126,12 +124,8 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
|||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
public ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
||||||
final Long targetTagId,
|
final Long targetTagId,
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final String rsqlParam, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeTagSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeTargetSortParam(sortParam);
|
|
||||||
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
final Page<Target> findTargetsAll;
|
final Page<Target> findTargetsAll;
|
||||||
if (rsqlParam == null) {
|
if (rsqlParam == null) {
|
||||||
findTargetsAll = targetManagement.findByTag(pageable, targetTagId);
|
findTargetsAll = targetManagement.findByTag(pageable, targetTagId);
|
||||||
@@ -194,7 +188,6 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private TargetTag findTargetTagById(final Long targetTagId) {
|
private TargetTag findTargetTagById(final Long targetTagId) {
|
||||||
return tagManagement.get(targetTagId)
|
return tagManagement.get(targetTagId).orElseThrow(() -> new EntityNotFoundException(TargetTag.class, targetTagId));
|
||||||
.orElseThrow(() -> new EntityNotFoundException(TargetTag.class, targetTagId));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility.sanitizeTargetTypeSortParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -20,16 +22,16 @@ import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetType;
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyPost;
|
import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyPost;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyPut;
|
import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyPut;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTypeRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTypeRestApi;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtDistributionSetTypeMapper;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtTargetTypeMapper;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.PagingUtility;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
|
||||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetType;
|
import org.eclipse.hawkbit.repository.model.TargetType;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Slice;
|
import org.springframework.data.domain.Slice;
|
||||||
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.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -51,12 +53,8 @@ public class MgmtTargetTypeResource implements MgmtTargetTypeRestApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<PagedList<MgmtTargetType>> getTargetTypes(
|
public ResponseEntity<PagedList<MgmtTargetType>> getTargetTypes(
|
||||||
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
|
final String rsqlParam, final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
||||||
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
|
final Pageable pageable = PagingUtility.toPageable(pagingOffsetParam, pagingLimitParam, sanitizeTargetTypeSortParam(sortParam));
|
||||||
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
|
|
||||||
final Sort sorting = PagingUtility.sanitizeTargetTypeSortParam(sortParam);
|
|
||||||
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
|
||||||
|
|
||||||
final Slice<TargetType> findTargetTypesAll;
|
final Slice<TargetType> findTargetTypesAll;
|
||||||
long countTargetTypesAll;
|
long countTargetTypesAll;
|
||||||
if (rsqlParam != null) {
|
if (rsqlParam != null) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.eclipse.hawkbit.audit.AuditLog;
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValue;
|
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValue;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValueRequest;
|
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValueRequest;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTenantManagementRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTenantManagementRestApi;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtTenantManagementMapper;
|
||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.InsufficientPermissionException;
|
import org.eclipse.hawkbit.repository.exception.InsufficientPermissionException;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2022 Bosch.IO GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -43,7 +43,7 @@ public final class MgmtActionMapper {
|
|||||||
.toList());
|
.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtAction toResponse(final Action action, final MgmtRepresentationMode repMode) {
|
public static MgmtAction toResponse(final Action action, final MgmtRepresentationMode repMode) {
|
||||||
final String controllerId = action.getTarget().getControllerId();
|
final String controllerId = action.getTarget().getControllerId();
|
||||||
if (repMode == MgmtRepresentationMode.COMPACT) {
|
if (repMode == MgmtRepresentationMode.COMPACT) {
|
||||||
return MgmtTargetMapper.toResponse(controllerId, action);
|
return MgmtTargetMapper.toResponse(controllerId, action);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2019 Bosch Software Innovations GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
@@ -48,12 +48,12 @@ public final class MgmtDistributionSetMapper {
|
|||||||
* @param sets to convert
|
* @param sets to convert
|
||||||
* @return converted list of {@link DistributionSet}s
|
* @return converted list of {@link DistributionSet}s
|
||||||
*/
|
*/
|
||||||
static List<DistributionSetCreate> dsFromRequest(
|
public static List<DistributionSetCreate> dsFromRequest(
|
||||||
final Collection<MgmtDistributionSetRequestBodyPost> sets, final EntityFactory entityFactory) {
|
final Collection<MgmtDistributionSetRequestBodyPost> sets, final EntityFactory entityFactory) {
|
||||||
return sets.stream().map(dsRest -> fromRequest(dsRest, entityFactory)).toList();
|
return sets.stream().map(dsRest -> fromRequest(dsRest, entityFactory)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtDistributionSet toResponse(final DistributionSet distributionSet) {
|
public static MgmtDistributionSet toResponse(final DistributionSet distributionSet) {
|
||||||
if (distributionSet == null) {
|
if (distributionSet == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ public final class MgmtDistributionSetMapper {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addLinks(final DistributionSet distributionSet, final MgmtDistributionSet response) {
|
public static void addLinks(final DistributionSet distributionSet, final MgmtDistributionSet response) {
|
||||||
response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getAssignedSoftwareModules(response.getId(),
|
response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getAssignedSoftwareModules(response.getId(),
|
||||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
||||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null))
|
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null))
|
||||||
@@ -94,7 +94,7 @@ public final class MgmtDistributionSetMapper {
|
|||||||
.withRel("metadata").expand());
|
.withRel("metadata").expand());
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtTargetAssignmentResponseBody toResponse(final DistributionSetAssignmentResult dsAssignmentResult) {
|
public static MgmtTargetAssignmentResponseBody toResponse(final DistributionSetAssignmentResult dsAssignmentResult) {
|
||||||
final MgmtTargetAssignmentResponseBody result = new MgmtTargetAssignmentResponseBody();
|
final MgmtTargetAssignmentResponseBody result = new MgmtTargetAssignmentResponseBody();
|
||||||
result.setAlreadyAssigned(dsAssignmentResult.getAlreadyAssigned());
|
result.setAlreadyAssigned(dsAssignmentResult.getAlreadyAssigned());
|
||||||
result.setAssignedActions(dsAssignmentResult.getAssignedEntity().stream()
|
result.setAssignedActions(dsAssignmentResult.getAssignedEntity().stream()
|
||||||
@@ -102,8 +102,7 @@ public final class MgmtDistributionSetMapper {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtTargetAssignmentResponseBody toResponse(
|
public static MgmtTargetAssignmentResponseBody toResponse(final List<DistributionSetAssignmentResult> dsAssignmentResults) {
|
||||||
final List<DistributionSetAssignmentResult> dsAssignmentResults) {
|
|
||||||
final MgmtTargetAssignmentResponseBody result = new MgmtTargetAssignmentResponseBody();
|
final MgmtTargetAssignmentResponseBody result = new MgmtTargetAssignmentResponseBody();
|
||||||
final int alreadyAssigned = dsAssignmentResults.stream()
|
final int alreadyAssigned = dsAssignmentResults.stream()
|
||||||
.mapToInt(DistributionSetAssignmentResult::getAlreadyAssigned).sum();
|
.mapToInt(DistributionSetAssignmentResult::getAlreadyAssigned).sum();
|
||||||
@@ -116,34 +115,32 @@ public final class MgmtDistributionSetMapper {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO - to be made package visible when hawkbit-mgmt-rest-deprecated is removed
|
|
||||||
public static List<MgmtDistributionSet> toResponseDistributionSets(final Collection<DistributionSet> sets) {
|
public static List<MgmtDistributionSet> toResponseDistributionSets(final Collection<DistributionSet> sets) {
|
||||||
if (sets == null) {
|
if (sets == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ResponseList<>(
|
return new ResponseList<>(sets.stream().map(MgmtDistributionSetMapper::toResponse).toList());
|
||||||
sets.stream().map(MgmtDistributionSetMapper::toResponse).toList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtMetadata toResponseDsMetadata(final String key, String value) {
|
public static MgmtMetadata toResponseDsMetadata(final String key, String value) {
|
||||||
final MgmtMetadata metadataRest = new MgmtMetadata();
|
final MgmtMetadata metadataRest = new MgmtMetadata();
|
||||||
metadataRest.setKey(key);
|
metadataRest.setKey(key);
|
||||||
metadataRest.setValue(value);
|
metadataRest.setValue(value);
|
||||||
return metadataRest;
|
return metadataRest;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, String> fromRequestDsMetadata(final List<MgmtMetadata> metadata) {
|
public static Map<String, String> fromRequestDsMetadata(final List<MgmtMetadata> metadata) {
|
||||||
return metadata == null
|
return metadata == null
|
||||||
? Collections.emptyMap()
|
? Collections.emptyMap()
|
||||||
: metadata.stream().collect(Collectors.toMap(MgmtMetadata::getKey, MgmtMetadata::getValue));
|
: metadata.stream().collect(Collectors.toMap(MgmtMetadata::getKey, MgmtMetadata::getValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtMetadata> toResponseDsMetadata(final Map<String, String> metadata) {
|
public static List<MgmtMetadata> toResponseDsMetadata(final Map<String, String> metadata) {
|
||||||
return metadata.entrySet().stream().map(e -> toResponseDsMetadata(e.getKey(), e.getValue())).toList();
|
return metadata.entrySet().stream().map(e -> toResponseDsMetadata(e.getKey(), e.getValue())).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtDistributionSet> toResponseFromDsList(final List<DistributionSet> sets) {
|
public static List<MgmtDistributionSet> toResponseFromDsList(final List<DistributionSet> sets) {
|
||||||
if (sets == null) {
|
if (sets == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@@ -157,8 +154,7 @@ public final class MgmtDistributionSetMapper {
|
|||||||
* @param dsRest to convert
|
* @param dsRest to convert
|
||||||
* @return converted {@link DistributionSet}
|
* @return converted {@link DistributionSet}
|
||||||
*/
|
*/
|
||||||
private static DistributionSetCreate fromRequest(final MgmtDistributionSetRequestBodyPost dsRest,
|
private static DistributionSetCreate fromRequest(final MgmtDistributionSetRequestBodyPost dsRest, final EntityFactory entityFactory) {
|
||||||
final EntityFactory entityFactory) {
|
|
||||||
final List<Long> modules = new ArrayList<>();
|
final List<Long> modules = new ArrayList<>();
|
||||||
if (dsRest.getOs() != null) {
|
if (dsRest.getOs() != null) {
|
||||||
modules.add(dsRest.getOs().getId());
|
modules.add(dsRest.getOs().getId());
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
@@ -17,6 +17,8 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetType;
|
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetType;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeRequestBodyPost;
|
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeRequestBodyPost;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeAssignment;
|
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeAssignment;
|
||||||
@@ -28,17 +30,12 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
|||||||
import org.eclipse.hawkbit.rest.json.model.ResponseList;
|
import org.eclipse.hawkbit.rest.json.model.ResponseList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mapper which maps repository model to RESTful model representation and
|
* A mapper which maps repository model to RESTful model representation and back.
|
||||||
* back.
|
|
||||||
*/
|
*/
|
||||||
final class MgmtDistributionSetTypeMapper {
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public final class MgmtDistributionSetTypeMapper {
|
||||||
|
|
||||||
// private constructor, utility class
|
public static List<DistributionSetTypeCreate> smFromRequest(final EntityFactory entityFactory, final Collection<MgmtDistributionSetTypeRequestBodyPost> smTypesRest) {
|
||||||
private MgmtDistributionSetTypeMapper() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<DistributionSetTypeCreate> smFromRequest(final EntityFactory entityFactory, final Collection<MgmtDistributionSetTypeRequestBodyPost> smTypesRest) {
|
|
||||||
if (smTypesRest == null) {
|
if (smTypesRest == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@@ -46,14 +43,14 @@ final class MgmtDistributionSetTypeMapper {
|
|||||||
return smTypesRest.stream().map(smRest -> fromRequest(entityFactory, smRest)).toList();
|
return smTypesRest.stream().map(smRest -> fromRequest(entityFactory, smRest)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtDistributionSetType> toListResponse(final Collection<DistributionSetType> types) {
|
public static List<MgmtDistributionSetType> toListResponse(final Collection<DistributionSetType> types) {
|
||||||
if (types == null) {
|
if (types == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
return new ResponseList<>(types.stream().map(MgmtDistributionSetTypeMapper::toResponse).toList());
|
return new ResponseList<>(types.stream().map(MgmtDistributionSetTypeMapper::toResponse).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtDistributionSetType toResponse(final DistributionSetType type) {
|
public static MgmtDistributionSetType toResponse(final DistributionSetType type) {
|
||||||
final MgmtDistributionSetType result = new MgmtDistributionSetType();
|
final MgmtDistributionSetType result = new MgmtDistributionSetType();
|
||||||
|
|
||||||
MgmtRestModelMapper.mapTypeToType(result, type);
|
MgmtRestModelMapper.mapTypeToType(result, type);
|
||||||
@@ -65,7 +62,7 @@ final class MgmtDistributionSetTypeMapper {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addLinks(final MgmtDistributionSetType result) {
|
public static void addLinks(final MgmtDistributionSetType result) {
|
||||||
|
|
||||||
result.add(linkTo(methodOn(MgmtDistributionSetTypeRestApi.class).getMandatoryModules(result.getId()))
|
result.add(linkTo(methodOn(MgmtDistributionSetTypeRestApi.class).getMandatoryModules(result.getId()))
|
||||||
.withRel(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULES).expand());
|
.withRel(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULES).expand());
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE;
|
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE;
|
||||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE;
|
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE;
|
||||||
@@ -55,15 +55,15 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
|||||||
* A mapper which maps repository model to RESTful model representation and back.
|
* A mapper which maps repository model to RESTful model representation and back.
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
final class MgmtRolloutMapper {
|
public final class MgmtRolloutMapper {
|
||||||
|
|
||||||
private static final String NOT_SUPPORTED = " is not supported";
|
private static final String NOT_SUPPORTED = " is not supported";
|
||||||
|
|
||||||
static List<MgmtRolloutResponseBody> toResponseRollout(final List<Rollout> rollouts) {
|
public static List<MgmtRolloutResponseBody> toResponseRollout(final List<Rollout> rollouts) {
|
||||||
return toResponseRollout(rollouts, false);
|
return toResponseRollout(rollouts, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtRolloutResponseBody> toResponseRolloutWithDetails(final List<Rollout> rollouts) {
|
public static List<MgmtRolloutResponseBody> toResponseRolloutWithDetails(final List<Rollout> rollouts) {
|
||||||
return toResponseRollout(rollouts, true);
|
return toResponseRollout(rollouts, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ final class MgmtRolloutMapper {
|
|||||||
return rollouts.stream().map(rollout -> toResponseRollout(rollout, withDetails)).toList();
|
return rollouts.stream().map(rollout -> toResponseRollout(rollout, withDetails)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtRolloutResponseBody toResponseRollout(final Rollout rollout, final boolean withDetails) {
|
public static MgmtRolloutResponseBody toResponseRollout(final Rollout rollout, final boolean withDetails) {
|
||||||
final MgmtRolloutResponseBody body = new MgmtRolloutResponseBody();
|
final MgmtRolloutResponseBody body = new MgmtRolloutResponseBody();
|
||||||
body.setCreatedAt(rollout.getCreatedAt());
|
body.setCreatedAt(rollout.getCreatedAt());
|
||||||
body.setCreatedBy(rollout.getCreatedBy());
|
body.setCreatedBy(rollout.getCreatedBy());
|
||||||
@@ -125,8 +125,8 @@ final class MgmtRolloutMapper {
|
|||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RolloutCreate fromRequest(final EntityFactory entityFactory, final MgmtRolloutRestRequestBodyPost restRequest,
|
public static RolloutCreate fromRequest(
|
||||||
final DistributionSet distributionSet) {
|
final EntityFactory entityFactory, final MgmtRolloutRestRequestBodyPost restRequest, final DistributionSet distributionSet) {
|
||||||
return entityFactory.rollout().create()
|
return entityFactory.rollout().create()
|
||||||
.name(restRequest.getName())
|
.name(restRequest.getName())
|
||||||
.description(restRequest.getDescription())
|
.description(restRequest.getDescription())
|
||||||
@@ -138,13 +138,14 @@ final class MgmtRolloutMapper {
|
|||||||
.dynamic(restRequest.isDynamic());
|
.dynamic(restRequest.isDynamic());
|
||||||
}
|
}
|
||||||
|
|
||||||
static RolloutUpdate fromRequest(final EntityFactory entityFactory, final MgmtRolloutRestRequestBodyPut restRequest, final long rolloutId) {
|
public static RolloutUpdate fromRequest(
|
||||||
|
final EntityFactory entityFactory, final MgmtRolloutRestRequestBodyPut restRequest, final long rolloutId) {
|
||||||
return entityFactory.rollout().update(rolloutId)
|
return entityFactory.rollout().update(rolloutId)
|
||||||
.name(restRequest.getName())
|
.name(restRequest.getName())
|
||||||
.description(restRequest.getDescription());
|
.description(restRequest.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
static RolloutCreate fromRetriedRollout(final EntityFactory entityFactory, final Rollout rollout) {
|
public static RolloutCreate fromRetriedRollout(final EntityFactory entityFactory, final Rollout rollout) {
|
||||||
return entityFactory.rollout().create()
|
return entityFactory.rollout().create()
|
||||||
.name(rollout.getName().concat("_retry"))
|
.name(rollout.getName().concat("_retry"))
|
||||||
.description(rollout.getDescription())
|
.description(rollout.getDescription())
|
||||||
@@ -156,13 +157,13 @@ final class MgmtRolloutMapper {
|
|||||||
.weight(null);
|
.weight(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RolloutGroupCreate fromRequest(final EntityFactory entityFactory, final MgmtRolloutGroup restRequest) {
|
public static RolloutGroupCreate fromRequest(final EntityFactory entityFactory, final MgmtRolloutGroup restRequest) {
|
||||||
return entityFactory.rolloutGroup().create().name(restRequest.getName())
|
return entityFactory.rolloutGroup().create().name(restRequest.getName())
|
||||||
.description(restRequest.getDescription()).targetFilterQuery(restRequest.getTargetFilterQuery())
|
.description(restRequest.getDescription()).targetFilterQuery(restRequest.getTargetFilterQuery())
|
||||||
.targetPercentage(restRequest.getTargetPercentage()).conditions(fromRequest(restRequest, false));
|
.targetPercentage(restRequest.getTargetPercentage()).conditions(fromRequest(restRequest, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
static DynamicRolloutGroupTemplate fromRequest(final MgmtDynamicRolloutGroupTemplate restRequest) {
|
public static DynamicRolloutGroupTemplate fromRequest(final MgmtDynamicRolloutGroupTemplate restRequest) {
|
||||||
if (restRequest == null) {
|
if (restRequest == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -172,8 +173,7 @@ final class MgmtRolloutMapper {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
static RolloutGroupConditions fromRequest(final AbstractMgmtRolloutConditionsEntity restRequest,
|
public static RolloutGroupConditions fromRequest(final AbstractMgmtRolloutConditionsEntity restRequest, final boolean withDefaults) {
|
||||||
final boolean withDefaults) {
|
|
||||||
final RolloutGroupConditionBuilder conditions = new RolloutGroupConditionBuilder();
|
final RolloutGroupConditionBuilder conditions = new RolloutGroupConditionBuilder();
|
||||||
|
|
||||||
if (withDefaults) {
|
if (withDefaults) {
|
||||||
@@ -201,7 +201,7 @@ final class MgmtRolloutMapper {
|
|||||||
return conditions.build();
|
return conditions.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtRolloutGroupResponseBody> toResponseRolloutGroup(
|
public static List<MgmtRolloutGroupResponseBody> toResponseRolloutGroup(
|
||||||
final List<RolloutGroup> rollouts, final boolean confirmationFlowEnabled, final boolean withDetails) {
|
final List<RolloutGroup> rollouts, final boolean confirmationFlowEnabled, final boolean withDetails) {
|
||||||
if (rollouts == null) {
|
if (rollouts == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
@@ -210,8 +210,8 @@ final class MgmtRolloutMapper {
|
|||||||
return rollouts.stream().map(group -> toResponseRolloutGroup(group, withDetails, confirmationFlowEnabled)).toList();
|
return rollouts.stream().map(group -> toResponseRolloutGroup(group, withDetails, confirmationFlowEnabled)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtRolloutGroupResponseBody toResponseRolloutGroup(final RolloutGroup rolloutGroup,
|
public static MgmtRolloutGroupResponseBody toResponseRolloutGroup(
|
||||||
final boolean withDetailedStatus, final boolean confirmationFlowEnabled) {
|
final RolloutGroup rolloutGroup, final boolean withDetailedStatus, final boolean confirmationFlowEnabled) {
|
||||||
final MgmtRolloutGroupResponseBody body = new MgmtRolloutGroupResponseBody();
|
final MgmtRolloutGroupResponseBody body = new MgmtRolloutGroupResponseBody();
|
||||||
body.setCreatedAt(rolloutGroup.getCreatedAt());
|
body.setCreatedAt(rolloutGroup.getCreatedAt());
|
||||||
body.setCreatedBy(rolloutGroup.getCreatedBy());
|
body.setCreatedBy(rolloutGroup.getCreatedBy());
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
@@ -30,6 +30,8 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequ
|
|||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.MgmtDownloadArtifactResource;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.MgmtSoftwareModuleResource;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleCreate;
|
import org.eclipse.hawkbit.repository.builder.SoftwareModuleCreate;
|
||||||
@@ -39,6 +41,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||||
import org.eclipse.hawkbit.rest.json.model.ResponseList;
|
import org.eclipse.hawkbit.rest.json.model.ResponseList;
|
||||||
import org.springframework.hateoas.Link;
|
import org.springframework.hateoas.Link;
|
||||||
|
import org.springframework.hateoas.server.mvc.WebMvcLinkBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mapper which maps repository model to RESTful model representation and back.
|
* A mapper which maps repository model to RESTful model representation and back.
|
||||||
@@ -46,8 +49,8 @@ import org.springframework.hateoas.Link;
|
|||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public final class MgmtSoftwareModuleMapper {
|
public final class MgmtSoftwareModuleMapper {
|
||||||
|
|
||||||
static List<SoftwareModuleMetadataCreate> fromRequestSwMetadata(final EntityFactory entityFactory,
|
public static List<SoftwareModuleMetadataCreate> fromRequestSwMetadata(
|
||||||
final Long softwareModuleId, final Collection<MgmtSoftwareModuleMetadata> metadata) {
|
final EntityFactory entityFactory, final Long softwareModuleId, final Collection<MgmtSoftwareModuleMetadata> metadata) {
|
||||||
if (metadata == null) {
|
if (metadata == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@@ -59,8 +62,8 @@ public final class MgmtSoftwareModuleMapper {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<SoftwareModuleCreate> smFromRequest(final EntityFactory entityFactory,
|
public static List<SoftwareModuleCreate> smFromRequest(
|
||||||
final Collection<MgmtSoftwareModuleRequestBodyPost> smsRest) {
|
final EntityFactory entityFactory, final Collection<MgmtSoftwareModuleRequestBodyPost> smsRest) {
|
||||||
if (smsRest == null) {
|
if (smsRest == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@@ -68,7 +71,7 @@ public final class MgmtSoftwareModuleMapper {
|
|||||||
return smsRest.stream().map(smRest -> fromRequest(entityFactory, smRest)).toList();
|
return smsRest.stream().map(smRest -> fromRequest(entityFactory, smRest)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtSoftwareModule> toResponse(final Collection<SoftwareModule> softwareModules) {
|
public static List<MgmtSoftwareModule> toResponse(final Collection<SoftwareModule> softwareModules) {
|
||||||
if (softwareModules == null) {
|
if (softwareModules == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@@ -76,7 +79,7 @@ public final class MgmtSoftwareModuleMapper {
|
|||||||
return new ResponseList<>(softwareModules.stream().map(MgmtSoftwareModuleMapper::toResponse).toList());
|
return new ResponseList<>(softwareModules.stream().map(MgmtSoftwareModuleMapper::toResponse).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtSoftwareModuleMetadata> toResponseSwMetadata(final Collection<SoftwareModuleMetadata> metadata) {
|
public static List<MgmtSoftwareModuleMetadata> toResponseSwMetadata(final Collection<SoftwareModuleMetadata> metadata) {
|
||||||
if (metadata == null) {
|
if (metadata == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@@ -84,7 +87,7 @@ public final class MgmtSoftwareModuleMapper {
|
|||||||
return metadata.stream().map(MgmtSoftwareModuleMapper::toResponseSwMetadata).toList();
|
return metadata.stream().map(MgmtSoftwareModuleMapper::toResponseSwMetadata).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtSoftwareModuleMetadata toResponseSwMetadata(final SoftwareModuleMetadata metadata) {
|
public static MgmtSoftwareModuleMetadata toResponseSwMetadata(final SoftwareModuleMetadata metadata) {
|
||||||
final MgmtSoftwareModuleMetadata metadataRest = new MgmtSoftwareModuleMetadata();
|
final MgmtSoftwareModuleMetadata metadataRest = new MgmtSoftwareModuleMetadata();
|
||||||
metadataRest.setKey(metadata.getKey());
|
metadataRest.setKey(metadata.getKey());
|
||||||
metadataRest.setValue(metadata.getValue());
|
metadataRest.setValue(metadata.getValue());
|
||||||
@@ -92,7 +95,7 @@ public final class MgmtSoftwareModuleMapper {
|
|||||||
return metadataRest;
|
return metadataRest;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtSoftwareModule toResponse(final SoftwareModule softwareModule) {
|
public static MgmtSoftwareModule toResponse(final SoftwareModule softwareModule) {
|
||||||
if (softwareModule == null) {
|
if (softwareModule == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -114,16 +117,16 @@ public final class MgmtSoftwareModuleMapper {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addLinks(final SoftwareModule softwareModule, final MgmtSoftwareModule response) {
|
public static void addLinks(final SoftwareModule softwareModule, final MgmtSoftwareModule response) {
|
||||||
response.add(linkTo(methodOn(MgmtSoftwareModuleRestApi.class).getArtifacts(response.getId(), null, null))
|
response.add(linkTo(methodOn(MgmtSoftwareModuleRestApi.class).getArtifacts(response.getId(), null, null))
|
||||||
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_ARTIFACT).expand());
|
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_ARTIFACT).expand());
|
||||||
response.add(linkTo(methodOn(MgmtSoftwareModuleTypeRestApi.class).getSoftwareModuleType(softwareModule.getType().getId()))
|
response.add(linkTo(methodOn(MgmtSoftwareModuleTypeRestApi.class).getSoftwareModuleType(softwareModule.getType().getId()))
|
||||||
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_TYPE).expand());
|
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_TYPE).expand());
|
||||||
response.add(linkTo(methodOn(MgmtSoftwareModuleResource.class).getMetadata(response.getId()))
|
response.add(WebMvcLinkBuilder.linkTo(methodOn(MgmtSoftwareModuleResource.class).getMetadata(response.getId()))
|
||||||
.withRel("metadata").expand());
|
.withRel("metadata").expand());
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtArtifact toResponse(final Artifact artifact) {
|
public static MgmtArtifact toResponse(final Artifact artifact) {
|
||||||
final MgmtArtifact artifactRest = new MgmtArtifact();
|
final MgmtArtifact artifactRest = new MgmtArtifact();
|
||||||
artifactRest.setId(artifact.getId());
|
artifactRest.setId(artifact.getId());
|
||||||
artifactRest.setSize(artifact.getSize());
|
artifactRest.setSize(artifact.getSize());
|
||||||
@@ -140,13 +143,13 @@ public final class MgmtSoftwareModuleMapper {
|
|||||||
return artifactRest;
|
return artifactRest;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addLinks(final Artifact artifact, final MgmtArtifact response) {
|
public static void addLinks(final Artifact artifact, final MgmtArtifact response) {
|
||||||
response.add(linkTo(methodOn(MgmtDownloadArtifactResource.class)
|
response.add(WebMvcLinkBuilder.linkTo(methodOn(MgmtDownloadArtifactResource.class)
|
||||||
.downloadArtifact(artifact.getSoftwareModule().getId(), artifact.getId())).withRel("download")
|
.downloadArtifact(artifact.getSoftwareModule().getId(), artifact.getId())).withRel("download")
|
||||||
.expand());
|
.expand());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addLinks(final Artifact artifact, final MgmtArtifact response,
|
public static void addLinks(final Artifact artifact, final MgmtArtifact response,
|
||||||
final ArtifactUrlHandler artifactUrlHandler, final SystemManagement systemManagement) {
|
final ArtifactUrlHandler artifactUrlHandler, final SystemManagement systemManagement) {
|
||||||
final List<ArtifactUrl> urls = artifactUrlHandler.getUrls(
|
final List<ArtifactUrl> urls = artifactUrlHandler.getUrls(
|
||||||
new URLPlaceholder(systemManagement.getTenantMetadata().getTenant(),
|
new URLPlaceholder(systemManagement.getTenantMetadata().getTenant(),
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
@@ -30,9 +30,9 @@ import org.eclipse.hawkbit.rest.json.model.ResponseList;
|
|||||||
* A mapper which maps repository model to RESTful model representation and back.
|
* A mapper which maps repository model to RESTful model representation and back.
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
final class MgmtSoftwareModuleTypeMapper {
|
public final class MgmtSoftwareModuleTypeMapper {
|
||||||
|
|
||||||
static List<SoftwareModuleTypeCreate> smFromRequest(final EntityFactory entityFactory,
|
public static List<SoftwareModuleTypeCreate> smFromRequest(final EntityFactory entityFactory,
|
||||||
final Collection<MgmtSoftwareModuleTypeRequestBodyPost> smTypesRest) {
|
final Collection<MgmtSoftwareModuleTypeRequestBodyPost> smTypesRest) {
|
||||||
if (smTypesRest == null) {
|
if (smTypesRest == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
@@ -41,7 +41,7 @@ final class MgmtSoftwareModuleTypeMapper {
|
|||||||
return smTypesRest.stream().map(smRest -> fromRequest(entityFactory, smRest)).toList();
|
return smTypesRest.stream().map(smRest -> fromRequest(entityFactory, smRest)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtSoftwareModuleType> toTypesResponse(final Collection<SoftwareModuleType> types) {
|
public static List<MgmtSoftwareModuleType> toTypesResponse(final Collection<SoftwareModuleType> types) {
|
||||||
if (types == null) {
|
if (types == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ final class MgmtSoftwareModuleTypeMapper {
|
|||||||
return new ResponseList<>(types.stream().map(MgmtSoftwareModuleTypeMapper::toResponse).toList());
|
return new ResponseList<>(types.stream().map(MgmtSoftwareModuleTypeMapper::toResponse).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtSoftwareModuleType toResponse(final SoftwareModuleType type) {
|
public static MgmtSoftwareModuleType toResponse(final SoftwareModuleType type) {
|
||||||
final MgmtSoftwareModuleType result = new MgmtSoftwareModuleType();
|
final MgmtSoftwareModuleType result = new MgmtSoftwareModuleType();
|
||||||
|
|
||||||
MgmtRestModelMapper.mapTypeToType(result, type);
|
MgmtRestModelMapper.mapTypeToType(result, type);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
@@ -34,9 +34,9 @@ import org.eclipse.hawkbit.rest.json.model.ResponseList;
|
|||||||
* A mapper which maps repository model to RESTful model representation and back.
|
* A mapper which maps repository model to RESTful model representation and back.
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
final class MgmtTagMapper {
|
public final class MgmtTagMapper {
|
||||||
|
|
||||||
static List<MgmtTag> toResponse(final List<TargetTag> targetTags) {
|
public static List<MgmtTag> toResponse(final List<TargetTag> targetTags) {
|
||||||
final List<MgmtTag> tagsRest = new ArrayList<>();
|
final List<MgmtTag> tagsRest = new ArrayList<>();
|
||||||
if (targetTags == null) {
|
if (targetTags == null) {
|
||||||
return tagsRest;
|
return tagsRest;
|
||||||
@@ -50,7 +50,7 @@ final class MgmtTagMapper {
|
|||||||
return new ResponseList<>(tagsRest);
|
return new ResponseList<>(tagsRest);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtTag toResponse(final TargetTag targetTag) {
|
public static MgmtTag toResponse(final TargetTag targetTag) {
|
||||||
final MgmtTag response = new MgmtTag();
|
final MgmtTag response = new MgmtTag();
|
||||||
if (targetTag == null) {
|
if (targetTag == null) {
|
||||||
return response;
|
return response;
|
||||||
@@ -63,14 +63,14 @@ final class MgmtTagMapper {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addLinks(final TargetTag targetTag, final MgmtTag response) {
|
public static void addLinks(final TargetTag targetTag, final MgmtTag response) {
|
||||||
response.add(linkTo(methodOn(MgmtTargetTagRestApi.class).getAssignedTargets(targetTag.getId(),
|
response.add(linkTo(methodOn(MgmtTargetTagRestApi.class).getAssignedTargets(targetTag.getId(),
|
||||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
null, MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
||||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("assignedTargets")
|
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null)).withRel("assignedTargets")
|
||||||
.expand());
|
.expand());
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtTag> toResponseDistributionSetTag(final List<DistributionSetTag> distributionSetTags) {
|
public static List<MgmtTag> toResponseDistributionSetTag(final List<DistributionSetTag> distributionSetTags) {
|
||||||
final List<MgmtTag> tagsRest = new ArrayList<>();
|
final List<MgmtTag> tagsRest = new ArrayList<>();
|
||||||
if (distributionSetTags == null) {
|
if (distributionSetTags == null) {
|
||||||
return tagsRest;
|
return tagsRest;
|
||||||
@@ -84,7 +84,7 @@ final class MgmtTagMapper {
|
|||||||
return new ResponseList<>(tagsRest);
|
return new ResponseList<>(tagsRest);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtTag toResponse(final DistributionSetTag distributionSetTag) {
|
public static MgmtTag toResponse(final DistributionSetTag distributionSetTag) {
|
||||||
final MgmtTag response = new MgmtTag();
|
final MgmtTag response = new MgmtTag();
|
||||||
if (distributionSetTag == null) {
|
if (distributionSetTag == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -99,14 +99,14 @@ final class MgmtTagMapper {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addLinks(final DistributionSetTag distributionSetTag, final MgmtTag response) {
|
public static void addLinks(final DistributionSetTag distributionSetTag, final MgmtTag response) {
|
||||||
response.add(linkTo(methodOn(MgmtDistributionSetTagRestApi.class).getAssignedDistributionSets(
|
response.add(linkTo(methodOn(MgmtDistributionSetTagRestApi.class).getAssignedDistributionSets(
|
||||||
distributionSetTag.getId(), MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
distributionSetTag.getId(), null, MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
||||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null))
|
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null))
|
||||||
.withRel("assignedDistributionSets").expand());
|
.withRel("assignedDistributionSets").expand());
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<TagCreate> mapTagFromRequest(final EntityFactory entityFactory, final Collection<MgmtTagRequestBodyPut> tags) {
|
public static List<TagCreate> mapTagFromRequest(final EntityFactory entityFactory, final Collection<MgmtTagRequestBodyPut> tags) {
|
||||||
return tags.stream()
|
return tags.stream()
|
||||||
.map(tagRest -> entityFactory.tag().create().name(tagRest.getName())
|
.map(tagRest -> entityFactory.tag().create().name(tagRest.getName())
|
||||||
.description(tagRest.getDescription()).colour(tagRest.getColour()))
|
.description(tagRest.getDescription()).colour(tagRest.getColour()))
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
@@ -37,7 +37,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public final class MgmtTargetFilterQueryMapper {
|
public final class MgmtTargetFilterQueryMapper {
|
||||||
|
|
||||||
static List<MgmtTargetFilterQuery> toResponse(
|
public static List<MgmtTargetFilterQuery> toResponse(
|
||||||
final List<TargetFilterQuery> filters, final boolean confirmationFlowEnabled, final boolean isRepresentationFull) {
|
final List<TargetFilterQuery> filters, final boolean confirmationFlowEnabled, final boolean isRepresentationFull) {
|
||||||
if (CollectionUtils.isEmpty(filters)) {
|
if (CollectionUtils.isEmpty(filters)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
@@ -45,8 +45,8 @@ public final class MgmtTargetFilterQueryMapper {
|
|||||||
return filters.stream().map(filter -> toResponse(filter, confirmationFlowEnabled, isRepresentationFull)).toList();
|
return filters.stream().map(filter -> toResponse(filter, confirmationFlowEnabled, isRepresentationFull)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtTargetFilterQuery toResponse(final TargetFilterQuery filter, final boolean confirmationFlowEnabled,
|
public static MgmtTargetFilterQuery toResponse(
|
||||||
final boolean isRepresentationFull) {
|
final TargetFilterQuery filter, final boolean confirmationFlowEnabled, final boolean isRepresentationFull) {
|
||||||
final MgmtTargetFilterQuery targetRest = new MgmtTargetFilterQuery();
|
final MgmtTargetFilterQuery targetRest = new MgmtTargetFilterQuery();
|
||||||
targetRest.setId(filter.getId());
|
targetRest.setId(filter.getId());
|
||||||
targetRest.setName(filter.getName());
|
targetRest.setName(filter.getName());
|
||||||
@@ -81,16 +81,16 @@ public final class MgmtTargetFilterQueryMapper {
|
|||||||
return targetRest;
|
return targetRest;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addLinks(final MgmtTargetFilterQuery targetRest) {
|
public static void addLinks(final MgmtTargetFilterQuery targetRest) {
|
||||||
targetRest.add(linkTo(methodOn(MgmtTargetFilterQueryRestApi.class)
|
targetRest.add(linkTo(methodOn(MgmtTargetFilterQueryRestApi.class)
|
||||||
.postAssignedDistributionSet(targetRest.getId(), null)).withRel("autoAssignDS").expand());
|
.postAssignedDistributionSet(targetRest.getId(), null)).withRel("autoAssignDS").expand());
|
||||||
}
|
}
|
||||||
|
|
||||||
static TargetFilterQueryCreate fromRequest(final EntityFactory entityFactory, final MgmtTargetFilterQueryRequestBody filterRest) {
|
public static TargetFilterQueryCreate fromRequest(final EntityFactory entityFactory, final MgmtTargetFilterQueryRequestBody filterRest) {
|
||||||
return entityFactory.targetFilterQuery().create().name(filterRest.getName()).query(filterRest.getQuery());
|
return entityFactory.targetFilterQuery().create().name(filterRest.getName()).query(filterRest.getQuery());
|
||||||
}
|
}
|
||||||
|
|
||||||
static AutoAssignDistributionSetUpdate fromRequest(final EntityFactory entityFactory, final long filterId,
|
public static AutoAssignDistributionSetUpdate fromRequest(final EntityFactory entityFactory, final long filterId,
|
||||||
final MgmtDistributionSetAutoAssignment assignRest) {
|
final MgmtDistributionSetAutoAssignment assignRest) {
|
||||||
final ActionType type = MgmtRestModelMapper.convertActionType(assignRest.getType());
|
final ActionType type = MgmtRestModelMapper.convertActionType(assignRest.getType());
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
@@ -75,9 +75,9 @@ public final class MgmtTargetMapper {
|
|||||||
.withRel(MgmtRestConstants.TARGET_V1_INSTALLED_DISTRIBUTION_SET).expand());
|
.withRel(MgmtRestConstants.TARGET_V1_INSTALLED_DISTRIBUTION_SET).expand());
|
||||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAttributes(response.getControllerId()))
|
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAttributes(response.getControllerId()))
|
||||||
.withRel(MgmtRestConstants.TARGET_V1_ATTRIBUTES).expand());
|
.withRel(MgmtRestConstants.TARGET_V1_ATTRIBUTES).expand());
|
||||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getActionHistory(response.getControllerId(), 0,
|
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getActionHistory(response.getControllerId(), null, 0,
|
||||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE,
|
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE,
|
||||||
ActionFields.ID.getJpaEntityFieldName() + ":" + SortDirection.DESC, null))
|
ActionFields.ID.getJpaEntityFieldName() + ":" + SortDirection.DESC))
|
||||||
.withRel(MgmtRestConstants.TARGET_V1_ACTIONS).expand());
|
.withRel(MgmtRestConstants.TARGET_V1_ACTIONS).expand());
|
||||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getMetadata(response.getControllerId()))
|
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getMetadata(response.getControllerId()))
|
||||||
.withRel("metadata").expand());
|
.withRel("metadata").expand());
|
||||||
@@ -130,8 +130,8 @@ public final class MgmtTargetMapper {
|
|||||||
* @param target the target
|
* @param target the target
|
||||||
* @return the response
|
* @return the response
|
||||||
*/
|
*/
|
||||||
public static MgmtTarget toResponse(final Target target, final TenantConfigHelper configHelper,
|
public static MgmtTarget toResponse(
|
||||||
final Function<Target, PollStatus> pollStatusResolver) {
|
final Target target, final TenantConfigHelper configHelper, final Function<Target, PollStatus> pollStatusResolver) {
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -176,31 +176,28 @@ public final class MgmtTargetMapper {
|
|||||||
targetRest.setAutoConfirmActive(target.getAutoConfirmationStatus() != null);
|
targetRest.setAutoConfirmActive(target.getAutoConfirmationStatus() != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
targetRest.add(
|
targetRest.add(linkTo(methodOn(MgmtTargetRestApi.class).getTarget(target.getControllerId())).withSelfRel().expand());
|
||||||
linkTo(methodOn(MgmtTargetRestApi.class).getTarget(target.getControllerId())).withSelfRel().expand());
|
|
||||||
|
|
||||||
addPollStatus(target, targetRest, pollStatusResolver == null ? configHelper.pollStatusResolver() : pollStatusResolver);
|
addPollStatus(target, targetRest, pollStatusResolver == null ? configHelper.pollStatusResolver() : pollStatusResolver);
|
||||||
|
|
||||||
return targetRest;
|
return targetRest;
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<TargetCreate> fromRequest(final EntityFactory entityFactory,
|
public static List<TargetCreate> fromRequest(final EntityFactory entityFactory, final Collection<MgmtTargetRequestBody> targetsRest) {
|
||||||
final Collection<MgmtTargetRequestBody> targetsRest) {
|
|
||||||
if (targetsRest == null) {
|
if (targetsRest == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return targetsRest.stream().map(targetRest -> fromRequest(entityFactory, targetRest))
|
return targetsRest.stream().map(targetRest -> fromRequest(entityFactory, targetRest)).toList();
|
||||||
.toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, String> fromRequestMetadata(final List<MgmtMetadata> metadata) {
|
public static Map<String, String> fromRequestMetadata(final List<MgmtMetadata> metadata) {
|
||||||
return metadata == null
|
return metadata == null
|
||||||
? Collections.emptyMap()
|
? Collections.emptyMap()
|
||||||
: metadata.stream().collect(Collectors.toMap(MgmtMetadata::getKey, MgmtMetadata::getValue));
|
: metadata.stream().collect(Collectors.toMap(MgmtMetadata::getKey, MgmtMetadata::getValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtActionStatus> toActionStatusRestResponse(
|
public static List<MgmtActionStatus> toActionStatusRestResponse(
|
||||||
final Collection<ActionStatus> actionStatus, final DeploymentManagement deploymentManagement) {
|
final Collection<ActionStatus> actionStatus, final DeploymentManagement deploymentManagement) {
|
||||||
if (actionStatus == null) {
|
if (actionStatus == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
@@ -214,7 +211,7 @@ public final class MgmtTargetMapper {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtAction toResponse(final String targetId, final Action action) {
|
public static MgmtAction toResponse(final String targetId, final Action action) {
|
||||||
final MgmtAction result = new MgmtAction();
|
final MgmtAction result = new MgmtAction();
|
||||||
|
|
||||||
result.setId(action.getId());
|
result.setId(action.getId());
|
||||||
@@ -263,7 +260,7 @@ public final class MgmtTargetMapper {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtAction toResponseWithLinks(final String controllerId, final Action action) {
|
public static MgmtAction toResponseWithLinks(final String controllerId, final Action action) {
|
||||||
final MgmtAction result = toResponse(controllerId, action);
|
final MgmtAction result = toResponse(controllerId, action);
|
||||||
|
|
||||||
if (action.isCancelingOrCanceled()) {
|
if (action.isCancelingOrCanceled()) {
|
||||||
@@ -293,7 +290,7 @@ public final class MgmtTargetMapper {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtAction> toResponse(final String targetId, final Collection<Action> actions) {
|
public static List<MgmtAction> toResponse(final String targetId, final Collection<Action> actions) {
|
||||||
if (actions == null) {
|
if (actions == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@@ -301,14 +298,14 @@ public final class MgmtTargetMapper {
|
|||||||
return actions.stream().map(action -> toResponse(targetId, action)).toList();
|
return actions.stream().map(action -> toResponse(targetId, action)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtMetadata toResponseMetadata(final String key, final String value) {
|
public static MgmtMetadata toResponseMetadata(final String key, final String value) {
|
||||||
final MgmtMetadata metadataRest = new MgmtMetadata();
|
final MgmtMetadata metadataRest = new MgmtMetadata();
|
||||||
metadataRest.setKey(key);
|
metadataRest.setKey(key);
|
||||||
metadataRest.setValue(value);
|
metadataRest.setValue(value);
|
||||||
return metadataRest;
|
return metadataRest;
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtMetadata> toResponseMetadata(final Map<String, String> metadata) {
|
public static List<MgmtMetadata> toResponseMetadata(final Map<String, String> metadata) {
|
||||||
return metadata.entrySet().stream().map(e -> toResponseMetadata(e.getKey(), e.getValue())).toList();
|
return metadata.entrySet().stream().map(e -> toResponseMetadata(e.getKey(), e.getValue())).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +338,7 @@ public final class MgmtTargetMapper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MgmtActionStatus toResponse(final ActionStatus actionStatus, final List<String> messages) {
|
public static MgmtActionStatus toResponse(final ActionStatus actionStatus, final List<String> messages) {
|
||||||
final MgmtActionStatus result = new MgmtActionStatus();
|
final MgmtActionStatus result = new MgmtActionStatus();
|
||||||
|
|
||||||
result.setMessages(messages);
|
result.setMessages(messages);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2021 Bosch.IO GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
@@ -35,7 +35,7 @@ import org.eclipse.hawkbit.rest.json.model.ResponseList;
|
|||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public final class MgmtTargetTypeMapper {
|
public final class MgmtTargetTypeMapper {
|
||||||
|
|
||||||
static List<TargetTypeCreate> targetFromRequest(
|
public static List<TargetTypeCreate> targetFromRequest(
|
||||||
final EntityFactory entityFactory, final Collection<MgmtTargetTypeRequestBodyPost> targetTypesRest) {
|
final EntityFactory entityFactory, final Collection<MgmtTargetTypeRequestBodyPost> targetTypesRest) {
|
||||||
if (targetTypesRest == null) {
|
if (targetTypesRest == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
@@ -45,14 +45,14 @@ public final class MgmtTargetTypeMapper {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<MgmtTargetType> toListResponse(final List<TargetType> types) {
|
public static List<MgmtTargetType> toListResponse(final List<TargetType> types) {
|
||||||
if (types == null) {
|
if (types == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
return new ResponseList<>(types.stream().map(MgmtTargetTypeMapper::toResponse).toList());
|
return new ResponseList<>(types.stream().map(MgmtTargetTypeMapper::toResponse).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
static MgmtTargetType toResponse(final TargetType type) {
|
public static MgmtTargetType toResponse(final TargetType type) {
|
||||||
final MgmtTargetType result = new MgmtTargetType();
|
final MgmtTargetType result = new MgmtTargetType();
|
||||||
|
|
||||||
MgmtRestModelMapper.mapTypeToType(result, type);
|
MgmtRestModelMapper.mapTypeToType(result, type);
|
||||||
@@ -62,7 +62,7 @@ public final class MgmtTargetTypeMapper {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addLinks(final MgmtTargetType result) {
|
public static void addLinks(final MgmtTargetType result) {
|
||||||
result.add(linkTo(methodOn(MgmtTargetTypeRestApi.class).getCompatibleDistributionSets(result.getId()))
|
result.add(linkTo(methodOn(MgmtTargetTypeRestApi.class).getCompatibleDistributionSets(result.getId()))
|
||||||
.withRel(MgmtRestConstants.TARGETTYPE_V1_DS_TYPES).expand());
|
.withRel(MgmtRestConstants.TARGETTYPE_V1_DS_TYPES).expand());
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
package org.eclipse.hawkbit.mgmt.rest.resource.mapper;
|
||||||
|
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
@@ -15,7 +15,9 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
|||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValue;
|
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValue;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.MgmtTenantManagementResource;
|
||||||
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
|
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
|
||||||
|
import org.springframework.hateoas.server.mvc.WebMvcLinkBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mapper which maps repository model to RESTful model representation and back.
|
* A mapper which maps repository model to RESTful model representation and back.
|
||||||
@@ -34,7 +36,7 @@ public final class MgmtTenantManagementMapper {
|
|||||||
restConfValue.setCreatedBy(repoConfValue.getCreatedBy());
|
restConfValue.setCreatedBy(repoConfValue.getCreatedBy());
|
||||||
restConfValue.setLastModifiedAt(repoConfValue.getLastModifiedAt());
|
restConfValue.setLastModifiedAt(repoConfValue.getLastModifiedAt());
|
||||||
restConfValue.setLastModifiedBy(repoConfValue.getLastModifiedBy());
|
restConfValue.setLastModifiedBy(repoConfValue.getLastModifiedBy());
|
||||||
restConfValue.add(linkTo(methodOn(MgmtTenantManagementResource.class).getTenantConfigurationValue(key)).withSelfRel().expand());
|
restConfValue.add(WebMvcLinkBuilder.linkTo(methodOn(MgmtTenantManagementResource.class).getTenantConfigurationValue(key)).withSelfRel().expand());
|
||||||
return restConfValue;
|
return restConfValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,22 +35,6 @@ import org.springframework.data.domain.Sort.Direction;
|
|||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public final class PagingUtility {
|
public final class PagingUtility {
|
||||||
|
|
||||||
public static int sanitizeOffsetParam(final int offset) {
|
|
||||||
if (offset < 0) {
|
|
||||||
return MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE;
|
|
||||||
}
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int sanitizePageLimitParam(final int pageLimit) {
|
|
||||||
if (pageLimit < 1) {
|
|
||||||
return MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE;
|
|
||||||
} else if (pageLimit > MgmtRestConstants.REQUEST_PARAMETER_PAGING_MAX_LIMIT) {
|
|
||||||
return MgmtRestConstants.REQUEST_PARAMETER_PAGING_MAX_LIMIT;
|
|
||||||
}
|
|
||||||
return pageLimit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Sort sanitizeTargetSortParam(final String sortParam) {
|
public static Sort sanitizeTargetSortParam(final String sortParam) {
|
||||||
if (sortParam == null) {
|
if (sortParam == null) {
|
||||||
// default
|
// default
|
||||||
@@ -149,10 +133,25 @@ public final class PagingUtility {
|
|||||||
return Sort.by(SortUtility.parse(RolloutGroupFields.class, sortParam));
|
return Sort.by(SortUtility.parse(RolloutGroupFields.class, sortParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Pageable toPageable(final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
|
public static Pageable toPageable(final int pagingOffsetParam, final int pagingLimitParam, final Sort sort) {
|
||||||
final int sanitizedOffsetParam = sanitizeOffsetParam(pagingOffsetParam);
|
final int sanitizedOffsetParam = sanitizeOffsetParam(pagingOffsetParam);
|
||||||
final int sanitizedLimitParam = sanitizePageLimitParam(pagingLimitParam);
|
final int sanitizedLimitParam = sanitizePageLimitParam(pagingLimitParam);
|
||||||
final Sort sorting = sanitizeRolloutSortParam(sortParam);
|
return new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sort);
|
||||||
return new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
|
}
|
||||||
|
|
||||||
|
private static int sanitizeOffsetParam(final int offset) {
|
||||||
|
if (offset < 0) {
|
||||||
|
return MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE;
|
||||||
|
}
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int sanitizePageLimitParam(final int pageLimit) {
|
||||||
|
if (pageLimit < 1) {
|
||||||
|
return MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE;
|
||||||
|
} else if (pageLimit > MgmtRestConstants.REQUEST_PARAMETER_PAGING_MAX_LIMIT) {
|
||||||
|
return MgmtRestConstants.REQUEST_PARAMETER_PAGING_MAX_LIMIT;
|
||||||
|
}
|
||||||
|
return pageLimit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,6 +41,7 @@ import org.awaitility.Awaitility;
|
|||||||
import org.eclipse.hawkbit.exception.SpServerError;
|
import org.eclipse.hawkbit.exception.SpServerError;
|
||||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtRestModelMapper;
|
||||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
|
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import io.qameta.allure.Story;
|
|||||||
import org.eclipse.hawkbit.exception.SpServerError;
|
import org.eclipse.hawkbit.exception.SpServerError;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
|
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtRestModelMapper;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.ResourceUtility;
|
import org.eclipse.hawkbit.mgmt.rest.resource.util.ResourceUtility;
|
||||||
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
|
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
|
||||||
import org.eclipse.hawkbit.repository.exception.DeletedException;
|
import org.eclipse.hawkbit.repository.exception.DeletedException;
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
* The repository interface for the {@link Rollout} model.
|
* The repository interface for the {@link Rollout} model.
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public interface RolloutRepository
|
public interface RolloutRepository extends BaseEntityRepository<JpaRollout> {
|
||||||
extends BaseEntityRepository<JpaRollout> {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all {@link Rollout} for given status.
|
* Retrieves all {@link Rollout} for given status.
|
||||||
@@ -38,8 +37,7 @@ public interface RolloutRepository
|
|||||||
* @param status the status of the rollouts to find
|
* @param status the status of the rollouts to find
|
||||||
* @return the list of {@link Rollout} for specific status
|
* @return the list of {@link Rollout} for specific status
|
||||||
*/
|
*/
|
||||||
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477
|
@Query("SELECT sm.id FROM JpaRollout sm WHERE sm.status IN ?1 ORDER BY sm.id ASC")
|
||||||
@Query("SELECT sm.id FROM JpaRollout sm WHERE sm.status IN ?1")
|
|
||||||
List<Long> findByStatusIn(Collection<RolloutStatus> status);
|
List<Long> findByStatusIn(Collection<RolloutStatus> status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,8 +62,7 @@ public interface RolloutRepository
|
|||||||
void deleteByTenant(@Param("tenant") String tenant);
|
void deleteByTenant(@Param("tenant") String tenant);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all {@link Rollout}s for a specific {@link DistributionSet} in
|
* Retrieves all {@link Rollout}s for a specific {@link DistributionSet} in a given {@link RolloutStatus}.
|
||||||
* a given {@link RolloutStatus}.
|
|
||||||
*
|
*
|
||||||
* @param set the distribution set
|
* @param set the distribution set
|
||||||
* @param status the status of the rollout
|
* @param status the status of the rollout
|
||||||
@@ -82,4 +79,4 @@ public interface RolloutRepository
|
|||||||
* @return the count
|
* @return the count
|
||||||
*/
|
*/
|
||||||
long countByDistributionSetIdAndStatusIn(long distributionSetId, Collection<RolloutStatus> status);
|
long countByDistributionSetIdAndStatusIn(long distributionSetId, Collection<RolloutStatus> status);
|
||||||
}
|
}
|
||||||
@@ -120,14 +120,14 @@ public class DistributionSetView extends TableView<MgmtDistributionSet, Long> {
|
|||||||
type.setItemLabelGenerator(MgmtDistributionSetType::getName);
|
type.setItemLabelGenerator(MgmtDistributionSetType::getName);
|
||||||
type.setItems(Optional.ofNullable(
|
type.setItems(Optional.ofNullable(
|
||||||
hawkbitClient.getDistributionSetTypeRestApi()
|
hawkbitClient.getDistributionSetTypeRestApi()
|
||||||
.getDistributionSetTypes(0, 20, Constants.NAME_ASC, null)
|
.getDistributionSetTypes(null, 0, 20, Constants.NAME_ASC)
|
||||||
.getBody())
|
.getBody())
|
||||||
.map(PagedList::getContent)
|
.map(PagedList::getContent)
|
||||||
.orElseGet(Collections::emptyList));
|
.orElseGet(Collections::emptyList));
|
||||||
tag.setItemLabelGenerator(MgmtTag::getName);
|
tag.setItemLabelGenerator(MgmtTag::getName);
|
||||||
tag.setItems(Optional.ofNullable(
|
tag.setItems(Optional.ofNullable(
|
||||||
hawkbitClient.getDistributionSetTagRestApi()
|
hawkbitClient.getDistributionSetTagRestApi()
|
||||||
.getDistributionSetTags(0, 20, Constants.NAME_ASC, null)
|
.getDistributionSetTags(null, 0, 20, Constants.NAME_ASC)
|
||||||
.getBody())
|
.getBody())
|
||||||
.map(PagedList::getContent)
|
.map(PagedList::getContent)
|
||||||
.orElseGet(Collections::emptyList));
|
.orElseGet(Collections::emptyList));
|
||||||
@@ -215,7 +215,7 @@ public class DistributionSetView extends TableView<MgmtDistributionSet, Long> {
|
|||||||
this::readyToCreate,
|
this::readyToCreate,
|
||||||
Optional.ofNullable(
|
Optional.ofNullable(
|
||||||
hawkbitClient.getDistributionSetTypeRestApi()
|
hawkbitClient.getDistributionSetTypeRestApi()
|
||||||
.getDistributionSetTypes(0, 30, Constants.NAME_ASC, null)
|
.getDistributionSetTypes(null, 0, 30, Constants.NAME_ASC)
|
||||||
.getBody())
|
.getBody())
|
||||||
.map(body -> body.getContent().toArray(new MgmtDistributionSetType[0]))
|
.map(body -> body.getContent().toArray(new MgmtDistributionSetType[0]))
|
||||||
.orElseGet(() -> new MgmtDistributionSetType[0]));
|
.orElseGet(() -> new MgmtDistributionSetType[0]));
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ public class RolloutView extends TableView<MgmtRolloutResponseBody, Long> {
|
|||||||
this::readyToCreate,
|
this::readyToCreate,
|
||||||
Optional.ofNullable(
|
Optional.ofNullable(
|
||||||
hawkbitClient.getTargetFilterQueryRestApi()
|
hawkbitClient.getTargetFilterQueryRestApi()
|
||||||
.getFilters(0, 30, Constants.NAME_ASC, null, null)
|
.getFilters(null, 0, 30, Constants.NAME_ASC, null)
|
||||||
.getBody())
|
.getBody())
|
||||||
.map(body -> body.getContent().toArray(new MgmtTargetFilterQuery[0]))
|
.map(body -> body.getContent().toArray(new MgmtTargetFilterQuery[0]))
|
||||||
.orElseGet(() -> new MgmtTargetFilterQuery[0]));
|
.orElseGet(() -> new MgmtTargetFilterQuery[0]));
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class SoftwareModuleView extends TableView<MgmtSoftwareModule, Long> {
|
|||||||
},
|
},
|
||||||
(query, rsqlFilter) -> Optional.ofNullable(
|
(query, rsqlFilter) -> Optional.ofNullable(
|
||||||
hawkbitClient.getSoftwareModuleRestApi()
|
hawkbitClient.getSoftwareModuleRestApi()
|
||||||
.getSoftwareModules(query.getOffset(), query.getPageSize(), Constants.NAME_ASC, rsqlFilter)
|
.getSoftwareModules(rsqlFilter, query.getOffset(), query.getPageSize(), Constants.NAME_ASC)
|
||||||
.getBody())
|
.getBody())
|
||||||
.stream().map(PagedList::getContent).flatMap(List::stream),
|
.stream().map(PagedList::getContent).flatMap(List::stream),
|
||||||
isParent ? v -> new CreateDialog(hawkbitClient).result() : null,
|
isParent ? v -> new CreateDialog(hawkbitClient).result() : null,
|
||||||
@@ -133,7 +133,7 @@ public class SoftwareModuleView extends TableView<MgmtSoftwareModule, Long> {
|
|||||||
type.setItemLabelGenerator(MgmtSoftwareModuleType::getName);
|
type.setItemLabelGenerator(MgmtSoftwareModuleType::getName);
|
||||||
type.setItems(Optional.ofNullable(
|
type.setItems(Optional.ofNullable(
|
||||||
hawkbitClient.getSoftwareModuleTypeRestApi()
|
hawkbitClient.getSoftwareModuleTypeRestApi()
|
||||||
.getTypes(0, 20, Constants.NAME_ASC, null)
|
.getTypes(null, 0, 20, Constants.NAME_ASC)
|
||||||
.getBody())
|
.getBody())
|
||||||
.map(PagedList::getContent)
|
.map(PagedList::getContent)
|
||||||
.orElseGet(Collections::emptyList));
|
.orElseGet(Collections::emptyList));
|
||||||
@@ -221,7 +221,7 @@ public class SoftwareModuleView extends TableView<MgmtSoftwareModule, Long> {
|
|||||||
this::readyToCreate,
|
this::readyToCreate,
|
||||||
Optional.ofNullable(
|
Optional.ofNullable(
|
||||||
hawkbitClient.getSoftwareModuleTypeRestApi()
|
hawkbitClient.getSoftwareModuleTypeRestApi()
|
||||||
.getTypes(0, 30, Constants.NAME_ASC, null)
|
.getTypes(null, 0, 30, Constants.NAME_ASC)
|
||||||
.getBody())
|
.getBody())
|
||||||
.map(body -> body.getContent().toArray(new MgmtSoftwareModuleType[0]))
|
.map(body -> body.getContent().toArray(new MgmtSoftwareModuleType[0]))
|
||||||
.orElseGet(() -> new MgmtSoftwareModuleType[0]));
|
.orElseGet(() -> new MgmtSoftwareModuleType[0]));
|
||||||
@@ -254,7 +254,7 @@ public class SoftwareModuleView extends TableView<MgmtSoftwareModule, Long> {
|
|||||||
distType.setItems(
|
distType.setItems(
|
||||||
Optional.ofNullable(
|
Optional.ofNullable(
|
||||||
hawkbitClient.getDistributionSetTypeRestApi()
|
hawkbitClient.getDistributionSetTypeRestApi()
|
||||||
.getDistributionSetTypes(0, 30, Constants.NAME_ASC, null)
|
.getDistributionSetTypes(null, 0, 30, Constants.NAME_ASC)
|
||||||
.getBody())
|
.getBody())
|
||||||
.map(body -> body.getContent().toArray(new MgmtDistributionSetType[0]))
|
.map(body -> body.getContent().toArray(new MgmtDistributionSetType[0]))
|
||||||
.orElseGet(() -> new MgmtDistributionSetType[0]));
|
.orElseGet(() -> new MgmtDistributionSetType[0]));
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ import org.eclipse.hawkbit.ui.simple.view.util.Filter;
|
|||||||
import org.eclipse.hawkbit.ui.simple.view.util.SelectionGrid;
|
import org.eclipse.hawkbit.ui.simple.view.util.SelectionGrid;
|
||||||
import org.eclipse.hawkbit.ui.simple.view.util.TableView;
|
import org.eclipse.hawkbit.ui.simple.view.util.TableView;
|
||||||
import org.eclipse.hawkbit.ui.simple.view.util.Utils;
|
import org.eclipse.hawkbit.ui.simple.view.util.Utils;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
@@ -113,7 +112,7 @@ public class TargetView extends TableView<MgmtTarget, String> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
(query, filter) -> hawkbitClient.getTargetRestApi()
|
(query, filter) -> hawkbitClient.getTargetRestApi()
|
||||||
.getTargets(query.getOffset(), query.getPageSize(), Constants.NAME_ASC, filter)
|
.getTargets(filter, query.getOffset(), query.getPageSize(), Constants.NAME_ASC)
|
||||||
.getBody()
|
.getBody()
|
||||||
.getContent()
|
.getContent()
|
||||||
.stream(),
|
.stream(),
|
||||||
@@ -162,11 +161,11 @@ public class TargetView extends TableView<MgmtTarget, String> {
|
|||||||
public List<Component> components() {
|
public List<Component> components() {
|
||||||
final List<Component> components = new LinkedList<>();
|
final List<Component> components = new LinkedList<>();
|
||||||
components.add(controllerId);
|
components.add(controllerId);
|
||||||
type.setItems(hawkbitClient.getTargetTypeRestApi().getTargetTypes(0, 20, Constants.NAME_ASC, null).getBody().getContent());
|
type.setItems(hawkbitClient.getTargetTypeRestApi().getTargetTypes(null, 0, 20, Constants.NAME_ASC).getBody().getContent());
|
||||||
if (!type.getValue().isEmpty()) {
|
if (!type.getValue().isEmpty()) {
|
||||||
components.add(type);
|
components.add(type);
|
||||||
}
|
}
|
||||||
tag.setItems(hawkbitClient.getTargetTagRestApi().getTargetTags(0, 20, Constants.NAME_ASC, null).getBody().getContent());
|
tag.setItems(hawkbitClient.getTargetTagRestApi().getTargetTags(null, 0, 20, Constants.NAME_ASC).getBody().getContent());
|
||||||
if (!tag.isEmpty()) {
|
if (!tag.isEmpty()) {
|
||||||
components.add(tag);
|
components.add(tag);
|
||||||
}
|
}
|
||||||
@@ -231,7 +230,7 @@ public class TargetView extends TableView<MgmtTarget, String> {
|
|||||||
return Optional
|
return Optional
|
||||||
.ofNullable(
|
.ofNullable(
|
||||||
hawkbitClient.getTargetFilterQueryRestApi()
|
hawkbitClient.getTargetFilterQueryRestApi()
|
||||||
.getFilters(0, 30, null, null, null)
|
.getFilters(null, 0, 30, null, null)
|
||||||
.getBody()
|
.getBody()
|
||||||
.getContent())
|
.getContent())
|
||||||
.orElse(Collections.emptyList());
|
.orElse(Collections.emptyList());
|
||||||
@@ -535,7 +534,7 @@ public class TargetView extends TableView<MgmtTarget, String> {
|
|||||||
int offset = 0;
|
int offset = 0;
|
||||||
do {
|
do {
|
||||||
List<MgmtTag> page = Optional.ofNullable(
|
List<MgmtTag> page = Optional.ofNullable(
|
||||||
hawkbitClient.getTargetTagRestApi().getTargetTags(offset, 50, Constants.NAME_ASC, null).getBody())
|
hawkbitClient.getTargetTagRestApi().getTargetTags(null, offset, 50, Constants.NAME_ASC).getBody())
|
||||||
.map(PagedList::getContent)
|
.map(PagedList::getContent)
|
||||||
.orElse(Collections.emptyList());
|
.orElse(Collections.emptyList());
|
||||||
tags.addAll(page);
|
tags.addAll(page);
|
||||||
@@ -572,7 +571,7 @@ public class TargetView extends TableView<MgmtTarget, String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<ActionStatusEntry> fetchActions() {
|
private List<ActionStatusEntry> fetchActions() {
|
||||||
return hawkbitClient.getTargetRestApi().getActionHistory(target.getControllerId(), 0, 30, null, null)
|
return hawkbitClient.getTargetRestApi().getActionHistory(target.getControllerId(), null, 0, 30, null)
|
||||||
.getBody()
|
.getBody()
|
||||||
.getContent()
|
.getContent()
|
||||||
.stream()
|
.stream()
|
||||||
@@ -757,7 +756,7 @@ public class TargetView extends TableView<MgmtTarget, String> {
|
|||||||
"Type",
|
"Type",
|
||||||
e -> {},
|
e -> {},
|
||||||
hawkbitClient.getTargetTypeRestApi()
|
hawkbitClient.getTargetTypeRestApi()
|
||||||
.getTargetTypes(0, 30, Constants.NAME_ASC, null)
|
.getTargetTypes(null, 0, 30, Constants.NAME_ASC)
|
||||||
.getBody()
|
.getBody()
|
||||||
.getContent()
|
.getContent()
|
||||||
.toArray(new MgmtTargetType[0])
|
.toArray(new MgmtTargetType[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user