1
2
3
4 package de.tivsource.page.entity.feedback;
5
6 import java.util.Date;
7 import java.util.Map;
8
9 import javax.persistence.Basic;
10 import javax.persistence.CascadeType;
11 import javax.persistence.Column;
12 import javax.persistence.Entity;
13 import javax.persistence.FetchType;
14 import javax.persistence.Id;
15 import javax.persistence.MapKey;
16 import javax.persistence.OneToMany;
17 import javax.persistence.Temporal;
18
19 import org.hibernate.search.annotations.DocumentId;
20
21 import de.tivsource.page.entity.enumeration.Language;
22
23
24
25
26
27 @Entity
28 public class FeedbackOption {
29
30
31
32
33
34
35 @Id
36 @DocumentId
37 @Column(name="uuid", unique=true, length=42)
38 private String uuid;
39
40
41
42
43 @OneToMany(mappedBy = "feedbackOption", cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
44 @MapKey(name = "language")
45 private Map<Language, FeedbackOptionDescription> descriptionMap;
46
47 private String mapKey;
48
49 private Integer maxStars;
50
51 private Integer orderNumber;
52
53 @Basic
54 @org.hibernate.annotations.Type(type = "yes_no")
55 private Boolean visible;
56
57
58
59
60 private String hints;
61
62 @Temporal(javax.persistence.TemporalType.TIMESTAMP)
63 private Date created;
64
65 @Temporal(javax.persistence.TemporalType.TIMESTAMP)
66 private Date modified;
67
68 private String modifiedBy;
69
70 private String modifiedAddress;
71
72 public String getUuid() {
73 return uuid;
74 }
75
76 public void setUuid(String uuid) {
77 this.uuid = uuid;
78 }
79
80 public Map<Language, FeedbackOptionDescription> getDescriptionMap() {
81 return descriptionMap;
82 }
83
84 public void setDescriptionMap(
85 Map<Language, FeedbackOptionDescription> descriptionMap) {
86 this.descriptionMap = descriptionMap;
87 }
88
89 public String getMapKey() {
90 return mapKey;
91 }
92
93 public void setMapKey(String mapKey) {
94 this.mapKey = mapKey;
95 }
96
97 public Integer getMaxStars() {
98 return maxStars;
99 }
100
101 public void setMaxStars(Integer maxStars) {
102 this.maxStars = maxStars;
103 }
104
105 public Integer getOrderNumber() {
106 return orderNumber;
107 }
108
109 public void setOrderNumber(Integer orderNumber) {
110 this.orderNumber = orderNumber;
111 }
112
113 public Boolean getVisible() {
114 return visible;
115 }
116
117 public void setVisible(Boolean visible) {
118 this.visible = visible;
119 }
120
121
122
123
124 public String getHints() {
125 return hints;
126 }
127
128
129
130
131 public void setHints(String hints) {
132 this.hints = hints;
133 }
134
135 public Date getCreated() {
136 return created;
137 }
138
139 public void setCreated(Date created) {
140 this.created = created;
141 }
142
143 public Date getModified() {
144 return modified;
145 }
146
147 public void setModified(Date modified) {
148 this.modified = modified;
149 }
150
151 public String getModifiedBy() {
152 return modifiedBy;
153 }
154
155 public void setModifiedBy(String modifiedBy) {
156 this.modifiedBy = modifiedBy;
157 }
158
159 public String getModifiedAddress() {
160 return modifiedAddress;
161 }
162
163 public void setModifiedAddress(String modifiedAddress) {
164 this.modifiedAddress = modifiedAddress;
165 }
166
167
168
169
170
171
172
173
174
175
176
177
178 public String getName(String language) {
179 String result = descriptionMap.get(Language.DE).getName();
180 String tmpResult = descriptionMap.get(Language.DE).getName();
181 try {
182 tmpResult = descriptionMap.get(
183 Language.valueOf(language.toUpperCase())).getName();
184 } catch (IllegalArgumentException e) {
185 return result;
186 } catch (NullPointerException e) {
187 return result;
188 }
189 return tmpResult;
190 }
191
192
193
194
195
196
197 public String getDescription(Language language) {
198 String result = descriptionMap.get(Language.DE).getDescription();
199 String tmpResult = descriptionMap.get(Language.DE).getDescription();
200
201 try {
202 tmpResult = descriptionMap.get(language).getDescription();
203 } catch (IllegalArgumentException e) {
204 return result;
205 } catch (NullPointerException e) {
206 return result;
207 }
208 return tmpResult;
209 }
210
211 public FeedbackOptionDescription getDescriptionObject(Language language) {
212 FeedbackOptionDescription result = descriptionMap.get(Language.DE);
213 FeedbackOptionDescription tmpResult = descriptionMap.get(Language.DE);
214 try {
215 tmpResult = descriptionMap.get(language);
216 } catch (IllegalArgumentException e) {
217 return result;
218 } catch (NullPointerException e) {
219 return result;
220 }
221 return tmpResult;
222 }
223
224
225
226
227
228
229 public String getHints(String language) {
230 String result = descriptionMap.get(Language.DE).getHints();
231 String tmpResult = descriptionMap.get(Language.DE).getHints();
232
233 try {
234 tmpResult = descriptionMap.get(Language.valueOf(language.toUpperCase())).getHints();
235 } catch (IllegalArgumentException e) {
236 return result;
237 } catch (NullPointerException e) {
238 return result;
239 }
240 return tmpResult;
241 }
242
243 }