1
19
20 package com.liferay.portlet.blogs.model.impl;
21
22 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23 import com.liferay.portal.kernel.util.GetterUtil;
24 import com.liferay.portal.model.impl.BaseModelImpl;
25
26 import com.liferay.portlet.blogs.model.BlogsStatsUser;
27 import com.liferay.portlet.blogs.model.BlogsStatsUserSoap;
28
29 import java.io.Serializable;
30
31 import java.lang.reflect.Proxy;
32
33 import java.sql.Types;
34
35 import java.util.ArrayList;
36 import java.util.Date;
37 import java.util.List;
38
39
59 public class BlogsStatsUserModelImpl extends BaseModelImpl {
60 public static final String TABLE_NAME = "BlogsStatsUser";
61 public static final Object[][] TABLE_COLUMNS = {
62 { "statsUserId", new Integer(Types.BIGINT) },
63
64
65 { "groupId", new Integer(Types.BIGINT) },
66
67
68 { "companyId", new Integer(Types.BIGINT) },
69
70
71 { "userId", new Integer(Types.BIGINT) },
72
73
74 { "entryCount", new Integer(Types.INTEGER) },
75
76
77 { "lastPostDate", new Integer(Types.TIMESTAMP) },
78
79
80 { "ratingsTotalEntries", new Integer(Types.INTEGER) },
81
82
83 { "ratingsTotalScore", new Integer(Types.DOUBLE) },
84
85
86 { "ratingsAverageScore", new Integer(Types.DOUBLE) }
87 };
88 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)";
89 public static final String TABLE_SQL_DROP = "drop table BlogsStatsUser";
90 public static final String DATA_SOURCE = "liferayDataSource";
91 public static final String SESSION_FACTORY = "liferaySessionFactory";
92 public static final String TX_MANAGER = "liferayTransactionManager";
93 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
94 "value.object.finder.cache.enabled.com.liferay.portlet.blogs.model.BlogsStatsUser"),
95 true);
96
97 public static BlogsStatsUser toModel(BlogsStatsUserSoap soapModel) {
98 BlogsStatsUser model = new BlogsStatsUserImpl();
99
100 model.setStatsUserId(soapModel.getStatsUserId());
101 model.setGroupId(soapModel.getGroupId());
102 model.setCompanyId(soapModel.getCompanyId());
103 model.setUserId(soapModel.getUserId());
104 model.setEntryCount(soapModel.getEntryCount());
105 model.setLastPostDate(soapModel.getLastPostDate());
106 model.setRatingsTotalEntries(soapModel.getRatingsTotalEntries());
107 model.setRatingsTotalScore(soapModel.getRatingsTotalScore());
108 model.setRatingsAverageScore(soapModel.getRatingsAverageScore());
109
110 return model;
111 }
112
113 public static List<BlogsStatsUser> toModels(BlogsStatsUserSoap[] soapModels) {
114 List<BlogsStatsUser> models = new ArrayList<BlogsStatsUser>(soapModels.length);
115
116 for (BlogsStatsUserSoap soapModel : soapModels) {
117 models.add(toModel(soapModel));
118 }
119
120 return models;
121 }
122
123 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
124 "lock.expiration.time.com.liferay.portlet.blogs.model.BlogsStatsUser"));
125
126 public BlogsStatsUserModelImpl() {
127 }
128
129 public long getPrimaryKey() {
130 return _statsUserId;
131 }
132
133 public void setPrimaryKey(long pk) {
134 setStatsUserId(pk);
135 }
136
137 public Serializable getPrimaryKeyObj() {
138 return new Long(_statsUserId);
139 }
140
141 public long getStatsUserId() {
142 return _statsUserId;
143 }
144
145 public void setStatsUserId(long statsUserId) {
146 if (statsUserId != _statsUserId) {
147 _statsUserId = statsUserId;
148 }
149 }
150
151 public long getGroupId() {
152 return _groupId;
153 }
154
155 public void setGroupId(long groupId) {
156 if (groupId != _groupId) {
157 _groupId = groupId;
158 }
159 }
160
161 public long getCompanyId() {
162 return _companyId;
163 }
164
165 public void setCompanyId(long companyId) {
166 if (companyId != _companyId) {
167 _companyId = companyId;
168 }
169 }
170
171 public long getUserId() {
172 return _userId;
173 }
174
175 public void setUserId(long userId) {
176 if (userId != _userId) {
177 _userId = userId;
178 }
179 }
180
181 public int getEntryCount() {
182 return _entryCount;
183 }
184
185 public void setEntryCount(int entryCount) {
186 if (entryCount != _entryCount) {
187 _entryCount = entryCount;
188 }
189 }
190
191 public Date getLastPostDate() {
192 return _lastPostDate;
193 }
194
195 public void setLastPostDate(Date lastPostDate) {
196 if (((lastPostDate == null) && (_lastPostDate != null)) ||
197 ((lastPostDate != null) && (_lastPostDate == null)) ||
198 ((lastPostDate != null) && (_lastPostDate != null) &&
199 !lastPostDate.equals(_lastPostDate))) {
200 _lastPostDate = lastPostDate;
201 }
202 }
203
204 public int getRatingsTotalEntries() {
205 return _ratingsTotalEntries;
206 }
207
208 public void setRatingsTotalEntries(int ratingsTotalEntries) {
209 if (ratingsTotalEntries != _ratingsTotalEntries) {
210 _ratingsTotalEntries = ratingsTotalEntries;
211 }
212 }
213
214 public double getRatingsTotalScore() {
215 return _ratingsTotalScore;
216 }
217
218 public void setRatingsTotalScore(double ratingsTotalScore) {
219 if (ratingsTotalScore != _ratingsTotalScore) {
220 _ratingsTotalScore = ratingsTotalScore;
221 }
222 }
223
224 public double getRatingsAverageScore() {
225 return _ratingsAverageScore;
226 }
227
228 public void setRatingsAverageScore(double ratingsAverageScore) {
229 if (ratingsAverageScore != _ratingsAverageScore) {
230 _ratingsAverageScore = ratingsAverageScore;
231 }
232 }
233
234 public BlogsStatsUser toEscapedModel() {
235 if (isEscapedModel()) {
236 return (BlogsStatsUser)this;
237 }
238 else {
239 BlogsStatsUser model = new BlogsStatsUserImpl();
240
241 model.setNew(isNew());
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 }