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.DateUtil;
025: import com.liferay.portal.kernel.util.GetterUtil;
026: import com.liferay.portal.model.impl.BaseModelImpl;
027: import com.liferay.portal.util.PropsUtil;
028:
029: import com.liferay.portlet.polls.model.PollsQuestion;
030:
031: import com.liferay.util.Html;
032:
033: import java.io.Serializable;
034:
035: import java.lang.reflect.Proxy;
036:
037: import java.sql.Types;
038:
039: import java.util.Date;
040:
041: /**
042: * <a href="PollsQuestionModelImpl.java.html"><b><i>View Source</i></b></a>
043: *
044: * <p>
045: * ServiceBuilder generated this class. Modifications in this class will be
046: * overwritten the next time is generated.
047: * </p>
048: *
049: * <p>
050: * This class is a model that represents the <code>PollsQuestion</code> table
051: * in the database.
052: * </p>
053: *
054: * @author Brian Wing Shun Chan
055: *
056: * @see com.liferay.portlet.polls.service.model.PollsQuestion
057: * @see com.liferay.portlet.polls.service.model.PollsQuestionModel
058: * @see com.liferay.portlet.polls.service.model.impl.PollsQuestionImpl
059: *
060: */
061: public class PollsQuestionModelImpl extends BaseModelImpl {
062: public static final String TABLE_NAME = "PollsQuestion";
063: public static final Object[][] TABLE_COLUMNS = {
064: { "uuid_", new Integer(Types.VARCHAR) },
065:
066: { "questionId", new Integer(Types.BIGINT) },
067:
068: { "groupId", new Integer(Types.BIGINT) },
069:
070: { "companyId", new Integer(Types.BIGINT) },
071:
072: { "userId", new Integer(Types.BIGINT) },
073:
074: { "userName", new Integer(Types.VARCHAR) },
075:
076: { "createDate", new Integer(Types.TIMESTAMP) },
077:
078: { "modifiedDate", new Integer(Types.TIMESTAMP) },
079:
080: { "title", new Integer(Types.VARCHAR) },
081:
082: { "description", new Integer(Types.VARCHAR) },
083:
084: { "expirationDate", new Integer(Types.TIMESTAMP) },
085:
086: { "lastVoteDate", new Integer(Types.TIMESTAMP) } };
087: public static final String TABLE_SQL_CREATE = "create table PollsQuestion (uuid_ VARCHAR(75) null,questionId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,title VARCHAR(500) null,description STRING null,expirationDate DATE null,lastVoteDate DATE null)";
088: public static final String TABLE_SQL_DROP = "drop table PollsQuestion";
089: public static final boolean CACHE_ENABLED = GetterUtil
090: .getBoolean(
091: PropsUtil
092: .get("value.object.finder.cache.enabled.com.liferay.portlet.polls.model.PollsQuestion"),
093: true);
094: public static final long LOCK_EXPIRATION_TIME = GetterUtil
095: .getLong(PropsUtil
096: .get("lock.expiration.time.com.liferay.portlet.polls.model.PollsQuestion"));
097:
098: public PollsQuestionModelImpl() {
099: }
100:
101: public long getPrimaryKey() {
102: return _questionId;
103: }
104:
105: public void setPrimaryKey(long pk) {
106: setQuestionId(pk);
107: }
108:
109: public Serializable getPrimaryKeyObj() {
110: return new Long(_questionId);
111: }
112:
113: public String getUuid() {
114: return GetterUtil.getString(_uuid);
115: }
116:
117: public void setUuid(String uuid) {
118: if ((uuid != null) && (uuid != _uuid)) {
119: _uuid = uuid;
120: }
121: }
122:
123: public long getQuestionId() {
124: return _questionId;
125: }
126:
127: public void setQuestionId(long questionId) {
128: if (questionId != _questionId) {
129: _questionId = questionId;
130: }
131: }
132:
133: public long getGroupId() {
134: return _groupId;
135: }
136:
137: public void setGroupId(long groupId) {
138: if (groupId != _groupId) {
139: _groupId = groupId;
140: }
141: }
142:
143: public long getCompanyId() {
144: return _companyId;
145: }
146:
147: public void setCompanyId(long companyId) {
148: if (companyId != _companyId) {
149: _companyId = companyId;
150: }
151: }
152:
153: public long getUserId() {
154: return _userId;
155: }
156:
157: public void setUserId(long userId) {
158: if (userId != _userId) {
159: _userId = userId;
160: }
161: }
162:
163: public String getUserName() {
164: return GetterUtil.getString(_userName);
165: }
166:
167: public void setUserName(String userName) {
168: if (((userName == null) && (_userName != null))
169: || ((userName != null) && (_userName == null))
170: || ((userName != null) && (_userName != null) && !userName
171: .equals(_userName))) {
172: _userName = userName;
173: }
174: }
175:
176: public Date getCreateDate() {
177: return _createDate;
178: }
179:
180: public void setCreateDate(Date createDate) {
181: if (((createDate == null) && (_createDate != null))
182: || ((createDate != null) && (_createDate == null))
183: || ((createDate != null) && (_createDate != null) && !createDate
184: .equals(_createDate))) {
185: _createDate = createDate;
186: }
187: }
188:
189: public Date getModifiedDate() {
190: return _modifiedDate;
191: }
192:
193: public void setModifiedDate(Date modifiedDate) {
194: if (((modifiedDate == null) && (_modifiedDate != null))
195: || ((modifiedDate != null) && (_modifiedDate == null))
196: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
197: .equals(_modifiedDate))) {
198: _modifiedDate = modifiedDate;
199: }
200: }
201:
202: public String getTitle() {
203: return GetterUtil.getString(_title);
204: }
205:
206: public void setTitle(String title) {
207: if (((title == null) && (_title != null))
208: || ((title != null) && (_title == null))
209: || ((title != null) && (_title != null) && !title
210: .equals(_title))) {
211: _title = title;
212: }
213: }
214:
215: public String getDescription() {
216: return GetterUtil.getString(_description);
217: }
218:
219: public void setDescription(String description) {
220: if (((description == null) && (_description != null))
221: || ((description != null) && (_description == null))
222: || ((description != null) && (_description != null) && !description
223: .equals(_description))) {
224: _description = description;
225: }
226: }
227:
228: public Date getExpirationDate() {
229: return _expirationDate;
230: }
231:
232: public void setExpirationDate(Date expirationDate) {
233: if (((expirationDate == null) && (_expirationDate != null))
234: || ((expirationDate != null) && (_expirationDate == null))
235: || ((expirationDate != null)
236: && (_expirationDate != null) && !expirationDate
237: .equals(_expirationDate))) {
238: _expirationDate = expirationDate;
239: }
240: }
241:
242: public Date getLastVoteDate() {
243: return _lastVoteDate;
244: }
245:
246: public void setLastVoteDate(Date lastVoteDate) {
247: if (((lastVoteDate == null) && (_lastVoteDate != null))
248: || ((lastVoteDate != null) && (_lastVoteDate == null))
249: || ((lastVoteDate != null) && (_lastVoteDate != null) && !lastVoteDate
250: .equals(_lastVoteDate))) {
251: _lastVoteDate = lastVoteDate;
252: }
253: }
254:
255: public PollsQuestion toEscapedModel() {
256: if (isEscapedModel()) {
257: return (PollsQuestion) this ;
258: } else {
259: PollsQuestion model = new PollsQuestionImpl();
260:
261: model.setEscapedModel(true);
262:
263: model.setUuid(Html.escape(getUuid()));
264: model.setQuestionId(getQuestionId());
265: model.setGroupId(getGroupId());
266: model.setCompanyId(getCompanyId());
267: model.setUserId(getUserId());
268: model.setUserName(Html.escape(getUserName()));
269: model.setCreateDate(getCreateDate());
270: model.setModifiedDate(getModifiedDate());
271: model.setTitle(Html.escape(getTitle()));
272: model.setDescription(Html.escape(getDescription()));
273: model.setExpirationDate(getExpirationDate());
274: model.setLastVoteDate(getLastVoteDate());
275:
276: model = (PollsQuestion) Proxy.newProxyInstance(
277: PollsQuestion.class.getClassLoader(),
278: new Class[] { PollsQuestion.class },
279: new ReadOnlyBeanHandler(model));
280:
281: return model;
282: }
283: }
284:
285: public Object clone() {
286: PollsQuestionImpl clone = new PollsQuestionImpl();
287:
288: clone.setUuid(getUuid());
289: clone.setQuestionId(getQuestionId());
290: clone.setGroupId(getGroupId());
291: clone.setCompanyId(getCompanyId());
292: clone.setUserId(getUserId());
293: clone.setUserName(getUserName());
294: clone.setCreateDate(getCreateDate());
295: clone.setModifiedDate(getModifiedDate());
296: clone.setTitle(getTitle());
297: clone.setDescription(getDescription());
298: clone.setExpirationDate(getExpirationDate());
299: clone.setLastVoteDate(getLastVoteDate());
300:
301: return clone;
302: }
303:
304: public int compareTo(Object obj) {
305: if (obj == null) {
306: return -1;
307: }
308:
309: PollsQuestionImpl pollsQuestion = (PollsQuestionImpl) obj;
310:
311: int value = 0;
312:
313: value = DateUtil.compareTo(getCreateDate(), pollsQuestion
314: .getCreateDate());
315:
316: value = value * -1;
317:
318: if (value != 0) {
319: return value;
320: }
321:
322: return 0;
323: }
324:
325: public boolean equals(Object obj) {
326: if (obj == null) {
327: return false;
328: }
329:
330: PollsQuestionImpl pollsQuestion = null;
331:
332: try {
333: pollsQuestion = (PollsQuestionImpl) obj;
334: } catch (ClassCastException cce) {
335: return false;
336: }
337:
338: long pk = pollsQuestion.getPrimaryKey();
339:
340: if (getPrimaryKey() == pk) {
341: return true;
342: } else {
343: return false;
344: }
345: }
346:
347: public int hashCode() {
348: return (int) getPrimaryKey();
349: }
350:
351: private String _uuid;
352: private long _questionId;
353: private long _groupId;
354: private long _companyId;
355: private long _userId;
356: private String _userName;
357: private Date _createDate;
358: private Date _modifiedDate;
359: private String _title;
360: private String _description;
361: private Date _expirationDate;
362: private Date _lastVoteDate;
363: }
|