Compo.java
5.47 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
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.model;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author jkj
*/
@Entity
@Table(name = "compos")
@NamedQueries({
@NamedQuery(name = "Compo.findAll", query = "SELECT c FROM Compo c"),
@NamedQuery(name = "Compo.findByComposId", query = "SELECT c FROM Compo c WHERE c.composId = :composId"),
@NamedQuery(name = "Compo.findByCompoName", query = "SELECT c FROM Compo c WHERE c.compoName = :compoName"),
@NamedQuery(name = "Compo.findByCompoStart", query = "SELECT c FROM Compo c WHERE c.compoStart = :compoStart"),
@NamedQuery(name = "Compo.findByVoteStart", query = "SELECT c FROM Compo c WHERE c.voteStart = :voteStart"),
@NamedQuery(name = "Compo.findByVoteEnd", query = "SELECT c FROM Compo c WHERE c.voteEnd = :voteEnd"),
@NamedQuery(name = "Compo.findBySubmitStart", query = "SELECT c FROM Compo c WHERE c.submitStart = :submitStart"),
@NamedQuery(name = "Compo.findBySubmitEnd", query = "SELECT c FROM Compo c WHERE c.submitEnd = :submitEnd"),
@NamedQuery(name = "Compo.findByHoldVoting", query = "SELECT c FROM Compo c WHERE c.holdVoting = :holdVoting")})
public class Compo implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "compos_id", nullable = false)
private Integer composId;
@Basic(optional = false)
@Column(name = "compo_name", nullable = false, length = 2147483647)
private String compoName;
@Column(name = "compo_start")
@Temporal(TemporalType.TIMESTAMP)
private Date compoStart;
@Column(name = "vote_start")
@Temporal(TemporalType.TIMESTAMP)
private Date voteStart;
@Column(name = "vote_end")
@Temporal(TemporalType.TIMESTAMP)
private Date voteEnd;
@Column(name = "submit_start")
@Temporal(TemporalType.TIMESTAMP)
private Date submitStart;
@Column(name = "submit_end")
@Temporal(TemporalType.TIMESTAMP)
private Date submitEnd;
@Basic(optional = false)
@Column(name = "hold_voting", nullable = false)
private boolean holdVoting;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "composId")
private List<CompoEntry> compoEntryList;
@JoinColumn(name = "events_id", referencedColumnName = "events_id", nullable = false)
@ManyToOne(optional = false)
private Event eventsId;
public Compo() {
}
public Compo(Integer composId) {
this.composId = composId;
}
public Compo(Integer composId, String compoName, boolean holdVoting) {
this.composId = composId;
this.compoName = compoName;
this.holdVoting = holdVoting;
}
public Integer getComposId() {
return composId;
}
public void setComposId(Integer composId) {
this.composId = composId;
}
public String getCompoName() {
return compoName;
}
public void setCompoName(String compoName) {
this.compoName = compoName;
}
public Date getCompoStart() {
return compoStart;
}
public void setCompoStart(Date compoStart) {
this.compoStart = compoStart;
}
public Date getVoteStart() {
return voteStart;
}
public void setVoteStart(Date voteStart) {
this.voteStart = voteStart;
}
public Date getVoteEnd() {
return voteEnd;
}
public void setVoteEnd(Date voteEnd) {
this.voteEnd = voteEnd;
}
public Date getSubmitStart() {
return submitStart;
}
public void setSubmitStart(Date submitStart) {
this.submitStart = submitStart;
}
public Date getSubmitEnd() {
return submitEnd;
}
public void setSubmitEnd(Date submitEnd) {
this.submitEnd = submitEnd;
}
public boolean getHoldVoting() {
return holdVoting;
}
public void setHoldVoting(boolean holdVoting) {
this.holdVoting = holdVoting;
}
public List<CompoEntry> getCompoEntryList() {
return compoEntryList;
}
public void setCompoEntryList(List<CompoEntry> compoEntryList) {
this.compoEntryList = compoEntryList;
}
public Event getEventsId() {
return eventsId;
}
public void setEventsId(Event eventsId) {
this.eventsId = eventsId;
}
@Override
public int hashCode() {
int hash = 0;
hash += (composId != null ? composId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Compo)) {
return false;
}
Compo other = (Compo) object;
if ((this.composId == null && other.composId != null) || (this.composId != null && !this.composId.equals(other.composId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "fi.insomnia.model.Compo[composId=" + composId + "]";
}
}