1
2
3
4
5
6 package org.tailormap.api.persistence;
7
8 import jakarta.persistence.Column;
9 import jakarta.persistence.Entity;
10 import jakarta.persistence.EntityListeners;
11 import jakarta.persistence.Id;
12 import jakarta.persistence.Version;
13 import jakarta.validation.constraints.NotNull;
14 import java.util.ArrayList;
15 import java.util.List;
16 import org.hibernate.annotations.Type;
17 import org.tailormap.api.persistence.json.CatalogNode;
18 import org.tailormap.api.persistence.listener.EntityEventPublisher;
19
20 @Entity
21 @EntityListeners(EntityEventPublisher.class)
22 public class Catalog {
23 public static final String MAIN = "main";
24
25 @Id
26 private String id;
27
28 @Version
29 private Long version;
30
31 @Type(value = io.hypersistence.utils.hibernate.type.json.JsonBinaryType.class)
32 @Column(columnDefinition = "jsonb")
33 @NotNull private List<CatalogNode> nodes = new ArrayList<>();
34
35 public String getId() {
36 return id;
37 }
38
39 public Catalog setId(String id) {
40 this.id = id;
41 return this;
42 }
43
44 public Long getVersion() {
45 return version;
46 }
47
48 public Catalog setVersion(Long version) {
49 this.version = version;
50 return this;
51 }
52
53 public List<CatalogNode> getNodes() {
54 return nodes;
55 }
56
57 public Catalog setNodes(List<CatalogNode> nodes) {
58 this.nodes = nodes;
59 return this;
60 }
61 }