1
2
3
4 package de.tivsource.page.common.css;
5
6 import java.util.Date;
7 import java.util.List;
8 import java.util.SortedSet;
9
10 import javax.persistence.CascadeType;
11 import javax.persistence.Column;
12 import javax.persistence.Entity;
13 import javax.persistence.EnumType;
14 import javax.persistence.Enumerated;
15 import javax.persistence.FetchType;
16 import javax.persistence.Id;
17 import javax.persistence.ManyToMany;
18 import javax.persistence.OneToMany;
19 import javax.persistence.Table;
20 import javax.persistence.Temporal;
21 import javax.persistence.Version;
22
23 import org.hibernate.annotations.SortNatural;
24 import org.hibernate.envers.Audited;
25 import org.hibernate.search.annotations.DocumentId;
26
27 import de.tivsource.page.entity.enumeration.Language;
28 import de.tivsource.page.entity.pictureitem.PictureItem;
29
30
31
32
33
34 @Audited
35 @Entity
36 @Table(name = "CSSGroup")
37 public class CSSGroup implements Comparable<CSSGroup> {
38
39
40
41
42
43 @Id
44 @DocumentId
45 @Column(name = "uuid", unique = true, length = 42)
46 private String uuid;
47
48 private String name;
49
50 private String description;
51
52 @Enumerated(EnumType.STRING)
53 private Language language;
54
55
56
57
58 @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER, mappedBy = "groups", targetEntity = CSSFile.class)
59 @SortNatural
60 private SortedSet<CSSFile> files;
61
62 @OneToMany(mappedBy = "cssGroup", cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
63 private List<PictureItem> pictureItems;
64
65 @Temporal(javax.persistence.TemporalType.TIMESTAMP)
66 private Date created;
67
68 @Temporal(javax.persistence.TemporalType.TIMESTAMP)
69 private Date modified;
70
71 private String modifiedBy;
72
73 private String modifiedAddress;
74
75
76
77
78 @Version
79 private Integer version;
80
81
82
83
84 public String getUuid() {
85 return uuid;
86 }
87
88
89
90
91
92 public void setUuid(String uuid) {
93 this.uuid = uuid;
94 }
95
96
97
98
99 public String getName() {
100 return name;
101 }
102
103
104
105
106
107 public void setName(String name) {
108 this.name = name;
109 }
110
111
112
113
114 public String getDescription() {
115 return description;
116 }
117
118
119
120
121
122 public void setDescription(String description) {
123 this.description = description;
124 }
125
126
127
128
129 public Language getLanguage() {
130 return language;
131 }
132
133
134
135
136
137 public void setLanguage(Language language) {
138 this.language = language;
139 }
140
141
142
143
144 public SortedSet<CSSFile> getFiles() {
145 return files;
146 }
147
148
149
150
151
152 public void setFiles(SortedSet<CSSFile> files) {
153 this.files = files;
154 }
155
156
157
158
159 public List<PictureItem> getPictureItems() {
160 return pictureItems;
161 }
162
163
164
165
166 public void setPictureItems(List<PictureItem> pictureItems) {
167 this.pictureItems = pictureItems;
168 }
169
170
171
172
173 public Date getCreated() {
174 return created;
175 }
176
177
178
179
180
181 public void setCreated(Date created) {
182 this.created = created;
183 }
184
185
186
187
188 public Date getModified() {
189 return modified;
190 }
191
192
193
194
195
196 public void setModified(Date modified) {
197 this.modified = modified;
198 }
199
200
201
202
203 public String getModifiedBy() {
204 return modifiedBy;
205 }
206
207
208
209
210
211 public void setModifiedBy(String modifiedBy) {
212 this.modifiedBy = modifiedBy;
213 }
214
215
216
217
218 public String getModifiedAddress() {
219 return modifiedAddress;
220 }
221
222
223
224
225
226 public void setModifiedAddress(String modifiedAddress) {
227 this.modifiedAddress = modifiedAddress;
228 }
229
230
231
232
233 public Integer getVersion() {
234 return version;
235 }
236
237
238
239
240
241 public void setVersion(Integer version) {
242 this.version = version;
243 }
244
245
246
247
248
249
250 @Override
251 public int compareTo(CSSGroup o) {
252 return o.name.compareTo(this.name);
253 }
254
255 }