Добавлен вывод позиций найденных паттернов
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
package ru.serega6531.packmate.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "service")
|
||||
@ToString(exclude = "streams")
|
||||
public class CtfService {
|
||||
|
||||
@Id
|
||||
@@ -18,8 +16,4 @@ public class CtfService {
|
||||
|
||||
private String name;
|
||||
|
||||
@OneToMany(mappedBy = "service", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JsonIgnore
|
||||
private List<Stream> streams;
|
||||
|
||||
}
|
||||
38
src/main/java/ru/serega6531/packmate/model/FoundPattern.java
Normal file
38
src/main/java/ru/serega6531/packmate/model/FoundPattern.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package ru.serega6531.packmate.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
@GenericGenerator(
|
||||
name = "found_pattern_generator",
|
||||
strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
|
||||
parameters = {
|
||||
@org.hibernate.annotations.Parameter(name = "sequence_name", value = "found_pattern_seq"),
|
||||
@org.hibernate.annotations.Parameter(name = "initial_value", value = "1"),
|
||||
@org.hibernate.annotations.Parameter(name = "increment_size", value = "1")
|
||||
}
|
||||
)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Getter
|
||||
@ToString
|
||||
public class FoundPattern {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(generator = "found_pattern_generator")
|
||||
@JsonIgnore
|
||||
private int id;
|
||||
private int patternId;
|
||||
private int startPosition;
|
||||
private int endPosition;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@@ -42,6 +43,9 @@ public class Packet {
|
||||
@JsonIgnore
|
||||
private Stream stream;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
private Set<FoundPattern> matches;
|
||||
|
||||
private long timestamp;
|
||||
|
||||
private boolean incoming; // true если от клиента к серверу, иначе false
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@ToString(exclude = "packets")
|
||||
@@ -26,13 +27,13 @@ public class Stream {
|
||||
@GeneratedValue(generator = "stream_generator")
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "service_id", nullable = false)
|
||||
private CtfService service;
|
||||
@Column(name = "service_id")
|
||||
private int service;
|
||||
|
||||
private Protocol protocol;
|
||||
|
||||
@OneToMany(mappedBy = "stream", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@OrderColumn
|
||||
@JsonIgnore
|
||||
private List<Packet> packets;
|
||||
|
||||
@@ -41,7 +42,7 @@ public class Stream {
|
||||
private long endTimestamp;
|
||||
|
||||
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
private List<Pattern> foundPatterns;
|
||||
private Set<Pattern> foundPatterns;
|
||||
|
||||
private boolean favorite;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user