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.blogs.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.blogs.model.BlogsStatsUser;
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="BlogsStatsUserModelImpl.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>BlogsStatsUser</code> table
048: * in the database.
049: * </p>
050: *
051: * @author Brian Wing Shun Chan
052: *
053: * @see com.liferay.portlet.blogs.service.model.BlogsStatsUser
054: * @see com.liferay.portlet.blogs.service.model.BlogsStatsUserModel
055: * @see com.liferay.portlet.blogs.service.model.impl.BlogsStatsUserImpl
056: *
057: */
058: public class BlogsStatsUserModelImpl extends BaseModelImpl {
059: public static final String TABLE_NAME = "BlogsStatsUser";
060: public static final Object[][] TABLE_COLUMNS = {
061: { "statsUserId", new Integer(Types.BIGINT) },
062:
063: { "groupId", new Integer(Types.BIGINT) },
064:
065: { "companyId", new Integer(Types.BIGINT) },
066:
067: { "userId", new Integer(Types.BIGINT) },
068:
069: { "entryCount", new Integer(Types.INTEGER) },
070:
071: { "lastPostDate", new Integer(Types.TIMESTAMP) },
072:
073: { "ratingsTotalEntries", new Integer(Types.INTEGER) },
074:
075: { "ratingsTotalScore", new Integer(Types.DOUBLE) },
076:
077: { "ratingsAverageScore", new Integer(Types.DOUBLE) } };
078: public static final String TABLE_SQL_CREATE = "create table BlogsStatsUser (statsUserId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,entryCount INTEGER,lastPostDate DATE null,ratingsTotalEntries INTEGER,ratingsTotalScore DOUBLE,ratingsAverageScore DOUBLE)";
079: public static final String TABLE_SQL_DROP = "drop table BlogsStatsUser";
080: public static final boolean CACHE_ENABLED = GetterUtil
081: .getBoolean(
082: PropsUtil
083: .get("value.object.finder.cache.enabled.com.liferay.portlet.blogs.model.BlogsStatsUser"),
084: true);
085: public static final long LOCK_EXPIRATION_TIME = GetterUtil
086: .getLong(PropsUtil
087: .get("lock.expiration.time.com.liferay.portlet.blogs.model.BlogsStatsUser"));
088:
089: public BlogsStatsUserModelImpl() {
090: }
091:
092: public long getPrimaryKey() {
093: return _statsUserId;
094: }
095:
096: public void setPrimaryKey(long pk) {
097: setStatsUserId(pk);
098: }
099:
100: public Serializable getPrimaryKeyObj() {
101: return new Long(_statsUserId);
102: }
103:
104: public long getStatsUserId() {
105: return _statsUserId;
106: }
107:
108: public void setStatsUserId(long statsUserId) {
109: if (statsUserId != _statsUserId) {
110: _statsUserId = statsUserId;
111: }
112: }
113:
114: public long getGroupId() {
115: return _groupId;
116: }
117:
118: public void setGroupId(long groupId) {
119: if (groupId != _groupId) {
120: _groupId = groupId;
121: }
122: }
123:
124: public long getCompanyId() {
125: return _companyId;
126: }
127:
128: public void setCompanyId(long companyId) {
129: if (companyId != _companyId) {
130: _companyId = companyId;
131: }
132: }
133:
134: public long getUserId() {
135: return _userId;
136: }
137:
138: public void setUserId(long userId) {
139: if (userId != _userId) {
140: _userId = userId;
141: }
142: }
143:
144: public int getEntryCount() {
145: return _entryCount;
146: }
147:
148: public void setEntryCount(int entryCount) {
149: if (entryCount != _entryCount) {
150: _entryCount = entryCount;
151: }
152: }
153:
154: public Date getLastPostDate() {
155: return _lastPostDate;
156: }
157:
158: public void setLastPostDate(Date lastPostDate) {
159: if (((lastPostDate == null) && (_lastPostDate != null))
160: || ((lastPostDate != null) && (_lastPostDate == null))
161: || ((lastPostDate != null) && (_lastPostDate != null) && !lastPostDate
162: .equals(_lastPostDate))) {
163: _lastPostDate = lastPostDate;
164: }
165: }
166:
167: public int getRatingsTotalEntries() {
168: return _ratingsTotalEntries;
169: }
170:
171: public void setRatingsTotalEntries(int ratingsTotalEntries) {
172: if (ratingsTotalEntries != _ratingsTotalEntries) {
173: _ratingsTotalEntries = ratingsTotalEntries;
174: }
175: }
176:
177: public double getRatingsTotalScore() {
178: return _ratingsTotalScore;
179: }
180:
181: public void setRatingsTotalScore(double ratingsTotalScore) {
182: if (ratingsTotalScore != _ratingsTotalScore) {
183: _ratingsTotalScore = ratingsTotalScore;
184: }
185: }
186:
187: public double getRatingsAverageScore() {
188: return _ratingsAverageScore;
189: }
190:
191: public void setRatingsAverageScore(double ratingsAverageScore) {
192: if (ratingsAverageScore != _ratingsAverageScore) {
193: _ratingsAverageScore = ratingsAverageScore;
194: }
195: }
196:
197: public BlogsStatsUser toEscapedModel() {
198: if (isEscapedModel()) {
199: return (BlogsStatsUser) this ;
200: } else {
201: BlogsStatsUser model = new BlogsStatsUserImpl();
202:
203: model.setEscapedModel(true);
204:
205: model.setStatsUserId(getStatsUserId());
206: model.setGroupId(getGroupId());
207: model.setCompanyId(getCompanyId());
208: model.setUserId(getUserId());
209: model.setEntryCount(getEntryCount());
210: model.setLastPostDate(getLastPostDate());
211: model.setRatingsTotalEntries(getRatingsTotalEntries());
212: model.setRatingsTotalScore(getRatingsTotalScore());
213: model.setRatingsAverageScore(getRatingsAverageScore());
214:
215: model = (BlogsStatsUser) Proxy.newProxyInstance(
216: BlogsStatsUser.class.getClassLoader(),
217: new Class[] { BlogsStatsUser.class },
218: new ReadOnlyBeanHandler(model));
219:
220: return model;
221: }
222: }
223:
224: public Object clone() {
225: BlogsStatsUserImpl clone = new BlogsStatsUserImpl();
226:
227: clone.setStatsUserId(getStatsUserId());
228: clone.setGroupId(getGroupId());
229: clone.setCompanyId(getCompanyId());
230: clone.setUserId(getUserId());
231: clone.setEntryCount(getEntryCount());
232: clone.setLastPostDate(getLastPostDate());
233: clone.setRatingsTotalEntries(getRatingsTotalEntries());
234: clone.setRatingsTotalScore(getRatingsTotalScore());
235: clone.setRatingsAverageScore(getRatingsAverageScore());
236:
237: return clone;
238: }
239:
240: public int compareTo(Object obj) {
241: if (obj == null) {
242: return -1;
243: }
244:
245: BlogsStatsUserImpl blogsStatsUser = (BlogsStatsUserImpl) obj;
246:
247: int value = 0;
248:
249: if (getEntryCount() < blogsStatsUser.getEntryCount()) {
250: value = -1;
251: } else if (getEntryCount() > blogsStatsUser.getEntryCount()) {
252: value = 1;
253: } else {
254: value = 0;
255: }
256:
257: value = value * -1;
258:
259: if (value != 0) {
260: return value;
261: }
262:
263: return 0;
264: }
265:
266: public boolean equals(Object obj) {
267: if (obj == null) {
268: return false;
269: }
270:
271: BlogsStatsUserImpl blogsStatsUser = null;
272:
273: try {
274: blogsStatsUser = (BlogsStatsUserImpl) obj;
275: } catch (ClassCastException cce) {
276: return false;
277: }
278:
279: long pk = blogsStatsUser.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 _statsUserId;
293: private long _groupId;
294: private long _companyId;
295: private long _userId;
296: private int _entryCount;
297: private Date _lastPostDate;
298: private int _ratingsTotalEntries;
299: private double _ratingsTotalScore;
300: private double _ratingsAverageScore;
301: }
|