Sonar Fixes (#2230)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-01-24 13:41:17 +02:00
committed by GitHub
parent e6c8215d05
commit d488203b5f
16 changed files with 125 additions and 85 deletions

View File

@@ -783,11 +783,23 @@ public class RepositoryApplicationConfiguration {
*/
@Bean
@ConditionalOnMissingBean
ControllerManagement controllerManagement(final ScheduledExecutorService executorService,
final ActionRepository actionRepository, final ActionStatusRepository actionStatusRepository,
final QuotaManagement quotaManagement, final RepositoryProperties repositoryProperties) {
return new JpaControllerManagement(executorService, actionRepository, actionStatusRepository, quotaManagement,
repositoryProperties);
ControllerManagement controllerManagement(
final ActionRepository actionRepository, final ActionStatusRepository actionStatusRepository, final QuotaManagement quotaManagement,
final RepositoryProperties repositoryProperties,
final TargetRepository targetRepository, final TargetTypeManagement targetTypeManagement,
final DeploymentManagement deploymentManagement, final ConfirmationManagement confirmationManagement,
final SoftwareModuleRepository softwareModuleRepository, final SoftwareModuleMetadataRepository softwareModuleMetadataRepository,
final DistributionSetManagement distributionSetManagement,
final TenantConfigurationManagement tenantConfigurationManagement,
final PlatformTransactionManager txManager, final EntityFactory entityFactory, final EntityManager entityManager,
final AfterTransactionCommitExecutor afterCommit, final EventPublisherHolder eventPublisherHolder,
final SystemSecurityContext systemSecurityContext, final TenantAware tenantAware,
final ScheduledExecutorService executorService) {
return new JpaControllerManagement(actionRepository, actionStatusRepository, quotaManagement, repositoryProperties,
targetRepository, targetTypeManagement, deploymentManagement, confirmationManagement, softwareModuleRepository,
softwareModuleMetadataRepository, distributionSetManagement, tenantConfigurationManagement, txManager,
entityFactory, entityManager, afterCommit, eventPublisherHolder, systemSecurityContext, tenantAware,
executorService);
}
@Bean

View File

@@ -22,6 +22,8 @@ import org.eclipse.hawkbit.repository.QuotaManagement;
import org.eclipse.hawkbit.repository.RepositoryProperties;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.builder.JpaActionStatusCreate;
import org.eclipse.hawkbit.repository.jpa.model.AbstractBaseEntity;
import org.eclipse.hawkbit.repository.jpa.model.AbstractJpaBaseEntity_;
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
import org.eclipse.hawkbit.repository.jpa.model.JpaAction_;
@@ -47,8 +49,7 @@ public class JpaActionManagement {
protected final RepositoryProperties repositoryProperties;
public JpaActionManagement(
final ActionRepository actionRepository,
final ActionStatusRepository actionStatusRepository, final QuotaManagement quotaManagement,
final ActionRepository actionRepository, final ActionStatusRepository actionStatusRepository, final QuotaManagement quotaManagement,
final RepositoryProperties repositoryProperties) {
this.actionRepository = actionRepository;
this.actionStatusRepository = actionStatusRepository;
@@ -109,12 +110,14 @@ public class JpaActionManagement {
actionRepository.findAll(
ActionSpecifications.byTargetControllerIdAndActiveAndWeightIsNull(controllerId, false),
JpaAction_.GRAPH_ACTION_DS,
PageRequest.of(0, maxActionCount, Sort.by(Sort.Order.desc(JpaAction_.WEIGHT), Sort.Order.asc(JpaAction_.ID)))).stream(),
PageRequest.of(
0, maxActionCount,
Sort.by(Sort.Order.desc(JpaAction_.WEIGHT), Sort.Order.asc(AbstractJpaBaseEntity_.ID)))).stream(),
// get the oldest actions without weight
actionRepository.findAll(
ActionSpecifications.byTargetControllerIdAndActiveAndWeightIsNull(controllerId, true),
JpaAction_.GRAPH_ACTION_DS,
PageRequest.of(0, maxActionCount, Sort.by(Sort.Order.asc(JpaAction_.ID)))).stream())
PageRequest.of(0, maxActionCount, Sort.by(Sort.Order.asc(AbstractJpaBaseEntity_.ID)))).stream())
.sorted(Comparator.comparingInt(this::getWeightConsideringDefault).reversed().thenComparing(Action::getId))
.limit(maxActionCount)
.map(Action.class::cast)

View File

@@ -193,6 +193,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
return localArtifactRepository.count(ArtifactSpecifications.bySoftwareModuleId(softwareModuleId));
}
@SuppressWarnings("java:S2201") // java:S2201 - the idea is to just check if the artifact exists
@Override
public Optional<DbArtifact> loadArtifactBinary(final String sha1Hash, final long softwareModuleId, final boolean isEncrypted) {
assertArtifactRepositoryAvailable();

View File

@@ -69,6 +69,7 @@ import org.eclipse.hawkbit.repository.jpa.acm.AccessController;
import org.eclipse.hawkbit.repository.jpa.builder.JpaActionStatusCreate;
import org.eclipse.hawkbit.repository.jpa.configuration.Constants;
import org.eclipse.hawkbit.repository.jpa.executor.AfterTransactionCommitExecutor;
import org.eclipse.hawkbit.repository.jpa.model.AbstractJpaBaseEntity_;
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus_;
@@ -128,42 +129,54 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
private final BlockingDeque<TargetPoll> queue;
@Autowired
private EntityManager entityManager;
@Autowired
// TODO - make it final
private TargetRepository targetRepository;
@Autowired
private SoftwareModuleRepository softwareModuleRepository;
@Autowired
private TenantConfigurationManagement tenantConfigurationManagement;
@Autowired
private SystemSecurityContext systemSecurityContext;
@Autowired
private EntityFactory entityFactory;
@Autowired
private EventPublisherHolder eventPublisherHolder;
@Autowired
private AfterTransactionCommitExecutor afterCommit;
@Autowired
private SoftwareModuleMetadataRepository softwareModuleMetadataRepository;
@Autowired
private PlatformTransactionManager txManager;
@Autowired
private TenantAware tenantAware;
@Autowired
private ConfirmationManagement confirmationManagement;
@Autowired
private TargetTypeManagement targetTypeManagement;
@Autowired
private DeploymentManagement deploymentManagement;
@Autowired
private DistributionSetManagement distributionSetManagement;
private final TargetTypeManagement targetTypeManagement;
private final DeploymentManagement deploymentManagement;
private final ConfirmationManagement confirmationManagement;
private final SoftwareModuleRepository softwareModuleRepository;
private final SoftwareModuleMetadataRepository softwareModuleMetadataRepository;
private final DistributionSetManagement distributionSetManagement;
private final TenantConfigurationManagement tenantConfigurationManagement;
private final PlatformTransactionManager txManager;
private final EntityFactory entityFactory;
private final EntityManager entityManager;
private final AfterTransactionCommitExecutor afterCommit;
private final EventPublisherHolder eventPublisherHolder;
private final SystemSecurityContext systemSecurityContext;
private final TenantAware tenantAware;
public JpaControllerManagement(final ScheduledExecutorService executorService,
final ActionRepository actionRepository, final ActionStatusRepository actionStatusRepository,
final QuotaManagement quotaManagement, final RepositoryProperties repositoryProperties) {
@SuppressWarnings("squid:S00107")
public JpaControllerManagement(
final ActionRepository actionRepository, final ActionStatusRepository actionStatusRepository, final QuotaManagement quotaManagement,
final RepositoryProperties repositoryProperties,
final TargetRepository targetRepository, final TargetTypeManagement targetTypeManagement,
final DeploymentManagement deploymentManagement, final ConfirmationManagement confirmationManagement,
final SoftwareModuleRepository softwareModuleRepository, final SoftwareModuleMetadataRepository softwareModuleMetadataRepository,
final DistributionSetManagement distributionSetManagement,
final TenantConfigurationManagement tenantConfigurationManagement,
final PlatformTransactionManager txManager, final EntityFactory entityFactory, final EntityManager entityManager,
final AfterTransactionCommitExecutor afterCommit, final EventPublisherHolder eventPublisherHolder,
final SystemSecurityContext systemSecurityContext, final TenantAware tenantAware,
final ScheduledExecutorService executorService) {
super(actionRepository, actionStatusRepository, quotaManagement, repositoryProperties);
this.targetRepository = targetRepository;
this.targetTypeManagement = targetTypeManagement;
this.deploymentManagement = deploymentManagement;
this.confirmationManagement = confirmationManagement;
this.softwareModuleRepository = softwareModuleRepository;
this.softwareModuleMetadataRepository = softwareModuleMetadataRepository;
this.distributionSetManagement = distributionSetManagement;
this.tenantConfigurationManagement = tenantConfigurationManagement;
this.txManager = txManager;
this.entityFactory = entityFactory;
this.entityManager = entityManager;
this.afterCommit = afterCommit;
this.eventPublisherHolder = eventPublisherHolder;
this.systemSecurityContext = systemSecurityContext;
this.tenantAware = tenantAware;
if (!repositoryProperties.isEagerPollPersistence()) {
executorService.scheduleWithFixedDelay(this::flushUpdateQueue,
repositoryProperties.getPollPersistenceFlushTime(),
@@ -289,11 +302,13 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
// get the highest action with weight
actionRepository.findAll(
ActionSpecifications.byTargetControllerIdAndActiveAndWeightIsNull(controllerId, false),
PageRequest.of(0, 1, Sort.by(Sort.Order.desc(JpaAction_.WEIGHT), Sort.Order.asc(JpaAction_.ID)))).stream(),
PageRequest.of(
0, 1,
Sort.by(Sort.Order.desc(JpaAction_.WEIGHT), Sort.Order.asc(AbstractJpaBaseEntity_.ID)))).stream(),
// get the oldest action without weight
actionRepository.findAll(
ActionSpecifications.byTargetControllerIdAndActiveAndWeightIsNull(controllerId, false),
PageRequest.of(0, 1, Sort.by(Sort.Order.asc(JpaAction_.ID)))).stream())
PageRequest.of(0, 1, Sort.by(Sort.Order.asc(AbstractJpaBaseEntity_.ID)))).stream())
.min(Comparator.comparingInt(this::getWeightConsideringDefault).reversed().thenComparing(Action::getId))
.map(Action.class::cast);
}
@@ -911,28 +926,22 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
*/
private Action handleRegisterRetrieved(final Long actionId, final String message) {
final JpaAction action = getActionAndThrowExceptionIfNotFound(actionId);
// do a manual query with CriteriaBuilder to avoid unnecessary field
// queries and an extra
// count query made by spring-data when using pageable requests, we
// don't need an extra count
// query, we just want to check if the last action status is a retrieved
// or not.
// do a manual query with CriteriaBuilder to avoid unnecessary field queries and an extra
// count query made by spring-data when using pageable requests, we don't need an extra count
// query, we just want to check if the last action status is a retrieved or not.
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
final CriteriaQuery<Object[]> queryActionStatus = cb.createQuery(Object[].class);
final Root<JpaActionStatus> actionStatusRoot = queryActionStatus.from(JpaActionStatus.class);
final CriteriaQuery<Object[]> query = queryActionStatus
.multiselect(actionStatusRoot.get(JpaActionStatus_.id), actionStatusRoot.get(JpaActionStatus_.status))
.where(cb.equal(actionStatusRoot.get(JpaActionStatus_.action).get(JpaAction_.id), actionId))
.orderBy(cb.desc(actionStatusRoot.get(JpaActionStatus_.id)));
.multiselect(actionStatusRoot.get(AbstractJpaBaseEntity_.id), actionStatusRoot.get(JpaActionStatus_.status))
.where(cb.equal(actionStatusRoot.get(JpaActionStatus_.action).get(AbstractJpaBaseEntity_.id), actionId))
.orderBy(cb.desc(actionStatusRoot.get(AbstractJpaBaseEntity_.id)));
final List<Object[]> resultList = entityManager.createQuery(query).setFirstResult(0).setMaxResults(1)
.getResultList();
// if the latest status is not in retrieve state then we add a retrieved
// state again, we want
// to document a deployment retrieved status and a cancel retrieved
// status, but multiple
// retrieves after the other we don't want to store to protect to
// overflood action status in
// if the latest status is not in retrieve state then we add a retrieved state again, we want
// to document a deployment retrieved status and a cancel retrieved status, but multiple
// retrieves after the other we don't want to store to protect to overflood action status in
// case controller retrieves a action multiple times.
if (resultList.isEmpty() || (Status.RETRIEVED != resultList.get(0)[1])) {
// document that the status has been retrieved

View File

@@ -57,9 +57,9 @@ import org.eclipse.hawkbit.repository.jpa.JpaManagementHelper;
import org.eclipse.hawkbit.repository.jpa.acm.AccessController;
import org.eclipse.hawkbit.repository.jpa.configuration.Constants;
import org.eclipse.hawkbit.repository.jpa.executor.AfterTransactionCommitExecutor;
import org.eclipse.hawkbit.repository.jpa.model.AbstractJpaBaseEntity_;
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus_;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget_;
@@ -162,6 +162,7 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
private final Database database;
private final RetryTemplate retryTemplate;
@SuppressWarnings("java:S107")
public JpaDeploymentManagement(
final EntityManager entityManager, final ActionRepository actionRepository,
final DistributionSetManagement distributionSetManagement, final TargetRepository targetRepository,
@@ -361,7 +362,7 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
final Root<JpaActionStatus> as = msgQuery.from(JpaActionStatus.class);
final ListJoin<JpaActionStatus, String> join = as.joinList("messages", JoinType.LEFT);
final CriteriaQuery<String> selMsgQuery = msgQuery.select(join);
selMsgQuery.where(cb.equal(as.get(JpaActionStatus_.id), actionStatusId));
selMsgQuery.where(cb.equal(as.get(AbstractJpaBaseEntity_.id), actionStatusId));
final List<String> result = new ArrayList<>(entityManager.createQuery(selMsgQuery)
.setFirstResult((int) pageable.getOffset()).setMaxResults(pageable.getPageSize()).getResultList());

View File

@@ -51,6 +51,7 @@ public class JpaDistributionSetInvalidationManagement implements DistributionSet
private final LockRegistry lockRegistry;
private final SystemSecurityContext systemSecurityContext;
@SuppressWarnings("java:S107")
public JpaDistributionSetInvalidationManagement(final DistributionSetManagement distributionSetManagement,
final RolloutManagement rolloutManagement, final DeploymentManagement deploymentManagement,
final TargetFilterQueryManagement targetFilterQueryManagement, final ActionRepository actionRepository,

View File

@@ -49,6 +49,7 @@ import org.eclipse.hawkbit.repository.jpa.JpaManagementHelper;
import org.eclipse.hawkbit.repository.jpa.acm.AccessController;
import org.eclipse.hawkbit.repository.jpa.builder.JpaDistributionSetCreate;
import org.eclipse.hawkbit.repository.jpa.configuration.Constants;
import org.eclipse.hawkbit.repository.jpa.model.AbstractJpaBaseEntity_;
import org.eclipse.hawkbit.repository.jpa.model.DsMetadataCompositeKey;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetMetadata;
@@ -115,6 +116,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
private final Database database;
private final RepositoryProperties repositoryProperties;
@SuppressWarnings("java:S107")
public JpaDistributionSetManagement(
final EntityManager entityManager,
final DistributionSetRepository distributionSetRepository,
@@ -175,6 +177,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
@Retryable(retryFor = { ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX,
backoff = @Backoff(delay = Constants.TX_RT_DELAY))
@PreAuthorize(SpPermission.SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
@SuppressWarnings("java:S1066") // javaS1066 - better readable that way
public DistributionSet update(final DistributionSetUpdate u) {
final GenericDistributionSetUpdate update = (GenericDistributionSetUpdate) u;
@@ -767,7 +770,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
private Specification<JpaDistributionSetMetadata> byDsIdSpec(final long dsId) {
return (root, query, cb) -> cb
.equal(root.get(JpaDistributionSetMetadata_.distributionSet).get(JpaDistributionSet_.id), dsId);
.equal(root.get(JpaDistributionSetMetadata_.distributionSet).get(AbstractJpaBaseEntity_.id), dsId);
}
private void assertDistributionSetIsNotAssignedToTargets(final Long distributionSet) {

View File

@@ -13,7 +13,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.im.authentication.SpPermission;
import org.eclipse.hawkbit.repository.DistributionSetTagFields;

View File

@@ -14,7 +14,7 @@ import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -74,8 +74,9 @@ import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
@NamedEntityGraph(name = "Action.ds", attributeNodes = { @NamedAttributeNode("distributionSet") })
})
@Entity
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
@SuppressWarnings("squid:S2160")
// squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// java:S1710 - not possible to use without group annotation
@SuppressWarnings({ "squid:S2160", "java:S1710", "java:S1171", "java:S3599" })
public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Action, EventAwareEntity {
@Serial
@@ -375,7 +376,7 @@ public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Actio
public static class StatusConverter extends MapAttributeConverter<Status, Integer> {
public StatusConverter() {
super(new HashMap<>() {{
super(new EnumMap<>(Status.class) {{
put(Status.FINISHED, 0);
put(Status.ERROR, 1);
put(Status.WARNING, 2);

View File

@@ -151,14 +151,13 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
}
if (message.length() > MESSAGE_ENTRY_LENGTH) {
// split
for (int off = 0; off < message.length(); ) {
for (int off = 0; off < message.length(); off += MESSAGE_ENTRY_LENGTH) {
final int end = off + MESSAGE_ENTRY_LENGTH;
if (end < message.length()) {
messages.add(message.substring(off, end));
} else {
messages.add(message.substring(off));
}
off = end;
}
} else {
messages.add(message);

View File

@@ -37,6 +37,8 @@ import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
@Index(name = "sp_idx_distribution_set_tag_prim", columnList = "tenant,id"),
@Index(name = "sp_idx_distribution_set_tag_01", columnList = "tenant,name") },
uniqueConstraints = @UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_ds_tag"))
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
@SuppressWarnings("squid:S2160")
public class JpaDistributionSetTag extends JpaTag implements DistributionSetTag, EventAwareEntity {
@Serial

View File

@@ -41,6 +41,7 @@ import org.springframework.util.ObjectUtils;
* @param <T> the domain type the repository manages
* @param <ID> the type of the id of the entity the repository manages
*/
@SuppressWarnings("java:S119") // inherited from SimpleJpaRepository
public class HawkbitBaseRepository<T, ID extends Serializable> extends SimpleJpaRepository<T, ID>
implements JpaSpecificationEntityGraphExecutor<T>, NoCountSliceRepository<T>, ACMRepository<T> {
@@ -73,12 +74,14 @@ public class HawkbitBaseRepository<T, ID extends Serializable> extends SimpleJpa
@Override
@Transactional
@NonNull
@SuppressWarnings("java:S6809") // this method already has a transactional annotation witch shall be applied
public <S extends T> S save(@Nullable AccessController.Operation operation, @NonNull final S entity) {
return save(entity);
}
@Override
@Transactional
@SuppressWarnings("java:S6809") // this method already has a transactional annotation witch shall be applied
public <S extends T> List<S> saveAll(@Nullable AccessController.Operation operation, final Iterable<S> entities) {
return saveAll(entities);
}
@@ -90,6 +93,7 @@ public class HawkbitBaseRepository<T, ID extends Serializable> extends SimpleJpa
@Override
@NonNull
@SuppressWarnings("java:S4449") // find all accepts null
public List<T> findAll(@Nullable final AccessController.Operation operation, @Nullable final Specification<T> spec) {
return findAll(spec);
}

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.repository.jpa.specifications;
import org.eclipse.hawkbit.repository.jpa.model.AbstractJpaNamedEntity_;
import org.eclipse.hawkbit.repository.jpa.model.AbstractJpaTypeEntity_;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType_;
import org.eclipse.hawkbit.repository.model.DistributionSet;
@@ -44,7 +46,7 @@ public final class DistributionSetTypeSpecification {
* @return the {@link DistributionSet} {@link Specification}
*/
public static Specification<JpaDistributionSetType> byName(final String name) {
return (targetRoot, query, cb) -> cb.equal(targetRoot.get(JpaDistributionSetType_.name), name);
return (targetRoot, query, cb) -> cb.equal(targetRoot.get(AbstractJpaNamedEntity_.name), name);
}
/**
@@ -56,6 +58,6 @@ public final class DistributionSetTypeSpecification {
* @return the {@link DistributionSet} {@link Specification}
*/
public static Specification<JpaDistributionSetType> byKey(final String key) {
return (targetRoot, query, cb) -> cb.equal(targetRoot.get(JpaDistributionSetType_.key), key);
return (targetRoot, query, cb) -> cb.equal(targetRoot.get(AbstractJpaTypeEntity_.key), key);
}
}

View File

@@ -281,6 +281,7 @@ public class DistributionSetView extends TableView<MgmtDistributionSet, Long> {
}
}
@SuppressWarnings({"java:S1171", "java:S3599"})
private static class AddSoftwareModulesDialog extends Utils.BaseDialog<Void> {
private final transient Set<MgmtSoftwareModule> softwareModules = Collections.synchronizedSet(new HashSet<>());

View File

@@ -61,6 +61,7 @@ import org.springframework.util.ObjectUtils;
@Route(value = "rollouts", layout = MainLayout.class)
@RolesAllowed({ "ROLLOUT_READ" })
@Uses(Icon.class)
@SuppressWarnings({"java:S1171", "java:S3599"})
public class RolloutView extends TableView<MgmtRolloutResponseBody, Long> {
public RolloutView(final HawkbitMgmtClient hawkbitClient) {
@@ -101,21 +102,6 @@ public class RolloutView extends TableView<MgmtRolloutResponseBody, Long> {
});
}
private static SelectionGrid<MgmtRolloutGroupResponseBody, Long> createGroupGrid() {
return new SelectionGrid<>(
new SelectionGrid.EntityRepresentation<>(MgmtRolloutGroupResponseBody.class, MgmtRolloutGroupResponseBody::getRolloutGroupId) {
@Override
protected void addColumns(final Grid<MgmtRolloutGroupResponseBody> grid) {
grid.addColumn(MgmtRolloutGroupResponseBody::getRolloutGroupId).setHeader(Constants.ID).setAutoWidth(true);
grid.addColumn(MgmtRolloutGroupResponseBody::getName).setHeader(Constants.NAME).setAutoWidth(true);
grid.addColumn(MgmtRolloutGroupResponseBody::getTotalTargets).setHeader(Constants.TARGET_COUNT).setAutoWidth(true);
grid.addColumn(MgmtRolloutGroupResponseBody::getTotalTargetsPerStatus).setHeader(Constants.STATS).setAutoWidth(true);
grid.addColumn(MgmtRolloutGroupResponseBody::getStatus).setHeader(Constants.STATUS).setAutoWidth(true);
}
});
}
private static class Actions extends HorizontalLayout {
private final long rolloutId;
@@ -265,6 +251,21 @@ public class RolloutView extends TableView<MgmtRolloutResponseBody, Long> {
.limit(query.getPageSize()));
groupGrid.setSelectionMode(Grid.SelectionMode.NONE);
}
private static SelectionGrid<MgmtRolloutGroupResponseBody, Long> createGroupGrid() {
return new SelectionGrid<>(
new SelectionGrid.EntityRepresentation<>(MgmtRolloutGroupResponseBody.class, MgmtRolloutGroupResponseBody::getRolloutGroupId) {
@Override
protected void addColumns(final Grid<MgmtRolloutGroupResponseBody> grid) {
grid.addColumn(MgmtRolloutGroupResponseBody::getRolloutGroupId).setHeader(Constants.ID).setAutoWidth(true);
grid.addColumn(MgmtRolloutGroupResponseBody::getName).setHeader(Constants.NAME).setAutoWidth(true);
grid.addColumn(MgmtRolloutGroupResponseBody::getTotalTargets).setHeader(Constants.TARGET_COUNT).setAutoWidth(true);
grid.addColumn(MgmtRolloutGroupResponseBody::getTotalTargetsPerStatus).setHeader(Constants.STATS).setAutoWidth(true);
grid.addColumn(MgmtRolloutGroupResponseBody::getStatus).setHeader(Constants.STATUS).setAutoWidth(true);
}
});
}
}
private static class CreateDialog extends Utils.BaseDialog<Void> {

View File

@@ -136,6 +136,7 @@ public class TargetView extends TableView<MgmtTarget, String> {
}
}
@SuppressWarnings({"java:S1171", "java:S3599"})
private static class RawFilter implements Filter.Rsql {
private final TextField textFilter = new TextField("Raw Filter");