1
2
3
4 package de.tivsource.page.common.captcha.image;
5
6 import java.io.Serializable;
7
8 import javax.persistence.Column;
9 import javax.persistence.Entity;
10 import javax.persistence.FetchType;
11 import javax.persistence.Id;
12 import javax.persistence.JoinColumn;
13 import javax.persistence.OneToOne;
14
15 import org.hibernate.search.annotations.DocumentId;
16
17 import de.tivsource.page.common.captcha.Captcha;
18 import de.tivsource.page.common.image.ImageUntouched;
19
20
21
22
23
24 @Entity
25 public class CaptchaImage extends ImageUntouched implements Comparable<ImageUntouched>, Serializable {
26
27
28
29
30 private static final long serialVersionUID = 3363676443970121844L;
31
32
33
34
35 @Id
36 @DocumentId
37 @Column(name = "uuid", unique = true, length=42)
38 private String uuid;
39
40 @OneToOne(fetch = FetchType.LAZY)
41 @JoinColumn(name = "captcha_uuid")
42 private Captcha captcha;
43
44 static {
45 uploadPath = "/srv/tiv-page/captcha/";
46 }
47
48
49
50
51 public String getUuid() {
52 return uuid;
53 }
54
55
56
57
58 public void setUuid(String uuid) {
59 this.uuid = uuid;
60 }
61
62
63
64
65 public Captcha getCaptcha() {
66 return captcha;
67 }
68
69
70
71
72 public void setCaptcha(Captcha captcha) {
73 this.captcha = captcha;
74 }
75
76 public int compareTo(CaptchaImage image) {
77 return image.getUuid().compareTo(this.uuid) * -1;
78 }
79
80 }