Remove peek usage as advised by sonar - mainly for debugging (#2073)
By API Stream.peek is mainly for debugging and could be skiped in some cases Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -239,7 +239,11 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
distributionSetRepository.saveAll(
|
||||
setsFound.stream()
|
||||
.filter(set -> assigned.contains(set.getId()))
|
||||
.peek(toSoftDelete -> toSoftDelete.setDeleted(true))
|
||||
.map(toSoftDelete -> {
|
||||
// don't use peek since it is by documentation mainly for debugging and could be skipped in some cases
|
||||
toSoftDelete.setDeleted(true);
|
||||
return toSoftDelete;
|
||||
})
|
||||
.toList());
|
||||
targetFilterQueryRepository.unsetAutoAssignDistributionSetAndActionTypeAndAccessContext(assigned.toArray(new Long[0]));
|
||||
}
|
||||
|
||||
@@ -114,13 +114,14 @@ public class OfflineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
|
||||
// targetRepository
|
||||
// .findAll(AccessController.Operation.UPDATE, targetRepository.byIdsSpec(targetIdsChunk))
|
||||
// .stream()
|
||||
// .peek(target -> {
|
||||
// .map(target -> {
|
||||
// target.setAssignedDistributionSet(set);
|
||||
// target.setInstalledDistributionSet(set);
|
||||
// target.setInstallationDate(now);
|
||||
// target.setLastModifiedAt(now);
|
||||
// target.setLastModifiedBy(currentUser);
|
||||
// target.setUpdateStatus(TargetUpdateStatus.IN_SYNC);
|
||||
// return target;
|
||||
// })
|
||||
// .toList());
|
||||
});
|
||||
|
||||
@@ -139,11 +139,12 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
|
||||
// targetRepository
|
||||
// .findAll(AccessController.Operation.UPDATE, targetRepository.byIdsSpec(targetIdsChunk))
|
||||
// .stream()
|
||||
// .peek(target -> {
|
||||
// .map(target -> {
|
||||
// target.setAssignedDistributionSet(set);
|
||||
// target.setLastModifiedAt(now);
|
||||
// target.setLastModifiedBy(currentUser);
|
||||
// target.setUpdateStatus(TargetUpdateStatus.PENDING);
|
||||
// return target;
|
||||
// })
|
||||
// .toList());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user