forked from Infosys/Discourse-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPolls.java
More file actions
356 lines (278 loc) · 7.43 KB
/
Copy pathPolls.java
File metadata and controls
356 lines (278 loc) · 7.43 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
/*
* Copyright 2021 Infosys Ltd.
* Use of this source code is governed by GNU General Public License version 2
* that can be found in the LICENSE file or at
* https://opensource.org/licenses/GPL-2.0
*/
package com.infy.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.HashSet;
import java.util.Set;
/**
* A Polls.
*/
@Entity
@Table(name = "polls")
public class Polls extends AbstractAuditingEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@Column(name = "post_id")
private Long postId;
@NotNull
@Column(name = "name", nullable = false)
private String name;
@Column(name = "close_at")
private Instant closeAt;
@NotNull
@Column(name = "type", nullable = false)
private Integer type;
@NotNull
@Column(name = "status", nullable = false)
private Integer status;
@NotNull
@Column(name = "results", nullable = false)
private Integer results;
@NotNull
@Column(name = "visibility", nullable = false)
private Integer visibility;
@Column(name = "min")
private Integer min;
@Column(name = "max")
private Integer max;
@Column(name = "step")
private Integer step;
@Column(name = "anonymous_voters")
private Integer anonymousVoters;
@NotNull
@Column(name = "chart_type", nullable = false)
private Integer chartType;
@Column(name = "groups")
private String groups;
@Column(name = "title")
private String title;
@OneToMany(mappedBy = "polls")
private Set<Posts> posts = new HashSet<>();
@ManyToOne
@JsonIgnoreProperties(value = "polls", allowSetters = true)
private PollVotes pollVotes;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getPostId() {
return postId;
}
public Polls postId(Long postId) {
this.postId = postId;
return this;
}
public void setPostId(Long postId) {
this.postId = postId;
}
public String getName() {
return name;
}
public Polls name(String name) {
this.name = name;
return this;
}
public void setName(String name) {
this.name = name;
}
public Instant getCloseAt() {
return closeAt;
}
public Polls closeAt(Instant closeAt) {
this.closeAt = closeAt;
return this;
}
public void setCloseAt(Instant closeAt) {
this.closeAt = closeAt;
}
public Integer getType() {
return type;
}
public Polls type(Integer type) {
this.type = type;
return this;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getStatus() {
return status;
}
public Polls status(Integer status) {
this.status = status;
return this;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getResults() {
return results;
}
public Polls results(Integer results) {
this.results = results;
return this;
}
public void setResults(Integer results) {
this.results = results;
}
public Integer getVisibility() {
return visibility;
}
public Polls visibility(Integer visibility) {
this.visibility = visibility;
return this;
}
public void setVisibility(Integer visibility) {
this.visibility = visibility;
}
public Integer getMin() {
return min;
}
public Polls min(Integer min) {
this.min = min;
return this;
}
public void setMin(Integer min) {
this.min = min;
}
public Integer getMax() {
return max;
}
public Polls max(Integer max) {
this.max = max;
return this;
}
public void setMax(Integer max) {
this.max = max;
}
public Integer getStep() {
return step;
}
public Polls step(Integer step) {
this.step = step;
return this;
}
public void setStep(Integer step) {
this.step = step;
}
public Integer getAnonymousVoters() {
return anonymousVoters;
}
public Polls anonymousVoters(Integer anonymousVoters) {
this.anonymousVoters = anonymousVoters;
return this;
}
public void setAnonymousVoters(Integer anonymousVoters) {
this.anonymousVoters = anonymousVoters;
}
public Integer getChartType() {
return chartType;
}
public Polls chartType(Integer chartType) {
this.chartType = chartType;
return this;
}
public void setChartType(Integer chartType) {
this.chartType = chartType;
}
public String getGroups() {
return groups;
}
public Polls groups(String groups) {
this.groups = groups;
return this;
}
public void setGroups(String groups) {
this.groups = groups;
}
public String getTitle() {
return title;
}
public Polls title(String title) {
this.title = title;
return this;
}
public void setTitle(String title) {
this.title = title;
}
public Set<Posts> getPosts() {
return posts;
}
public Polls posts(Set<Posts> posts) {
this.posts = posts;
return this;
}
public Polls addPosts(Posts posts) {
this.posts.add(posts);
posts.setPolls(this);
return this;
}
public Polls removePosts(Posts posts) {
this.posts.remove(posts);
posts.setPolls(null);
return this;
}
public void setPosts(Set<Posts> posts) {
this.posts = posts;
}
public PollVotes getPollVotes() {
return pollVotes;
}
public Polls pollVotes(PollVotes pollVotes) {
this.pollVotes = pollVotes;
return this;
}
public void setPollVotes(PollVotes pollVotes) {
this.pollVotes = pollVotes;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Polls)) {
return false;
}
return id != null && id.equals(((Polls) o).id);
}
@Override
public int hashCode() {
return 31;
}
// prettier-ignore
@Override
public String toString() {
return "Polls{" +
"id=" + getId() +
", postId=" + getPostId() +
", name='" + getName() + "'" +
", closeAt='" + getCloseAt() + "'" +
", type=" + getType() +
", status=" + getStatus() +
", results=" + getResults() +
", visibility=" + getVisibility() +
", min=" + getMin() +
", max=" + getMax() +
", step=" + getStep() +
", anonymousVoters=" + getAnonymousVoters() +
", chartType=" + getChartType() +
", groups='" + getGroups() + "'" +
", title='" + getTitle() + "'" +
"}";
}
}