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 @Id private String id;
25
26 @Version private Long version;
27
28 @Type(value = io.hypersistence.utils.hibernate.type.json.JsonBinaryType.class)
29 @Column(columnDefinition = "jsonb")
30 @NotNull
31 private List<CatalogNode> nodes = new ArrayList<>();
32
33 public String getId() {
34 return id;
35 }
36
37 public Catalog setId(String id) {
38 this.id = id;
39 return this;
40 }
41
42 public Long getVersion() {
43 return version;
44 }
45
46 public Catalog setVersion(Long version) {
47 this.version = version;
48 return this;
49 }
50
51 public List<CatalogNode> getNodes() {
52 return nodes;
53 }
54
55 public Catalog setNodes(List<CatalogNode> nodes) {
56 this.nodes = nodes;
57 return this;
58 }
59 }