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 private Long version;
32
33 @NotNull private String name;
34
35 private Long featureSourceId;
36
37 private String featureTypeName;
38
39 @Type(value = io.hypersistence.utils.hibernate.type.json.JsonBinaryType.class)
40 @Column(columnDefinition = "jsonb")
41 @NotNull
42 private FormOptions options = new FormOptions();
43
44 @Type(value = io.hypersistence.utils.hibernate.type.json.JsonBinaryType.class)
45 @Column(columnDefinition = "jsonb")
46 @NotNull
47 private List<FormField> fields = new ArrayList<>();
48
49 public Long getId() {
50 return id;
51 }
52
53 public void setId(Long id) {
54 this.id = id;
55 }
56
57 public Long getVersion() {
58 return version;
59 }
60
61 public void setVersion(Long version) {
62 this.version = version;
63 }
64
65 public String getName() {
66 return name;
67 }
68
69 public void setName(String name) {
70 this.name = name;
71 }
72
73 public Long getFeatureSourceId() {
74 return featureSourceId;
75 }
76
77 public void setFeatureSourceId(Long featureSourceId) {
78 this.featureSourceId = featureSourceId;
79 }
80
81 public String getFeatureTypeName() {
82 return featureTypeName;
83 }
84
85 public void setFeatureTypeName(String featureTypeName) {
86 this.featureTypeName = featureTypeName;
87 }
88
89 public FormOptions getOptions() {
90 return options;
91 }
92
93 public void setOptions(FormOptions options) {
94 this.options = options;
95 }
96
97 public List<FormField> getFields() {
98 return fields;
99 }
100
101 public void setFields(List<FormField> fields) {
102 this.fields = fields;
103 }
104 }