1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.mobility.admin.entity;
17
18 import java.io.Serializable;
19
20 import javax.persistence.CascadeType;
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.FetchType;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.GenerationType;
26 import javax.persistence.Id;
27 import javax.persistence.JoinColumn;
28 import javax.persistence.NamedQueries;
29 import javax.persistence.NamedQuery;
30 import javax.persistence.OneToOne;
31 import javax.persistence.Table;
32 import javax.persistence.Transient;
33 import javax.persistence.Version;
34 import javax.xml.bind.annotation.XmlRootElement;
35
36 import org.kuali.mobility.security.authz.entity.AclExpression;
37
38
39
40
41
42
43 @NamedQueries({
44
45 @NamedQuery(
46 name="Tool.getAllTools",
47 query="SELECT t FROM Tool t"
48 ),
49
50 @NamedQuery(
51 name="Tool.getToolById",
52 query="SELECT t FROM Tool t WHERE t.toolId = :id"
53 ),
54
55 @NamedQuery(
56 name="Tool.deleteToolById",
57 query="delete from Tool t where t.toolId = :toolId"
58 )
59 })
60 @Entity
61 @Table(name="TL_T")
62 @XmlRootElement(name="tool")
63 public class Tool implements Serializable, Comparable<Tool> {
64
65
66
67 public static final int UNDEFINED_REQUISITES = 0;
68 public static final int NATIVE = 1;
69 public static final int IOS = 2;
70 public static final int ANDROID = 4;
71 public static final int WINDOWS_PHONE = 8;
72 public static final int BLACKBERRY = 16;
73 public static final int NON_NATIVE = 32;
74 public static final int ALL_PLATFORMS = IOS | ANDROID | WINDOWS_PHONE | BLACKBERRY;
75 public static final int ANY = NATIVE | NON_NATIVE | IOS | ANDROID | WINDOWS_PHONE | BLACKBERRY;
76
77
78 private static final long serialVersionUID = 4709451428489759275L;
79
80
81
82
83 @Id
84 @GeneratedValue(strategy = GenerationType.TABLE)
85 @Column(name="ID")
86 private Long toolId;
87
88
89
90
91 @Column(name="ALIAS")
92 private String alias;
93
94
95
96
97 @Column(name="TTL")
98 private String title;
99
100
101
102
103 @Column(name="SB_TTL")
104 private String subtitle;
105
106
107
108
109 @Column(name="URL")
110 private String url;
111
112
113
114
115 @Column(name="DESC_TXT")
116 private String description;
117
118
119
120
121 @Column(name="ICN_URL")
122 private String iconUrl;
123
124
125
126
127 @Column(name="CONTACTS")
128 private String contacts;
129
130
131
132
133 @Column(name="KEYWORDS")
134 private String keywords;
135
136
137
138
139 @Column(name="REQUISITES")
140 private int requisites;
141
142
143
144
145 @Column(name="ACL_VIEW_ID", insertable=false, updatable=false)
146 private Long aclViewingId;
147
148
149
150
151 @Column(name="ACL_PUB_ID", insertable=false, updatable=false)
152 private Long aclPublishingId;
153
154
155
156
157 @OneToOne(fetch=FetchType.EAGER, cascade={ CascadeType.ALL } )
158 @JoinColumn(name="ACL_VIEW_ID", referencedColumnName="ID", nullable=true)
159 private AclExpression viewingPermission;
160
161
162
163
164 @OneToOne(fetch=FetchType.EAGER, cascade={ CascadeType.ALL } )
165 @JoinColumn(name="ACL_PUB_ID", referencedColumnName="ID", nullable=true)
166 private AclExpression publishingPermission;
167
168
169
170
171 @Version
172 @Column(name="VER_NBR")
173 private Long versionNumber;
174
175
176
177
178 @Transient
179 private String badgeCount;
180
181
182
183
184 @Transient
185 private String badgeText;
186
187
188
189
190
191 public Long getToolId() {
192 return toolId;
193 }
194
195
196
197
198
199 public void setToolId(Long toolId) {
200 this.toolId = toolId;
201 }
202
203
204
205
206
207 public String getAlias() {
208 return alias;
209 }
210
211
212
213
214
215 public void setAlias(String alias) {
216 this.alias = alias;
217 }
218
219
220
221
222
223 public String getTitle() {
224 return title;
225 }
226
227
228
229
230
231 public void setTitle(String title) {
232 this.title = title;
233 }
234
235
236
237
238
239 public String getUrl() {
240 return url;
241 }
242
243
244
245
246
247 public void setUrl(String url) {
248 this.url = url;
249 }
250
251
252
253
254
255 public String getDescription() {
256 return description;
257 }
258
259
260
261
262
263 public void setDescription(String description) {
264 this.description = description;
265 }
266
267
268
269
270
271 public String getBadgeCount() {
272 return badgeCount;
273 }
274
275
276
277
278
279 public void setBadgeCount(String badgeCount) {
280 this.badgeCount = badgeCount;
281 }
282
283
284
285
286
287 public String getIconUrl() {
288 return iconUrl;
289 }
290
291
292
293
294
295 public void setIconUrl(String iconUrl) {
296 this.iconUrl = iconUrl;
297 }
298
299
300
301
302
303 public Long getVersionNumber() {
304 return versionNumber;
305 }
306
307
308
309
310
311 public void setVersionNumber(Long versionNumber) {
312 this.versionNumber = versionNumber;
313 }
314
315
316
317
318
319 @Override
320 public int compareTo(Tool that) {
321 if (that == null) {
322 return -1;
323 }
324 return this.title.compareTo(that.title);
325 }
326
327
328
329
330
331 @Override
332 public boolean equals(Object that) {
333 if (that == null) {
334 return false;
335 }
336 if (that instanceof Tool) {
337 return this.toolId.equals(((Tool)that).toolId);
338 }
339 return false;
340 }
341
342
343
344
345
346
347 public String getContacts() {
348 return contacts;
349 }
350
351
352
353
354
355 public void setContacts(String contacts) {
356 this.contacts = contacts;
357 }
358
359
360
361
362
363 public int getRequisites() {
364 return requisites;
365 }
366
367
368
369
370
371 public void setRequisites(int requisites) {
372 this.requisites = requisites;
373 }
374
375
376
377
378
379
380 public String getSubtitle() {
381 return subtitle;
382 }
383
384
385
386
387
388 public void setSubtitle(String subtitle) {
389 this.subtitle = subtitle;
390 }
391
392
393
394
395
396 public String getKeywords() {
397 return keywords;
398 }
399
400
401
402
403
404 public void setKeywords(String keywords) {
405 this.keywords = keywords;
406 }
407
408
409
410
411
412 public String getBadgeText() {
413 return badgeText;
414 }
415
416
417
418
419
420 public void setBadgeText(String badgeText) {
421 this.badgeText = badgeText;
422 }
423
424
425
426
427
428 public Long getAclViewingId() {
429 return aclViewingId;
430 }
431
432
433
434
435
436 public void setAclViewingId(Long aclViewingId) {
437 this.aclViewingId = aclViewingId;
438 }
439
440
441
442
443
444 public Long getAclPublishingId() {
445 return aclPublishingId;
446 }
447
448
449
450
451
452 public void setAclPublishingId(Long aclPublishingId) {
453 this.aclPublishingId = aclPublishingId;
454 }
455
456
457
458
459
460 public AclExpression getViewingPermission() {
461 return viewingPermission;
462 }
463
464
465
466
467
468 public void setViewingPermission(AclExpression viewingPermission) {
469 this.viewingPermission = viewingPermission;
470 }
471
472
473
474
475
476 public AclExpression getPublishingPermission() {
477 return publishingPermission;
478 }
479
480
481
482
483
484 public void setPublishingPermission(AclExpression publishingPermission) {
485 this.publishingPermission = publishingPermission;
486 }
487
488 }