Fix some compile warnings (#2919)
* Fix some compile warnings * Some classes made final * JPA entities made not serializable Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.artifact.exception;
|
package org.eclipse.hawkbit.artifact.exception;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||||
@@ -21,6 +23,9 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
|||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class FileSizeQuotaExceededException extends AbstractServerRtException {
|
public class FileSizeQuotaExceededException extends AbstractServerRtException {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final String MAX_ARTIFACT_SIZE_EXCEEDED = "Maximum artifact size (%s) exceeded.";
|
private static final String MAX_ARTIFACT_SIZE_EXCEEDED = "Maximum artifact size (%s) exceeded.";
|
||||||
private static final SpServerError errorType = SpServerError.SP_FILE_SIZE_QUOTA_EXCEEDED;
|
private static final SpServerError errorType = SpServerError.SP_FILE_SIZE_QUOTA_EXCEEDED;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.artifact.exception;
|
package org.eclipse.hawkbit.artifact.exception;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||||
@@ -21,6 +23,9 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
|||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class StorageQuotaExceededException extends AbstractServerRtException {
|
public class StorageQuotaExceededException extends AbstractServerRtException {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final String MAX_ARTIFACT_SIZE_TOTAL_EXCEEDED = "Storage quota exceeded, %s left.";
|
private static final String MAX_ARTIFACT_SIZE_TOTAL_EXCEEDED = "Storage quota exceeded, %s left.";
|
||||||
private static final SpServerError errorType = SpServerError.SP_STORAGE_QUOTA_EXCEEDED;
|
private static final SpServerError errorType = SpServerError.SP_STORAGE_QUOTA_EXCEEDED;
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.security.controller;
|
|||||||
|
|
||||||
import static org.eclipse.hawkbit.context.AccessContext.asTenant;
|
import static org.eclipse.hawkbit.context.AccessContext.asTenant;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -61,6 +62,9 @@ public interface Authenticator {
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
private static class AuthenticatedController extends AbstractAuthenticationToken {
|
private static class AuthenticatedController extends AbstractAuthenticationToken {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final Collection<GrantedAuthority> CONTROLLER_AUTHORITY =
|
private static final Collection<GrantedAuthority> CONTROLLER_AUTHORITY =
|
||||||
List.of(new SimpleGrantedAuthority(SpRole.CONTROLLER_ROLE));
|
List.of(new SimpleGrantedAuthority(SpRole.CONTROLLER_ROLE));
|
||||||
private final String controllerId;
|
private final String controllerId;
|
||||||
|
|||||||
@@ -16,19 +16,13 @@ import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
|
|||||||
import org.springframework.util.ErrorHandler;
|
import org.springframework.util.ErrorHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link RabbitListenerContainerFactory} that can be configured through
|
* {@link RabbitListenerContainerFactory} that can be configured through hawkBit's {@link AmqpProperties}.
|
||||||
* hawkBit's {@link AmqpProperties}.
|
|
||||||
*/
|
*/
|
||||||
public class ConfigurableRabbitListenerContainerFactory extends SimpleRabbitListenerContainerFactory {
|
public final class ConfigurableRabbitListenerContainerFactory extends SimpleRabbitListenerContainerFactory {
|
||||||
|
|
||||||
private final int declarationRetries;
|
private final int declarationRetries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param missingQueuesFatal the missingQueuesFatal to set.
|
|
||||||
* @param declarationRetries The number of retries
|
|
||||||
* @param errorHandler the error handler which should be use
|
|
||||||
* @see SimpleMessageListenerContainer#setMissingQueuesFatal
|
* @see SimpleMessageListenerContainer#setMissingQueuesFatal
|
||||||
*/
|
*/
|
||||||
public ConfigurableRabbitListenerContainerFactory(
|
public ConfigurableRabbitListenerContainerFactory(
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import org.springframework.util.ObjectUtils;
|
|||||||
*/
|
*/
|
||||||
@ToString
|
@ToString
|
||||||
@Slf4j
|
@Slf4j
|
||||||
class RequeueExceptionStrategy implements FatalExceptionStrategy {
|
final class RequeueExceptionStrategy implements FatalExceptionStrategy {
|
||||||
|
|
||||||
private final List<FatalExceptionStrategy> fatalExceptionStrategies = new ArrayList<>();
|
private final List<FatalExceptionStrategy> fatalExceptionStrategies = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import org.eclipse.hawkbit.repository.model.Action;
|
|||||||
import org.eclipse.hawkbit.repository.model.ActionProperties;
|
import org.eclipse.hawkbit.repository.model.ActionProperties;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
@@ -427,8 +426,8 @@ class AmqpMessageHandlerServiceTest {
|
|||||||
* Test next update is provided on finished action
|
* Test next update is provided on finished action
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
void lookupNextUpdateActionAfterFinished() {
|
void lookupNextUpdateActionAfterFinished() {
|
||||||
|
|
||||||
// Mock
|
// Mock
|
||||||
final Action action = createActionWithTarget(22L);
|
final Action action = createActionWithTarget(22L);
|
||||||
when(controllerManagementMock.findActionWithDetails(anyLong())).thenReturn(Optional.of(action));
|
when(controllerManagementMock.findActionWithDetails(anyLong())).thenReturn(Optional.of(action));
|
||||||
@@ -460,7 +459,7 @@ class AmqpMessageHandlerServiceTest {
|
|||||||
* Test feedback code is persisted in messages when provided with DmfActionUpdateStatus
|
* Test feedback code is persisted in messages when provided with DmfActionUpdateStatus
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void feedBackCodeIsPersistedInMessages() throws IllegalAccessException {
|
void feedBackCodeIsPersistedInMessages() {
|
||||||
// Mock
|
// Mock
|
||||||
final Action action = createActionWithTarget(22L);
|
final Action action = createActionWithTarget(22L);
|
||||||
when(controllerManagementMock.findActionWithDetails(anyLong())).thenReturn(Optional.of(action));
|
when(controllerManagementMock.findActionWithDetails(anyLong())).thenReturn(Optional.of(action));
|
||||||
@@ -471,9 +470,7 @@ class AmqpMessageHandlerServiceTest {
|
|||||||
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
|
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
|
||||||
messageProperties.setHeader(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
|
messageProperties.setHeader(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
|
||||||
|
|
||||||
final DmfActionUpdateStatus actionUpdateStatus = new DmfActionUpdateStatus(
|
final DmfActionUpdateStatus actionUpdateStatus = new DmfActionUpdateStatus(23L, DmfActionStatus.RUNNING, null, 2L, null, 12);
|
||||||
23L, DmfActionStatus.RUNNING, null, 2L, null, 12);
|
|
||||||
|
|
||||||
final Message message = createMessage(actionUpdateStatus, messageProperties);
|
final Message message = createMessage(actionUpdateStatus, messageProperties);
|
||||||
|
|
||||||
// test
|
// test
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
private static final String DMF_ATTR_TEST_CONTROLLER_ID = "Dmf_hand_updateAttributes";
|
private static final String DMF_ATTR_TEST_CONTROLLER_ID = "Dmf_hand_updateAttributes";
|
||||||
private static final String UPDATE_ATTR_TEST_CONTROLLER_ID = "ControllerAttributeTestTarget";
|
private static final String UPDATE_ATTR_TEST_CONTROLLER_ID = "ControllerAttributeTestTarget";
|
||||||
private static final String TARGET_PREFIX = "Dmf_hand_";
|
private static final String TARGET_PREFIX = "Dmf_hand_";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AmqpProperties amqpProperties;
|
private AmqpProperties amqpProperties;
|
||||||
|
|
||||||
@@ -133,11 +133,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
void registerTargetWithName() {
|
void registerTargetWithName() {
|
||||||
final String controllerId = TARGET_PREFIX + "registerTargetWithName";
|
final String controllerId = TARGET_PREFIX + "registerTargetWithName";
|
||||||
final String name = "NonDefaultTargetName";
|
final String name = "NonDefaultTargetName";
|
||||||
registerAndAssertTargetWithExistingTenant(controllerId, name, 1, TargetUpdateStatus.REGISTERED, CREATED_BY,
|
registerAndAssertTargetWithExistingTenant(controllerId, name, 1, TargetUpdateStatus.REGISTERED, CREATED_BY, null);
|
||||||
null);
|
registerSameTargetAndAssertBasedOnVersion(controllerId, name + "_updated", 1, TargetUpdateStatus.REGISTERED, null);
|
||||||
|
|
||||||
registerSameTargetAndAssertBasedOnVersion(controllerId, name + "_updated", 1, TargetUpdateStatus.REGISTERED,
|
|
||||||
null);
|
|
||||||
|
|
||||||
Mockito.verifyNoInteractions(getDeadletterListener());
|
Mockito.verifyNoInteractions(getDeadletterListener());
|
||||||
}
|
}
|
||||||
@@ -156,8 +153,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
attributes.put("testKey1", "testValue1");
|
attributes.put("testKey1", "testValue1");
|
||||||
attributes.put("testKey2", "testValue2");
|
attributes.put("testKey2", "testValue2");
|
||||||
|
|
||||||
registerAndAssertTargetWithExistingTenant(controllerId, null, 1, TargetUpdateStatus.REGISTERED, CREATED_BY,
|
registerAndAssertTargetWithExistingTenant(controllerId, null, 1, TargetUpdateStatus.REGISTERED, CREATED_BY, attributes);
|
||||||
attributes);
|
|
||||||
|
|
||||||
attributes.put("testKey3", "testValue3");
|
attributes.put("testKey3", "testValue3");
|
||||||
registerSameTargetAndAssertBasedOnVersion(controllerId, null, 1, TargetUpdateStatus.REGISTERED, attributes);
|
registerSameTargetAndAssertBasedOnVersion(controllerId, null, 1, TargetUpdateStatus.REGISTERED, attributes);
|
||||||
@@ -176,24 +172,22 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
void registerTargetWithNameAndAttributes() {
|
void registerTargetWithNameAndAttributes() {
|
||||||
final String controllerId = TARGET_PREFIX + "registerTargetWithAttributes";
|
final String controllerId = TARGET_PREFIX + "registerTargetWithAttributes";
|
||||||
final String name = "NonDefaultTargetName";
|
final String name = "NonDefaultTargetName";
|
||||||
|
|
||||||
final Map<String, String> attributes = new HashMap<>();
|
final Map<String, String> attributes = new HashMap<>();
|
||||||
attributes.put("testKey1", "testValue1");
|
attributes.put("testKey1", "testValue1");
|
||||||
attributes.put("testKey2", "testValue2");
|
attributes.put("testKey2", "testValue2");
|
||||||
|
registerAndAssertTargetWithExistingTenant(controllerId, name, 1, TargetUpdateStatus.REGISTERED, CREATED_BY, attributes);
|
||||||
registerAndAssertTargetWithExistingTenant(controllerId, name, 1, TargetUpdateStatus.REGISTERED, CREATED_BY,
|
|
||||||
attributes);
|
|
||||||
|
|
||||||
attributes.put("testKey3", "testValue3");
|
attributes.put("testKey3", "testValue3");
|
||||||
registerSameTargetAndAssertBasedOnVersion(controllerId, name + "_updated", 1, TargetUpdateStatus.REGISTERED,
|
registerSameTargetAndAssertBasedOnVersion(controllerId, name + "_updated", 1, TargetUpdateStatus.REGISTERED, attributes);
|
||||||
attributes);
|
|
||||||
|
|
||||||
Mockito.verifyNoInteractions(getDeadletterListener());
|
Mockito.verifyNoInteractions(getDeadletterListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
|
||||||
/**
|
/**
|
||||||
* Tests register invalid target with empty controller id.
|
* Tests register invalid target with empty controller id.
|
||||||
*/
|
*/
|
||||||
|
@ParameterizedTest
|
||||||
@ValueSource(strings = { "", "Invalid Invalid" })
|
@ValueSource(strings = { "", "Invalid Invalid" })
|
||||||
@NullSource
|
@NullSource
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
|
||||||
@@ -328,10 +322,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
assertAllTargetsCount(0);
|
assertAllTargetsCount(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
|
||||||
/**
|
/**
|
||||||
* Tests null type message header. This message should forwarded to the deadletter queue
|
* Tests null type message header. This message should forwarded to the deadletter queue
|
||||||
*/
|
*/
|
||||||
|
@ParameterizedTest
|
||||||
@ValueSource(strings = { "", "NotExist" })
|
@ValueSource(strings = { "", "NotExist" })
|
||||||
@NullSource
|
@NullSource
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
|
||||||
@@ -344,10 +338,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
assertAllTargetsCount(0);
|
assertAllTargetsCount(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
|
||||||
/**
|
/**
|
||||||
* Tests null topic message header. This message should forwarded to the deadletter queue
|
* Tests null topic message header. This message should forwarded to the deadletter queue
|
||||||
*/
|
*/
|
||||||
|
@ParameterizedTest
|
||||||
@ValueSource(strings = { "", "NotExist" })
|
@ValueSource(strings = { "", "NotExist" })
|
||||||
@NullSource
|
@NullSource
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
|
||||||
@@ -372,10 +366,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
verifyOneDeadLetterMessage();
|
verifyOneDeadLetterMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
|
||||||
/**
|
/**
|
||||||
* Tests invalid null message content. This message should forwarded to the deadletter queue
|
* Tests invalid null message content. This message should forwarded to the deadletter queue
|
||||||
*/
|
*/
|
||||||
|
@ParameterizedTest
|
||||||
@ValueSource(strings = { "", "Invalid Content" })
|
@ValueSource(strings = { "", "Invalid Content" })
|
||||||
@NullSource
|
@NullSource
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
|
||||||
@@ -431,7 +425,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
void runningActionStatus() {
|
void runningActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "runningActionStatus";
|
final String controllerId = TARGET_PREFIX + "runningActionStatus";
|
||||||
@@ -451,7 +445,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
void downloadedActionStatus() {
|
void downloadedActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "downloadedActionStatus";
|
final String controllerId = TARGET_PREFIX + "downloadedActionStatus";
|
||||||
@@ -470,7 +464,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
void downloadActionStatus() {
|
void downloadActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "downloadActionStatus";
|
final String controllerId = TARGET_PREFIX + "downloadActionStatus";
|
||||||
@@ -490,7 +484,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
void errorActionStatus() {
|
void errorActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "errorActionStatus";
|
final String controllerId = TARGET_PREFIX + "errorActionStatus";
|
||||||
@@ -509,7 +503,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
void warningActionStatus() {
|
void warningActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "warningActionStatus";
|
final String controllerId = TARGET_PREFIX + "warningActionStatus";
|
||||||
@@ -528,7 +522,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
void retrievedActionStatus() {
|
void retrievedActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "retrievedActionStatus";
|
final String controllerId = TARGET_PREFIX + "retrievedActionStatus";
|
||||||
@@ -547,7 +541,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
void cancelNotAllowActionStatus() {
|
void cancelNotAllowActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "cancelNotAllowActionStatus";
|
final String controllerId = TARGET_PREFIX + "cancelNotAllowActionStatus";
|
||||||
@@ -567,7 +561,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetPollEvent.class, count = 2) })
|
||||||
void receiveDownloadAndInstallMessageAfterAssignment() {
|
void receiveDownloadAndInstallMessageAfterAssignment() {
|
||||||
final String controllerId = TARGET_PREFIX + "receiveDownLoadAndInstallMessageAfterAssignment";
|
final String controllerId = TARGET_PREFIX + "receiveDownLoadAndInstallMessageAfterAssignment";
|
||||||
@@ -598,7 +592,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetPollEvent.class, count = 2) })
|
||||||
void receiveDownloadMessageBeforeMaintenanceWindowStartTime() {
|
void receiveDownloadMessageBeforeMaintenanceWindowStartTime() {
|
||||||
final String controllerId = TARGET_PREFIX + "receiveDownLoadMessageBeforeMaintenanceWindowStartTime";
|
final String controllerId = TARGET_PREFIX + "receiveDownLoadMessageBeforeMaintenanceWindowStartTime";
|
||||||
@@ -607,8 +601,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
registerAndAssertTargetWithExistingTenant(controllerId);
|
registerAndAssertTargetWithExistingTenant(controllerId);
|
||||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
final DistributionSet distributionSet = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
||||||
testdataFactory.addSoftwareModuleMetadata(distributionSet);
|
testdataFactory.addSoftwareModuleMetadata(distributionSet);
|
||||||
assignDistributionSetWithMaintenanceWindow(distributionSet.getId(), controllerId, getTestSchedule(2),
|
assignDistributionSetWithMaintenanceWindow(
|
||||||
getTestDuration(1), getTestTimeZone());
|
distributionSet.getId(), controllerId, getTestSchedule(2), getTestDuration(1), getTestTimeZone());
|
||||||
|
|
||||||
// test
|
// test
|
||||||
registerSameTargetAndAssertBasedOnVersion(controllerId, 1, TargetUpdateStatus.PENDING);
|
registerSameTargetAndAssertBasedOnVersion(controllerId, 1, TargetUpdateStatus.PENDING);
|
||||||
@@ -630,7 +624,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetPollEvent.class, count = 2) })
|
||||||
void receiveDownloadAndInstallMessageDuringMaintenanceWindow() {
|
void receiveDownloadAndInstallMessageDuringMaintenanceWindow() {
|
||||||
final String controllerId = TARGET_PREFIX + "receiveDownLoadAndInstallMessageDuringMaintenanceWindow";
|
final String controllerId = TARGET_PREFIX + "receiveDownLoadAndInstallMessageDuringMaintenanceWindow";
|
||||||
@@ -639,8 +633,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
registerAndAssertTargetWithExistingTenant(controllerId);
|
registerAndAssertTargetWithExistingTenant(controllerId);
|
||||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
final DistributionSet distributionSet = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
||||||
testdataFactory.addSoftwareModuleMetadata(distributionSet);
|
testdataFactory.addSoftwareModuleMetadata(distributionSet);
|
||||||
assignDistributionSetWithMaintenanceWindow(distributionSet.getId(), controllerId, getTestSchedule(-5),
|
assignDistributionSetWithMaintenanceWindow(
|
||||||
getTestDuration(10), getTestTimeZone());
|
distributionSet.getId(), controllerId, getTestSchedule(-5), getTestDuration(10), getTestTimeZone());
|
||||||
|
|
||||||
// test
|
// test
|
||||||
registerSameTargetAndAssertBasedOnVersion(controllerId, 1, TargetUpdateStatus.PENDING);
|
registerSameTargetAndAssertBasedOnVersion(controllerId, 1, TargetUpdateStatus.PENDING);
|
||||||
@@ -722,7 +716,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
void canceledRejectedNotAllowActionStatus() {
|
void canceledRejectedNotAllowActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "canceledRejectedNotAllowActionStatus";
|
final String controllerId = TARGET_PREFIX + "canceledRejectedNotAllowActionStatus";
|
||||||
@@ -744,7 +738,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
@Expect(type = DistributionSetUpdatedEvent.class, count = 1), // implicit lock
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 9), // implicit lock
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
void canceledRejectedActionStatus() {
|
void canceledRejectedActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "canceledRejectedActionStatus";
|
final String controllerId = TARGET_PREFIX + "canceledRejectedActionStatus";
|
||||||
@@ -770,22 +764,16 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
void updateAttributesWithDifferentUpdateModes() {
|
void updateAttributesWithDifferentUpdateModes() {
|
||||||
final String controllerId = TARGET_PREFIX + "updateAttributes";
|
final String controllerId = TARGET_PREFIX + "updateAttributes";
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
registerAndAssertTargetWithExistingTenant(controllerId);
|
registerAndAssertTargetWithExistingTenant(controllerId);
|
||||||
|
|
||||||
// no update mode specified
|
// no update mode specified
|
||||||
updateAttributesWithoutUpdateMode();
|
updateAttributesWithoutUpdateMode();
|
||||||
|
|
||||||
// update mode REPLACE
|
// update mode REPLACE
|
||||||
updateAttributesWithUpdateModeReplace();
|
updateAttributesWithUpdateModeReplace();
|
||||||
|
|
||||||
// update mode MERGE
|
// update mode MERGE
|
||||||
updateAttributesWithUpdateModeMerge();
|
updateAttributesWithUpdateModeMerge();
|
||||||
|
|
||||||
// update mode REMOVE
|
// update mode REMOVE
|
||||||
updateAttributesWithUpdateModeRemove();
|
updateAttributesWithUpdateModeRemove();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -827,7 +815,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
void updateAttributesWithWrongBody() {
|
void updateAttributesWithWrongBody() {
|
||||||
// setup
|
// setup
|
||||||
registerAndAssertTargetWithExistingTenant(UPDATE_ATTR_TEST_CONTROLLER_ID);
|
registerAndAssertTargetWithExistingTenant(UPDATE_ATTR_TEST_CONTROLLER_ID);
|
||||||
final Message createUpdateAttributesMessageWrongBody = createUpdateAttributesMessageWrongBody( UPDATE_ATTR_TEST_CONTROLLER_ID);
|
final Message createUpdateAttributesMessageWrongBody = createUpdateAttributesMessageWrongBody(UPDATE_ATTR_TEST_CONTROLLER_ID);
|
||||||
|
|
||||||
// test
|
// test
|
||||||
getDmfClient().send(createUpdateAttributesMessageWrongBody);
|
getDmfClient().send(createUpdateAttributesMessageWrongBody);
|
||||||
@@ -902,8 +890,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 2),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 3),
|
@Expect(type = TargetUpdatedEvent.class, count = 3),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
void downloadOnlyAssignmentAllowsActionStatusUpdatesWhenTargetReportsFinishedAndUpdatesInstalledDS()
|
void downloadOnlyAssignmentAllowsActionStatusUpdatesWhenTargetReportsFinishedAndUpdatesInstalledDS() throws IOException {
|
||||||
throws IOException {
|
|
||||||
// create target
|
// create target
|
||||||
final String controllerId = TARGET_PREFIX + "registerTargets_1";
|
final String controllerId = TARGET_PREFIX + "registerTargets_1";
|
||||||
final DistributionSet distributionSet = createTargetAndDistributionSetAndAssign(controllerId, DOWNLOAD_ONLY);
|
final DistributionSet distributionSet = createTargetAndDistributionSetAndAssign(controllerId, DOWNLOAD_ONLY);
|
||||||
@@ -1125,10 +1112,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateAttributesWithUpdateModeRemove() {
|
private void updateAttributesWithUpdateModeRemove() {
|
||||||
|
|
||||||
// assemble the expected attributes
|
// assemble the expected attributes
|
||||||
final Map<String, String> expectedAttributes = targetManagement
|
final Map<String, String> expectedAttributes = targetManagement.getControllerAttributes(DMF_ATTR_TEST_CONTROLLER_ID);
|
||||||
.getControllerAttributes(DMF_ATTR_TEST_CONTROLLER_ID);
|
|
||||||
expectedAttributes.remove("k1");
|
expectedAttributes.remove("k1");
|
||||||
expectedAttributes.remove("k3");
|
expectedAttributes.remove("k3");
|
||||||
|
|
||||||
@@ -1256,8 +1241,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendUpdateAttributeMessage(final DmfAttributeUpdate attributeUpdate) {
|
private void sendUpdateAttributeMessage(final DmfAttributeUpdate attributeUpdate) {
|
||||||
final Message updateMessage = createUpdateAttributesMessage(DMF_ATTR_TEST_CONTROLLER_ID,
|
final Message updateMessage = createUpdateAttributesMessage(DMF_ATTR_TEST_CONTROLLER_ID, TENANT_EXIST, attributeUpdate);
|
||||||
AbstractAmqpServiceIntegrationTest.TENANT_EXIST, attributeUpdate);
|
|
||||||
getDmfClient().send(updateMessage);
|
getDmfClient().send(updateMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1266,8 +1250,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
await().untilAsserted(() -> {
|
await().untilAsserted(() -> {
|
||||||
try {
|
try {
|
||||||
SecurityContextSwitch.asPrivileged(() -> {
|
SecurityContextSwitch.asPrivileged(() -> {
|
||||||
final List<ActionStatus> actionStatusList = deploymentManagement
|
final List<ActionStatus> actionStatusList = deploymentManagement.findActionStatusByAction(actionId, PAGE).getContent();
|
||||||
.findActionStatusByAction(actionId, PAGE).getContent();
|
|
||||||
assertThat(actionStatusList).hasSize(statusListCount);
|
assertThat(actionStatusList).hasSize(statusListCount);
|
||||||
|
|
||||||
final List<Status> status = actionStatusList.stream().map(ActionStatus::getStatus)
|
final List<Status> status = actionStatusList.stream().map(ActionStatus::getStatus)
|
||||||
@@ -1283,9 +1266,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getAuthenticationMessageCount() {
|
private int getAuthenticationMessageCount() {
|
||||||
return Integer
|
return Integer.parseInt(Objects.requireNonNull(
|
||||||
.parseInt(Objects.requireNonNull(getRabbitAdmin().getQueueProperties(amqpProperties.getReceiverQueue()))
|
getRabbitAdmin().getQueueProperties(amqpProperties.getReceiverQueue())).get(RabbitAdmin.QUEUE_MESSAGE_COUNT).toString());
|
||||||
.get(RabbitAdmin.QUEUE_MESSAGE_COUNT).toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertEmptyReceiverQueueCount() {
|
private void assertEmptyReceiverQueueCount() {
|
||||||
@@ -1298,8 +1280,7 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
|
|||||||
|
|
||||||
private void verifyNumberOfDeadLetterMessages(final int numberOfInvocations) {
|
private void verifyNumberOfDeadLetterMessages(final int numberOfInvocations) {
|
||||||
assertEmptyReceiverQueueCount();
|
assertEmptyReceiverQueueCount();
|
||||||
await().untilAsserted(
|
await().untilAsserted(() -> Mockito.verify(getDeadletterListener(), Mockito.times(numberOfInvocations)).handleMessage(Mockito.any()));
|
||||||
() -> Mockito.verify(getDeadletterListener(), Mockito.times(numberOfInvocations)).handleMessage(Mockito.any()));
|
|
||||||
Mockito.reset(getDeadletterListener());
|
Mockito.reset(getDeadletterListener());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,11 +54,6 @@
|
|||||||
<artifactId>http-client</artifactId>
|
<artifactId>http-client</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.amqp</groupId>
|
<groupId>org.springframework.amqp</groupId>
|
||||||
<artifactId>spring-rabbit-test</artifactId>
|
<artifactId>spring-rabbit-test</artifactId>
|
||||||
|
|||||||
@@ -61,12 +61,6 @@
|
|||||||
<artifactId>spring-ai-mcp-annotations</artifactId>
|
<artifactId>spring-ai-mcp-annotations</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
|
||||||
<optional>true</optional>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||||
<artifactId>caffeine</artifactId>
|
<artifactId>caffeine</artifactId>
|
||||||
|
|||||||
@@ -9,8 +9,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mcp.server.client;
|
package org.eclipse.hawkbit.mcp.server.client;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
public class McpAuthenticationException extends RuntimeException {
|
public class McpAuthenticationException extends RuntimeException {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public McpAuthenticationException(String message) {
|
public McpAuthenticationException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import org.springframework.hateoas.RepresentationModel;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}""")
|
}""")
|
||||||
public class MgmtActionId extends RepresentationModel<MgmtActionId> {
|
public final class MgmtActionId extends RepresentationModel<MgmtActionId> {
|
||||||
|
|
||||||
@Schema(description = "ID of the action")
|
@Schema(description = "ID of the action")
|
||||||
private long id;
|
private long id;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import lombok.NoArgsConstructor;
|
|||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@JsonDeserialize(using = MgmtDistributionSetAssignmentsDeserializer.class)
|
@JsonDeserialize(using = MgmtDistributionSetAssignmentsDeserializer.class)
|
||||||
public class MgmtDistributionSetAssignments extends ArrayList<MgmtDistributionSetAssignment> {
|
public final class MgmtDistributionSetAssignments extends ArrayList<MgmtDistributionSetAssignment> {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -39,16 +39,6 @@ public class MgmtDistributionSetAssignments extends ArrayList<MgmtDistributionSe
|
|||||||
add(assignment);
|
add(assignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for an object that contains multiple distribution set
|
|
||||||
* assignments
|
|
||||||
*
|
|
||||||
* @param assignments the assignments
|
|
||||||
*/
|
|
||||||
public MgmtDistributionSetAssignments(final List<MgmtDistributionSetAssignment> assignments) {
|
|
||||||
super(assignments);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public interface MgmtTargetRestApi {
|
|||||||
@Operation(summary = "Controls (confirm/deny) actions waiting for confirmation", description = """
|
@Operation(summary = "Controls (confirm/deny) actions waiting for confirmation", description = """
|
||||||
Either confirm or deny an action which is waiting for confirmation.
|
Either confirm or deny an action which is waiting for confirmation.
|
||||||
The action will be transferred into the RUNNING state in case confirming it.
|
The action will be transferred into the RUNNING state in case confirming it.
|
||||||
The action will remain in WAITING_FOR_CONFIRMATION state in case denying it.
|
The action will remain in WAITING_FOR_CONFIRMATION state in case denying it.
|
||||||
Required Permission: READ_REPOSITORY AND UPDATE_TARGET
|
Required Permission: READ_REPOSITORY AND UPDATE_TARGET
|
||||||
""")
|
""")
|
||||||
@PutNoContentResponses
|
@PutNoContentResponses
|
||||||
|
|||||||
@@ -470,6 +470,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
|||||||
final Map<String, Object> info = exceptionInfo.getInfo();
|
final Map<String, Object> info = exceptionInfo.getInfo();
|
||||||
assertThat(info).isNotNull();
|
assertThat(info).isNotNull();
|
||||||
assertThat(info.get(EntityNotFoundException.TYPE)).isEqualTo(DistributionSet.class.getSimpleName());
|
assertThat(info.get(EntityNotFoundException.TYPE)).isEqualTo(DistributionSet.class.getSimpleName());
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
final List<String> notFound = (List<String>) info.get(EntityNotFoundException.ENTITY_ID);
|
final List<String> notFound = (List<String>) info.get(EntityNotFoundException.ENTITY_ID);
|
||||||
Collections.sort(notFound);
|
Collections.sort(notFound);
|
||||||
assertThat(notFound).isEqualTo(missing);
|
assertThat(notFound).isEqualTo(missing);
|
||||||
|
|||||||
@@ -97,8 +97,6 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
|||||||
private RolloutGroupManagement rolloutGroupManagement;
|
private RolloutGroupManagement rolloutGroupManagement;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RolloutTestApprovalStrategy approvalStrategy;
|
private RolloutTestApprovalStrategy approvalStrategy;
|
||||||
@Autowired
|
|
||||||
private DistributionSetManagement distributionSetManagement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the GET request of retrieving a single rollout.
|
* Handles the GET request of retrieving a single rollout.
|
||||||
@@ -1984,7 +1982,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
|||||||
|
|
||||||
private long postRollout(final String name, final int groupSize, final Long distributionSetId,
|
private long postRollout(final String name, final int groupSize, final Long distributionSetId,
|
||||||
final String targetFilterQuery, final int targets, final Action.ActionType type, final Long startTime,
|
final String targetFilterQuery, final int targets, final Action.ActionType type, final Long startTime,
|
||||||
final Long forceTime, boolean isDynamic, String dynamicGroupSuffix, int dynamicGroupTargetsCount) throws Exception {
|
final Long forceTime, boolean isDynamic, final String dynamicGroupSuffix, int dynamicGroupTargetsCount) throws Exception {
|
||||||
final String actionType = MgmtRestModelMapper.convertActionType(type).getName();
|
final String actionType = MgmtRestModelMapper.convertActionType(type).getName();
|
||||||
final String rollout = JsonBuilder.rollout(name, "desc", groupSize, distributionSetId, targetFilterQuery,
|
final String rollout = JsonBuilder.rollout(name, "desc", groupSize, distributionSetId, targetFilterQuery,
|
||||||
new RolloutGroupConditionBuilder().withDefaults().build(), null, actionType, null, startTime, forceTime,
|
new RolloutGroupConditionBuilder().withDefaults().build(), null, actionType, null, startTime, forceTime,
|
||||||
|
|||||||
@@ -381,6 +381,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
|||||||
final Map<String, Object> info = exceptionInfo.getInfo();
|
final Map<String, Object> info = exceptionInfo.getInfo();
|
||||||
assertThat(info).isNotNull();
|
assertThat(info).isNotNull();
|
||||||
assertThat(info.get(EntityNotFoundException.TYPE)).isEqualTo(Target.class.getSimpleName());
|
assertThat(info.get(EntityNotFoundException.TYPE)).isEqualTo(Target.class.getSimpleName());
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
final List<String> notFound = (List<String>) info.get(EntityNotFoundException.ENTITY_ID);
|
final List<String> notFound = (List<String>) info.get(EntityNotFoundException.ENTITY_ID);
|
||||||
Collections.sort(notFound);
|
Collections.sort(notFound);
|
||||||
assertThat(notFound).isEqualTo(missing);
|
assertThat(notFound).isEqualTo(missing);
|
||||||
@@ -424,6 +425,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
|||||||
final Map<String, Object> info = exceptionInfo.getInfo();
|
final Map<String, Object> info = exceptionInfo.getInfo();
|
||||||
assertThat(info).isNotNull();
|
assertThat(info).isNotNull();
|
||||||
assertThat(info.get(EntityNotFoundException.TYPE)).isEqualTo(Target.class.getSimpleName());
|
assertThat(info.get(EntityNotFoundException.TYPE)).isEqualTo(Target.class.getSimpleName());
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
final List<String> notFound = (List<String>) info.get(EntityNotFoundException.ENTITY_ID);
|
final List<String> notFound = (List<String>) info.get(EntityNotFoundException.ENTITY_ID);
|
||||||
Collections.sort(notFound);
|
Collections.sort(notFound);
|
||||||
assertThat(notFound).isEqualTo(missing);
|
assertThat(notFound).isEqualTo(missing);
|
||||||
@@ -558,6 +560,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
|||||||
final Map<String, Object> info = exceptionInfo.getInfo();
|
final Map<String, Object> info = exceptionInfo.getInfo();
|
||||||
assertThat(info).isNotNull();
|
assertThat(info).isNotNull();
|
||||||
assertThat(info.get(EntityNotFoundException.TYPE)).isEqualTo(Target.class.getSimpleName());
|
assertThat(info.get(EntityNotFoundException.TYPE)).isEqualTo(Target.class.getSimpleName());
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
final List<String> notFound = (List<String>) info.get(EntityNotFoundException.ENTITY_ID);
|
final List<String> notFound = (List<String>) info.get(EntityNotFoundException.ENTITY_ID);
|
||||||
Collections.sort(notFound);
|
Collections.sort(notFound);
|
||||||
assertThat(notFound).isEqualTo(missing);
|
assertThat(notFound).isEqualTo(missing);
|
||||||
@@ -604,6 +607,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
|||||||
final Map<String, Object> info = exceptionInfo.getInfo();
|
final Map<String, Object> info = exceptionInfo.getInfo();
|
||||||
assertThat(info).isNotNull();
|
assertThat(info).isNotNull();
|
||||||
assertThat(info.get(EntityNotFoundException.TYPE)).isEqualTo(Target.class.getSimpleName());
|
assertThat(info.get(EntityNotFoundException.TYPE)).isEqualTo(Target.class.getSimpleName());
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
final List<String> notFound = (List<String>) info.get(EntityNotFoundException.ENTITY_ID);
|
final List<String> notFound = (List<String>) info.get(EntityNotFoundException.ENTITY_ID);
|
||||||
Collections.sort(notFound);
|
Collections.sort(notFound);
|
||||||
assertThat(notFound).isEqualTo(missing);
|
assertThat(notFound).isEqualTo(missing);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
|
|||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.eclipse.hawkbit.auth.SpPermission;
|
import org.eclipse.hawkbit.auth.SpPermission;
|
||||||
@@ -95,7 +96,7 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
|
|||||||
mvc.perform(get("/rest/v1/system/configs")).andExpect(result -> {
|
mvc.perform(get("/rest/v1/system/configs")).andExpect(result -> {
|
||||||
// returns default DS type because of READ_TARGET
|
// returns default DS type because of READ_TARGET
|
||||||
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value());
|
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value());
|
||||||
assertThat(new ObjectMapper().reader().readValue(result.getResponse().getContentAsString(), HashMap.class)).hasSize(1);
|
assertThat((Map<?, ?>) new ObjectMapper().reader().readValue(result.getResponse().getContentAsString(), HashMap.class)).hasSize(1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
|
|||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.eclipse.hawkbit.auth.SpPermission;
|
import org.eclipse.hawkbit.auth.SpPermission;
|
||||||
@@ -94,12 +95,11 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
|
|||||||
@Test
|
@Test
|
||||||
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
|
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
|
||||||
void onlyDSIfNoTenantConfig() throws Exception {
|
void onlyDSIfNoTenantConfig() throws Exception {
|
||||||
mvc.perform(get("/rest/v1/system/configs"))
|
mvc.perform(get("/rest/v1/system/configs")).andExpect(result -> {
|
||||||
.andExpect(result -> {
|
// returns default DS type because of READ_TARGET
|
||||||
// returns default DS type because of READ_TARGET
|
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value());
|
||||||
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value());
|
assertThat((Map<?, ?>) new ObjectMapper().reader().readValue(result.getResponse().getContentAsString(), HashMap.class)).hasSize(1);
|
||||||
assertThat(new ObjectMapper().reader().readValue(result.getResponse().getContentAsString(), HashMap.class)).hasSize(1);
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ql;
|
package org.eclipse.hawkbit.ql;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -20,10 +22,13 @@ import lombok.ToString;
|
|||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class QueryException extends RuntimeException {
|
public class QueryException extends RuntimeException {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public enum ErrorCode {
|
public enum ErrorCode {
|
||||||
INVALID_SYNTAX,
|
INVALID_SYNTAX,
|
||||||
UNSUPPORTED_FIELD,
|
UNSUPPORTED_FIELD,
|
||||||
GENERIC // an other
|
GENERIC // another
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
|||||||
@@ -506,6 +506,7 @@ public interface RolloutManagement extends PermissionSupport {
|
|||||||
* The name suffix, by default "" is used.
|
* The name suffix, by default "" is used.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@Builder.Default
|
||||||
private String nameSuffix = "";
|
private String nameSuffix = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ public interface SoftwareModuleTypeManagement<T extends SoftwareModuleType>
|
|||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private int maxAssignments = 1;
|
private int maxAssignments = 1;
|
||||||
@Builder.Default
|
|
||||||
private int minArtifacts;
|
private int minArtifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public abstract class AbstractAssignmentEvent extends RemoteTenantAwareEvent {
|
|||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final Map<String, ActionProperties> actions = new HashMap<>();
|
private final HashMap<String, ActionProperties> actions = new HashMap<>();
|
||||||
|
|
||||||
protected AbstractAssignmentEvent(final Action a) {
|
protected AbstractAssignmentEvent(final Action a) {
|
||||||
super(a.getTenant(), null);
|
super(a.getTenant(), null);
|
||||||
@@ -45,8 +45,7 @@ public abstract class AbstractAssignmentEvent extends RemoteTenantAwareEvent {
|
|||||||
|
|
||||||
protected AbstractAssignmentEvent(final String tenant, final Object source, final List<Action> a) {
|
protected AbstractAssignmentEvent(final String tenant, final Object source, final List<Action> a) {
|
||||||
super(tenant, source);
|
super(tenant, source);
|
||||||
actions.putAll(a.stream()
|
actions.putAll(a.stream().collect(Collectors.toMap(action -> action.getTarget().getControllerId(), ActionProperties::new)));
|
||||||
.collect(Collectors.toMap(action -> action.getTarget().getControllerId(), ActionProperties::new)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<ActionProperties> getActionPropertiesForController(final String controllerId) {
|
public Optional<ActionProperties> getActionPropertiesForController(final String controllerId) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.event.remote;
|
package org.eclipse.hawkbit.repository.event.remote;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
@@ -23,6 +24,9 @@ import org.springframework.context.ApplicationEvent;
|
|||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public abstract class AbstractRemoteEvent extends ApplicationEvent {
|
public abstract class AbstractRemoteEvent extends ApplicationEvent {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
|
|
||||||
// for serialization libs like jackson
|
// for serialization libs like jackson
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package org.eclipse.hawkbit.repository.event.remote;
|
package org.eclipse.hawkbit.repository.event.remote;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -31,12 +32,12 @@ public class RolloutStoppedEvent extends RemoteTenantAwareEvent {
|
|||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Collection<Long> rolloutGroupIds;
|
private ArrayList<Long> rolloutGroupIds;
|
||||||
private long rolloutId;
|
private long rolloutId;
|
||||||
|
|
||||||
public RolloutStoppedEvent(final String tenant, final long rolloutId, final Collection<Long> rolloutGroupIds) {
|
public RolloutStoppedEvent(final String tenant, final long rolloutId, final Collection<Long> rolloutGroupIds) {
|
||||||
super(tenant, rolloutId);
|
super(tenant, rolloutId);
|
||||||
this.rolloutId = rolloutId;
|
this.rolloutId = rolloutId;
|
||||||
this.rolloutGroupIds = rolloutGroupIds;
|
this.rolloutGroupIds = new ArrayList<>(rolloutGroupIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.event.remote.service;
|
package org.eclipse.hawkbit.repository.event.remote.service;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.eclipse.hawkbit.repository.event.remote.AbstractRemoteEvent;
|
import org.eclipse.hawkbit.repository.event.remote.AbstractRemoteEvent;
|
||||||
@@ -17,6 +19,9 @@ import org.eclipse.hawkbit.repository.event.remote.AbstractRemoteEvent;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public abstract class AbstractServiceRemoteEvent<T extends AbstractRemoteEvent> extends AbstractRemoteEvent {
|
public abstract class AbstractServiceRemoteEvent<T extends AbstractRemoteEvent> extends AbstractRemoteEvent {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final T remoteEvent;
|
private final T remoteEvent;
|
||||||
|
|
||||||
protected AbstractServiceRemoteEvent(T remoteEvent) {
|
protected AbstractServiceRemoteEvent(T remoteEvent) {
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.exception;
|
package org.eclipse.hawkbit.repository.exception;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||||
@@ -22,6 +24,9 @@ import org.eclipse.hawkbit.repository.model.BaseEntity;
|
|||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class AssignmentQuotaExceededException extends AbstractServerRtException {
|
public class AssignmentQuotaExceededException extends AbstractServerRtException {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final String ASSIGNMENT_QUOTA_EXCEEDED_MESSAGE = "Quota exceeded: Cannot assign %s more %s entities to %s '%s'. The maximum is %s.";
|
private static final String ASSIGNMENT_QUOTA_EXCEEDED_MESSAGE = "Quota exceeded: Cannot assign %s more %s entities to %s '%s'. The maximum is %s.";
|
||||||
private static final SpServerError errorType = SpServerError.SP_QUOTA_EXCEEDED;
|
private static final SpServerError errorType = SpServerError.SP_QUOTA_EXCEEDED;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.repository.exception;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -33,22 +32,15 @@ public class IncompatibleTargetTypeException extends AbstractServerRtException {
|
|||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final Collection<String> targetTypeNames;
|
|
||||||
private final Collection<String> distributionSetTypeNames;
|
|
||||||
|
|
||||||
public IncompatibleTargetTypeException(final String targetTypeName, final Collection<String> distributionSetTypeNames) {
|
public IncompatibleTargetTypeException(final String targetTypeName, final Collection<String> distributionSetTypeNames) {
|
||||||
super(SpServerError.SP_TARGET_TYPE_INCOMPATIBLE,
|
super(SpServerError.SP_TARGET_TYPE_INCOMPATIBLE,
|
||||||
String.format("Target of type %s is not compatible with distribution set of types %s", targetTypeName, distributionSetTypeNames)
|
String.format("Target of type %s is not compatible with distribution set of types %s",
|
||||||
);
|
targetTypeName, distributionSetTypeNames));
|
||||||
this.targetTypeNames = Collections.singleton(targetTypeName);
|
|
||||||
this.distributionSetTypeNames = distributionSetTypeNames;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IncompatibleTargetTypeException(final Collection<String> targetTypeNames, final String distributionSetTypeName) {
|
public IncompatibleTargetTypeException(final Collection<String> targetTypeNames, final String distributionSetTypeName) {
|
||||||
super(SpServerError.SP_TARGET_TYPE_INCOMPATIBLE,
|
super(SpServerError.SP_TARGET_TYPE_INCOMPATIBLE,
|
||||||
String.format("Targets of types %s are not compatible with distribution set of type %s", targetTypeNames,
|
String.format("Targets of types %s are not compatible with distribution set of type %s",
|
||||||
distributionSetTypeName));
|
targetTypeNames, distributionSetTypeName));
|
||||||
this.targetTypeNames = targetTypeNames;
|
|
||||||
this.distributionSetTypeNames = Collections.singleton(distributionSetTypeName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.model;
|
package org.eclipse.hawkbit.repository.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.Identifiable;
|
import org.eclipse.hawkbit.repository.Identifiable;
|
||||||
@@ -17,7 +16,7 @@ import org.eclipse.hawkbit.repository.Identifiable;
|
|||||||
/**
|
/**
|
||||||
* Core information of all entities.
|
* Core information of all entities.
|
||||||
*/
|
*/
|
||||||
public interface BaseEntity extends Serializable, Identifiable<Long> {
|
public interface BaseEntity extends Identifiable<Long> {
|
||||||
|
|
||||||
static Long getIdOrNull(final BaseEntity entity) {
|
static Long getIdOrNull(final BaseEntity entity) {
|
||||||
return entity == null ? null : entity.getId();
|
return entity == null ? null : entity.getId();
|
||||||
|
|||||||
@@ -19,10 +19,9 @@ public class EventJacksonMessageConverter extends MappingJackson2MessageConverte
|
|||||||
|
|
||||||
public static final MimeType APPLICATION_REMOTE_EVENT_JSON = new MimeType("application", "remote-event-json");
|
public static final MimeType APPLICATION_REMOTE_EVENT_JSON = new MimeType("application", "remote-event-json");
|
||||||
|
|
||||||
|
|
||||||
public EventJacksonMessageConverter() {
|
public EventJacksonMessageConverter() {
|
||||||
super(APPLICATION_REMOTE_EVENT_JSON);
|
super(APPLICATION_REMOTE_EVENT_JSON);
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
EventType.getNamedTypes().forEach(objectMapper::registerSubtypes);
|
EventType.getNamedTypes().forEach(objectMapper::registerSubtypes);
|
||||||
setObjectMapper(objectMapper);
|
setObjectMapper(objectMapper);
|
||||||
}
|
}
|
||||||
@@ -36,4 +35,4 @@ public class EventJacksonMessageConverter extends MappingJackson2MessageConverte
|
|||||||
protected Object convertFromInternal(final Message<?> message, final Class<?> targetClass, final Object conversionHint) {
|
protected Object convertFromInternal(final Message<?> message, final Class<?> targetClass, final Object conversionHint) {
|
||||||
return super.convertFromInternal(message, targetClass, conversionHint);
|
return super.convertFromInternal(message, targetClass, conversionHint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa;
|
package org.eclipse.hawkbit.repository.jpa;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -142,6 +143,9 @@ public class JpaConfiguration extends JpaBaseConfiguration {
|
|||||||
|
|
||||||
static class CustomHibernateJpaDialect extends HibernateJpaDialect {
|
static class CustomHibernateJpaDialect extends HibernateJpaDialect {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected CustomHibernateJpaDialect() {
|
protected CustomHibernateJpaDialect() {
|
||||||
super();
|
super();
|
||||||
this.setJdbcExceptionTranslator(JpaExceptionTranslator.getTranslator());
|
this.setJdbcExceptionTranslator(JpaExceptionTranslator.getTranslator());
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.acm;
|
package org.eclipse.hawkbit.repository.jpa.acm;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.lang.reflect.Proxy;
|
import java.lang.reflect.Proxy;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -70,7 +71,7 @@ public class AccessControllerConfiguration {
|
|||||||
return new AccessController<>() {
|
return new AccessController<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public Optional<Specification<JpaAction>> getAccessRules(final Operation operation) {
|
public Optional<Specification<JpaAction>> getAccessRules(final Operation operation) {
|
||||||
return targetAccessController.getAccessRules(map(operation)).map(targetSpec -> (actionRoot, query, cb) -> {
|
return targetAccessController.getAccessRules(map(operation)).map(targetSpec -> (actionRoot, query, cb) -> {
|
||||||
final Join<JpaAction, JpaTarget> targetJoin = actionRoot.join(JpaAction_.target);
|
final Join<JpaAction, JpaTarget> targetJoin = actionRoot.join(JpaAction_.target);
|
||||||
@@ -162,6 +163,9 @@ public class AccessControllerConfiguration {
|
|||||||
|
|
||||||
private static class RawAuthoritiesAuthentication implements Authentication {
|
private static class RawAuthoritiesAuthentication implements Authentication {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final Authentication authentication;
|
private final Authentication authentication;
|
||||||
private final transient SingletonSupplier<List<? extends GrantedAuthority>> rawAuthoritiesSupplier;
|
private final transient SingletonSupplier<List<? extends GrantedAuthority>> rawAuthoritiesSupplier;
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import javax.sql.DataSource;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.hawkbit.repository.jpa.utils.DeploymentHelper;
|
import org.eclipse.hawkbit.repository.jpa.utils.DeploymentHelper;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
import org.springframework.dao.DeadlockLoserDataAccessException;
|
|
||||||
import org.springframework.dao.PessimisticLockingFailureException;
|
import org.springframework.dao.PessimisticLockingFailureException;
|
||||||
import org.springframework.dao.QueryTimeoutException;
|
import org.springframework.dao.QueryTimeoutException;
|
||||||
import org.springframework.integration.jdbc.lock.DefaultLockRepository;
|
import org.springframework.integration.jdbc.lock.DefaultLockRepository;
|
||||||
@@ -55,10 +54,8 @@ public class DistributedLockRepository extends DefaultLockRepository {
|
|||||||
// lock <-> next refresh time
|
// lock <-> next refresh time
|
||||||
private final Map<String, Instant> lockToRefreshTime = new ConcurrentHashMap<>();
|
private final Map<String, Instant> lockToRefreshTime = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
public DistributedLockRepository(
|
||||||
* @param dataSource to use for managing the locks
|
final DataSource dataSource, final LockProperties lockProperties, final PlatformTransactionManager txManager) {
|
||||||
*/
|
|
||||||
public DistributedLockRepository(final DataSource dataSource, final LockProperties lockProperties, final PlatformTransactionManager txManager) {
|
|
||||||
super(dataSource);
|
super(dataSource);
|
||||||
this.txManager = txManager;
|
this.txManager = txManager;
|
||||||
|
|
||||||
@@ -91,14 +88,14 @@ public class DistributedLockRepository extends DefaultLockRepository {
|
|||||||
if (count < MAX_DELETE_RETRY) {
|
if (count < MAX_DELETE_RETRY) {
|
||||||
log.debug("Failed to delete cluster lock {}. We try again.", lock, e);
|
log.debug("Failed to delete cluster lock {}. We try again.", lock, e);
|
||||||
return delete(lock, count + 1);
|
return delete(lock, count + 1);
|
||||||
} else {
|
} else {
|
||||||
log.warn("Failed to delete cluster lock {}!", lock, e);
|
log.warn("Failed to delete cluster lock {}!", lock, e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(propagation=Propagation.NOT_SUPPORTED)
|
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||||
@Override
|
@Override
|
||||||
public boolean acquire(final String lock) {
|
public boolean acquire(final String lock) {
|
||||||
try {
|
try {
|
||||||
@@ -106,14 +103,13 @@ public class DistributedLockRepository extends DefaultLockRepository {
|
|||||||
// because we need to know real (after transaction commit) result Ïto know if it is really successful.
|
// because we need to know real (after transaction commit) result Ïto know if it is really successful.
|
||||||
// otherwise the super.acquire will return result before been committed and could be false positive
|
// otherwise the super.acquire will return result before been committed and could be false positive
|
||||||
final boolean acquired = DeploymentHelper.runInNewTransaction(
|
final boolean acquired = DeploymentHelper.runInNewTransaction(
|
||||||
txManager, "lock-acquire", Isolation.READ_COMMITTED.value(), status -> super.acquire(lock));
|
txManager, "lock-acquire", Isolation.READ_COMMITTED.value(), status -> super.acquire(lock));
|
||||||
if (acquired) {
|
if (acquired) {
|
||||||
// update next refresh time
|
// update next refresh time
|
||||||
refreshAfterMillis.ifPresent(
|
refreshAfterMillis.ifPresent(afterMillis -> lockToRefreshTime.put(lock, Instant.now().plus(afterMillis, ChronoUnit.MILLIS)));
|
||||||
afterMillis -> lockToRefreshTime.put(lock, Instant.now().plus(afterMillis, ChronoUnit.MILLIS)));
|
|
||||||
}
|
}
|
||||||
return acquired;
|
return acquired;
|
||||||
} catch (final DataIntegrityViolationException | DeadlockLoserDataAccessException e) {
|
} catch (final DataIntegrityViolationException | PessimisticLockingFailureException e) {
|
||||||
log.debug("Could not acquire cluster lock {}. I guess another node has it.", lock, e);
|
log.debug("Could not acquire cluster lock {}. I guess another node has it.", lock, e);
|
||||||
return false;
|
return false;
|
||||||
} catch (final QueryTimeoutException e) {
|
} catch (final QueryTimeoutException e) {
|
||||||
@@ -122,7 +118,7 @@ public class DistributedLockRepository extends DefaultLockRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"java:S1066"})
|
@SuppressWarnings({ "java:S1066" })
|
||||||
@Scheduled(initialDelayString = TIC_PERIOD_MS, fixedDelayString = TIC_PERIOD_MS)
|
@Scheduled(initialDelayString = TIC_PERIOD_MS, fixedDelayString = TIC_PERIOD_MS)
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
refreshAfterMillis.ifPresentOrElse(afterMillis -> {
|
refreshAfterMillis.ifPresentOrElse(afterMillis -> {
|
||||||
|
|||||||
@@ -124,7 +124,8 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
QUERY_DELETE_ACTIONS_BY_STATE_AND_LAST_MODIFIED = new EnumMap<>(Database.class);
|
QUERY_DELETE_ACTIONS_BY_STATE_AND_LAST_MODIFIED = new EnumMap<>(Database.class);
|
||||||
QUERY_DELETE_ACTIONS_BY_STATE_AND_LAST_MODIFIED.put(Database.POSTGRESQL,
|
QUERY_DELETE_ACTIONS_BY_STATE_AND_LAST_MODIFIED.put(
|
||||||
|
Database.POSTGRESQL,
|
||||||
"DELETE FROM sp_action " + "WHERE id IN (SELECT id FROM sp_action " + "WHERE tenant=" + Jpa.nativeQueryParamPrefix() + "tenant" + " AND status IN (%s)" + " AND last_modified_at<" + Jpa.nativeQueryParamPrefix() + "last_modified_at LIMIT " + ACTION_PAGE_LIMIT + ")");
|
"DELETE FROM sp_action " + "WHERE id IN (SELECT id FROM sp_action " + "WHERE tenant=" + Jpa.nativeQueryParamPrefix() + "tenant" + " AND status IN (%s)" + " AND last_modified_at<" + Jpa.nativeQueryParamPrefix() + "last_modified_at LIMIT " + ACTION_PAGE_LIMIT + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -421,8 +421,8 @@ public class JpaDistributionSetManagement
|
|||||||
|
|
||||||
private List<JpaDistributionSet> updateTag(
|
private List<JpaDistributionSet> updateTag(
|
||||||
final Collection<Long> dsIds, final long dsTagId,
|
final Collection<Long> dsIds, final long dsTagId,
|
||||||
final BiFunction<DistributionSetTag, JpaDistributionSet, JpaDistributionSet> updater) {
|
final BiFunction<JpaDistributionSetTag, JpaDistributionSet, JpaDistributionSet> updater) {
|
||||||
final DistributionSetTag tag = distributionSetTagManagement.get(dsTagId);
|
final JpaDistributionSetTag tag = distributionSetTagManagement.get(dsTagId);
|
||||||
final List<JpaDistributionSet> allDs = dsIds.size() == 1 ?
|
final List<JpaDistributionSet> allDs = dsIds.size() == 1 ?
|
||||||
jpaRepository.findById(dsIds.iterator().next())
|
jpaRepository.findById(dsIds.iterator().next())
|
||||||
.map(List::of)
|
.map(List::of)
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.MappedSuperclass;
|
import jakarta.persistence.MappedSuperclass;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
@@ -36,9 +34,6 @@ import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public abstract class AbstractJpaNamedEntity extends AbstractJpaTenantAwareBaseEntity implements NamedEntity {
|
public abstract class AbstractJpaNamedEntity extends AbstractJpaTenantAwareBaseEntity implements NamedEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Column(name = "name", nullable = false, length = NAME_MAX_SIZE)
|
@Column(name = "name", nullable = false, length = NAME_MAX_SIZE)
|
||||||
@Size(min = 1, max = NAME_MAX_SIZE)
|
@Size(min = 1, max = NAME_MAX_SIZE)
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -9,14 +9,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.MappedSuperclass;
|
import jakarta.persistence.MappedSuperclass;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
@@ -25,6 +25,7 @@ import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
|||||||
/**
|
/**
|
||||||
* Extension for {@link NamedEntity} that are versioned.
|
* Extension for {@link NamedEntity} that are versioned.
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED) // Default constructor needed for JPA entities
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
@@ -33,27 +34,13 @@ import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public abstract class AbstractJpaNamedVersionedEntity extends AbstractJpaNamedEntity implements NamedVersionedEntity {
|
public abstract class AbstractJpaNamedVersionedEntity extends AbstractJpaNamedEntity implements NamedVersionedEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Column(name = "version", nullable = false, length = NamedVersionedEntity.VERSION_MAX_SIZE)
|
@Column(name = "version", nullable = false, length = NamedVersionedEntity.VERSION_MAX_SIZE)
|
||||||
@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE)
|
@Size(min = 1, max = NamedVersionedEntity.VERSION_MAX_SIZE)
|
||||||
@NotNull
|
@NotNull
|
||||||
private String version;
|
private String version;
|
||||||
|
|
||||||
/**
|
|
||||||
* parameterized constructor.
|
|
||||||
*
|
|
||||||
* @param name of the entity
|
|
||||||
* @param version of the entity
|
|
||||||
* @param description
|
|
||||||
*/
|
|
||||||
AbstractJpaNamedVersionedEntity(final String name, final String version, final String description) {
|
AbstractJpaNamedVersionedEntity(final String name, final String version, final String description) {
|
||||||
super(name, description);
|
super(name, description);
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
AbstractJpaNamedVersionedEntity() {
|
|
||||||
// Default constructor needed for JPA entities
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,8 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.MappedSuperclass;
|
import jakarta.persistence.MappedSuperclass;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
@@ -34,9 +32,6 @@ import org.eclipse.hawkbit.repository.model.Type;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public abstract class AbstractJpaTypeEntity extends AbstractJpaNamedEntity implements Type {
|
public abstract class AbstractJpaTypeEntity extends AbstractJpaNamedEntity implements Type {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Column(name = "type_key", nullable = false, updatable = false, length = KEY_MAX_SIZE)
|
@Column(name = "type_key", nullable = false, updatable = false, length = KEY_MAX_SIZE)
|
||||||
@Size(min = 1, max = KEY_MAX_SIZE)
|
@Size(min = 1, max = KEY_MAX_SIZE)
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
@@ -35,10 +33,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
|||||||
@NoArgsConstructor // Default constructor for JPA
|
@NoArgsConstructor // Default constructor for JPA
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "sp_ds_type_element")
|
@Table(name = "sp_ds_type_element")
|
||||||
public class DistributionSetTypeElement implements Serializable {
|
public class DistributionSetTypeElement {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@EmbeddedId
|
@EmbeddedId
|
||||||
private DistributionSetTypeElementCompositeKey key;
|
private DistributionSetTypeElementCompositeKey key;
|
||||||
|
|||||||
@@ -9,9 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Embeddable;
|
import jakarta.persistence.Embeddable;
|
||||||
|
|
||||||
@@ -25,10 +22,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
@Data
|
@Data
|
||||||
@Embeddable
|
@Embeddable
|
||||||
public class DistributionSetTypeElementCompositeKey implements Serializable {
|
public class DistributionSetTypeElementCompositeKey {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Column(name = "distribution_set_type", nullable = false, updatable = false)
|
@Column(name = "distribution_set_type", nullable = false, updatable = false)
|
||||||
private Long dsType;
|
private Long dsType;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.repository.jpa.model;
|
|||||||
|
|
||||||
import static org.eclipse.hawkbit.repository.model.BaseEntity.getIdOrNull;
|
import static org.eclipse.hawkbit.repository.model.BaseEntity.getIdOrNull;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -72,13 +71,9 @@ import org.eclipse.hawkbit.repository.model.Target;
|
|||||||
@SuppressWarnings({ "squid:S2160", "java:S1710", "java:S1171", "java:S3599" })
|
@SuppressWarnings({ "squid:S2160", "java:S1710", "java:S1171", "java:S3599" })
|
||||||
public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Action, EventAwareEntity {
|
public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Action, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||||
@JoinColumn(
|
@JoinColumn(name = "distribution_set", nullable = false, updatable = false)
|
||||||
name = "distribution_set", nullable = false, updatable = false)
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private JpaDistributionSet distributionSet;
|
private JpaDistributionSet distributionSet;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -46,9 +45,6 @@ import org.eclipse.hawkbit.repository.model.ActionStatus;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements ActionStatus {
|
public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements ActionStatus {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private static final int MESSAGE_ENTRY_LENGTH = 512;
|
private static final int MESSAGE_ENTRY_LENGTH = 512;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -40,9 +38,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public class JpaArtifact extends AbstractJpaTenantAwareBaseEntity implements Artifact {
|
public class JpaArtifact extends AbstractJpaTenantAwareBaseEntity implements Artifact {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@ManyToOne(optional = false, cascade = { CascadeType.PERSIST }, fetch = FetchType.LAZY)
|
@ManyToOne(optional = false, cascade = { CascadeType.PERSIST }, fetch = FetchType.LAZY)
|
||||||
@JoinColumn(
|
@JoinColumn(
|
||||||
name = "software_module", nullable = false, updatable = false)
|
name = "software_module", nullable = false, updatable = false)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -68,9 +67,6 @@ public class JpaDistributionSet
|
|||||||
extends AbstractJpaNamedVersionedEntity
|
extends AbstractJpaNamedVersionedEntity
|
||||||
implements DistributionSet, WithMetadata<String, String>, EventAwareEntity {
|
implements DistributionSet, WithMetadata<String, String>, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY, optional = false, targetEntity = JpaDistributionSetType.class)
|
@ManyToOne(fetch = FetchType.LAZY, optional = false, targetEntity = JpaDistributionSetType.class)
|
||||||
@JoinColumn(name = "ds_type", nullable = false, updatable = false)
|
@JoinColumn(name = "ds_type", nullable = false, updatable = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -81,17 +77,14 @@ public class JpaDistributionSet
|
|||||||
name = "sp_ds_sm",
|
name = "sp_ds_sm",
|
||||||
joinColumns = { @JoinColumn(name = "ds_id", nullable = false) },
|
joinColumns = { @JoinColumn(name = "ds_id", nullable = false) },
|
||||||
inverseJoinColumns = { @JoinColumn(name = "sm_id", nullable = false) })
|
inverseJoinColumns = { @JoinColumn(name = "sm_id", nullable = false) })
|
||||||
private Set<SoftwareModule> modules = new HashSet<>();
|
private Set<JpaSoftwareModule> modules = new HashSet<>();
|
||||||
|
|
||||||
@ManyToMany(targetEntity = JpaDistributionSetTag.class)
|
@ManyToMany(targetEntity = JpaDistributionSetTag.class)
|
||||||
@JoinTable(
|
@JoinTable(
|
||||||
name = "sp_ds_tag",
|
name = "sp_ds_tag",
|
||||||
joinColumns = {
|
joinColumns = { @JoinColumn(name = "ds", nullable = false) },
|
||||||
@JoinColumn(name = "ds", nullable = false) },
|
inverseJoinColumns = { @JoinColumn(name = "tag", nullable = false) })
|
||||||
inverseJoinColumns = {
|
private Set<JpaDistributionSetTag> tags = new HashSet<>();
|
||||||
@JoinColumn(
|
|
||||||
name = "tag", nullable = false) })
|
|
||||||
private Set<DistributionSetTag> tags = new HashSet<>();
|
|
||||||
|
|
||||||
// no cascade option on an ElementCollection, the target objects are always persisted, merged, removed with their parent
|
// no cascade option on an ElementCollection, the target objects are always persisted, merged, removed with their parent
|
||||||
@Getter
|
@Getter
|
||||||
@@ -128,7 +121,7 @@ public class JpaDistributionSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("java:S1144") // used via reflection copy utils
|
@SuppressWarnings("java:S1144") // used via reflection copy utils
|
||||||
private JpaDistributionSet setModules(final Set<SoftwareModule> modules) {
|
private JpaDistributionSet setModules(final Set<JpaSoftwareModule> modules) {
|
||||||
if (modules == null) {
|
if (modules == null) {
|
||||||
return this; // do not change
|
return this; // do not change
|
||||||
}
|
}
|
||||||
@@ -163,14 +156,14 @@ public class JpaDistributionSet
|
|||||||
}).orElse(true);
|
}).orElse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addModule(final SoftwareModule softwareModule) {
|
public void addModule(final JpaSoftwareModule softwareModule) {
|
||||||
if (isLocked()) {
|
if (isLocked()) {
|
||||||
throw new LockedException(JpaDistributionSet.class, getId(), "ADD_SOFTWARE_MODULE");
|
throw new LockedException(JpaDistributionSet.class, getId(), "ADD_SOFTWARE_MODULE");
|
||||||
}
|
}
|
||||||
|
|
||||||
checkTypeCompatability(softwareModule);
|
checkTypeCompatability(softwareModule);
|
||||||
|
|
||||||
final Optional<SoftwareModule> found = modules.stream()
|
final Optional<JpaSoftwareModule> found = modules.stream()
|
||||||
.filter(module -> module.getId().equals(softwareModule.getId())).findAny();
|
.filter(module -> module.getId().equals(softwareModule.getId())).findAny();
|
||||||
if (found.isPresent()) {
|
if (found.isPresent()) {
|
||||||
return;
|
return;
|
||||||
@@ -199,14 +192,14 @@ public class JpaDistributionSet
|
|||||||
return Collections.unmodifiableSet(tags);
|
return Collections.unmodifiableSet(tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTag(final DistributionSetTag tag) {
|
public void addTag(final JpaDistributionSetTag tag) {
|
||||||
if (tags == null) {
|
if (tags == null) {
|
||||||
tags = new HashSet<>();
|
tags = new HashSet<>();
|
||||||
}
|
}
|
||||||
tags.add(tag);
|
tags.add(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeTag(final DistributionSetTag tag) {
|
public void removeTag(final JpaDistributionSetTag tag) {
|
||||||
if (tags != null) {
|
if (tags != null) {
|
||||||
tags.remove(tag);
|
tags.remove(tag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -35,19 +34,9 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public class JpaDistributionSetTag extends JpaTag implements DistributionSetTag, EventAwareEntity {
|
public class JpaDistributionSetTag extends JpaTag implements DistributionSetTag, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@ManyToMany(mappedBy = "tags", targetEntity = JpaDistributionSet.class, fetch = FetchType.LAZY)
|
@ManyToMany(mappedBy = "tags", targetEntity = JpaDistributionSet.class, fetch = FetchType.LAZY)
|
||||||
private List<DistributionSet> assignedToDistributionSet;
|
private List<DistributionSet> assignedToDistributionSet;
|
||||||
|
|
||||||
/**
|
|
||||||
* Public constructor.
|
|
||||||
*
|
|
||||||
* @param name of the {@link DistributionSetTag}
|
|
||||||
* @param description of the {@link DistributionSetTag}
|
|
||||||
* @param colour of tag in UI
|
|
||||||
*/
|
|
||||||
public JpaDistributionSetTag(final String name, final String description, final String colour) {
|
public JpaDistributionSetTag(final String name, final String description, final String colour) {
|
||||||
super(name, description, colour);
|
super(name, description, colour);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -42,9 +41,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public class JpaDistributionSetType extends AbstractJpaTypeEntity implements DistributionSetType, EventAwareEntity {
|
public class JpaDistributionSetType extends AbstractJpaTypeEntity implements DistributionSetType, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(
|
||||||
mappedBy = "dsType", targetEntity = DistributionSetTypeElement.class,
|
mappedBy = "dsType", targetEntity = DistributionSetTypeElement.class,
|
||||||
fetch = FetchType.EAGER,
|
fetch = FetchType.EAGER,
|
||||||
@@ -125,7 +121,8 @@ public class JpaDistributionSetType extends AbstractJpaTypeEntity implements Dis
|
|||||||
.publishEvent(new DistributionSetTypeDeletedEvent(getTenant(), getId(), getClass()));
|
.publishEvent(new DistributionSetTypeDeletedEvent(getTenant(), getId(), getClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private JpaDistributionSetType replaceOrAddModuleTypes(final Set<SoftwareModuleType> smTypes, final boolean mandatory, final boolean replace) {
|
private JpaDistributionSetType replaceOrAddModuleTypes(final Set<SoftwareModuleType> smTypes, final boolean mandatory,
|
||||||
|
final boolean replace) {
|
||||||
if (smTypes == null) {
|
if (smTypes == null) {
|
||||||
return this; // do not change
|
return this; // do not change
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
@@ -63,9 +62,6 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
|||||||
@SuppressWarnings({ "squid:S2160", "java:S1710", "java:S1171", "java:S3599" })
|
@SuppressWarnings({ "squid:S2160", "java:S1710", "java:S1171", "java:S3599" })
|
||||||
public class JpaRollout extends AbstractJpaNamedEntity implements Rollout, EventAwareEntity {
|
public class JpaRollout extends AbstractJpaNamedEntity implements Rollout, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@OneToMany(targetEntity = JpaRolloutGroup.class, fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }, mappedBy = "rollout")
|
@OneToMany(targetEntity = JpaRolloutGroup.class, fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }, mappedBy = "rollout")
|
||||||
private List<JpaRolloutGroup> rolloutGroups = new ArrayList<>();
|
private List<JpaRolloutGroup> rolloutGroups = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -48,9 +47,6 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public class JpaRolloutGroup extends AbstractJpaNamedEntity implements RolloutGroup, EventAwareEntity {
|
public class JpaRolloutGroup extends AbstractJpaNamedEntity implements RolloutGroup, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "rollout", nullable = false, updatable = false)
|
@JoinColumn(name = "rollout", nullable = false, updatable = false)
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -67,9 +65,6 @@ public class JpaSoftwareModule
|
|||||||
extends AbstractJpaNamedVersionedEntity
|
extends AbstractJpaNamedVersionedEntity
|
||||||
implements SoftwareModule, WithMetadata<MetadataValue, JpaSoftwareModule.JpaMetadataValue>, EventAwareEntity {
|
implements SoftwareModule, WithMetadata<MetadataValue, JpaSoftwareModule.JpaMetadataValue>, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "sm_type", nullable = false, updatable = false)
|
@JoinColumn(name = "sm_type", nullable = false, updatable = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -178,10 +173,7 @@ public class JpaSoftwareModule
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Embeddable
|
@Embeddable
|
||||||
public static class JpaMetadataValue implements MetadataValue, Serializable {
|
public static class JpaMetadataValue implements MetadataValue {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Column(name = "meta_value", length = SoftwareModule.METADATA_VALUE_MAX_SIZE)
|
@Column(name = "meta_value", length = SoftwareModule.METADATA_VALUE_MAX_SIZE)
|
||||||
@Size(max = METADATA_VALUE_MAX_SIZE)
|
@Size(max = METADATA_VALUE_MAX_SIZE)
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
@@ -36,9 +34,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public class JpaSoftwareModuleType extends AbstractJpaTypeEntity implements SoftwareModuleType, EventAwareEntity {
|
public class JpaSoftwareModuleType extends AbstractJpaTypeEntity implements SoftwareModuleType, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Setter(value = lombok.AccessLevel.PRIVATE) // used via reflection
|
@Setter(value = lombok.AccessLevel.PRIVATE) // used via reflection
|
||||||
@Column(name = "min_artifacts", nullable = false)
|
@Column(name = "min_artifacts", nullable = false)
|
||||||
@Min(0)
|
@Min(0)
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.MappedSuperclass;
|
import jakarta.persistence.MappedSuperclass;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
@@ -31,9 +29,6 @@ import org.eclipse.hawkbit.repository.model.Tag;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public class JpaTag extends AbstractJpaNamedEntity implements Tag {
|
public class JpaTag extends AbstractJpaNamedEntity implements Tag {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Column(name = "colour", nullable = true, length = Tag.COLOUR_MAX_SIZE)
|
@Column(name = "colour", nullable = true, length = Tag.COLOUR_MAX_SIZE)
|
||||||
@Size(max = Tag.COLOUR_MAX_SIZE)
|
@Size(max = Tag.COLOUR_MAX_SIZE)
|
||||||
private String colour;
|
private String colour;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -84,9 +83,6 @@ import org.springframework.util.ObjectUtils;
|
|||||||
@SuppressWarnings({ "squid:S2160", "java:S1710" })
|
@SuppressWarnings({ "squid:S2160", "java:S1710" })
|
||||||
public class JpaTarget extends AbstractJpaNamedEntity implements Target, EventAwareEntity {
|
public class JpaTarget extends AbstractJpaNamedEntity implements Target, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
@Column(name = "controller_id", length = Target.CONTROLLER_ID_MAX_SIZE, updatable = false, nullable = false)
|
@Column(name = "controller_id", length = Target.CONTROLLER_ID_MAX_SIZE, updatable = false, nullable = false)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
@@ -46,9 +45,6 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public class JpaTargetFilterQuery extends AbstractJpaTenantAwareBaseEntity implements TargetFilterQuery, EventAwareEntity {
|
public class JpaTargetFilterQuery extends AbstractJpaTenantAwareBaseEntity implements TargetFilterQuery, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Column(name = "name", length = NamedEntity.NAME_MAX_SIZE, nullable = false)
|
@Column(name = "name", length = NamedEntity.NAME_MAX_SIZE, nullable = false)
|
||||||
@Size(max = NamedEntity.NAME_MAX_SIZE)
|
@Size(max = NamedEntity.NAME_MAX_SIZE)
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
@@ -113,7 +109,7 @@ public class JpaTargetFilterQuery extends AbstractJpaTenantAwareBaseEntity imple
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fireUpdateEvent() {
|
public void fireUpdateEvent() {
|
||||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent( new TargetFilterQueryUpdatedEvent(this));
|
EventPublisherHolder.getInstance().getEventPublisher().publishEvent(new TargetFilterQueryUpdatedEvent(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
@@ -31,9 +29,6 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
|
|||||||
@Table(name = "sp_target_tag")
|
@Table(name = "sp_target_tag")
|
||||||
public class JpaTargetTag extends JpaTag implements TargetTag, EventAwareEntity {
|
public class JpaTargetTag extends JpaTag implements TargetTag, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public JpaTargetTag(final String name, final String description, final String colour) {
|
public JpaTargetTag(final String name, final String description, final String colour) {
|
||||||
super(name, description, colour);
|
super(name, description, colour);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -40,9 +39,6 @@ import org.eclipse.hawkbit.repository.model.TargetType;
|
|||||||
@SuppressWarnings("java:S2160") // the super class equals/hashcode shall be used
|
@SuppressWarnings("java:S2160") // the super class equals/hashcode shall be used
|
||||||
public class JpaTargetType extends AbstractJpaTypeEntity implements TargetType, EventAwareEntity {
|
public class JpaTargetType extends AbstractJpaTypeEntity implements TargetType, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@ManyToMany(targetEntity = JpaDistributionSetType.class)
|
@ManyToMany(targetEntity = JpaDistributionSetType.class)
|
||||||
@JoinTable(
|
@JoinTable(
|
||||||
name = "sp_target_type_ds_type",
|
name = "sp_target_type_ds_type",
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
import jakarta.persistence.Basic;
|
import jakarta.persistence.Basic;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -39,9 +37,6 @@ import org.eclipse.hawkbit.repository.model.TenantConfiguration;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public class JpaTenantConfiguration extends AbstractJpaTenantAwareBaseEntity implements TenantConfiguration, EventAwareEntity {
|
public class JpaTenantConfiguration extends AbstractJpaTenantAwareBaseEntity implements TenantConfiguration, EventAwareEntity {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Column(name = "conf_key", length = TenantConfiguration.KEY_MAX_SIZE, nullable = false, updatable = false)
|
@Column(name = "conf_key", length = TenantConfiguration.KEY_MAX_SIZE, nullable = false, updatable = false)
|
||||||
@Size(min = 1, max = TenantConfiguration.KEY_MAX_SIZE)
|
@Size(min = 1, max = TenantConfiguration.KEY_MAX_SIZE)
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
@@ -47,9 +45,6 @@ import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
|||||||
@SuppressWarnings("squid:S2160")
|
@SuppressWarnings("squid:S2160")
|
||||||
public class JpaTenantMetaData extends AbstractJpaBaseEntity implements TenantMetaData {
|
public class JpaTenantMetaData extends AbstractJpaBaseEntity implements TenantMetaData {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Column(name = "tenant", nullable = false, updatable = false, length = 40)
|
@Column(name = "tenant", nullable = false, updatable = false, length = 40)
|
||||||
@Size(min = 1, max = 40)
|
@Size(min = 1, max = 40)
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
@@ -35,10 +33,7 @@ import org.eclipse.hawkbit.repository.model.Target;
|
|||||||
@IdClass(RolloutTargetGroupId.class)
|
@IdClass(RolloutTargetGroupId.class)
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "sp_rollout_target_group")
|
@Table(name = "sp_rollout_target_group")
|
||||||
public class RolloutTargetGroup implements Serializable {
|
public class RolloutTargetGroup {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@ManyToOne(optional = false, targetEntity = JpaRolloutGroup.class, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
|
@ManyToOne(optional = false, targetEntity = JpaRolloutGroup.class, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
|
||||||
|
|||||||
@@ -9,9 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model;
|
package org.eclipse.hawkbit.repository.jpa.model;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -24,10 +21,7 @@ import org.eclipse.hawkbit.repository.model.Target;
|
|||||||
@NoArgsConstructor // Default constructor for JPA
|
@NoArgsConstructor // Default constructor for JPA
|
||||||
@Getter
|
@Getter
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class RolloutTargetGroupId implements Serializable {
|
public class RolloutTargetGroupId {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Long rolloutGroup;
|
private Long rolloutGroup;
|
||||||
private Long target;
|
private Long target;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public interface BaseEntityRepository<T extends AbstractJpaBaseEntity>
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("uchecked")
|
@SuppressWarnings("unchecked")
|
||||||
default Class<? extends BaseEntity> getManagementClass() {
|
default Class<? extends BaseEntity> getManagementClass() {
|
||||||
final Class<T> domainClass = getDomainClass();
|
final Class<T> domainClass = getDomainClass();
|
||||||
final String domainClassSimpleName = domainClass.getSimpleName();
|
final String domainClassSimpleName = domainClass.getSimpleName();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import org.springframework.util.ObjectUtils;
|
|||||||
* @param <ID> the type of the id of the entity the repository manages
|
* @param <ID> the type of the id of the entity the repository manages
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("java:S119") // inherited from SimpleJpaRepository
|
@SuppressWarnings("java:S119") // inherited from SimpleJpaRepository
|
||||||
public class HawkbitBaseRepository<T, ID extends Serializable> extends SimpleJpaRepository<T, ID>
|
public final class HawkbitBaseRepository<T, ID extends Serializable> extends SimpleJpaRepository<T, ID>
|
||||||
implements JpaSpecificationEntityGraphExecutor<T>, NoCountSliceRepository<T>, ACMRepository<T> {
|
implements JpaSpecificationEntityGraphExecutor<T>, NoCountSliceRepository<T>, ACMRepository<T> {
|
||||||
|
|
||||||
private final EntityManager entityManager;
|
private final EntityManager entityManager;
|
||||||
|
|||||||
@@ -9,12 +9,17 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.rollout.condition;
|
package org.eclipse.hawkbit.repository.jpa.rollout.condition;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception indicating that a specific evaluator is missing in the application
|
* Exception indicating that a specific evaluator is missing in the application
|
||||||
* context.
|
* context.
|
||||||
*/
|
*/
|
||||||
public class EvaluatorNotConfiguredException extends RuntimeException {
|
public class EvaluatorNotConfiguredException extends RuntimeException {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final String MESSAGE_FORMAT = "Cannot find any configured evaluator for action/condition '%s'. Please ensure to configure one in the application context to make use of it.";
|
private static final String MESSAGE_FORMAT = "Cannot find any configured evaluator for action/condition '%s'. Please ensure to configure one in the application context to make use of it.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.utils;
|
package org.eclipse.hawkbit.repository.jpa.utils;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -94,6 +95,9 @@ public class StatisticsUtils {
|
|||||||
// Map with user-friendly toString, sorted and without the last ", "
|
// Map with user-friendly toString, sorted and without the last ", "
|
||||||
private static class MapUFToString extends HashMap<String, Double> {
|
private static class MapUFToString extends HashMap<String, Double> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest
|
|||||||
|
|
||||||
protected static <T> T[] toArray(final Iterable<? extends T> it, final Class<T> type) {
|
protected static <T> T[] toArray(final Iterable<? extends T> it, final Class<T> type) {
|
||||||
final List<T> list = toList(it);
|
final List<T> list = toList(it);
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
final T[] array = (T[]) Array.newInstance(type, list.size());
|
final T[] array = (T[]) Array.newInstance(type, list.size());
|
||||||
for (int i = 0; i < array.length; i++) {
|
for (int i = 0; i < array.length; i++) {
|
||||||
array[i] = list.get(i);
|
array[i] = list.get(i);
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class TargetTypeManagementTest extends AbstractAccessControllerManagementTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
void verifyRead() {
|
void verifyRead() {
|
||||||
// permissions to read only type1 target types
|
// permissions to read only type1 target types
|
||||||
runAs(withAuthorities(READ_TARGET_TYPE + "/id==" + targetType1.getId()), () -> {
|
runAs(withAuthorities(READ_TARGET_TYPE + "/id==" + targetType1.getId()), () -> {
|
||||||
|
|||||||
@@ -150,12 +150,11 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
|||||||
final String successCondition = "50";
|
final String successCondition = "50";
|
||||||
final String errorCondition = "80";
|
final String errorCondition = "80";
|
||||||
final String rolloutName = "rolloutTest";
|
final String rolloutName = "rolloutTest";
|
||||||
final String targetPrefixName = rolloutName;
|
|
||||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet("dsFor" + rolloutName);
|
final DistributionSet distributionSet = testdataFactory.createDistributionSet("dsFor" + rolloutName);
|
||||||
testdataFactory.createTargets(amountTargetsForRollout, targetPrefixName + "-", targetPrefixName);
|
testdataFactory.createTargets(amountTargetsForRollout, rolloutName + "-", rolloutName);
|
||||||
|
|
||||||
final Rollout createdRollout = testdataFactory.createRolloutByVariables(rolloutName, "desc", amountGroups,
|
final Rollout createdRollout = testdataFactory.createRolloutByVariables(
|
||||||
"controllerId==" + targetPrefixName + "-*", distributionSet, successCondition, errorCondition);
|
rolloutName, "desc", amountGroups,"controllerId==" + rolloutName + "-*", distributionSet, successCondition, errorCondition);
|
||||||
|
|
||||||
rolloutManagement.delete(createdRollout.getId());
|
rolloutManagement.delete(createdRollout.getId());
|
||||||
rolloutHandler.handleAll();
|
rolloutHandler.handleAll();
|
||||||
|
|||||||
@@ -987,12 +987,14 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
final int noOfDeployedTargets = 4;
|
final int noOfDeployedTargets = 4;
|
||||||
final int noOfDistributionSets = 3;
|
final int noOfDistributionSets = 3;
|
||||||
|
|
||||||
final DeploymentResult deploymentResult = prepareComplexRepo(undeployedTargetPrefix, noOfUndeployedTargets,
|
final DeploymentResult deploymentResult = prepareComplexRepo(
|
||||||
deployedTargetPrefix, noOfDeployedTargets, noOfDistributionSets, "myTestDS");
|
undeployedTargetPrefix, noOfUndeployedTargets, deployedTargetPrefix, noOfDeployedTargets, noOfDistributionSets, "myTestDS");
|
||||||
|
|
||||||
final List<Long> deployedTargetIDs = deploymentResult.getDeployedTargetIDs();
|
final List<Long> deployedTargetIDs = deploymentResult.getDeployedTargetIDs();
|
||||||
final List<Long> undeployedTargetIDs = deploymentResult.getUndeployedTargetIDs();
|
final List<Long> undeployedTargetIDs = deploymentResult.getUndeployedTargetIDs();
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
final Collection<JpaTarget> savedNakedTargets = (Collection) deploymentResult.getUndeployedTargets();
|
final Collection<JpaTarget> savedNakedTargets = (Collection) deploymentResult.getUndeployedTargets();
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
final Collection<JpaTarget> savedDeployedTargets = (Collection) deploymentResult.getDeployedTargets();
|
final Collection<JpaTarget> savedDeployedTargets = (Collection) deploymentResult.getDeployedTargets();
|
||||||
|
|
||||||
// retrieving all Actions created by the assignDistributionSet call
|
// retrieving all Actions created by the assignDistributionSet call
|
||||||
|
|||||||
@@ -123,12 +123,10 @@ public abstract class AbstractIntegrationTest {
|
|||||||
protected static final Pageable UNPAGED = Pageable.unpaged();
|
protected static final Pageable UNPAGED = Pageable.unpaged();
|
||||||
|
|
||||||
protected static final URI LOCALHOST = URI.create("http://127.0.0.1");
|
protected static final URI LOCALHOST = URI.create("http://127.0.0.1");
|
||||||
protected static final int DEFAULT_TEST_WEIGHT = 500;
|
|
||||||
protected static final Random RND = TestdataFactory.RND;
|
protected static final Random RND = TestdataFactory.RND;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of {@link DistributionSetType}s that exist in every test case. One
|
* Number of {@link DistributionSetType}s that exist in every test case. One generated by using
|
||||||
* generated by using
|
|
||||||
* {@link TestdataFactory#findOrCreateDefaultTestDsType()} and three
|
* {@link TestdataFactory#findOrCreateDefaultTestDsType()} and three
|
||||||
* {@link SystemManagement#getTenantMetadata()};
|
* {@link SystemManagement#getTenantMetadata()};
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ public class SecurityContextSwitch {
|
|||||||
// in some cases it could be serializable, e.g. if got via {@link java.lang.reflect.AnnotatedElement} (see javadoc) or WithUserImpl,
|
// in some cases it could be serializable, e.g. if got via {@link java.lang.reflect.AnnotatedElement} (see javadoc) or WithUserImpl,
|
||||||
// and in some cases it used to be serialized, e.g. in {@link SecurityContextSerializer#JavaSerialization.serialize},
|
// and in some cases it used to be serialized, e.g. in {@link SecurityContextSerializer#JavaSerialization.serialize},
|
||||||
// must not be made transient!
|
// must not be made transient!
|
||||||
|
@SuppressWarnings("serial")
|
||||||
private final WithUser annotation;
|
private final WithUser annotation;
|
||||||
|
|
||||||
WithUserSecurityContext(final WithUser annotation) {
|
WithUserSecurityContext(final WithUser annotation) {
|
||||||
@@ -197,6 +198,9 @@ public class SecurityContextSwitch {
|
|||||||
|
|
||||||
private static class WithUserImpl implements WithUser, Serializable {
|
private static class WithUserImpl implements WithUser, Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final String principal;
|
private final String principal;
|
||||||
private final String tenant;
|
private final String tenant;
|
||||||
private final boolean autoCreateTenant;
|
private final boolean autoCreateTenant;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class DmfApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
DmfTenant dmfTenant(Tenant tenant, Amqp amqp) {
|
DmfTenant dmfTenant(final Tenant tenant, final Amqp amqp) {
|
||||||
return new DmfTenant(tenant, amqp);
|
return new DmfTenant(tenant, amqp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import org.springframework.amqp.core.Message;
|
|||||||
/**
|
/**
|
||||||
* An in-memory simulated DMF Tenant to hold the controller twins in memory and be able to retrieve them again.
|
* An in-memory simulated DMF Tenant to hold the controller twins in memory and be able to retrieve them again.
|
||||||
*/
|
*/
|
||||||
public class DmfTenant {
|
public final class DmfTenant {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final Tenant tenant;
|
private final Tenant tenant;
|
||||||
@@ -39,8 +39,8 @@ public class DmfTenant {
|
|||||||
|
|
||||||
public DmfTenant(final Tenant tenant, final Amqp amqp, final boolean initVHost) {
|
public DmfTenant(final Tenant tenant, final Amqp amqp, final boolean initVHost) {
|
||||||
this.tenant = tenant;
|
this.tenant = tenant;
|
||||||
this.vHost = amqp.getVhost(tenant.getDmf(), initVHost);
|
vHost = amqp.getVhost(tenant.getDmf(), initVHost);
|
||||||
this.vHost.register(this);
|
vHost.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
|||||||
* Abstract class for sender and receiver service.
|
* Abstract class for sender and receiver service.
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class VHost extends DmfSender implements MessageListener {
|
public final class VHost extends DmfSender implements MessageListener {
|
||||||
|
|
||||||
private static final String REGEX_EXTRACT_ACTION_ID = "[^0-9]";
|
private static final String REGEX_EXTRACT_ACTION_ID = "[^0-9]";
|
||||||
|
|
||||||
@@ -54,19 +54,12 @@ public class VHost extends DmfSender implements MessageListener {
|
|||||||
private final ConcurrentHashMap<String, DmfTenant> dmfTenants = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, DmfTenant> dmfTenants = new ConcurrentHashMap<>();
|
||||||
private final Set<Long> openActions = Collections.synchronizedSet(new HashSet<>());
|
private final Set<Long> openActions = Collections.synchronizedSet(new HashSet<>());
|
||||||
|
|
||||||
public VHost(final ConnectionFactory connectionFactory, final AmqpProperties amqpProperties) {
|
|
||||||
this(connectionFactory, amqpProperties, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public VHost(final ConnectionFactory connectionFactory, final AmqpProperties amqpProperties, final boolean initVHost) {
|
public VHost(final ConnectionFactory connectionFactory, final AmqpProperties amqpProperties, final boolean initVHost) {
|
||||||
super(new RabbitTemplate(connectionFactory), amqpProperties);
|
super(new RabbitTemplate(connectionFactory), amqpProperties);
|
||||||
|
|
||||||
// It is necessary to define rabbitTemplate as a Bean and set
|
// It is necessary to define rabbitTemplate as a Bean and set Jackson2JsonMessageConverter explicitly here in order to convert only
|
||||||
// Jackson2JsonMessageConverter explicitly here in order to convert only
|
// OUTCOMING messages to JSON. In case of INCOMING messages, Jackson2JsonMessageConverter can not handle messages with NULL
|
||||||
// OUTCOMING messages to json. In case of INCOMING messages,
|
// payload (e.g. REQUEST_ATTRIBUTES_UPDATE), so the SimpleMessageConverter is used instead per default.
|
||||||
// Jackson2JsonMessageConverter can not handle messages with NULL
|
|
||||||
// payload (e.g. REQUEST_ATTRIBUTES_UPDATE), so the
|
|
||||||
// SimpleMessageConverter is used instead per default.
|
|
||||||
rabbitTemplate.setMessageConverter(new Jackson2JsonMessageConverter());
|
rabbitTemplate.setMessageConverter(new Jackson2JsonMessageConverter());
|
||||||
|
|
||||||
if (initVHost) {
|
if (initVHost) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui;
|
|||||||
|
|
||||||
import static feign.Util.ISO_8859_1;
|
import static feign.Util.ISO_8859_1;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
@@ -53,6 +54,9 @@ import org.springframework.security.oauth2.core.oidc.user.OidcUser;
|
|||||||
@Import(FeignClientsConfiguration.class)
|
@Import(FeignClientsConfiguration.class)
|
||||||
public class HawkbitUiApp implements AppShellConfigurator {
|
public class HawkbitUiApp implements AppShellConfigurator {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final String AUTHORIZATION_HEADER = "Authorization";
|
private static final String AUTHORIZATION_HEADER = "Authorization";
|
||||||
private static final RequestInterceptor AUTHORIZATION = requestTemplate -> {
|
private static final RequestInterceptor AUTHORIZATION = requestTemplate -> {
|
||||||
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui;
|
package org.eclipse.hawkbit.ui;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -49,10 +50,13 @@ import org.eclipse.hawkbit.ui.view.TargetView;
|
|||||||
/**
|
/**
|
||||||
* The main view is a top-level placeholder for other views.
|
* The main view is a top-level placeholder for other views.
|
||||||
*/
|
*/
|
||||||
public class MainLayout extends AppLayout {
|
public final class MainLayout extends AppLayout {
|
||||||
|
|
||||||
static final List<Class<? extends Component>> DEFAULT_VIEW_PRIORITY = List.of(TargetView.class, DistributionSetView.class,
|
@Serial
|
||||||
SoftwareModuleView.class, RolloutView.class);
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
static final List<Class<? extends Component>> DEFAULT_VIEW_PRIORITY = List.of(
|
||||||
|
TargetView.class, DistributionSetView.class, SoftwareModuleView.class, RolloutView.class);
|
||||||
private final transient AuthenticatedUser authenticatedUser;
|
private final transient AuthenticatedUser authenticatedUser;
|
||||||
private final AccessAnnotationChecker accessChecker;
|
private final AccessAnnotationChecker accessChecker;
|
||||||
private H2 viewTitle;
|
private H2 viewTitle;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
package org.eclipse.hawkbit.ui;
|
package org.eclipse.hawkbit.ui;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@@ -19,7 +20,10 @@ import org.springframework.stereotype.Component;
|
|||||||
@Component
|
@Component
|
||||||
public class SimpleI18NProvider extends DefaultI18NProvider {
|
public class SimpleI18NProvider extends DefaultI18NProvider {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
SimpleI18NProvider() {
|
SimpleI18NProvider() {
|
||||||
super(Arrays.stream(Locale.getAvailableLocales()).toList());
|
super(Arrays.stream(Locale.getAvailableLocales()).toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
package org.eclipse.hawkbit.ui;
|
package org.eclipse.hawkbit.ui;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
import com.vaadin.flow.server.ServiceInitEvent;
|
import com.vaadin.flow.server.ServiceInitEvent;
|
||||||
import com.vaadin.flow.server.VaadinServiceInitListener;
|
import com.vaadin.flow.server.VaadinServiceInitListener;
|
||||||
import com.vaadin.flow.spring.annotation.SpringComponent;
|
import com.vaadin.flow.spring.annotation.SpringComponent;
|
||||||
@@ -19,6 +21,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@SpringComponent
|
@SpringComponent
|
||||||
public class VaadinServiceInit implements VaadinServiceInitListener {
|
public class VaadinServiceInit implements VaadinServiceInitListener {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@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
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.ui.component;
|
|||||||
|
|
||||||
import static org.eclipse.hawkbit.ui.view.Constants.STATUS;
|
import static org.eclipse.hawkbit.ui.view.Constants.STATUS;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -39,7 +40,10 @@ import org.eclipse.hawkbit.ui.view.TargetView;
|
|||||||
import org.eclipse.hawkbit.ui.view.util.Utils;
|
import org.eclipse.hawkbit.ui.view.util.Utils;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class TargetActionsHistory extends Grid<TargetActionsHistory.ActionStatusEntry> {
|
public final class TargetActionsHistory extends Grid<TargetActionsHistory.ActionStatusEntry> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient HawkbitMgmtClient hawkbitClient;
|
private final transient HawkbitMgmtClient hawkbitClient;
|
||||||
private transient MgmtTarget target;
|
private transient MgmtTarget target;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.view;
|
package org.eclipse.hawkbit.ui.view;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
import jakarta.annotation.security.RolesAllowed;
|
import jakarta.annotation.security.RolesAllowed;
|
||||||
|
|
||||||
import com.vaadin.flow.component.html.H2;
|
import com.vaadin.flow.component.html.H2;
|
||||||
@@ -24,7 +26,10 @@ import org.eclipse.hawkbit.ui.MainLayout;
|
|||||||
@Route(value = "about", layout = MainLayout.class)
|
@Route(value = "about", layout = MainLayout.class)
|
||||||
@RouteAlias(value = "", layout = MainLayout.class)
|
@RouteAlias(value = "", layout = MainLayout.class)
|
||||||
@RolesAllowed({ "ANONYMOUS" })
|
@RolesAllowed({ "ANONYMOUS" })
|
||||||
public class AboutView extends VerticalLayout {
|
public final class AboutView extends VerticalLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public AboutView() {
|
public AboutView() {
|
||||||
setSpacing(false);
|
setSpacing(false);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.view;
|
package org.eclipse.hawkbit.ui.view;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -32,12 +33,15 @@ import org.eclipse.hawkbit.ui.MainLayout;
|
|||||||
@Route(value = "config", layout = MainLayout.class)
|
@Route(value = "config", layout = MainLayout.class)
|
||||||
@RolesAllowed({ "CONFIG_READ" })
|
@RolesAllowed({ "CONFIG_READ" })
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ConfigView extends VerticalLayout {
|
public final class ConfigView extends VerticalLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final String WIDTH = "width";
|
private static final String WIDTH = "width";
|
||||||
private static final String PX_300 = "300px";
|
private static final String PX_300 = "300px";
|
||||||
|
|
||||||
private final Map<String, MgmtSystemTenantConfigurationValueRequest> configValue = new HashMap<>();
|
private final transient Map<String, MgmtSystemTenantConfigurationValueRequest> configValue = new HashMap<>();
|
||||||
|
|
||||||
public ConfigView(final HawkbitMgmtClient hawkbitClient) {
|
public ConfigView(final HawkbitMgmtClient hawkbitClient) {
|
||||||
setSpacing(false);
|
setSpacing(false);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.view;
|
package org.eclipse.hawkbit.ui.view;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -64,6 +65,9 @@ import org.eclipse.hawkbit.ui.view.util.Utils;
|
|||||||
@Uses(Icon.class)
|
@Uses(Icon.class)
|
||||||
public class DistributionSetView extends TableView<MgmtDistributionSet, Long> {
|
public class DistributionSetView extends TableView<MgmtDistributionSet, Long> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public DistributionSetView(final HawkbitMgmtClient hawkbitClient) {
|
public DistributionSetView(final HawkbitMgmtClient hawkbitClient) {
|
||||||
super(
|
super(
|
||||||
new DistributionSetFilter(hawkbitClient),
|
new DistributionSetFilter(hawkbitClient),
|
||||||
@@ -184,6 +188,9 @@ public class DistributionSetView extends TableView<MgmtDistributionSet, Long> {
|
|||||||
|
|
||||||
private static class DistributionSetDetails extends FormLayout {
|
private static class DistributionSetDetails extends FormLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient HawkbitMgmtClient hawkbitClient;
|
private final transient HawkbitMgmtClient hawkbitClient;
|
||||||
|
|
||||||
private final TextArea description = new TextArea("Description");
|
private final TextArea description = new TextArea("Description");
|
||||||
@@ -238,6 +245,9 @@ public class DistributionSetView extends TableView<MgmtDistributionSet, Long> {
|
|||||||
|
|
||||||
private static class CreateDialog extends Utils.BaseDialog<Void> {
|
private static class CreateDialog extends Utils.BaseDialog<Void> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient HawkbitMgmtClient hawkbitClient;
|
private final transient HawkbitMgmtClient hawkbitClient;
|
||||||
|
|
||||||
private final Select<MgmtDistributionSetType> type;
|
private final Select<MgmtDistributionSetType> type;
|
||||||
@@ -325,6 +335,9 @@ public class DistributionSetView extends TableView<MgmtDistributionSet, Long> {
|
|||||||
@SuppressWarnings({ "java:S1171", "java:S3599" })
|
@SuppressWarnings({ "java:S1171", "java:S3599" })
|
||||||
private static class AddSoftwareModulesDialog extends Utils.BaseDialog<Void> {
|
private static class AddSoftwareModulesDialog extends Utils.BaseDialog<Void> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient Set<MgmtSoftwareModule> softwareModules = Collections.synchronizedSet(new HashSet<>());
|
private final transient Set<MgmtSoftwareModule> softwareModules = Collections.synchronizedSet(new HashSet<>());
|
||||||
|
|
||||||
private AddSoftwareModulesDialog(final long distributionSetId, final HawkbitMgmtClient hawkbitClient) {
|
private AddSoftwareModulesDialog(final long distributionSetId, final HawkbitMgmtClient hawkbitClient) {
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.view;
|
package org.eclipse.hawkbit.ui.view;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
import com.vaadin.flow.component.login.LoginI18n;
|
import com.vaadin.flow.component.login.LoginI18n;
|
||||||
import com.vaadin.flow.component.login.LoginOverlay;
|
import com.vaadin.flow.component.login.LoginOverlay;
|
||||||
import com.vaadin.flow.router.BeforeEnterEvent;
|
import com.vaadin.flow.router.BeforeEnterEvent;
|
||||||
@@ -23,7 +25,10 @@ import org.eclipse.hawkbit.ui.security.AuthenticatedUser;
|
|||||||
@AnonymousAllowed
|
@AnonymousAllowed
|
||||||
@PageTitle("Login")
|
@PageTitle("Login")
|
||||||
@Route(value = "login")
|
@Route(value = "login")
|
||||||
public class LoginView extends LoginOverlay implements BeforeEnterObserver {
|
public final class LoginView extends LoginOverlay implements BeforeEnterObserver {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient AuthenticatedUser authenticatedUser;
|
private final transient AuthenticatedUser authenticatedUser;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.view;
|
package org.eclipse.hawkbit.ui.view;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -63,7 +64,10 @@ import org.springframework.util.ObjectUtils;
|
|||||||
@RolesAllowed({ "ROLLOUT_READ" })
|
@RolesAllowed({ "ROLLOUT_READ" })
|
||||||
@Uses(Icon.class)
|
@Uses(Icon.class)
|
||||||
@SuppressWarnings({ "java:S1171", "java:S3599" })
|
@SuppressWarnings({ "java:S1171", "java:S3599" })
|
||||||
public class RolloutView extends TableView<MgmtRolloutResponseBody, Long> {
|
public final class RolloutView extends TableView<MgmtRolloutResponseBody, Long> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public RolloutView(final HawkbitMgmtClient hawkbitClient) {
|
public RolloutView(final HawkbitMgmtClient hawkbitClient) {
|
||||||
super(
|
super(
|
||||||
@@ -105,6 +109,9 @@ public class RolloutView extends TableView<MgmtRolloutResponseBody, Long> {
|
|||||||
|
|
||||||
private static class Actions extends HorizontalLayout {
|
private static class Actions extends HorizontalLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final long rolloutId;
|
private final long rolloutId;
|
||||||
private final Grid<MgmtRolloutResponseBody> grid;
|
private final Grid<MgmtRolloutResponseBody> grid;
|
||||||
private final transient HawkbitMgmtClient hawkbitClient;
|
private final transient HawkbitMgmtClient hawkbitClient;
|
||||||
@@ -190,6 +197,9 @@ public class RolloutView extends TableView<MgmtRolloutResponseBody, Long> {
|
|||||||
|
|
||||||
private static class RolloutDetails extends FormLayout {
|
private static class RolloutDetails extends FormLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient HawkbitMgmtClient hawkbitClient;
|
private final transient HawkbitMgmtClient hawkbitClient;
|
||||||
|
|
||||||
private final TextArea description = new TextArea(Constants.DESCRIPTION);
|
private final TextArea description = new TextArea(Constants.DESCRIPTION);
|
||||||
@@ -283,6 +293,9 @@ public class RolloutView extends TableView<MgmtRolloutResponseBody, Long> {
|
|||||||
|
|
||||||
private static class CreateDialog extends Utils.BaseDialog<Void> {
|
private static class CreateDialog extends Utils.BaseDialog<Void> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final TextField name;
|
private final TextField name;
|
||||||
private final ComboBox<MgmtDistributionSet> distributionSet;
|
private final ComboBox<MgmtDistributionSet> distributionSet;
|
||||||
private final ComboBox<MgmtTargetFilterQuery> targetFilter;
|
private final ComboBox<MgmtTargetFilterQuery> targetFilter;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.ui.view;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -69,6 +70,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class SoftwareModuleView extends TableView<MgmtSoftwareModule, Long> {
|
public class SoftwareModuleView extends TableView<MgmtSoftwareModule, Long> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public SoftwareModuleView(final HawkbitMgmtClient hawkbitClient) {
|
public SoftwareModuleView(final HawkbitMgmtClient hawkbitClient) {
|
||||||
this(true, hawkbitClient);
|
this(true, hawkbitClient);
|
||||||
@@ -156,6 +160,9 @@ public class SoftwareModuleView extends TableView<MgmtSoftwareModule, Long> {
|
|||||||
|
|
||||||
private static class SoftwareModuleDetails extends FormLayout {
|
private static class SoftwareModuleDetails extends FormLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient HawkbitMgmtClient hawkbitClient;
|
private final transient HawkbitMgmtClient hawkbitClient;
|
||||||
|
|
||||||
private final TextArea description = new TextArea(Constants.DESCRIPTION);
|
private final TextArea description = new TextArea(Constants.DESCRIPTION);
|
||||||
@@ -202,6 +209,9 @@ public class SoftwareModuleView extends TableView<MgmtSoftwareModule, Long> {
|
|||||||
|
|
||||||
private static class CreateDialog extends Utils.BaseDialog<Void> {
|
private static class CreateDialog extends Utils.BaseDialog<Void> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final Select<MgmtSoftwareModuleType> type;
|
private final Select<MgmtSoftwareModuleType> type;
|
||||||
private final TextField name;
|
private final TextField name;
|
||||||
private final TextField version;
|
private final TextField version;
|
||||||
@@ -337,6 +347,9 @@ public class SoftwareModuleView extends TableView<MgmtSoftwareModule, Long> {
|
|||||||
|
|
||||||
private static class AddArtifactsDialog extends Utils.BaseDialog<Void> {
|
private static class AddArtifactsDialog extends Utils.BaseDialog<Void> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient Set<MgmtArtifact> artifacts = Collections.synchronizedSet(new HashSet<>());
|
private final transient Set<MgmtArtifact> artifacts = Collections.synchronizedSet(new HashSet<>());
|
||||||
|
|
||||||
private AddArtifactsDialog(
|
private AddArtifactsDialog(
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.view;
|
package org.eclipse.hawkbit.ui.view;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -91,7 +92,10 @@ import org.springframework.util.ObjectUtils;
|
|||||||
@Route(value = "targets", layout = MainLayout.class)
|
@Route(value = "targets", layout = MainLayout.class)
|
||||||
@RolesAllowed({ "TARGET_READ" })
|
@RolesAllowed({ "TARGET_READ" })
|
||||||
@Uses(Icon.class)
|
@Uses(Icon.class)
|
||||||
public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
public final class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static final String STATUS = "Status";
|
public static final String STATUS = "Status";
|
||||||
public static final String UPDATE = "Sync";
|
public static final String UPDATE = "Sync";
|
||||||
@@ -344,6 +348,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
protected static class TargetDetailedView extends VerticalLayout {
|
protected static class TargetDetailedView extends VerticalLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final Span targetId;
|
private final Span targetId;
|
||||||
private final TargetDetails targetDetails;
|
private final TargetDetails targetDetails;
|
||||||
private final TargetAssignedInstalled targetAssignedInstalled;
|
private final TargetAssignedInstalled targetAssignedInstalled;
|
||||||
@@ -383,6 +390,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
private static class TargetDetails extends FormLayout {
|
private static class TargetDetails extends FormLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient HawkbitMgmtClient hawkbitClient;
|
private final transient HawkbitMgmtClient hawkbitClient;
|
||||||
private final TextArea description = new TextArea(Constants.DESCRIPTION);
|
private final TextArea description = new TextArea(Constants.DESCRIPTION);
|
||||||
private final TextField createdBy = Utils.textField(Constants.CREATED_BY);
|
private final TextField createdBy = Utils.textField(Constants.CREATED_BY);
|
||||||
@@ -444,6 +454,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
private static class TargetAssignedInstalled extends FormLayout {
|
private static class TargetAssignedInstalled extends FormLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient HawkbitMgmtClient hawkbitClient;
|
private final transient HawkbitMgmtClient hawkbitClient;
|
||||||
private final LinkedTextArea assigned = new LinkedTextArea("Assigned Distribution Set", "/distribution_sets?");
|
private final LinkedTextArea assigned = new LinkedTextArea("Assigned Distribution Set", "/distribution_sets?");
|
||||||
private final LinkedTextArea installed = new LinkedTextArea("Installed Distribution Set", "/distribution_sets?");
|
private final LinkedTextArea installed = new LinkedTextArea("Installed Distribution Set", "/distribution_sets?");
|
||||||
@@ -489,6 +502,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
private static class TargetTags extends VerticalLayout {
|
private static class TargetTags extends VerticalLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient HawkbitMgmtClient hawkbitClient;
|
private final transient HawkbitMgmtClient hawkbitClient;
|
||||||
private final ComboBox<MgmtTag> tagSelector = new ComboBox<>(TAG);
|
private final ComboBox<MgmtTag> tagSelector = new ComboBox<>(TAG);
|
||||||
private final HorizontalLayout tagsArea = new HorizontalLayout();
|
private final HorizontalLayout tagsArea = new HorizontalLayout();
|
||||||
@@ -601,6 +617,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
private static class TargetMetadata extends VerticalLayout {
|
private static class TargetMetadata extends VerticalLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static final String KEY = "Key";
|
public static final String KEY = "Key";
|
||||||
public static final String VALUE = "Value";
|
public static final String VALUE = "Value";
|
||||||
|
|
||||||
@@ -672,7 +691,10 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TargetActionsHistoryLayout extends VerticalLayout {
|
public static final class TargetActionsHistoryLayout extends VerticalLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final TargetActionsHistory targetActionsHistory;
|
private final TargetActionsHistory targetActionsHistory;
|
||||||
|
|
||||||
@@ -689,6 +711,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
public static class ActionStepsGrid extends Grid<ActionStepsGrid.ActionStepEntry> {
|
public static class ActionStepsGrid extends Grid<ActionStepsGrid.ActionStepEntry> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient HawkbitMgmtClient hawkbitClient;
|
private final transient HawkbitMgmtClient hawkbitClient;
|
||||||
private transient MgmtTarget target;
|
private transient MgmtTarget target;
|
||||||
private transient Long actionId;
|
private transient Long actionId;
|
||||||
@@ -775,6 +800,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
private static class RegisterDialog extends Utils.BaseDialog<Void> {
|
private static class RegisterDialog extends Utils.BaseDialog<Void> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final Select<MgmtTargetType> type;
|
private final Select<MgmtTargetType> type;
|
||||||
private final TextField controllerId;
|
private final TextField controllerId;
|
||||||
private final TextField name;
|
private final TextField name;
|
||||||
@@ -850,6 +878,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
private static class AssignDialog extends Utils.BaseDialog<Void> {
|
private static class AssignDialog extends Utils.BaseDialog<Void> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final ComboBox<MgmtDistributionSet> distributionSet;
|
private final ComboBox<MgmtDistributionSet> distributionSet;
|
||||||
private final Select<MgmtActionType> actionType;
|
private final Select<MgmtActionType> actionType;
|
||||||
private final DateTimePicker forceTime = new DateTimePicker("Force Time");
|
private final DateTimePicker forceTime = new DateTimePicker("Force Time");
|
||||||
@@ -918,6 +949,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
private static class CreateTagDialog extends Utils.BaseDialog<Void> {
|
private static class CreateTagDialog extends Utils.BaseDialog<Void> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final TextField name;
|
private final TextField name;
|
||||||
private final TextArea description = new TextArea(Constants.DESCRIPTION);
|
private final TextArea description = new TextArea(Constants.DESCRIPTION);
|
||||||
|
|
||||||
@@ -961,6 +995,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
private static class AddMetadataDialog extends Utils.BaseDialog<Void> {
|
private static class AddMetadataDialog extends Utils.BaseDialog<Void> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final TextField key;
|
private final TextField key;
|
||||||
private final TextField value;
|
private final TextField value;
|
||||||
|
|
||||||
@@ -1001,6 +1038,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
private static class TargetStatusCell extends HorizontalLayout {
|
private static class TargetStatusCell extends HorizontalLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private TargetStatusCell(final MgmtTarget target) {
|
private TargetStatusCell(final MgmtTarget target) {
|
||||||
final MgmtPollStatus pollStatus = target.getPollStatus();
|
final MgmtPollStatus pollStatus = target.getPollStatus();
|
||||||
add(pollStatusIconMapper(pollStatus));
|
add(pollStatusIconMapper(pollStatus));
|
||||||
@@ -1024,6 +1064,9 @@ public class TargetView extends TableView<TargetView.TargetWithDs, String> {
|
|||||||
|
|
||||||
private static class TargetUpdateStatusCell extends HorizontalLayout {
|
private static class TargetUpdateStatusCell extends HorizontalLayout {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private TargetUpdateStatusCell(final MgmtTarget target) {
|
private TargetUpdateStatusCell(final MgmtTarget target) {
|
||||||
final String targetUpdateStatus = Optional.ofNullable(target.getUpdateStatus()).orElse("unknown");
|
final String targetUpdateStatus = Optional.ofNullable(target.getUpdateStatus()).orElse("unknown");
|
||||||
add(targetUpdateStatusMapper(targetUpdateStatus));
|
add(targetUpdateStatusMapper(targetUpdateStatus));
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.view.util;
|
package org.eclipse.hawkbit.ui.view.util;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -30,7 +31,10 @@ import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
|||||||
import com.vaadin.flow.theme.lumo.LumoUtility;
|
import com.vaadin.flow.theme.lumo.LumoUtility;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
public class Filter extends Div {
|
public final class Filter extends Div {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private transient Rsql rsql;
|
private transient Rsql rsql;
|
||||||
private final transient Rsql secondaryRsql;
|
private final transient Rsql secondaryRsql;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.view.util;
|
package org.eclipse.hawkbit.ui.view.util;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
import com.vaadin.flow.component.card.Card;
|
import com.vaadin.flow.component.card.Card;
|
||||||
import com.vaadin.flow.component.card.CardVariant;
|
import com.vaadin.flow.component.card.CardVariant;
|
||||||
import com.vaadin.flow.component.html.Anchor;
|
import com.vaadin.flow.component.html.Anchor;
|
||||||
@@ -17,27 +19,29 @@ import com.vaadin.flow.component.html.Span;
|
|||||||
|
|
||||||
public class LinkedTextArea extends Div {
|
public class LinkedTextArea extends Div {
|
||||||
|
|
||||||
String queryPrefix;
|
@Serial
|
||||||
Card card;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public LinkedTextArea(String title, String queryPrefix) {
|
private final String queryPrefix;
|
||||||
super();
|
private final Card card;
|
||||||
|
|
||||||
|
public LinkedTextArea(final String title, final String queryPrefix) {
|
||||||
|
this.queryPrefix = queryPrefix;
|
||||||
card = new Card();
|
card = new Card();
|
||||||
card.setTitle(title);
|
card.setTitle(title);
|
||||||
this.queryPrefix = queryPrefix;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValueWithLink(String value, String query) {
|
public void setValueWithLink(String value, String query) {
|
||||||
var span = new Span(value);
|
final Span span = new Span(value);
|
||||||
span.setWhiteSpace(WhiteSpace.PRE_WRAP);
|
span.setWhiteSpace(WhiteSpace.PRE_WRAP);
|
||||||
card.add(span);
|
card.add(span);
|
||||||
card.addThemeVariants(CardVariant.LUMO_ELEVATED);
|
card.addThemeVariants(CardVariant.LUMO_ELEVATED);
|
||||||
if (query != null) {
|
if (query != null) {
|
||||||
var a = new Anchor(queryPrefix + query, card);
|
final Anchor anchor = new Anchor(queryPrefix + query, card);
|
||||||
a.addClassName("nocolor");
|
anchor.addClassName("nocolor");
|
||||||
add(a);
|
add(anchor);
|
||||||
} else {
|
} else {
|
||||||
add(card);
|
add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.view.util;
|
package org.eclipse.hawkbit.ui.view.util;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -24,7 +25,10 @@ import com.vaadin.flow.theme.lumo.LumoUtility;
|
|||||||
|
|
||||||
// id type shall have proper equals and hashCode - i.e. eligible hash set element
|
// id type shall have proper equals and hashCode - i.e. eligible hash set element
|
||||||
@SuppressWarnings("java:S119") // better readability
|
@SuppressWarnings("java:S119") // better readability
|
||||||
public class SelectionGrid<T, ID> extends Grid<T> {
|
public final class SelectionGrid<T, ID> extends Grid<T> {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private volatile String rsqlFilter;
|
private volatile String rsqlFilter;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.view.util;
|
package org.eclipse.hawkbit.ui.view.util;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.concurrent.CompletionStage;
|
import java.util.concurrent.CompletionStage;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -38,6 +39,9 @@ import org.eclipse.hawkbit.ui.view.Constants;
|
|||||||
@SuppressWarnings("java:S119") // better readability
|
@SuppressWarnings("java:S119") // better readability
|
||||||
public class TableView<T, ID> extends Div implements Constants, BeforeEnterObserver {
|
public class TableView<T, ID> extends Div implements Constants, BeforeEnterObserver {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final String COLOR = "color";
|
private static final String COLOR = "color";
|
||||||
private static final String VAR_LUMO_SECONDARY_TEXT_COLOR = "var(--lumo-secondary-text-color)";
|
private static final String VAR_LUMO_SECONDARY_TEXT_COLOR = "var(--lumo-secondary-text-color)";
|
||||||
private static final String VAR_LUMO_PRIMARY_COLOR = "var(--lumo-primary-color)";
|
private static final String VAR_LUMO_PRIMARY_COLOR = "var(--lumo-primary-color)";
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.view.util;
|
package org.eclipse.hawkbit.ui.view.util;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -58,17 +59,15 @@ import com.vaadin.flow.data.renderer.ComponentRenderer;
|
|||||||
import com.vaadin.flow.data.renderer.LocalDateTimeRenderer;
|
import com.vaadin.flow.data.renderer.LocalDateTimeRenderer;
|
||||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||||
import com.vaadin.flow.theme.lumo.LumoUtility;
|
import com.vaadin.flow.theme.lumo.LumoUtility;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
|
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
|
||||||
import org.eclipse.hawkbit.ui.view.Constants;
|
import org.eclipse.hawkbit.ui.view.Constants;
|
||||||
|
|
||||||
|
@NoArgsConstructor(access = lombok.AccessLevel.PRIVATE) // prevent initialization
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
private Utils() {
|
|
||||||
// prevent initialization
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String COMBO_NAME_ALLOWED_CHARS = "[0-9a-zA-Z-_./]";
|
public static final String COMBO_NAME_ALLOWED_CHARS = "[0-9a-zA-Z-_./]";
|
||||||
|
|
||||||
public static TextField textField(final String label) {
|
public static TextField textField(final String label) {
|
||||||
@@ -148,8 +147,8 @@ public class Utils {
|
|||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T, ID> ConfirmDialog promptForDeleteConfirmation(Function<SelectionGrid<T, ID>, CompletionStage<Void>> removeHandler,
|
private static <T, ID> ConfirmDialog promptForDeleteConfirmation(
|
||||||
SelectionGrid<T, ID> selectionGrid) {
|
final Function<SelectionGrid<T, ID>, CompletionStage<Void>> removeHandler, final SelectionGrid<T, ID> selectionGrid) {
|
||||||
final ConfirmDialog dialog = new ConfirmDialog();
|
final ConfirmDialog dialog = new ConfirmDialog();
|
||||||
dialog.setHeader("Confirm Deletion");
|
dialog.setHeader("Confirm Deletion");
|
||||||
dialog.setText("Are you sure you want to delete the selected items? This action cannot be undone.");
|
dialog.setText("Are you sure you want to delete the selected items? This action cannot be undone.");
|
||||||
@@ -160,9 +159,7 @@ public class Utils {
|
|||||||
dialog.setConfirmButtonTheme(ButtonVariant.LUMO_ERROR.getVariantName());
|
dialog.setConfirmButtonTheme(ButtonVariant.LUMO_ERROR.getVariantName());
|
||||||
dialog.setConfirmText("Delete");
|
dialog.setConfirmText("Delete");
|
||||||
dialog.addConfirmListener(event -> {
|
dialog.addConfirmListener(event -> {
|
||||||
removeHandler
|
removeHandler.apply(selectionGrid).thenAccept(v -> selectionGrid.refreshGrid(false));
|
||||||
.apply(selectionGrid)
|
|
||||||
.thenAccept(v -> selectionGrid.refreshGrid(false));
|
|
||||||
dialog.close();
|
dialog.close();
|
||||||
});
|
});
|
||||||
return dialog;
|
return dialog;
|
||||||
@@ -238,6 +235,9 @@ public class Utils {
|
|||||||
|
|
||||||
public static class BaseDialog<T> extends Dialog {
|
public static class BaseDialog<T> extends Dialog {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected final transient CompletableFuture<T> result = new CompletableFuture<>();
|
protected final transient CompletableFuture<T> result = new CompletableFuture<>();
|
||||||
|
|
||||||
protected BaseDialog(final String headerTitle) {
|
protected BaseDialog(final String headerTitle) {
|
||||||
|
|||||||
11
pom.xml
11
pom.xml
@@ -196,6 +196,12 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
@@ -378,6 +384,7 @@
|
|||||||
-->
|
-->
|
||||||
<groupId>com.diffplug.spotless</groupId>
|
<groupId>com.diffplug.spotless</groupId>
|
||||||
<artifactId>spotless-maven-plugin</artifactId>
|
<artifactId>spotless-maven-plugin</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<ratchetFrom>${ratchetFrom}</ratchetFrom>
|
<ratchetFrom>${ratchetFrom}</ratchetFrom>
|
||||||
<java>
|
<java>
|
||||||
@@ -467,7 +474,9 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<compilerArgument>-Xlint:all</compilerArgument>
|
<parameters>true</parameters>
|
||||||
|
<proc>full</proc>
|
||||||
|
<compilerArgument>-Xlint:all,-processing</compilerArgument>
|
||||||
<showWarnings>true</showWarnings>
|
<showWarnings>true</showWarnings>
|
||||||
<showDeprecation>true</showDeprecation>
|
<showDeprecation>true</showDeprecation>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
Reference in New Issue
Block a user