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