001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.polls.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.impl.BaseModelImpl;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.portlet.polls.model.PollsVote;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: import java.util.Date;
037:
038: /**
039: * <a href="PollsVoteModelImpl.java.html"><b><i>View Source</i></b></a>
040: *
041: * <p>
042: * ServiceBuilder generated this class. Modifications in this class will be
043: * overwritten the next time is generated.
044: * </p>
045: *
046: * <p>
047: * This class is a model that represents the <code>PollsVote</code> table
048: * in the database.
049: * </p>
050: *
051: * @author Brian Wing Shun Chan
052: *
053: * @see com.liferay.portlet.polls.service.model.PollsVote
054: * @see com.liferay.portlet.polls.service.model.PollsVoteModel
055: * @see com.liferay.portlet.polls.service.model.impl.PollsVoteImpl
056: *
057: */
058: public class PollsVoteModelImpl extends BaseModelImpl {
059: public static final String TABLE_NAME = "PollsVote";
060: public static final Object[][] TABLE_COLUMNS = {
061: { "voteId", new Integer(Types.BIGINT) },
062:
063: { "userId", new Integer(Types.BIGINT) },
064:
065: { "questionId", new Integer(Types.BIGINT) },
066:
067: { "choiceId", new Integer(Types.BIGINT) },
068:
069: { "voteDate", new Integer(Types.TIMESTAMP) } };
070: public static final String TABLE_SQL_CREATE = "create table PollsVote (voteId LONG not null primary key,userId LONG,questionId LONG,choiceId LONG,voteDate DATE null)";
071: public static final String TABLE_SQL_DROP = "drop table PollsVote";
072: public static final boolean CACHE_ENABLED = GetterUtil
073: .getBoolean(
074: PropsUtil
075: .get("value.object.finder.cache.enabled.com.liferay.portlet.polls.model.PollsVote"),
076: true);
077: public static final long LOCK_EXPIRATION_TIME = GetterUtil
078: .getLong(PropsUtil
079: .get("lock.expiration.time.com.liferay.portlet.polls.model.PollsVote"));
080:
081: public PollsVoteModelImpl() {
082: }
083:
084: public long getPrimaryKey() {
085: return _voteId;
086: }
087:
088: public void setPrimaryKey(long pk) {
089: setVoteId(pk);
090: }
091:
092: public Serializable getPrimaryKeyObj() {
093: return new Long(_voteId);
094: }
095:
096: public long getVoteId() {
097: return _voteId;
098: }
099:
100: public void setVoteId(long voteId) {
101: if (voteId != _voteId) {
102: _voteId = voteId;
103: }
104: }
105:
106: public long getUserId() {
107: return _userId;
108: }
109:
110: public void setUserId(long userId) {
111: if (userId != _userId) {
112: _userId = userId;
113: }
114: }
115:
116: public long getQuestionId() {
117: return _questionId;
118: }
119:
120: public void setQuestionId(long questionId) {
121: if (questionId != _questionId) {
122: _questionId = questionId;
123: }
124: }
125:
126: public long getChoiceId() {
127: return _choiceId;
128: }
129:
130: public void setChoiceId(long choiceId) {
131: if (choiceId != _choiceId) {
132: _choiceId = choiceId;
133: }
134: }
135:
136: public Date getVoteDate() {
137: return _voteDate;
138: }
139:
140: public void setVoteDate(Date voteDate) {
141: if (((voteDate == null) && (_voteDate != null))
142: || ((voteDate != null) && (_voteDate == null))
143: || ((voteDate != null) && (_voteDate != null) && !voteDate
144: .equals(_voteDate))) {
145: _voteDate = voteDate;
146: }
147: }
148:
149: public PollsVote toEscapedModel() {
150: if (isEscapedModel()) {
151: return (PollsVote) this ;
152: } else {
153: PollsVote model = new PollsVoteImpl();
154:
155: model.setEscapedModel(true);
156:
157: model.setVoteId(getVoteId());
158: model.setUserId(getUserId());
159: model.setQuestionId(getQuestionId());
160: model.setChoiceId(getChoiceId());
161: model.setVoteDate(getVoteDate());
162:
163: model = (PollsVote) Proxy.newProxyInstance(PollsVote.class
164: .getClassLoader(), new Class[] { PollsVote.class },
165: new ReadOnlyBeanHandler(model));
166:
167: return model;
168: }
169: }
170:
171: public Object clone() {
172: PollsVoteImpl clone = new PollsVoteImpl();
173:
174: clone.setVoteId(getVoteId());
175: clone.setUserId(getUserId());
176: clone.setQuestionId(getQuestionId());
177: clone.setChoiceId(getChoiceId());
178: clone.setVoteDate(getVoteDate());
179:
180: return clone;
181: }
182:
183: public int compareTo(Object obj) {
184: if (obj == null) {
185: return -1;
186: }
187:
188: PollsVoteImpl pollsVote = (PollsVoteImpl) obj;
189:
190: long pk = pollsVote.getPrimaryKey();
191:
192: if (getPrimaryKey() < pk) {
193: return -1;
194: } else if (getPrimaryKey() > pk) {
195: return 1;
196: } else {
197: return 0;
198: }
199: }
200:
201: public boolean equals(Object obj) {
202: if (obj == null) {
203: return false;
204: }
205:
206: PollsVoteImpl pollsVote = null;
207:
208: try {
209: pollsVote = (PollsVoteImpl) obj;
210: } catch (ClassCastException cce) {
211: return false;
212: }
213:
214: long pk = pollsVote.getPrimaryKey();
215:
216: if (getPrimaryKey() == pk) {
217: return true;
218: } else {
219: return false;
220: }
221: }
222:
223: public int hashCode() {
224: return (int) getPrimaryKey();
225: }
226:
227: private long _voteId;
228: private long _userId;
229: private long _questionId;
230: private long _choiceId;
231: private Date _voteDate;
232: }
|