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.ratings.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.ratings.model.RatingsEntry;
029:
030: import com.liferay.util.Html;
031:
032: import java.io.Serializable;
033:
034: import java.lang.reflect.Proxy;
035:
036: import java.sql.Types;
037:
038: import java.util.Date;
039:
040: /**
041: * <a href="RatingsEntryModelImpl.java.html"><b><i>View Source</i></b></a>
042: *
043: * <p>
044: * ServiceBuilder generated this class. Modifications in this class will be
045: * overwritten the next time is generated.
046: * </p>
047: *
048: * <p>
049: * This class is a model that represents the <code>RatingsEntry</code> table
050: * in the database.
051: * </p>
052: *
053: * @author Brian Wing Shun Chan
054: *
055: * @see com.liferay.portlet.ratings.service.model.RatingsEntry
056: * @see com.liferay.portlet.ratings.service.model.RatingsEntryModel
057: * @see com.liferay.portlet.ratings.service.model.impl.RatingsEntryImpl
058: *
059: */
060: public class RatingsEntryModelImpl extends BaseModelImpl {
061: public static final String TABLE_NAME = "RatingsEntry";
062: public static final Object[][] TABLE_COLUMNS = {
063: { "entryId", new Integer(Types.BIGINT) },
064:
065: { "companyId", new Integer(Types.BIGINT) },
066:
067: { "userId", new Integer(Types.BIGINT) },
068:
069: { "userName", new Integer(Types.VARCHAR) },
070:
071: { "createDate", new Integer(Types.TIMESTAMP) },
072:
073: { "modifiedDate", new Integer(Types.TIMESTAMP) },
074:
075: { "classNameId", new Integer(Types.BIGINT) },
076:
077: { "classPK", new Integer(Types.BIGINT) },
078:
079: { "score", new Integer(Types.DOUBLE) } };
080: public static final String TABLE_SQL_CREATE = "create table RatingsEntry (entryId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,score DOUBLE)";
081: public static final String TABLE_SQL_DROP = "drop table RatingsEntry";
082: public static final boolean CACHE_ENABLED = GetterUtil
083: .getBoolean(
084: PropsUtil
085: .get("value.object.finder.cache.enabled.com.liferay.portlet.ratings.model.RatingsEntry"),
086: true);
087: public static final long LOCK_EXPIRATION_TIME = GetterUtil
088: .getLong(PropsUtil
089: .get("lock.expiration.time.com.liferay.portlet.ratings.model.RatingsEntry"));
090:
091: public RatingsEntryModelImpl() {
092: }
093:
094: public long getPrimaryKey() {
095: return _entryId;
096: }
097:
098: public void setPrimaryKey(long pk) {
099: setEntryId(pk);
100: }
101:
102: public Serializable getPrimaryKeyObj() {
103: return new Long(_entryId);
104: }
105:
106: public long getEntryId() {
107: return _entryId;
108: }
109:
110: public void setEntryId(long entryId) {
111: if (entryId != _entryId) {
112: _entryId = entryId;
113: }
114: }
115:
116: public long getCompanyId() {
117: return _companyId;
118: }
119:
120: public void setCompanyId(long companyId) {
121: if (companyId != _companyId) {
122: _companyId = companyId;
123: }
124: }
125:
126: public long getUserId() {
127: return _userId;
128: }
129:
130: public void setUserId(long userId) {
131: if (userId != _userId) {
132: _userId = userId;
133: }
134: }
135:
136: public String getUserName() {
137: return GetterUtil.getString(_userName);
138: }
139:
140: public void setUserName(String userName) {
141: if (((userName == null) && (_userName != null))
142: || ((userName != null) && (_userName == null))
143: || ((userName != null) && (_userName != null) && !userName
144: .equals(_userName))) {
145: _userName = userName;
146: }
147: }
148:
149: public Date getCreateDate() {
150: return _createDate;
151: }
152:
153: public void setCreateDate(Date createDate) {
154: if (((createDate == null) && (_createDate != null))
155: || ((createDate != null) && (_createDate == null))
156: || ((createDate != null) && (_createDate != null) && !createDate
157: .equals(_createDate))) {
158: _createDate = createDate;
159: }
160: }
161:
162: public Date getModifiedDate() {
163: return _modifiedDate;
164: }
165:
166: public void setModifiedDate(Date modifiedDate) {
167: if (((modifiedDate == null) && (_modifiedDate != null))
168: || ((modifiedDate != null) && (_modifiedDate == null))
169: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
170: .equals(_modifiedDate))) {
171: _modifiedDate = modifiedDate;
172: }
173: }
174:
175: public long getClassNameId() {
176: return _classNameId;
177: }
178:
179: public void setClassNameId(long classNameId) {
180: if (classNameId != _classNameId) {
181: _classNameId = classNameId;
182: }
183: }
184:
185: public long getClassPK() {
186: return _classPK;
187: }
188:
189: public void setClassPK(long classPK) {
190: if (classPK != _classPK) {
191: _classPK = classPK;
192: }
193: }
194:
195: public double getScore() {
196: return _score;
197: }
198:
199: public void setScore(double score) {
200: if (score != _score) {
201: _score = score;
202: }
203: }
204:
205: public RatingsEntry toEscapedModel() {
206: if (isEscapedModel()) {
207: return (RatingsEntry) this ;
208: } else {
209: RatingsEntry model = new RatingsEntryImpl();
210:
211: model.setEscapedModel(true);
212:
213: model.setEntryId(getEntryId());
214: model.setCompanyId(getCompanyId());
215: model.setUserId(getUserId());
216: model.setUserName(Html.escape(getUserName()));
217: model.setCreateDate(getCreateDate());
218: model.setModifiedDate(getModifiedDate());
219: model.setClassNameId(getClassNameId());
220: model.setClassPK(getClassPK());
221: model.setScore(getScore());
222:
223: model = (RatingsEntry) Proxy.newProxyInstance(
224: RatingsEntry.class.getClassLoader(),
225: new Class[] { RatingsEntry.class },
226: new ReadOnlyBeanHandler(model));
227:
228: return model;
229: }
230: }
231:
232: public Object clone() {
233: RatingsEntryImpl clone = new RatingsEntryImpl();
234:
235: clone.setEntryId(getEntryId());
236: clone.setCompanyId(getCompanyId());
237: clone.setUserId(getUserId());
238: clone.setUserName(getUserName());
239: clone.setCreateDate(getCreateDate());
240: clone.setModifiedDate(getModifiedDate());
241: clone.setClassNameId(getClassNameId());
242: clone.setClassPK(getClassPK());
243: clone.setScore(getScore());
244:
245: return clone;
246: }
247:
248: public int compareTo(Object obj) {
249: if (obj == null) {
250: return -1;
251: }
252:
253: RatingsEntryImpl ratingsEntry = (RatingsEntryImpl) obj;
254:
255: long pk = ratingsEntry.getPrimaryKey();
256:
257: if (getPrimaryKey() < pk) {
258: return -1;
259: } else if (getPrimaryKey() > pk) {
260: return 1;
261: } else {
262: return 0;
263: }
264: }
265:
266: public boolean equals(Object obj) {
267: if (obj == null) {
268: return false;
269: }
270:
271: RatingsEntryImpl ratingsEntry = null;
272:
273: try {
274: ratingsEntry = (RatingsEntryImpl) obj;
275: } catch (ClassCastException cce) {
276: return false;
277: }
278:
279: long pk = ratingsEntry.getPrimaryKey();
280:
281: if (getPrimaryKey() == pk) {
282: return true;
283: } else {
284: return false;
285: }
286: }
287:
288: public int hashCode() {
289: return (int) getPrimaryKey();
290: }
291:
292: private long _entryId;
293: private long _companyId;
294: private long _userId;
295: private String _userName;
296: private Date _createDate;
297: private Date _modifiedDate;
298: private long _classNameId;
299: private long _classPK;
300: private double _score;
301: }
|