Fix sonar findings: optional rest params boolean -> Boolean (#1990)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-09 20:43:21 +02:00
committed by GitHub
parent e886dda9e6
commit bb8095e84a
5 changed files with 11 additions and 10 deletions

View File

@@ -495,12 +495,12 @@ public interface MgmtDistributionSetRestApi {
ResponseEntity<MgmtTargetAssignmentResponseBody> createAssignedTarget(
@PathVariable("distributionSetId") Long distributionSetId,
final List<MgmtTargetAssignmentRequestBody> targetIds,
@RequestParam(value = "offline", required = false) boolean offline);
@RequestParam(value = "offline", required = false) Boolean offline);
/**
* Gets a paged list of meta data for a distribution set.
* Gets a paged list of meta-data for a distribution set.
*
* @param distributionSetId the ID of the distribution set for the meta data
* @param distributionSetId the ID of the distribution set for the meta-data
* @param pagingOffsetParam the offset of list of targets for pagination, 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

View File

@@ -646,7 +646,7 @@ public interface MgmtTargetRestApi {
defaults set in factory, manual updates or migrations from other update systems. A completed action
is added to the history of the target(s). Target is set to IN_SYNC state as both assigned and
installed DS are set. Note: only executed if the target has currently no running update""")
boolean offline);
Boolean offline);
/**
* Handles the GET request of retrieving the installed distribution set of

View File

@@ -289,10 +289,10 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
public ResponseEntity<MgmtTargetAssignmentResponseBody> createAssignedTarget(
@PathVariable("distributionSetId") final Long distributionSetId,
@RequestBody final List<MgmtTargetAssignmentRequestBody> assignments,
@RequestParam(value = "offline", required = false) final boolean offline) {
if (offline) {
@RequestParam(value = "offline", required = false) final Boolean offline) {
if (offline != null && offline) {
final List<Entry<String, Long>> offlineAssignments = assignments.stream()
.map(assignment -> new SimpleEntry<String, Long>(assignment.getId(), distributionSetId))
.map(assignment -> new SimpleEntry<>(assignment.getId(), distributionSetId))
.collect(Collectors.toList());
return ResponseEntity.ok(MgmtDistributionSetMapper
.toResponse(deployManagament.offlineAssignedDistributionSets(offlineAssignments)));

View File

@@ -351,8 +351,8 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
public ResponseEntity<MgmtTargetAssignmentResponseBody> postAssignedDistributionSet(
@PathVariable("targetId") final String targetId,
@RequestBody final MgmtDistributionSetAssignments dsAssignments,
@RequestParam(value = "offline", required = false) final boolean offline) {
if (offline) {
@RequestParam(value = "offline", required = false) final Boolean offline) {
if (offline != null && offline) {
final List<Entry<String, Long>> offlineAssignments = dsAssignments.stream()
.map(dsAssignment -> new SimpleEntry<String, Long>(targetId, dsAssignment.getId()))
.collect(Collectors.toList());