1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.logging.log4j.catalog.jpa.model;
18
19 import javax.persistence.CascadeType;
20 import javax.persistence.Column;
21 import javax.persistence.Entity;
22 import javax.persistence.FetchType;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.GenerationType;
25 import javax.persistence.Id;
26 import javax.persistence.JoinColumn;
27 import javax.persistence.JoinTable;
28 import javax.persistence.ManyToMany;
29 import javax.persistence.Table;
30 import javax.persistence.UniqueConstraint;
31 import java.io.Serializable;
32 import java.util.List;
33
34
35
36
37 @Entity
38 @Table(name = "CATALOG_CATEGORY",
39 uniqueConstraints = { @UniqueConstraint(columnNames = { "NAME" })})
40 public class CategoryModel implements Serializable {
41 private static final long serialVersionUID = 5776108323599073407L;
42
43 @Id
44 @GeneratedValue(strategy= GenerationType.IDENTITY)
45 @Column(name = "ID")
46 private Long id;
47 @Column(name = "NAME")
48 private String name;
49 @Column(name = "DISPLAY_NAME")
50 private String displayName;
51 @Column(name = "DESCRIPTION")
52 private String description;
53 @Column(name = "CATALOG_ID")
54 private String catalogId;
55 @ManyToMany(fetch = FetchType.EAGER)
56 @JoinTable(name = "category_events", joinColumns = { @JoinColumn(name = "category_id")},
57 inverseJoinColumns = { @JoinColumn(name = "event_id")})
58 private List<EventModel> events;
59
60 public CategoryModel() {
61 catalogId = "DEFAULT";
62 }
63
64
65
66
67
68 public Long getId() {
69 return id;
70 }
71
72
73
74
75
76 public void setId(Long id) {
77 this.id = id;
78 }
79
80
81
82
83
84
85
86 public String getName() {
87 return name;
88 }
89
90
91
92
93
94
95
96 public void setName(String value) {
97 this.name = value;
98 }
99
100
101
102
103
104 public String getDisplayName() {
105 return displayName;
106 }
107
108
109
110
111
112 public void setDisplayName(String dislpayName) {
113 this.displayName = dislpayName;
114 }
115
116
117
118
119
120
121
122 public String getDescription() {
123 return description;
124 }
125
126
127
128
129
130
131
132 public void setDescription(String value) {
133 this.description = value;
134 }
135
136
137
138
139
140 public String getCatalogId() {
141 return catalogId;
142 }
143
144
145
146
147
148 public void setCatalogId(String catalogId) {
149 this.catalogId = catalogId;
150 }
151
152
153
154
155
156 public List<EventModel> getEvents() {
157 return events;
158 }
159
160
161
162
163
164 public void setEvents(List<EventModel> events) {
165 this.events = events;
166 }
167
168 }