Sonar Fixes (#2243)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-01-27 16:46:28 +02:00
committed by GitHub
parent 5cc4372981
commit 881900600f
15 changed files with 135 additions and 144 deletions

View File

@@ -16,7 +16,6 @@ import java.util.Optional;
import jakarta.validation.constraints.NotNull;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.cache.interceptor.SimpleKeyGenerator;
import org.springframework.context.annotation.Bean;

View File

@@ -101,7 +101,6 @@ import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
import org.eclipse.hawkbit.security.SystemSecurityContext;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.ConcurrencyFailureException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;

View File

@@ -79,7 +79,6 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyReplacer;
import org.eclipse.hawkbit.security.SystemSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.ConcurrencyFailureException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -668,7 +667,8 @@ public class JpaRolloutManagement implements RolloutManagement {
// prepare the groups
final List<RolloutGroup> srcGroups = groupList.stream()
.map(group -> prepareRolloutGroupWithDefaultConditions(group, conditions))
.collect(Collectors.toList());
.map(RolloutGroup.class::cast)
.toList();
srcGroups.forEach(RolloutHelper::verifyRolloutGroupHasConditions);
RolloutHelper.verifyRemainingTargets(calculateRemainingTargets(

View File

@@ -15,7 +15,6 @@ import org.eclipse.hawkbit.repository.jpa.repository.LocalArtifactRepository;
import org.eclipse.hawkbit.repository.jpa.repository.TargetRepository;
import org.eclipse.hawkbit.repository.report.model.TenantUsage;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.repository.jpa.rsql;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import jakarta.validation.constraints.NotNull;
@@ -105,7 +105,8 @@ public abstract class AbstractRSQLVisitor<A extends Enum<A> & RsqlQueryField> {
}
private List<String> getExpectedFieldList() {
final List<String> expectedFieldList = Arrays.stream(rsqlQueryFieldType.getEnumConstants())
return Stream.concat(
Arrays.stream(rsqlQueryFieldType.getEnumConstants())
.filter(enumField -> enumField.getSubEntityAttributes().isEmpty()).map(enumField -> {
final String enumFieldName = enumField.name().toLowerCase();
if (enumField.isMap()) {
@@ -113,9 +114,8 @@ public abstract class AbstractRSQLVisitor<A extends Enum<A> & RsqlQueryField> {
} else {
return enumFieldName;
}
}).collect(Collectors.toList());
final List<String> expectedSubFieldList = Arrays.stream(rsqlQueryFieldType.getEnumConstants())
}),
Arrays.stream(rsqlQueryFieldType.getEnumConstants())
.filter(enumField -> !enumField.getSubEntityAttributes().isEmpty()).flatMap(enumField -> {
final List<String> subEntity = enumField
.getSubEntityAttributes().stream().map(fieldName -> enumField.name().toLowerCase()
@@ -123,9 +123,8 @@ public abstract class AbstractRSQLVisitor<A extends Enum<A> & RsqlQueryField> {
.toList();
return subEntity.stream();
}).toList();
expectedFieldList.addAll(expectedSubFieldList);
return expectedFieldList;
}))
.toList();
}
@Value