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 * @param controllerId of the device to check
*/ */
void checkSingleTarget(String controllerId); void checkSingleTarget(String controllerId);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -23,4 +23,4 @@ public interface ApplicationEventFilter {
* @return true if event should be filtered * @return true if event should be filtered
*/ */
boolean filter(final ApplicationEvent event); 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. * @return the tenant of the event.
*/ */
String getTenant(); String getTenant();
} }

View File

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

View File

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

View File

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

View File

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

View File

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