Remove CustomEvents - unused (#2039)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-15 20:01:18 +02:00
committed by GitHub
parent ec6009b268
commit 05dd580a28
26 changed files with 47 additions and 97 deletions

View File

@@ -28,5 +28,4 @@ public interface AutoAssignExecutor {
* @param controllerId of the device to check
*/
void checkSingleTarget(String controllerId);
}
}

View File

@@ -22,5 +22,4 @@ public interface ActionStatusBuilder {
* @return create builder
*/
ActionStatusCreate create(long actionId);
}
}

View File

@@ -30,5 +30,4 @@ public interface SoftwareModuleMetadataBuilder {
* @return builder instance
*/
SoftwareModuleMetadataCreate create(long softwareModuleId);
}
}

View File

@@ -46,5 +46,4 @@ public interface SoftwareModuleMetadataCreate {
* builder
*/
SoftwareModuleMetadata build();
}
}

View File

@@ -32,5 +32,4 @@ public interface SoftwareModuleMetadataUpdate {
* @return updated builder instance
*/
SoftwareModuleMetadataUpdate targetVisible(Boolean visible);
}
}

View File

@@ -26,4 +26,4 @@ public interface SoftwareModuleTypeBuilder {
* @return builder instance
*/
SoftwareModuleTypeCreate create();
}
}

View File

@@ -59,4 +59,4 @@ public interface SoftwareModuleTypeCreate {
* builder
*/
SoftwareModuleType build();
}
}

View File

@@ -26,5 +26,4 @@ public interface TagBuilder {
* @return builder instance
*/
TagCreate create();
}
}

View File

@@ -38,5 +38,4 @@ public interface TagUpdate {
* @return updated builder instance
*/
TagUpdate colour(@Size(max = Tag.COLOUR_MAX_SIZE) String colour);
}
}

View File

@@ -28,4 +28,4 @@ public interface TargetBuilder {
* @return builder instance
*/
TargetCreate create();
}
}

View File

@@ -81,5 +81,4 @@ public interface TargetCreate {
* @return peek on current state of {@link Target} in the builder
*/
Target build();
}
}

View File

@@ -36,4 +36,4 @@ public interface TargetFilterQueryBuilder {
* @return builder instance
*/
TargetFilterQueryCreate create();
}
}

View File

@@ -92,4 +92,4 @@ public interface TargetFilterQueryCreate {
* @return peek on current state of {@link TargetFilterQuery} in the builder
*/
TargetFilterQuery build();
}
}

View File

@@ -31,4 +31,4 @@ public interface TargetFilterQueryUpdate {
* @return updated builder instance
*/
TargetFilterQueryUpdate query(@Size(min = 1, max = TargetFilterQuery.QUERY_MAX_SIZE) String query);
}
}

View File

@@ -26,4 +26,4 @@ public interface TargetTypeBuilder {
* @return builder instance
*/
TargetTypeCreate create();
}
}

View File

@@ -80,4 +80,4 @@ public interface TargetTypeCreate {
* builder
*/
TargetType build();
}
}

View File

@@ -38,4 +38,4 @@ public interface TargetTypeUpdate {
* @return updated builder instance
*/
TargetTypeUpdate name(@Size(max = NamedEntity.NAME_MAX_SIZE) String name);
}
}

View File

@@ -70,4 +70,4 @@ public interface TargetUpdate {
* @return updated builder instance
*/
TargetUpdate requestAttributes(Boolean requestAttributes);
}
}

View File

@@ -23,4 +23,4 @@ public interface ApplicationEventFilter {
* @return true if event should be filtered
*/
boolean filter(final ApplicationEvent event);
}
}

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.repository.event;
/**
* Events to be published to refresh data on UI.
*/
public enum CustomEvents {
TARGETS_CREATED_EVENT,
DISTRIBUTION_CREATED_EVENT
}

View File

@@ -20,4 +20,4 @@ public interface TenantAwareEvent {
* @return the tenant of the event.
*/
String getTenant();
}
}

View File

@@ -14,8 +14,7 @@ import java.util.Objects;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
/**
* Event which is published in case a {@linkplain RolloutGroup} is created or
* updated
* Event which is published in case a {@linkplain RolloutGroup} is created or updated
*/
public abstract class AbstractRolloutGroupEvent extends RemoteEntityEvent<RolloutGroup> {

View File

@@ -41,5 +41,4 @@ public interface ActionStatus extends TenantAwareBaseEntity {
Status getStatus();
Optional<Integer> getCode();
}
}

View File

@@ -15,6 +15,7 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import lombok.Getter;
import org.eclipse.hawkbit.repository.ValidString;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.springframework.util.StringUtils;
@@ -34,12 +35,9 @@ public abstract class AbstractActionStatusCreate<T> {
protected List<@ValidString String> messages;
@Getter
protected Long actionId;
public Long getActionId() {
return actionId;
}
public T status(final Status status) {
this.status = status;
@@ -59,10 +57,11 @@ public abstract class AbstractActionStatusCreate<T> {
}
public T messages(final Collection<String> messages) {
final List<String> newMessages = messages.stream().map(String::strip).toList();
if (this.messages == null) {
this.messages = messages.stream().map(StringUtils::trimWhitespace).collect(Collectors.toList());
this.messages = newMessages;
} else {
this.messages.addAll(messages.stream().map(StringUtils::trimWhitespace).collect(Collectors.toList()));
this.messages.addAll(newMessages);
}
return (T) this;
@@ -72,7 +71,7 @@ public abstract class AbstractActionStatusCreate<T> {
if (this.messages == null) {
this.messages = new ArrayList<>();
}
this.messages.add(StringUtils.trimWhitespace(message));
this.messages.add(message.strip());
return (T) this;
}
@@ -80,5 +79,4 @@ public abstract class AbstractActionStatusCreate<T> {
public Optional<Long> getOccurredAt() {
return Optional.ofNullable(occurredAt);
}
}
}

View File

@@ -16,8 +16,7 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
/**
* Create/build implementation.
*/
public class JpaActionStatusCreate extends AbstractActionStatusCreate<ActionStatusCreate>
implements ActionStatusCreate {
public class JpaActionStatusCreate extends AbstractActionStatusCreate<ActionStatusCreate> implements ActionStatusCreate {
JpaActionStatusCreate(final Long actionId) {
super.actionId = actionId;

View File

@@ -9,6 +9,7 @@
*/
package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -30,6 +31,10 @@ import jakarta.persistence.NamedEntityGraph;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus;
@@ -37,20 +42,23 @@ import org.eclipse.hawkbit.repository.model.ActionStatus;
/**
* Entity to store the status for a specific action.
*/
@NoArgsConstructor(access = AccessLevel.PUBLIC) // JPA default constructor
@Table(name = "sp_action_status", indexes = {
@Index(name = "sp_idx_action_status_02", columnList = "tenant,action,status"),
@Index(name = "sp_idx_action_status_prim", columnList = "tenant,id") })
@Index(name = "sp_idx_action_status_prim", columnList = "tenant,id")
})
@NamedEntityGraph(name = "ActionStatus.withMessages", attributeNodes = { @NamedAttributeNode("messages") })
@Entity
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
// sub entities
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
@SuppressWarnings("squid:S2160")
public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements ActionStatus {
private static final int MESSAGE_ENTRY_LENGTH = 512;
@Serial
private static final long serialVersionUID = 1L;
private static final int MESSAGE_ENTRY_LENGTH = 512;
@Setter @Getter
@Column(name = "target_occurred_at", nullable = false, updatable = false)
private long occurredAt;
@@ -61,11 +69,13 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
@NotNull
private JpaAction action;
@Setter @Getter
@Column(name = "status", nullable = false, updatable = false)
@Convert(converter = JpaAction.StatusConverter.class)
@NotNull
private Status status;
// TODO - messages is not used yet. Check and verify if to remove or expose via REST API
// no cascade option on an ElementCollection, the target objects are always persisted, merged, removed with their parent.
@ElementCollection(fetch = FetchType.LAZY, targetClass = String.class)
@CollectionTable(
@@ -78,6 +88,7 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
@Column(name = "detail_message", length = MESSAGE_ENTRY_LENGTH, nullable = false, insertable = false, updatable = false)
private List<String> messages;
@Setter
@Column(name = "code", nullable = true, updatable = false)
private Integer code;
@@ -120,22 +131,6 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
this.occurredAt = occurredAt;
}
/**
* JPA default constructor.
*/
public JpaActionStatus() {
// JPA default constructor.
}
@Override
public long getOccurredAt() {
return occurredAt;
}
public void setOccurredAt(final long occurredAt) {
this.occurredAt = occurredAt;
}
@Override
public Action getAction() {
return action;
@@ -145,23 +140,10 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
this.action = (JpaAction) action;
}
@Override
public Status getStatus() {
return status;
}
public void setStatus(final Status status) {
this.status = status;
}
public Optional<Integer> getCode() {
return Optional.ofNullable(code);
}
public void setCode(final Integer code) {
this.code = code;
}
public final void addMessage(final String message) {
if (message != null) {
if (messages == null) {
@@ -191,4 +173,4 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
return Collections.unmodifiableList(messages);
}
}
}