Fix sonar findings (#2572)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -14,7 +14,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow a target to declare running distribution set version
|
* Allow a target to declare running distribution set version
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class AuthenticationFilters {
|
|||||||
* An abstraction for all controller based security to parse the e.g. the tenant name from the URL and the controller ID from the URL to do
|
* An abstraction for all controller based security to parse the e.g. the tenant name from the URL and the controller ID from the URL to do
|
||||||
* security checks based on this information.
|
* security checks based on this information.
|
||||||
*/
|
*/
|
||||||
public static abstract class AbstractAuthenticationFilter extends OncePerRequestFilter {
|
public abstract static class AbstractAuthenticationFilter extends OncePerRequestFilter {
|
||||||
|
|
||||||
private static final String TENANT_PLACE_HOLDER = "tenant";
|
private static final String TENANT_PLACE_HOLDER = "tenant";
|
||||||
private static final String CONTROLLER_ID_PLACE_HOLDER = "controllerId";
|
private static final String CONTROLLER_ID_PLACE_HOLDER = "controllerId";
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
|||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||||
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.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.springframework.amqp.core.Binding;
|
import org.springframework.amqp.core.Binding;
|
||||||
import org.springframework.amqp.core.BindingBuilder;
|
import org.springframework.amqp.core.BindingBuilder;
|
||||||
@@ -275,8 +277,8 @@ public class DmfApiConfiguration {
|
|||||||
final RabbitTemplate rabbitTemplate,
|
final RabbitTemplate rabbitTemplate,
|
||||||
final AmqpMessageSenderService amqpSenderService, final ArtifactUrlHandler artifactUrlHandler,
|
final AmqpMessageSenderService amqpSenderService, final ArtifactUrlHandler artifactUrlHandler,
|
||||||
final SystemSecurityContext systemSecurityContext, final SystemManagement systemManagement,
|
final SystemSecurityContext systemSecurityContext, final SystemManagement systemManagement,
|
||||||
final TargetManagement targetManagement, final DistributionSetManagement distributionSetManagement,
|
final TargetManagement targetManagement, final DistributionSetManagement<? extends DistributionSet> distributionSetManagement,
|
||||||
final SoftwareModuleManagement softwareModuleManagement, final DeploymentManagement deploymentManagement,
|
final SoftwareModuleManagement<? extends SoftwareModule> softwareModuleManagement, final DeploymentManagement deploymentManagement,
|
||||||
final TenantConfigurationManagement tenantConfigurationManagement) {
|
final TenantConfigurationManagement tenantConfigurationManagement) {
|
||||||
return new AmqpMessageDispatcherService(rabbitTemplate, amqpSenderService, artifactUrlHandler,
|
return new AmqpMessageDispatcherService(rabbitTemplate, amqpSenderService, artifactUrlHandler,
|
||||||
systemSecurityContext, systemManagement, targetManagement, serviceMatcher, softwareModuleManagement, distributionSetManagement,
|
systemSecurityContext, systemManagement, targetManagement, serviceMatcher, softwareModuleManagement, distributionSetManagement,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.dmf.json.model;
|
package org.eclipse.hawkbit.dmf.json.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -18,8 +17,6 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
|||||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSON representation of batch download and update request.
|
* JSON representation of batch download and update request.
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.dmf.json.model;
|
package org.eclipse.hawkbit.dmf.json.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.dmf.json.model;
|
package org.eclipse.hawkbit.dmf.json.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class MgmtActionStatus {
|
|||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(example = "running")
|
@Schema(example = "running")
|
||||||
private StatusType type;
|
private Type type;
|
||||||
|
|
||||||
private List<String> messages;
|
private List<String> messages;
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class MgmtActionStatus {
|
|||||||
@Schema(example = "200")
|
@Schema(example = "200")
|
||||||
private Integer code;
|
private Integer code;
|
||||||
|
|
||||||
public enum StatusType {
|
public enum Type {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action is finished successfully for this target.
|
* Action is finished successfully for this target.
|
||||||
@@ -116,8 +116,8 @@ public class MgmtActionStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public static StatusType forValue(String s) {
|
public static Type forValue(String s) {
|
||||||
return StatusType.valueOf(s.toUpperCase());
|
return Type.valueOf(s.toUpperCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,6 @@ import java.util.List;
|
|||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.context.annotation.Description;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Feature: Tests for the MgmtTargetAssignmentResponseBody<br/>
|
* Feature: Tests for the MgmtTargetAssignmentResponseBody<br/>
|
||||||
|
|||||||
@@ -64,14 +64,14 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
|||||||
|
|
||||||
private final RolloutManagement rolloutManagement;
|
private final RolloutManagement rolloutManagement;
|
||||||
private final RolloutGroupManagement rolloutGroupManagement;
|
private final RolloutGroupManagement rolloutGroupManagement;
|
||||||
private final DistributionSetManagement distributionSetManagement;
|
private final DistributionSetManagement<? extends DistributionSet> distributionSetManagement;
|
||||||
private final TargetFilterQueryManagement targetFilterQueryManagement;
|
private final TargetFilterQueryManagement targetFilterQueryManagement;
|
||||||
private final EntityFactory entityFactory;
|
private final EntityFactory entityFactory;
|
||||||
private final TenantConfigHelper tenantConfigHelper;
|
private final TenantConfigHelper tenantConfigHelper;
|
||||||
|
|
||||||
MgmtRolloutResource(
|
MgmtRolloutResource(
|
||||||
final RolloutManagement rolloutManagement, final RolloutGroupManagement rolloutGroupManagement,
|
final RolloutManagement rolloutManagement, final RolloutGroupManagement rolloutGroupManagement,
|
||||||
final DistributionSetManagement distributionSetManagement,
|
final DistributionSetManagement<? extends DistributionSet> distributionSetManagement,
|
||||||
final TargetFilterQueryManagement targetFilterQueryManagement, final EntityFactory entityFactory,
|
final TargetFilterQueryManagement targetFilterQueryManagement, final EntityFactory entityFactory,
|
||||||
final SystemSecurityContext systemSecurityContext,
|
final SystemSecurityContext systemSecurityContext,
|
||||||
final TenantConfigurationManagement tenantConfigurationManagement) {
|
final TenantConfigurationManagement tenantConfigurationManagement) {
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModule
|
|||||||
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.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.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;
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ public final class MgmtTargetMapper {
|
|||||||
result.setReportedAt(actionStatus.getCreatedAt());
|
result.setReportedAt(actionStatus.getCreatedAt());
|
||||||
result.setTimestamp(actionStatus.getOccurredAt());
|
result.setTimestamp(actionStatus.getOccurredAt());
|
||||||
result.setId(actionStatus.getId());
|
result.setId(actionStatus.getId());
|
||||||
result.setType(MgmtActionStatus.StatusType.forValue(actionStatus.getStatus().name()));
|
result.setType(MgmtActionStatus.Type.forValue(actionStatus.getStatus().name()));
|
||||||
actionStatus.getCode().ifPresent(result::setCode);
|
actionStatus.getCode().ifPresent(result::setCode);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -380,6 +380,7 @@ public interface DistributionSetManagement<T extends DistributionSet>
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("java:S3400") // java:S3400 it's used via reflection
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.util.Collection;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -103,6 +103,8 @@ import org.eclipse.hawkbit.repository.jpa.rollout.condition.StartNextGroupRollou
|
|||||||
import org.eclipse.hawkbit.repository.jpa.rollout.condition.ThresholdRolloutGroupErrorCondition;
|
import org.eclipse.hawkbit.repository.jpa.rollout.condition.ThresholdRolloutGroupErrorCondition;
|
||||||
import org.eclipse.hawkbit.repository.jpa.rollout.condition.ThresholdRolloutGroupSuccessCondition;
|
import org.eclipse.hawkbit.repository.jpa.rollout.condition.ThresholdRolloutGroupSuccessCondition;
|
||||||
import org.eclipse.hawkbit.repository.jpa.rsql.RsqlUtility;
|
import org.eclipse.hawkbit.repository.jpa.rsql.RsqlUtility;
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
@@ -148,8 +150,6 @@ import org.springframework.transaction.PlatformTransactionManager;
|
|||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
|
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General configuration for hawkBit's Repository.
|
* General configuration for hawkBit's Repository.
|
||||||
*/
|
*/
|
||||||
@@ -319,7 +319,7 @@ public class JpaRepositoryConfiguration {
|
|||||||
* @return TargetTypeBuilder bean
|
* @return TargetTypeBuilder bean
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
TargetTypeBuilder targetTypeBuilder(final DistributionSetTypeManagement dsTypeManagement) {
|
TargetTypeBuilder targetTypeBuilder(final DistributionSetTypeManagement<? extends DistributionSetType> dsTypeManagement) {
|
||||||
return new JpaTargetTypeBuilder(dsTypeManagement);
|
return new JpaTargetTypeBuilder(dsTypeManagement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ public class JpaRepositoryConfiguration {
|
|||||||
* @return RolloutBuilder bean
|
* @return RolloutBuilder bean
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
RolloutBuilder rolloutBuilder(final DistributionSetManagement distributionSetManagement) {
|
RolloutBuilder rolloutBuilder(final DistributionSetManagement<? extends DistributionSet> distributionSetManagement) {
|
||||||
return new JpaRolloutBuilder(distributionSetManagement);
|
return new JpaRolloutBuilder(distributionSetManagement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +344,7 @@ public class JpaRepositoryConfiguration {
|
|||||||
* @return TargetFilterQueryBuilder bean
|
* @return TargetFilterQueryBuilder bean
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
TargetFilterQueryBuilder targetFilterQueryBuilder(final DistributionSetManagement distributionSetManagement) {
|
TargetFilterQueryBuilder targetFilterQueryBuilder(final DistributionSetManagement<? extends DistributionSet> distributionSetManagement) {
|
||||||
return new JpaTargetFilterQueryBuilder(distributionSetManagement);
|
return new JpaTargetFilterQueryBuilder(distributionSetManagement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class SystemManagementCacheKeyGenerator implements CurrentTenantCacheKeyG
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object generate(final Object target, final Method method, final Object... params) {
|
public Object generate(final Object target, final Method method, final Object... params) {
|
||||||
String tenant = getTenantInCreation().orElseGet(() -> tenantAware.getCurrentTenant()).toUpperCase();
|
String tenant = getTenantInCreation().orElseGet(tenantAware::getCurrentTenant).toUpperCase();
|
||||||
return SimpleKeyGenerator.generateKey(tenant, tenant);
|
return SimpleKeyGenerator.generateKey(tenant, tenant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.eclipse.hawkbit.repository.builder.GenericRolloutUpdate;
|
|||||||
import org.eclipse.hawkbit.repository.builder.RolloutBuilder;
|
import org.eclipse.hawkbit.repository.builder.RolloutBuilder;
|
||||||
import org.eclipse.hawkbit.repository.builder.RolloutCreate;
|
import org.eclipse.hawkbit.repository.builder.RolloutCreate;
|
||||||
import org.eclipse.hawkbit.repository.builder.RolloutUpdate;
|
import org.eclipse.hawkbit.repository.builder.RolloutUpdate;
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,9 +22,9 @@ import org.eclipse.hawkbit.repository.model.Rollout;
|
|||||||
*/
|
*/
|
||||||
public class JpaRolloutBuilder implements RolloutBuilder {
|
public class JpaRolloutBuilder implements RolloutBuilder {
|
||||||
|
|
||||||
private final DistributionSetManagement distributionSetManagement;
|
private final DistributionSetManagement<? extends DistributionSet> distributionSetManagement;
|
||||||
|
|
||||||
public JpaRolloutBuilder(final DistributionSetManagement distributionSetManagement) {
|
public JpaRolloutBuilder(final DistributionSetManagement<? extends DistributionSet> distributionSetManagement) {
|
||||||
this.distributionSetManagement = distributionSetManagement;
|
this.distributionSetManagement = distributionSetManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,19 +33,13 @@ public class JpaRolloutCreate extends AbstractNamedEntityBuilder<RolloutCreate>
|
|||||||
@Min(Action.WEIGHT_MIN)
|
@Min(Action.WEIGHT_MIN)
|
||||||
@Max(Action.WEIGHT_MAX)
|
@Max(Action.WEIGHT_MAX)
|
||||||
protected Integer weight;
|
protected Integer weight;
|
||||||
private final DistributionSetManagement distributionSetManagement;
|
private final DistributionSetManagement<? extends DistributionSet> distributionSetManagement;
|
||||||
private boolean dynamic;
|
private boolean dynamic;
|
||||||
|
|
||||||
JpaRolloutCreate(final DistributionSetManagement distributionSetManagement) {
|
JpaRolloutCreate(final DistributionSetManagement<? extends DistributionSet> distributionSetManagement) {
|
||||||
this.distributionSetManagement = distributionSetManagement;
|
this.distributionSetManagement = distributionSetManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link DistributionSet} of rollout
|
|
||||||
*
|
|
||||||
* @param distributionSetId ID of the distributionSetId
|
|
||||||
* @return this builder
|
|
||||||
*/
|
|
||||||
public RolloutCreate distributionSetId(final long distributionSetId) {
|
public RolloutCreate distributionSetId(final long distributionSetId) {
|
||||||
this.distributionSetId = distributionSetId;
|
this.distributionSetId = distributionSetId;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|||||||
* Create/build implementation.
|
* Create/build implementation.
|
||||||
*/
|
*/
|
||||||
public class JpaSoftwareModuleMetadataCreate
|
public class JpaSoftwareModuleMetadataCreate
|
||||||
extends AbstractSoftwareModuleMetadataUpdateCreate<SoftwareModuleMetadataCreate>
|
extends AbstractSoftwareModuleMetadataUpdateCreate<SoftwareModuleMetadataCreate> implements SoftwareModuleMetadataCreate {
|
||||||
implements SoftwareModuleMetadataCreate {
|
|
||||||
|
|
||||||
private final JpaSoftwareModuleManagement softwareModuleManagement;
|
private final JpaSoftwareModuleManagement softwareModuleManagement;
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ public class JpaTargetBuilder implements TargetBuilder {
|
|||||||
|
|
||||||
private final TargetTypeManagement targetTypeManagement;
|
private final TargetTypeManagement targetTypeManagement;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param targetTypeManagement Target type management
|
|
||||||
*/
|
|
||||||
public JpaTargetBuilder(TargetTypeManagement targetTypeManagement) {
|
public JpaTargetBuilder(TargetTypeManagement targetTypeManagement) {
|
||||||
this.targetTypeManagement = targetTypeManagement;
|
this.targetTypeManagement = targetTypeManagement;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,11 +25,6 @@ public class JpaTargetCreate extends AbstractTargetUpdateCreate<TargetCreate> im
|
|||||||
|
|
||||||
private final TargetTypeManagement targetTypeManagement;
|
private final TargetTypeManagement targetTypeManagement;
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param targetTypeManagement Target type management
|
|
||||||
*/
|
|
||||||
JpaTargetCreate(final TargetTypeManagement targetTypeManagement) {
|
JpaTargetCreate(final TargetTypeManagement targetTypeManagement) {
|
||||||
super(null);
|
super(null);
|
||||||
this.targetTypeManagement = targetTypeManagement;
|
this.targetTypeManagement = targetTypeManagement;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import org.eclipse.hawkbit.repository.builder.GenericTargetFilterQueryUpdate;
|
|||||||
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryBuilder;
|
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryBuilder;
|
||||||
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryCreate;
|
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryCreate;
|
||||||
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryUpdate;
|
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryUpdate;
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,9 +23,9 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
|||||||
*/
|
*/
|
||||||
public class JpaTargetFilterQueryBuilder implements TargetFilterQueryBuilder {
|
public class JpaTargetFilterQueryBuilder implements TargetFilterQueryBuilder {
|
||||||
|
|
||||||
private final DistributionSetManagement distributionSetManagement;
|
private final DistributionSetManagement<? extends DistributionSet> distributionSetManagement;
|
||||||
|
|
||||||
public JpaTargetFilterQueryBuilder(final DistributionSetManagement distributionSetManagement) {
|
public JpaTargetFilterQueryBuilder(final DistributionSetManagement<? extends DistributionSet> distributionSetManagement) {
|
||||||
this.distributionSetManagement = distributionSetManagement;
|
this.distributionSetManagement = distributionSetManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import org.eclipse.hawkbit.repository.builder.TargetFilterQueryCreate;
|
|||||||
import org.eclipse.hawkbit.repository.exception.InvalidAutoAssignActionTypeException;
|
import org.eclipse.hawkbit.repository.exception.InvalidAutoAssignActionTypeException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetFilterQuery;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetFilterQuery;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,9 +24,9 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
|||||||
public class JpaTargetFilterQueryCreate extends AbstractTargetFilterQueryUpdateCreate<TargetFilterQueryCreate>
|
public class JpaTargetFilterQueryCreate extends AbstractTargetFilterQueryUpdateCreate<TargetFilterQueryCreate>
|
||||||
implements TargetFilterQueryCreate {
|
implements TargetFilterQueryCreate {
|
||||||
|
|
||||||
private final DistributionSetManagement distributionSetManagement;
|
private final DistributionSetManagement<? extends DistributionSet> distributionSetManagement;
|
||||||
|
|
||||||
JpaTargetFilterQueryCreate(final DistributionSetManagement distributionSetManagement) {
|
JpaTargetFilterQueryCreate(final DistributionSetManagement<? extends DistributionSet> distributionSetManagement) {
|
||||||
this.distributionSetManagement = distributionSetManagement;
|
this.distributionSetManagement = distributionSetManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.eclipse.hawkbit.repository.builder.GenericTargetTypeUpdate;
|
|||||||
import org.eclipse.hawkbit.repository.builder.TargetTypeBuilder;
|
import org.eclipse.hawkbit.repository.builder.TargetTypeBuilder;
|
||||||
import org.eclipse.hawkbit.repository.builder.TargetTypeCreate;
|
import org.eclipse.hawkbit.repository.builder.TargetTypeCreate;
|
||||||
import org.eclipse.hawkbit.repository.builder.TargetTypeUpdate;
|
import org.eclipse.hawkbit.repository.builder.TargetTypeUpdate;
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetType;
|
import org.eclipse.hawkbit.repository.model.TargetType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,14 +22,9 @@ import org.eclipse.hawkbit.repository.model.TargetType;
|
|||||||
*/
|
*/
|
||||||
public class JpaTargetTypeBuilder implements TargetTypeBuilder {
|
public class JpaTargetTypeBuilder implements TargetTypeBuilder {
|
||||||
|
|
||||||
private final DistributionSetTypeManagement distributionSetTypeManagement;
|
private final DistributionSetTypeManagement<? extends DistributionSetType> distributionSetTypeManagement;
|
||||||
|
|
||||||
/**
|
public JpaTargetTypeBuilder(DistributionSetTypeManagement<? extends DistributionSetType> distributionSetTypeManagement) {
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param distributionSetTypeManagement Distribution set type management
|
|
||||||
*/
|
|
||||||
public JpaTargetTypeBuilder(DistributionSetTypeManagement distributionSetTypeManagement) {
|
|
||||||
this.distributionSetTypeManagement = distributionSetTypeManagement;
|
this.distributionSetTypeManagement = distributionSetTypeManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,14 +27,9 @@ import org.springframework.util.CollectionUtils;
|
|||||||
*/
|
*/
|
||||||
public class JpaTargetTypeCreate extends AbstractTargetTypeUpdateCreate<TargetTypeCreate> implements TargetTypeCreate {
|
public class JpaTargetTypeCreate extends AbstractTargetTypeUpdateCreate<TargetTypeCreate> implements TargetTypeCreate {
|
||||||
|
|
||||||
private final DistributionSetTypeManagement distributionSetTypeManagement;
|
private final DistributionSetTypeManagement<? extends DistributionSetType> distributionSetTypeManagement;
|
||||||
|
|
||||||
/**
|
JpaTargetTypeCreate(final DistributionSetTypeManagement<? extends DistributionSetType> distributionSetTypeManagement) {
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param distributionSetTypeManagement Distribution set type management
|
|
||||||
*/
|
|
||||||
JpaTargetTypeCreate(final DistributionSetTypeManagement distributionSetTypeManagement) {
|
|
||||||
this.distributionSetTypeManagement = distributionSetTypeManagement;
|
this.distributionSetTypeManagement = distributionSetTypeManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,13 +44,13 @@ public class JpaTargetTypeCreate extends AbstractTargetTypeUpdateCreate<TargetTy
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<DistributionSetType> findDistributionSetTypeWithExceptionIfNotFound(
|
private Collection<? extends DistributionSetType> findDistributionSetTypeWithExceptionIfNotFound(
|
||||||
final Collection<Long> distributionSetTypeId) {
|
final Collection<Long> distributionSetTypeId) {
|
||||||
if (CollectionUtils.isEmpty(distributionSetTypeId)) {
|
if (CollectionUtils.isEmpty(distributionSetTypeId)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Collection<DistributionSetType> type = distributionSetTypeManagement.get(distributionSetTypeId);
|
final Collection<? extends DistributionSetType> type = distributionSetTypeManagement.get(distributionSetTypeId);
|
||||||
if (type.size() < distributionSetTypeId.size()) {
|
if (type.size() < distributionSetTypeId.size()) {
|
||||||
throw new EntityNotFoundException(SoftwareModuleType.class, distributionSetTypeId);
|
throw new EntityNotFoundException(SoftwareModuleType.class, distributionSetTypeId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -780,9 +780,9 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
|
|||||||
final String initiatedBy, final Long dsId,
|
final String initiatedBy, final Long dsId,
|
||||||
final Collection<TargetWithActionType> targetsWithActionType, final String actionMessage,
|
final Collection<TargetWithActionType> targetsWithActionType, final String actionMessage,
|
||||||
final AbstractDsAssignmentStrategy assignmentStrategy) {
|
final AbstractDsAssignmentStrategy assignmentStrategy) {
|
||||||
final JpaDistributionSet distributionSet = (JpaDistributionSet) distributionSetManagement.getValidAndComplete(dsId);
|
final JpaDistributionSet distributionSet = distributionSetManagement.getValidAndComplete(dsId);
|
||||||
|
|
||||||
if (((JpaDistributionSetManagement) distributionSetManagement).isImplicitLockApplicable(distributionSet)) {
|
if (distributionSetManagement.isImplicitLockApplicable(distributionSet)) {
|
||||||
// without new transaction DS changed event is not thrown
|
// without new transaction DS changed event is not thrown
|
||||||
DeploymentHelper.runInNewTransaction(txManager, "Implicit lock", status -> {
|
DeploymentHelper.runInNewTransaction(txManager, "Implicit lock", status -> {
|
||||||
distributionSetManagement.lock(distributionSet.getId());
|
distributionSetManagement.lock(distributionSet.getId());
|
||||||
@@ -951,7 +951,7 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
|
|||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
final JpaTarget target = (JpaTarget) action.getTarget();
|
final JpaTarget target = action.getTarget();
|
||||||
if (target.getAssignedDistributionSet() != null
|
if (target.getAssignedDistributionSet() != null
|
||||||
&& action.getDistributionSet().getId().equals(target.getAssignedDistributionSet().getId())) {
|
&& action.getDistributionSet().getId().equals(target.getAssignedDistributionSet().getId())) {
|
||||||
// the target has already the distribution set assigned, we don't
|
// the target has already the distribution set assigned, we don't
|
||||||
@@ -1003,8 +1003,8 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
|
|||||||
|
|
||||||
private void setAssignmentOnTargets(final List<JpaAction> actions) {
|
private void setAssignmentOnTargets(final List<JpaAction> actions) {
|
||||||
final List<JpaTarget> assignedDsTargets = actions.stream().map(savedAction -> {
|
final List<JpaTarget> assignedDsTargets = actions.stream().map(savedAction -> {
|
||||||
final JpaTarget mergedTarget = (JpaTarget) entityManager.merge(savedAction.getTarget());
|
final JpaTarget mergedTarget = entityManager.merge(savedAction.getTarget());
|
||||||
mergedTarget.setAssignedDistributionSet((JpaDistributionSet) savedAction.getDistributionSet());
|
mergedTarget.setAssignedDistributionSet(savedAction.getDistributionSet());
|
||||||
mergedTarget.setUpdateStatus(TargetUpdateStatus.PENDING);
|
mergedTarget.setUpdateStatus(TargetUpdateStatus.PENDING);
|
||||||
return mergedTarget;
|
return mergedTarget;
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ public class JpaDistributionSetManagement
|
|||||||
this.repositoryProperties = repositoryProperties;
|
this.repositoryProperties = repositoryProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("java:S1066") // java:S1066 better readable without merging the if statements
|
||||||
@Override
|
@Override
|
||||||
public JpaDistributionSet update(final Update update) {
|
public JpaDistributionSet update(final Update update) {
|
||||||
final JpaDistributionSet distributionSet = getValid0(update.getId());
|
final JpaDistributionSet distributionSet = getValid0(update.getId());
|
||||||
@@ -164,6 +165,7 @@ public class JpaDistributionSetManagement
|
|||||||
return toDelete.stream().filter(distributionSet -> assigned.contains(distributionSet.getId())).toList();
|
return toDelete.stream().filter(distributionSet -> assigned.contains(distributionSet.getId())).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void delete0(final Collection<Long> distributionSetIDs) {
|
protected void delete0(final Collection<Long> distributionSetIDs) {
|
||||||
if (ObjectUtils.isEmpty(distributionSetIDs)) {
|
if (ObjectUtils.isEmpty(distributionSetIDs)) {
|
||||||
return; // super checks but if empty we don't want to unassign from target filters
|
return; // super checks but if empty we don't want to unassign from target filters
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class JpaRolloutManagement implements RolloutManagement {
|
|||||||
private final RolloutStatusCache rolloutStatusCache;
|
private final RolloutStatusCache rolloutStatusCache;
|
||||||
private final ActionRepository actionRepository;
|
private final ActionRepository actionRepository;
|
||||||
private final TargetManagement targetManagement;
|
private final TargetManagement targetManagement;
|
||||||
private final DistributionSetManagement distributionSetManagement;
|
private final DistributionSetManagement<? extends DistributionSet> distributionSetManagement;
|
||||||
private final TenantConfigurationManagement tenantConfigurationManagement;
|
private final TenantConfigurationManagement tenantConfigurationManagement;
|
||||||
private final QuotaManagement quotaManagement;
|
private final QuotaManagement quotaManagement;
|
||||||
private final AfterTransactionCommitExecutor afterCommit;
|
private final AfterTransactionCommitExecutor afterCommit;
|
||||||
@@ -135,7 +135,7 @@ public class JpaRolloutManagement implements RolloutManagement {
|
|||||||
final RolloutStatusCache rolloutStatusCache,
|
final RolloutStatusCache rolloutStatusCache,
|
||||||
final ActionRepository actionRepository,
|
final ActionRepository actionRepository,
|
||||||
final TargetManagement targetManagement,
|
final TargetManagement targetManagement,
|
||||||
final DistributionSetManagement distributionSetManagement,
|
final DistributionSetManagement<? extends DistributionSet> distributionSetManagement,
|
||||||
final TenantConfigurationManagement tenantConfigurationManagement,
|
final TenantConfigurationManagement tenantConfigurationManagement,
|
||||||
final QuotaManagement quotaManagement,
|
final QuotaManagement quotaManagement,
|
||||||
final AfterTransactionCommitExecutor afterCommit,
|
final AfterTransactionCommitExecutor afterCommit,
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import org.eclipse.hawkbit.repository.QuotaManagement;
|
|||||||
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareModuleFields;
|
import org.eclipse.hawkbit.repository.SoftwareModuleFields;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.artifact.encryption.ArtifactEncryptionService;
|
import org.eclipse.hawkbit.repository.artifact.encryption.ArtifactEncryptionService;
|
||||||
import org.eclipse.hawkbit.repository.builder.GenericSoftwareModuleMetadataUpdate;
|
import org.eclipse.hawkbit.repository.builder.GenericSoftwareModuleMetadataUpdate;
|
||||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleMetadataCreate;
|
import org.eclipse.hawkbit.repository.builder.SoftwareModuleMetadataCreate;
|
||||||
@@ -77,7 +76,6 @@ public class JpaSoftwareModuleManagement
|
|||||||
|
|
||||||
protected static final String SOFTWARE_MODULE_METADATA = "SoftwareModuleMetadata";
|
protected static final String SOFTWARE_MODULE_METADATA = "SoftwareModuleMetadata";
|
||||||
|
|
||||||
private final SoftwareModuleTypeManagement<? extends SoftwareModuleType> softwareModuleTypeManagement;
|
|
||||||
private final DistributionSetRepository distributionSetRepository;
|
private final DistributionSetRepository distributionSetRepository;
|
||||||
private final SoftwareModuleMetadataRepository softwareModuleMetadataRepository;
|
private final SoftwareModuleMetadataRepository softwareModuleMetadataRepository;
|
||||||
private final SoftwareModuleTypeRepository softwareModuleTypeRepository;
|
private final SoftwareModuleTypeRepository softwareModuleTypeRepository;
|
||||||
@@ -87,13 +85,11 @@ public class JpaSoftwareModuleManagement
|
|||||||
protected JpaSoftwareModuleManagement(
|
protected JpaSoftwareModuleManagement(
|
||||||
final SoftwareModuleRepository softwareModuleRepository,
|
final SoftwareModuleRepository softwareModuleRepository,
|
||||||
final EntityManager entityManager,
|
final EntityManager entityManager,
|
||||||
final SoftwareModuleTypeManagement<? extends SoftwareModuleType> softwareModuleTypeManagement,
|
|
||||||
final DistributionSetRepository distributionSetRepository,
|
final DistributionSetRepository distributionSetRepository,
|
||||||
final SoftwareModuleMetadataRepository softwareModuleMetadataRepository,
|
final SoftwareModuleMetadataRepository softwareModuleMetadataRepository,
|
||||||
final SoftwareModuleTypeRepository softwareModuleTypeRepository,
|
final SoftwareModuleTypeRepository softwareModuleTypeRepository,
|
||||||
final ArtifactManagement artifactManagement, final QuotaManagement quotaManagement) {
|
final ArtifactManagement artifactManagement, final QuotaManagement quotaManagement) {
|
||||||
super(softwareModuleRepository, entityManager);
|
super(softwareModuleRepository, entityManager);
|
||||||
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
|
|
||||||
this.distributionSetRepository = distributionSetRepository;
|
this.distributionSetRepository = distributionSetRepository;
|
||||||
this.softwareModuleMetadataRepository = softwareModuleMetadataRepository;
|
this.softwareModuleMetadataRepository = softwareModuleMetadataRepository;
|
||||||
this.softwareModuleTypeRepository = softwareModuleTypeRepository;
|
this.softwareModuleTypeRepository = softwareModuleTypeRepository;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModuleType;
|
|||||||
import org.eclipse.hawkbit.repository.jpa.repository.DistributionSetTypeRepository;
|
import org.eclipse.hawkbit.repository.jpa.repository.DistributionSetTypeRepository;
|
||||||
import org.eclipse.hawkbit.repository.jpa.repository.SoftwareModuleRepository;
|
import org.eclipse.hawkbit.repository.jpa.repository.SoftwareModuleRepository;
|
||||||
import org.eclipse.hawkbit.repository.jpa.repository.SoftwareModuleTypeRepository;
|
import org.eclipse.hawkbit.repository.jpa.repository.SoftwareModuleTypeRepository;
|
||||||
import org.eclipse.hawkbit.repository.jpa.utils.ExceptionMapper;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import jakarta.persistence.metamodel.MapAttribute;
|
|||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.FilterParams;
|
import org.eclipse.hawkbit.repository.FilterParams;
|
||||||
import org.eclipse.hawkbit.repository.QuotaManagement;
|
import org.eclipse.hawkbit.repository.QuotaManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetFields;
|
import org.eclipse.hawkbit.repository.TargetFields;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class JpaTargetTagManagement implements TargetTagManagement {
|
|||||||
private final TargetTagRepository targetTagRepository;
|
private final TargetTagRepository targetTagRepository;
|
||||||
|
|
||||||
protected JpaTargetTagManagement(final TargetTagRepository targetTagRepository) {
|
protected JpaTargetTagManagement(final TargetTagRepository targetTagRepository) {
|
||||||
this.targetTagRepository = targetTagRepository;;
|
this.targetTagRepository = targetTagRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -204,9 +204,7 @@ public class JpaTenantConfigurationManagement implements TenantConfigurationMana
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.getEntity().ifPresent(tenantConfiguration -> {
|
event.getEntity().ifPresent(tenantConfiguration -> evictCacheEntryByKeyIfPresent(tenantConfiguration.getKey()));
|
||||||
evictCacheEntryByKeyIfPresent(tenantConfiguration.getKey());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import jakarta.persistence.criteria.Predicate;
|
|||||||
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.AbstractJpaNamedEntity_;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout_;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout_;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public final class DeploymentHelper {
|
|||||||
action.setActive(false);
|
action.setActive(false);
|
||||||
action.setStatus(Status.CANCELED);
|
action.setStatus(Status.CANCELED);
|
||||||
|
|
||||||
final JpaTarget target = (JpaTarget) action.getTarget();
|
final JpaTarget target = action.getTarget();
|
||||||
final List<Action> nextActiveActions = actionRepository
|
final List<Action> nextActiveActions = actionRepository
|
||||||
.findAll(ActionSpecifications.byTargetIdAndIsActive(target.getId()), Sort.by(Sort.Order.asc(AbstractJpaBaseEntity_.ID)))
|
.findAll(ActionSpecifications.byTargetIdAndIsActive(target.getId()), Sort.by(Sort.Order.asc(AbstractJpaBaseEntity_.ID)))
|
||||||
.stream()
|
.stream()
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@ExpectEvents({
|
@ExpectEvents({
|
||||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2) })
|
@Expect(type = TargetUpdatedEvent.class, count = 2) })
|
||||||
void updateTargetAttributesFailsIfTooManyEntries() throws Exception {
|
void updateTargetAttributesFailsIfTooManyEntries() {
|
||||||
final String controllerId = "test123";
|
final String controllerId = "test123";
|
||||||
final int allowedAttributes = quotaManagement.getMaxAttributeEntriesPerTarget();
|
final int allowedAttributes = quotaManagement.getMaxAttributeEntriesPerTarget();
|
||||||
testdataFactory.createTarget(controllerId);
|
testdataFactory.createTarget(controllerId);
|
||||||
@@ -178,7 +178,7 @@ class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1) })
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1) })
|
||||||
void controllerProvidesIntermediateFeedbackFailsIfQuotaHit() throws Exception {
|
void controllerProvidesIntermediateFeedbackFailsIfQuotaHit() {
|
||||||
final int allowStatusEntries = 10;
|
final int allowStatusEntries = 10;
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
|
|
||||||
@@ -1154,7 +1154,7 @@ class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@ExpectEvents({
|
@ExpectEvents({
|
||||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 3) })
|
@Expect(type = TargetUpdatedEvent.class, count = 3) })
|
||||||
void updateTargetAttributes() throws Exception {
|
void updateTargetAttributes() {
|
||||||
final String controllerId = "test123";
|
final String controllerId = "test123";
|
||||||
final Target target = testdataFactory.createTarget(controllerId);
|
final Target target = testdataFactory.createTarget(controllerId);
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import jakarta.validation.ConstraintViolationException;
|
import jakarta.validation.ConstraintViolationException;
|
||||||
|
|
||||||
|
import org.assertj.core.api.Assertions;
|
||||||
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.event.remote.entity.SoftwareModuleCreatedEvent;
|
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent;
|
||||||
@@ -27,7 +28,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
|||||||
import org.eclipse.hawkbit.repository.test.matcher.Expect;
|
import org.eclipse.hawkbit.repository.test.matcher.Expect;
|
||||||
import org.eclipse.hawkbit.repository.test.matcher.ExpectEvents;
|
import org.eclipse.hawkbit.repository.test.matcher.ExpectEvents;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.data.domain.Slice;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Feature: Component Tests - Repository<br/>
|
* Feature: Component Tests - Repository<br/>
|
||||||
@@ -40,7 +40,7 @@ class SoftwareModuleTypeManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
* of Optional not present.
|
* of Optional not present.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
@ExpectEvents({ @Expect(type = SoftwareModuleCreatedEvent.class, count = 0) })
|
@ExpectEvents({ @Expect(type = SoftwareModuleCreatedEvent.class) })
|
||||||
void nonExistingEntityAccessReturnsNotPresent() {
|
void nonExistingEntityAccessReturnsNotPresent() {
|
||||||
|
|
||||||
assertThat(softwareModuleTypeManagement.get(NOT_EXIST_IDL)).isNotPresent();
|
assertThat(softwareModuleTypeManagement.get(NOT_EXIST_IDL)).isNotPresent();
|
||||||
@@ -53,7 +53,7 @@ class SoftwareModuleTypeManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
* by means of throwing EntityNotFoundException.
|
* by means of throwing EntityNotFoundException.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
@ExpectEvents({ @Expect(type = SoftwareModuleCreatedEvent.class, count = 0) })
|
@ExpectEvents({ @Expect(type = SoftwareModuleCreatedEvent.class) })
|
||||||
void entityQueriesReferringToNotExistingEntitiesThrowsException() {
|
void entityQueriesReferringToNotExistingEntitiesThrowsException() {
|
||||||
verifyThrownExceptionBy(() -> softwareModuleTypeManagement.delete(NOT_EXIST_IDL), "SoftwareModuleType");
|
verifyThrownExceptionBy(() -> softwareModuleTypeManagement.delete(NOT_EXIST_IDL), "SoftwareModuleType");
|
||||||
|
|
||||||
@@ -114,35 +114,35 @@ class SoftwareModuleTypeManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void deleteAssignedAndUnassignedSoftwareModuleTypes() {
|
void deleteAssignedAndUnassignedSoftwareModuleTypes() {
|
||||||
assertThat((Slice) softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType, runtimeType, appType);
|
Assertions.<SoftwareModuleType>assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType, runtimeType, appType);
|
||||||
|
|
||||||
SoftwareModuleType type = softwareModuleTypeManagement
|
SoftwareModuleType type = softwareModuleTypeManagement
|
||||||
.create(SoftwareModuleTypeManagement.Create.builder().key("bundle").name("OSGi Bundle").build());
|
.create(SoftwareModuleTypeManagement.Create.builder().key("bundle").name("OSGi Bundle").build());
|
||||||
|
|
||||||
assertThat((Slice) softwareModuleTypeManagement.findAll(PAGE)).hasSize(4).contains(osType, runtimeType, appType, type);
|
Assertions.<SoftwareModuleType>assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(4).contains(osType, runtimeType, appType, type);
|
||||||
|
|
||||||
// delete unassigned
|
// delete unassigned
|
||||||
softwareModuleTypeManagement.delete(type.getId());
|
softwareModuleTypeManagement.delete(type.getId());
|
||||||
assertThat((Slice) softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType, runtimeType, appType);
|
Assertions.<SoftwareModuleType>assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType, runtimeType, appType);
|
||||||
assertThat((List) softwareModuleTypeRepository.findAll()).hasSize(3).contains(osType, runtimeType, appType);
|
Assertions.<SoftwareModuleType>assertThat(softwareModuleTypeRepository.findAll()).hasSize(3).contains(osType, runtimeType, appType);
|
||||||
|
|
||||||
type = softwareModuleTypeManagement
|
type = softwareModuleTypeManagement
|
||||||
.create(SoftwareModuleTypeManagement.Create.builder().key("bundle2").name("OSGi Bundle2").build());
|
.create(SoftwareModuleTypeManagement.Create.builder().key("bundle2").name("OSGi Bundle2").build());
|
||||||
|
|
||||||
assertThat((Slice) softwareModuleTypeManagement.findAll(PAGE)).hasSize(4).contains(osType, runtimeType, appType, type);
|
Assertions.<SoftwareModuleType>assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(4).contains(osType, runtimeType, appType, type);
|
||||||
|
|
||||||
softwareModuleManagement
|
softwareModuleManagement
|
||||||
.create(SoftwareModuleManagement.Create.builder().type(type).name("Test SM").version("1.0").build());
|
.create(SoftwareModuleManagement.Create.builder().type(type).name("Test SM").version("1.0").build());
|
||||||
|
|
||||||
// delete assigned
|
// delete assigned
|
||||||
softwareModuleTypeManagement.delete(type.getId());
|
softwareModuleTypeManagement.delete(type.getId());
|
||||||
assertThat((Slice) softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType, runtimeType, appType);
|
Assertions.<SoftwareModuleType>assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType, runtimeType, appType);
|
||||||
assertThat((Slice) softwareModuleTypeManagement.findByRsql("name==*", PAGE)).hasSize(3).contains(osType, runtimeType, appType);
|
Assertions.<SoftwareModuleType>assertThat(softwareModuleTypeManagement.findByRsql("name==*", PAGE)).hasSize(3).contains(osType, runtimeType, appType);
|
||||||
assertThat(softwareModuleTypeManagement.count()).isEqualTo(3);
|
assertThat(softwareModuleTypeManagement.count()).isEqualTo(3);
|
||||||
|
|
||||||
assertThat(softwareModuleTypeRepository.findAll()).hasSize(4).contains((JpaSoftwareModuleType) osType,
|
assertThat(softwareModuleTypeRepository.findAll()).hasSize(4).contains((JpaSoftwareModuleType) osType,
|
||||||
(JpaSoftwareModuleType) runtimeType, (JpaSoftwareModuleType) appType,
|
(JpaSoftwareModuleType) runtimeType, (JpaSoftwareModuleType) appType,
|
||||||
softwareModuleTypeRepository.findById(type.getId()).get());
|
softwareModuleTypeRepository.findById(type.getId()).orElseThrow());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,8 +156,8 @@ class SoftwareModuleTypeManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
softwareModuleTypeManagement
|
softwareModuleTypeManagement
|
||||||
.create(SoftwareModuleTypeManagement.Create.builder().key("thetype2").name("anothername").build());
|
.create(SoftwareModuleTypeManagement.Create.builder().key("thetype2").name("anothername").build());
|
||||||
|
|
||||||
assertThat((((SoftwareModuleTypeManagement<SoftwareModuleType>) softwareModuleTypeManagement)).findByName("thename")).as(
|
Assertions.<SoftwareModuleType>assertThat(((SoftwareModuleTypeManagement<SoftwareModuleType>) softwareModuleTypeManagement).findByName("thename"))
|
||||||
"Type with given name").contains(found);
|
.as("Type with given name").contains(found);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -129,8 +129,7 @@ class SystemManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
assertThat(tenants).containsOnly(new TenantUsage("DEFAULT"), tenantUsage0, tenantUsage1);
|
assertThat(tenants).containsOnly(new TenantUsage("DEFAULT"), tenantUsage0, tenantUsage1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] createTestTenantsForSystemStatistics(final int tenants, final int artifactSize, final int targets,
|
private byte[] createTestTenantsForSystemStatistics(final int tenants, final int artifactSize, final int targets, final int updates) {
|
||||||
final int updates) throws Exception {
|
|
||||||
final Random randomgen = new Random();
|
final Random randomgen = new Random();
|
||||||
final byte[] random = new byte[artifactSize];
|
final byte[] random = new byte[artifactSize];
|
||||||
randomgen.nextBytes(random);
|
randomgen.nextBytes(random);
|
||||||
|
|||||||
@@ -25,32 +25,14 @@ import org.eclipse.hawkbit.repository.artifact.urlhandler.ArtifactUrlHandlerProp
|
|||||||
import org.eclipse.hawkbit.repository.artifact.urlhandler.PropertyBasedArtifactUrlHandler;
|
import org.eclipse.hawkbit.repository.artifact.urlhandler.PropertyBasedArtifactUrlHandler;
|
||||||
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
||||||
import org.eclipse.hawkbit.event.BusProtoStuffMessageConverter;
|
import org.eclipse.hawkbit.event.BusProtoStuffMessageConverter;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetInvalidationManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
|
||||||
import org.eclipse.hawkbit.repository.QuotaManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.RolloutApprovalStrategy;
|
import org.eclipse.hawkbit.repository.RolloutApprovalStrategy;
|
||||||
import org.eclipse.hawkbit.repository.RolloutHandler;
|
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.RolloutStatusCache;
|
import org.eclipse.hawkbit.repository.RolloutStatusCache;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.event.ApplicationEventFilter;
|
import org.eclipse.hawkbit.repository.event.ApplicationEventFilter;
|
||||||
import org.eclipse.hawkbit.repository.event.EventPublisherHolder;
|
import org.eclipse.hawkbit.repository.event.EventPublisherHolder;
|
||||||
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyReplacer;
|
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyReplacer;
|
||||||
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyResolver;
|
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyResolver;
|
||||||
import org.eclipse.hawkbit.repository.test.util.RolloutTestApprovalStrategy;
|
import org.eclipse.hawkbit.repository.test.util.RolloutTestApprovalStrategy;
|
||||||
import org.eclipse.hawkbit.repository.test.util.SystemManagementHolder;
|
import org.eclipse.hawkbit.repository.test.util.SystemManagementHolder;
|
||||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
|
||||||
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
||||||
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
||||||
import org.eclipse.hawkbit.security.SecurityContextSerializer;
|
import org.eclipse.hawkbit.security.SecurityContextSerializer;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.sdk;
|
package org.eclipse.hawkbit.sdk;
|
||||||
|
|
||||||
import java.security.cert.Certificate;
|
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.security.SecureRandom;
|
|||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import lombok.NoArgsConstructor;
|
|||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.AuditorAware;
|
import org.springframework.data.domain.AuditorAware;
|
||||||
import org.springframework.security.core.Authentication;
|
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
|
||||||
|
|
||||||
@NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
|
||||||
@SuppressWarnings("java:S6548") // java:S6548 - singleton holder ensures static access to spring resources in some places
|
@SuppressWarnings("java:S6548") // java:S6548 - singleton holder ensures static access to spring resources in some places
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ package org.eclipse.hawkbit.ui.simple;
|
|||||||
import com.vaadin.flow.component.page.AppShellConfigurator;
|
import com.vaadin.flow.component.page.AppShellConfigurator;
|
||||||
import com.vaadin.flow.server.PWA;
|
import com.vaadin.flow.server.PWA;
|
||||||
import com.vaadin.flow.theme.Theme;
|
import com.vaadin.flow.theme.Theme;
|
||||||
import com.vaadin.flow.theme.lumo.Lumo;
|
|
||||||
import feign.Contract;
|
import feign.Contract;
|
||||||
import feign.RequestInterceptor;
|
import feign.RequestInterceptor;
|
||||||
import feign.codec.Decoder;
|
import feign.codec.Decoder;
|
||||||
@@ -57,7 +56,7 @@ import static java.util.Collections.emptyList;
|
|||||||
@Import(FeignClientsConfiguration.class)
|
@Import(FeignClientsConfiguration.class)
|
||||||
public class SimpleUIApp implements AppShellConfigurator {
|
public class SimpleUIApp implements AppShellConfigurator {
|
||||||
|
|
||||||
private static final Function<OAuth2TokenManager, RequestInterceptor> AUTHORIZATION = (oAuth2TokenManager) -> requestTemplate -> {
|
private static final Function<OAuth2TokenManager, RequestInterceptor> AUTHORIZATION = oAuth2TokenManager -> requestTemplate -> {
|
||||||
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
if (oAuth2TokenManager != null && authentication instanceof OAuth2AuthenticationToken oAuth2AuthenticationToken) {
|
if (oAuth2TokenManager != null && authentication instanceof OAuth2AuthenticationToken oAuth2AuthenticationToken) {
|
||||||
String bearerToken = oAuth2TokenManager.getToken(oAuth2AuthenticationToken);
|
String bearerToken = oAuth2TokenManager.getToken(oAuth2AuthenticationToken);
|
||||||
@@ -109,7 +108,7 @@ public class SimpleUIApp implements AppShellConfigurator {
|
|||||||
@Bean
|
@Bean
|
||||||
OAuth2UserService<OidcUserRequest, OidcUser> oidcUserService(final HawkbitMgmtClient hawkbitClient) {
|
OAuth2UserService<OidcUserRequest, OidcUser> oidcUserService(final HawkbitMgmtClient hawkbitClient) {
|
||||||
final OidcUserService delegate = new OidcUserService();
|
final OidcUserService delegate = new OidcUserService();
|
||||||
return (userRequest) -> {
|
return userRequest -> {
|
||||||
OidcUser oidcUser = delegate.loadUser(userRequest);
|
OidcUser oidcUser = delegate.loadUser(userRequest);
|
||||||
|
|
||||||
final OAuth2AuthenticationToken tempToken = new OAuth2AuthenticationToken(
|
final OAuth2AuthenticationToken tempToken = new OAuth2AuthenticationToken(
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ public class VaadinServiceInit implements VaadinServiceInitListener {
|
|||||||
@Override
|
@Override
|
||||||
public void serviceInit(ServiceInitEvent event) {
|
public void serviceInit(ServiceInitEvent event) {
|
||||||
// cache zoneId of client as soon as possible
|
// cache zoneId of client as soon as possible
|
||||||
event.getSource().addUIInitListener(uiEvent -> {
|
event.getSource().addUIInitListener(uiEvent ->
|
||||||
uiEvent.getUI().getPage().retrieveExtendedClientDetails(details -> {});
|
uiEvent.getUI().getPage().retrieveExtendedClientDetails(details -> {}));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,16 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
public static final String FILTER = "Filter";
|
public static final String FILTER = "Filter";
|
||||||
public static final String TAG = "Tag";
|
public static final String TAG = "Tag";
|
||||||
|
|
||||||
|
public static final String GREEN = "green";
|
||||||
|
public static final String RED = "red";
|
||||||
|
public static final String ORANGE = "orange";
|
||||||
|
public static final String GRAY = "gray";
|
||||||
|
public static final String BROWN = "brown";
|
||||||
|
public static final String TEAL = "teal";
|
||||||
|
public static final String PURPLE = "purple";
|
||||||
|
public static final String CORAL = "coral";
|
||||||
|
public static final String BLACK = "black";
|
||||||
|
|
||||||
public TargetView(final HawkbitMgmtClient hawkbitClient) {
|
public TargetView(final HawkbitMgmtClient hawkbitClient) {
|
||||||
super(
|
super(
|
||||||
new RawFilter(hawkbitClient), new SimpleFilter(hawkbitClient),
|
new RawFilter(hawkbitClient), new SimpleFilter(hawkbitClient),
|
||||||
@@ -650,19 +660,17 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
final Icon icon;
|
final Icon icon;
|
||||||
|
|
||||||
switch (status.getType()) {
|
switch (status.getType()) {
|
||||||
case FINISHED -> icon = Utils.iconColored(VaadinIcon.CHECK_CIRCLE, "Finished", "green");
|
case FINISHED -> icon = Utils.iconColored(VaadinIcon.CHECK_CIRCLE, "Finished", GREEN);
|
||||||
case ERROR -> icon = Utils.iconColored(VaadinIcon.CLOSE_CIRCLE, "Error", "red");
|
case ERROR -> icon = Utils.iconColored(VaadinIcon.CLOSE_CIRCLE, "Error", RED);
|
||||||
case WARNING -> icon = Utils.iconColored(VaadinIcon.WARNING, "Warning", "orange");
|
case WARNING -> icon = Utils.iconColored(VaadinIcon.WARNING, "Warning", ORANGE);
|
||||||
case RUNNING -> icon = Utils.iconColored(VaadinIcon.ADJUST, "Running", "green");
|
case RUNNING -> icon = Utils.iconColored(VaadinIcon.ADJUST, "Running", GREEN);
|
||||||
case RETRIEVED -> icon = Utils.iconColored(VaadinIcon.CIRCLE_THIN, "Retrieved", "green");
|
case RETRIEVED -> icon = Utils.iconColored(VaadinIcon.CIRCLE_THIN, "Retrieved", GREEN);
|
||||||
case CANCELED -> icon = Utils.iconColored(VaadinIcon.CLOSE_CIRCLE_O, "Canceled", "gray");
|
case CANCELED -> icon = Utils.iconColored(VaadinIcon.CLOSE_CIRCLE_O, "Canceled", GRAY);
|
||||||
case CANCELING -> icon = Utils.iconColored(VaadinIcon.CLOSE_CIRCLE, "Cancelling", "brown");
|
case CANCELING -> icon = Utils.iconColored(VaadinIcon.CLOSE_CIRCLE, "Cancelling", BROWN);
|
||||||
case DOWNLOAD -> icon = Utils.iconColored(VaadinIcon.CLOUD_DOWNLOAD_O, "Download", "teal");
|
case DOWNLOAD -> icon = Utils.iconColored(VaadinIcon.CLOUD_DOWNLOAD_O, "Download", TEAL);
|
||||||
case DOWNLOADED -> icon = Utils.iconColored(VaadinIcon.CLOUD_DOWNLOAD, "Downloaded", "purple");
|
case DOWNLOADED -> icon = Utils.iconColored(VaadinIcon.CLOUD_DOWNLOAD, "Downloaded", PURPLE);
|
||||||
case WAIT_FOR_CONFIRMATION ->
|
case WAIT_FOR_CONFIRMATION -> icon = Utils.iconColored(VaadinIcon.QUESTION_CIRCLE, "Wait for confirmation", CORAL);
|
||||||
icon = Utils.iconColored(VaadinIcon.QUESTION_CIRCLE, "Wait for confirmation", "coral");
|
default -> icon = Utils.iconColored(VaadinIcon.CIRCLE_THIN, status.getType().getName().toLowerCase(), BLACK);
|
||||||
default -> icon = Utils.iconColored(VaadinIcon.CIRCLE_THIN, status.getType().getName().toLowerCase(),
|
|
||||||
"black");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
icon.addClassNames(LumoUtility.IconSize.SMALL);
|
icon.addClassNames(LumoUtility.IconSize.SMALL);
|
||||||
@@ -910,9 +918,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
final String color = switch (targetUpdateStatus) {
|
final String color = switch (targetUpdateStatus) {
|
||||||
case "error" -> "red";
|
case "error" -> RED;
|
||||||
case "in_sync" -> "green";
|
case "in_sync" -> GREEN;
|
||||||
case "pending" -> "orange";
|
case "pending" -> ORANGE;
|
||||||
case "registered" -> "lightblue";
|
case "registered" -> "lightblue";
|
||||||
default -> "blue";
|
default -> "blue";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class TableView<T, ID> extends Div implements Constants, BeforeEnterObser
|
|||||||
}
|
}
|
||||||
|
|
||||||
filter = new Filter(
|
filter = new Filter(
|
||||||
(rsqlFilter) -> {
|
rsqlFilter -> {
|
||||||
closeDetailsPanel();
|
closeDetailsPanel();
|
||||||
if (rsqlFilter != null) {
|
if (rsqlFilter != null) {
|
||||||
var queryParameters = UI.getCurrent().getActiveViewLocation()
|
var queryParameters = UI.getCurrent().getActiveViewLocation()
|
||||||
|
|||||||
@@ -261,9 +261,7 @@ public class Utils {
|
|||||||
|
|
||||||
private static ZoneId getZoneId() {
|
private static ZoneId getZoneId() {
|
||||||
CompletableFuture<ZoneId> zoneId = new CompletableFuture<>();
|
CompletableFuture<ZoneId> zoneId = new CompletableFuture<>();
|
||||||
UI.getCurrent().getPage().retrieveExtendedClientDetails(details -> {
|
UI.getCurrent().getPage().retrieveExtendedClientDetails(details -> zoneId.complete(ZoneId.of(details.getTimeZoneId())));
|
||||||
zoneId.complete(ZoneId.of(details.getTimeZoneId()));
|
|
||||||
});
|
|
||||||
try {
|
try {
|
||||||
return zoneId.get(1, TimeUnit.SECONDS);
|
return zoneId.get(1, TimeUnit.SECONDS);
|
||||||
} catch (final InterruptedException e) {
|
} catch (final InterruptedException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user