1
22
23 package com.liferay.portlet.polls.model.impl;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.model.impl.BaseModelImpl;
27 import com.liferay.portal.util.PropsUtil;
28
29 import java.io.Serializable;
30
31 import java.sql.Types;
32
33 import java.util.Date;
34
35
55 public class PollsVoteModelImpl extends BaseModelImpl {
56 public static String TABLE_NAME = "PollsVote";
57 public static Object[][] TABLE_COLUMNS = {
58 { "voteId", new Integer(Types.BIGINT) },
59 { "userId", new Integer(Types.BIGINT) },
60 { "questionId", new Integer(Types.BIGINT) },
61 { "choiceId", new Integer(Types.BIGINT) },
62 { "voteDate", new Integer(Types.TIMESTAMP) }
63 };
64 public static String TABLE_SQL_CREATE = "create table PollsVote (voteId LONG not null primary key,userId LONG,questionId LONG,choiceId LONG,voteDate DATE null)";
65 public static String TABLE_SQL_DROP = "drop table PollsVote";
66 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
67 "xss.allow.com.liferay.portlet.polls.model.PollsVote"),
68 XSS_ALLOW);
69 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
70 "lock.expiration.time.com.liferay.portlet.polls.model.PollsVoteModel"));
71
72 public PollsVoteModelImpl() {
73 }
74
75 public long getPrimaryKey() {
76 return _voteId;
77 }
78
79 public void setPrimaryKey(long pk) {
80 setVoteId(pk);
81 }
82
83 public Serializable getPrimaryKeyObj() {
84 return new Long(_voteId);
85 }
86
87 public long getVoteId() {
88 return _voteId;
89 }
90
91 public void setVoteId(long voteId) {
92 if (voteId != _voteId) {
93 _voteId = voteId;
94 }
95 }
96
97 public long getUserId() {
98 return _userId;
99 }
100
101 public void setUserId(long userId) {
102 if (userId != _userId) {
103 _userId = userId;
104 }
105 }
106
107 public long getQuestionId() {
108 return _questionId;
109 }
110
111 public void setQuestionId(long questionId) {
112 if (questionId != _questionId) {
113 _questionId = questionId;
114 }
115 }
116
117 public long getChoiceId() {
118 return _choiceId;
119 }
120
121 public void setChoiceId(long choiceId) {
122 if (choiceId != _choiceId) {
123 _choiceId = choiceId;
124 }
125 }
126
127 public Date getVoteDate() {
128 return _voteDate;
129 }
130
131 public void setVoteDate(Date voteDate) {
132 if (((voteDate == null) && (_voteDate != null)) ||
133 ((voteDate != null) && (_voteDate == null)) ||
134 ((voteDate != null) && (_voteDate != null) &&
135 !voteDate.equals(_voteDate))) {
136 _voteDate = voteDate;
137 }
138 }
139
140 public Object clone() {
141 PollsVoteImpl clone = new PollsVoteImpl();
142 clone.setVoteId(getVoteId());
143 clone.setUserId(getUserId());
144 clone.setQuestionId(getQuestionId());
145 clone.setChoiceId(getChoiceId());
146 clone.setVoteDate(getVoteDate());
147
148 return clone;
149 }
150
151 public int compareTo(Object obj) {
152 if (obj == null) {
153 return -1;
154 }
155
156 PollsVoteImpl pollsVote = (PollsVoteImpl)obj;
157 long pk = pollsVote.getPrimaryKey();
158
159 if (getPrimaryKey() < pk) {
160 return -1;
161 }
162 else if (getPrimaryKey() > pk) {
163 return 1;
164 }
165 else {
166 return 0;
167 }
168 }
169
170 public boolean equals(Object obj) {
171 if (obj == null) {
172 return false;
173 }
174
175 PollsVoteImpl pollsVote = null;
176
177 try {
178 pollsVote = (PollsVoteImpl)obj;
179 }
180 catch (ClassCastException cce) {
181 return false;
182 }
183
184 long pk = pollsVote.getPrimaryKey();
185
186 if (getPrimaryKey() == pk) {
187 return true;
188 }
189 else {
190 return false;
191 }
192 }
193
194 public int hashCode() {
195 return (int)getPrimaryKey();
196 }
197
198 private long _voteId;
199 private long _userId;
200 private long _questionId;
201 private long _choiceId;
202 private Date _voteDate;
203 }