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