1
22
23 package com.liferay.portlet.blogs.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.impl.BaseModelImpl;
28 import com.liferay.portal.util.PropsUtil;
29
30 import com.liferay.portlet.blogs.model.BlogsStatsUser;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38 import java.util.Date;
39
40
60 public class BlogsStatsUserModelImpl extends BaseModelImpl {
61 public static final String TABLE_NAME = "BlogsStatsUser";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "statsUserId", new Integer(Types.BIGINT) },
64
65
66 { "groupId", new Integer(Types.BIGINT) },
67
68
69 { "companyId", new Integer(Types.BIGINT) },
70
71
72 { "userId", new Integer(Types.BIGINT) },
73
74
75 { "entryCount", new Integer(Types.INTEGER) },
76
77
78 { "lastPostDate", new Integer(Types.TIMESTAMP) },
79
80
81 { "ratingsTotalEntries", new Integer(Types.INTEGER) },
82
83
84 { "ratingsTotalScore", new Integer(Types.DOUBLE) },
85
86
87 { "ratingsAverageScore", new Integer(Types.DOUBLE) }
88 };
89 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)";
90 public static final String TABLE_SQL_DROP = "drop table BlogsStatsUser";
91 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
92 "value.object.finder.cache.enabled.com.liferay.portlet.blogs.model.BlogsStatsUser"),
93 true);
94 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
95 "lock.expiration.time.com.liferay.portlet.blogs.model.BlogsStatsUser"));
96
97 public BlogsStatsUserModelImpl() {
98 }
99
100 public long getPrimaryKey() {
101 return _statsUserId;
102 }
103
104 public void setPrimaryKey(long pk) {
105 setStatsUserId(pk);
106 }
107
108 public Serializable getPrimaryKeyObj() {
109 return new Long(_statsUserId);
110 }
111
112 public long getStatsUserId() {
113 return _statsUserId;
114 }
115
116 public void setStatsUserId(long statsUserId) {
117 if (statsUserId != _statsUserId) {
118 _statsUserId = statsUserId;
119 }
120 }
121
122 public long getGroupId() {
123 return _groupId;
124 }
125
126 public void setGroupId(long groupId) {
127 if (groupId != _groupId) {
128 _groupId = groupId;
129 }
130 }
131
132 public long getCompanyId() {
133 return _companyId;
134 }
135
136 public void setCompanyId(long companyId) {
137 if (companyId != _companyId) {
138 _companyId = companyId;
139 }
140 }
141
142 public long getUserId() {
143 return _userId;
144 }
145
146 public void setUserId(long userId) {
147 if (userId != _userId) {
148 _userId = userId;
149 }
150 }
151
152 public int getEntryCount() {
153 return _entryCount;
154 }
155
156 public void setEntryCount(int entryCount) {
157 if (entryCount != _entryCount) {
158 _entryCount = entryCount;
159 }
160 }
161
162 public Date getLastPostDate() {
163 return _lastPostDate;
164 }
165
166 public void setLastPostDate(Date lastPostDate) {
167 if (((lastPostDate == null) && (_lastPostDate != null)) ||
168 ((lastPostDate != null) && (_lastPostDate == null)) ||
169 ((lastPostDate != null) && (_lastPostDate != null) &&
170 !lastPostDate.equals(_lastPostDate))) {
171 _lastPostDate = lastPostDate;
172 }
173 }
174
175 public int getRatingsTotalEntries() {
176 return _ratingsTotalEntries;
177 }
178
179 public void setRatingsTotalEntries(int ratingsTotalEntries) {
180 if (ratingsTotalEntries != _ratingsTotalEntries) {
181 _ratingsTotalEntries = ratingsTotalEntries;
182 }
183 }
184
185 public double getRatingsTotalScore() {
186 return _ratingsTotalScore;
187 }
188
189 public void setRatingsTotalScore(double ratingsTotalScore) {
190 if (ratingsTotalScore != _ratingsTotalScore) {
191 _ratingsTotalScore = ratingsTotalScore;
192 }
193 }
194
195 public double getRatingsAverageScore() {
196 return _ratingsAverageScore;
197 }
198
199 public void setRatingsAverageScore(double ratingsAverageScore) {
200 if (ratingsAverageScore != _ratingsAverageScore) {
201 _ratingsAverageScore = ratingsAverageScore;
202 }
203 }
204
205 public BlogsStatsUser toEscapedModel() {
206 if (isEscapedModel()) {
207 return (BlogsStatsUser)this;
208 }
209 else {
210 BlogsStatsUser model = new BlogsStatsUserImpl();
211
212 model.setEscapedModel(true);
213
214 model.setStatsUserId(getStatsUserId());
215 model.setGroupId(getGroupId());
216 model.setCompanyId(getCompanyId());
217 model.setUserId(getUserId());
218 model.setEntryCount(getEntryCount());
219 model.setLastPostDate(getLastPostDate());
220 model.setRatingsTotalEntries(getRatingsTotalEntries());
221 model.setRatingsTotalScore(getRatingsTotalScore());
222 model.setRatingsAverageScore(getRatingsAverageScore());
223
224 model = (BlogsStatsUser)Proxy.newProxyInstance(BlogsStatsUser.class.getClassLoader(),
225 new Class[] { BlogsStatsUser.class },
226 new ReadOnlyBeanHandler(model));
227
228 return model;
229 }
230 }
231
232 public Object clone() {
233 BlogsStatsUserImpl clone = new BlogsStatsUserImpl();
234
235 clone.setStatsUserId(getStatsUserId());
236 clone.setGroupId(getGroupId());
237 clone.setCompanyId(getCompanyId());
238 clone.setUserId(getUserId());
239 clone.setEntryCount(getEntryCount());
240 clone.setLastPostDate(getLastPostDate());
241 clone.setRatingsTotalEntries(getRatingsTotalEntries());
242 clone.setRatingsTotalScore(getRatingsTotalScore());
243 clone.setRatingsAverageScore(getRatingsAverageScore());
244
245 return clone;
246 }
247
248 public int compareTo(Object obj) {
249 if (obj == null) {
250 return -1;
251 }
252
253 BlogsStatsUserImpl blogsStatsUser = (BlogsStatsUserImpl)obj;
254
255 int value = 0;
256
257 if (getEntryCount() < blogsStatsUser.getEntryCount()) {
258 value = -1;
259 }
260 else if (getEntryCount() > blogsStatsUser.getEntryCount()) {
261 value = 1;
262 }
263 else {
264 value = 0;
265 }
266
267 value = value * -1;
268
269 if (value != 0) {
270 return value;
271 }
272
273 return 0;
274 }
275
276 public boolean equals(Object obj) {
277 if (obj == null) {
278 return false;
279 }
280
281 BlogsStatsUserImpl blogsStatsUser = null;
282
283 try {
284 blogsStatsUser = (BlogsStatsUserImpl)obj;
285 }
286 catch (ClassCastException cce) {
287 return false;
288 }
289
290 long pk = blogsStatsUser.getPrimaryKey();
291
292 if (getPrimaryKey() == pk) {
293 return true;
294 }
295 else {
296 return false;
297 }
298 }
299
300 public int hashCode() {
301 return (int)getPrimaryKey();
302 }
303
304 private long _statsUserId;
305 private long _groupId;
306 private long _companyId;
307 private long _userId;
308 private int _entryCount;
309 private Date _lastPostDate;
310 private int _ratingsTotalEntries;
311 private double _ratingsTotalScore;
312 private double _ratingsAverageScore;
313 }