Compo.java
4.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.util.Calendar;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
* Competition to be held at the event.
*/
@Entity
@Table(name = "compos")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Compo extends GenericEntity {
private static final long serialVersionUID = 2L;
/**
* Name of the competition.
*/
@Column(name = "compo_name", nullable = false)
private String name;
public static final String EVENT_ID_COLUMN = "event_id";
@ManyToOne()
@JoinColumn(name = EVENT_ID_COLUMN, nullable = false)
private LanEvent event;
/**
* Start time of the competition Submitting entries should be disabled after
* this time.
*/
@Column(name = "compo_start")
@Temporal(TemporalType.TIMESTAMP)
private Calendar startTime;
@Column(name = "compo_end")
@Temporal(TemporalType.TIMESTAMP)
private Calendar endTime;
/**
* When the voting should start
*
* @see {@link #holdVoting}
*/
@Column(name = "vote_start")
@Temporal(TemporalType.TIMESTAMP)
private Calendar voteStart;
@Column(name = "vote_end")
@Temporal(TemporalType.TIMESTAMP)
private Calendar voteEnd;
@Column(name = "submit_start")
@Temporal(TemporalType.TIMESTAMP)
private Calendar submitStart;
@Column(name = "submit_end")
@Temporal(TemporalType.TIMESTAMP)
private Calendar submitEnd;
@Lob
@Column(name = "description")
private String description;
@Column(name = "max_participant_count")
private int maxParticipantCount;
/**
* If ( for some unimaginable reason ) compo is delayed hold voting can be
* used to postpone the start of the voting from the time specified in
* {@link #voteStart}
*/
@Column(name = "hold_voting", nullable = false)
private boolean holdVoting = true;
/**
* Entries submitted to participate this compo.
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "compo")
@OrderBy("sort")
private List<CompoEntry> compoEntries;
public Compo(String compoName, boolean holdVoting) {
this();
this.name = compoName;
this.holdVoting = holdVoting;
}
public Compo() {
super();
}
public String getName() {
return name;
}
public void setName(String compoName) {
this.name = compoName;
}
public Calendar getStartTime() {
return startTime;
}
public void setStartTime(Calendar compoStart) {
this.startTime = compoStart;
}
public Calendar getVoteStart() {
return voteStart;
}
public void setVoteStart(Calendar voteStart) {
this.voteStart = voteStart;
}
public Calendar getVoteEnd() {
return voteEnd;
}
public void setVoteEnd(Calendar voteEnd) {
this.voteEnd = voteEnd;
}
public Calendar getSubmitStart() {
return submitStart;
}
public void setSubmitStart(Calendar submitStart) {
this.submitStart = submitStart;
}
public Calendar getSubmitEnd() {
return submitEnd;
}
public void setSubmitEnd(Calendar submitEnd) {
this.submitEnd = submitEnd;
}
public boolean getHoldVoting() {
return holdVoting;
}
public void setHoldVoting(boolean holdVoting) {
this.holdVoting = holdVoting;
}
public List<CompoEntry> getCompoEntries() {
return compoEntries;
}
public void setCompoEntries(List<CompoEntry> compoEntryList) {
this.compoEntries = compoEntryList;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
/**
* @return the maxParticipantCount
*/
public int getMaxParticipantCount() {
return maxParticipantCount;
}
/**
* @param maxParticipantCount
* the maxParticipantCount to set
*/
public void setMaxParticipantCount(int maxParticipantCount) {
this.maxParticipantCount = maxParticipantCount;
}
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
public Calendar getEndTime() {
return endTime;
}
public void setEndTime(Calendar endTime) {
this.endTime = endTime;
}
}