BrightSide Workbench Full Report + Source Code
PollVote.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2018 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.elephant.entities.db;
20 
21 import java.util.Date;
22 import javax.persistence.Entity;
23 import javax.persistence.Id;
24 import javax.persistence.IdClass;
25 import javax.persistence.Temporal;
26 import org.turro.action.Contacts;
27 import org.turro.elephant.db.ElephantPU;
28 import org.turro.plugin.contacts.IContact;
29 
34 @Entity
35 @IdClass(PollVotePK.class)
36 public class PollVote implements java.io.Serializable {
37 
38  @Id
39  private Long idPoll;
40 
41  @Id
42  private String pollData;
43 
44  @Id
45  private String idContact;
46 
47  private int vote;
48 
49  @Temporal(javax.persistence.TemporalType.TIMESTAMP)
50  private Date voteDate;
51 
52  public Long getIdPoll() {
53  return idPoll;
54  }
55 
56  public void setIdPoll(Long idPoll) {
57  this.idPoll = idPoll;
58  }
59 
60  public String getPollData() {
61  return pollData;
62  }
63 
64  public void setPollData(String pollData) {
65  this.pollData = pollData;
66  }
67 
68  public String getIdContact() {
69  return idContact;
70  }
71 
72  public void setIdContact(String idContact) {
73  this.idContact = idContact;
74  }
75 
76  public int getVote() {
77  return vote;
78  }
79 
80  public void setVote(int vote) {
81  this.vote = vote;
82  }
83 
84  public Date getVoteDate() {
85  return voteDate;
86  }
87 
88  public void setVoteDate(Date voteDate) {
89  this.voteDate = voteDate;
90  }
91 
92  /* Helpers */
93 
94  public boolean isEmpty() {
95  return false;
96  }
97 
99  PollOptionPK pk = new PollOptionPK();
100  pk.setIdPoll(idPoll);
101  pk.setPollData(pollData);
102  return new ElephantPU().find(PollOption.class, pk);
103  }
104 
105  public IContact getContact() {
106  return Contacts.getContactById(idContact);
107  }
108 
109 }
static IContact getContactById(String id)
Definition: Contacts.java:72
void setPollData(String pollData)
Definition: PollVote.java:64
void setIdContact(String idContact)
Definition: PollVote.java:72