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