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