1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
package org.directdemocracyportal.democracy.model.application; |
6 | |
|
7 | |
import java.util.Date; |
8 | |
|
9 | |
import javax.persistence.DiscriminatorColumn; |
10 | |
import javax.persistence.DiscriminatorType; |
11 | |
import javax.persistence.Entity; |
12 | |
import javax.persistence.GeneratedValue; |
13 | |
import javax.persistence.GenerationType; |
14 | |
import javax.persistence.Id; |
15 | |
import javax.persistence.Inheritance; |
16 | |
import javax.persistence.InheritanceType; |
17 | |
import javax.persistence.JoinColumn; |
18 | |
import javax.persistence.ManyToOne; |
19 | |
import javax.persistence.Temporal; |
20 | |
import javax.persistence.TemporalType; |
21 | |
|
22 | |
import org.directdemocracyportal.democracy.model.core.BaseEntity; |
23 | |
import org.hibernate.annotations.Cache; |
24 | |
import org.hibernate.annotations.CacheConcurrencyStrategy; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
@Entity |
30 | |
@Inheritance(strategy = InheritanceType.JOINED) |
31 | |
@DiscriminatorColumn(name = "event_type", discriminatorType = DiscriminatorType.STRING) |
32 | |
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) |
33 | |
public class Event extends BaseEntity |
34 | |
{ |
35 | |
|
36 | |
|
37 | |
private static final long serialVersionUID = 2771108428103239806L; |
38 | |
|
39 | |
|
40 | |
private Long id; |
41 | |
|
42 | |
|
43 | |
private User user; |
44 | |
|
45 | |
|
46 | |
private Action action; |
47 | |
|
48 | |
|
49 | |
private Date time; |
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | 1 | public Event() { |
55 | 1 | } |
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | 1 | public Event(User user, Action action, Date time) { |
65 | 1 | this.user = user; |
66 | 1 | this.action = action; |
67 | 1 | this.time = time; |
68 | 1 | } |
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
@Override |
76 | |
@Id |
77 | |
@GeneratedValue(strategy = GenerationType.AUTO) |
78 | |
public Long getId() { |
79 | 1 | return this.id; |
80 | |
} |
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
public void setId(Long id) { |
88 | 0 | this.id = id; |
89 | 0 | } |
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
@ManyToOne |
97 | |
@JoinColumn |
98 | |
public User getUser() { |
99 | 0 | return user; |
100 | |
} |
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
public void setUser(User user) { |
108 | 0 | this.user = user; |
109 | 0 | } |
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
public Action getAction() { |
117 | 1 | return action; |
118 | |
} |
119 | |
|
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | |
|
125 | |
public void setAction(Action action) { |
126 | 0 | this.action = action; |
127 | 0 | } |
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
@Temporal(TemporalType.DATE) |
135 | |
public Date getTime() { |
136 | 0 | return time; |
137 | |
} |
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | |
public void setTime(Date time) { |
145 | 0 | this.time = time; |
146 | 0 | } |
147 | |
} |