1
2
3
4
5
6
7 package org.tailormap.api.persistence;
8
9 import jakarta.persistence.Column;
10 import jakarta.persistence.Entity;
11 import jakarta.persistence.EntityListeners;
12 import jakarta.persistence.GeneratedValue;
13 import jakarta.persistence.GenerationType;
14 import jakarta.persistence.Id;
15 import jakarta.persistence.Version;
16 import jakarta.validation.constraints.NotNull;
17 import java.util.ArrayList;
18 import java.util.List;
19 import org.hibernate.annotations.Type;
20 import org.tailormap.api.persistence.json.FormField;
21 import org.tailormap.api.persistence.json.FormOptions;
22 import org.tailormap.api.persistence.listener.EntityEventPublisher;
23
24 @Entity
25 @EntityListeners(EntityEventPublisher.class)
26 public class Form {
27 @Id
28 @GeneratedValue(strategy = GenerationType.IDENTITY)
29 private Long id;
30
31 @Version
32 private Long version;
33
34 @NotNull private String name;
35
36 private Long featureSourceId;
37
38 private String featureTypeName;
39
40 @Type(value = io.hypersistence.utils.hibernate.type.json.JsonBinaryType.class)
41 @Column(columnDefinition = "jsonb")
42 @NotNull private FormOptions options = new FormOptions();
43
44 @Type(value = io.hypersistence.utils.hibernate.type.json.JsonBinaryType.class)
45 @Column(columnDefinition = "jsonb")
46 @NotNull private List<FormField> fields = new ArrayList<>();
47
48 public Long getId() {
49 return id;
50 }
51
52 public void setId(Long id) {
53 this.id = id;
54 }
55
56 public Long getVersion() {
57 return version;
58 }
59
60 public void setVersion(Long version) {
61 this.version = version;
62 }
63
64 public String getName() {
65 return name;
66 }
67
68 public void setName(String name) {
69 this.name = name;
70 }
71
72 public Long getFeatureSourceId() {
73 return featureSourceId;
74 }
75
76 public void setFeatureSourceId(Long featureSourceId) {
77 this.featureSourceId = featureSourceId;
78 }
79
80 public String getFeatureTypeName() {
81 return featureTypeName;
82 }
83
84 public void setFeatureTypeName(String featureTypeName) {
85 this.featureTypeName = featureTypeName;
86 }
87
88 public FormOptions getOptions() {
89 return options;
90 }
91
92 public void setOptions(FormOptions options) {
93 this.options = options;
94 }
95
96 public List<FormField> getFields() {
97 return fields;
98 }
99
100 public void setFields(List<FormField> fields) {
101 this.fields = fields;
102 }
103 }