1
22
23 package com.liferay.portlet.messageboards.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.messageboards.model.MBStatsUser;
30 import com.liferay.portlet.messageboards.model.MBStatsUserSoap;
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 MBStatsUserModelImpl extends BaseModelImpl {
63 public static final String TABLE_NAME = "MBStatsUser";
64 public static final Object[][] TABLE_COLUMNS = {
65 { "statsUserId", new Integer(Types.BIGINT) },
66
67
68 { "groupId", new Integer(Types.BIGINT) },
69
70
71 { "userId", new Integer(Types.BIGINT) },
72
73
74 { "messageCount", new Integer(Types.INTEGER) },
75
76
77 { "lastPostDate", new Integer(Types.TIMESTAMP) }
78 };
79 public static final String TABLE_SQL_CREATE = "create table MBStatsUser (statsUserId LONG not null primary key,groupId LONG,userId LONG,messageCount INTEGER,lastPostDate DATE null)";
80 public static final String TABLE_SQL_DROP = "drop table MBStatsUser";
81 public static final String DATA_SOURCE = "liferayDataSource";
82 public static final String SESSION_FACTORY = "liferaySessionFactory";
83 public static final String TX_MANAGER = "liferayTransactionManager";
84 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
85 "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBStatsUser"),
86 true);
87
88 public static MBStatsUser toModel(MBStatsUserSoap soapModel) {
89 MBStatsUser model = new MBStatsUserImpl();
90
91 model.setStatsUserId(soapModel.getStatsUserId());
92 model.setGroupId(soapModel.getGroupId());
93 model.setUserId(soapModel.getUserId());
94 model.setMessageCount(soapModel.getMessageCount());
95 model.setLastPostDate(soapModel.getLastPostDate());
96
97 return model;
98 }
99
100 public static List<MBStatsUser> toModels(MBStatsUserSoap[] soapModels) {
101 List<MBStatsUser> models = new ArrayList<MBStatsUser>(soapModels.length);
102
103 for (MBStatsUserSoap soapModel : soapModels) {
104 models.add(toModel(soapModel));
105 }
106
107 return models;
108 }
109
110 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
111 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBStatsUser"));
112
113 public MBStatsUserModelImpl() {
114 }
115
116 public long getPrimaryKey() {
117 return _statsUserId;
118 }
119
120 public void setPrimaryKey(long pk) {
121 setStatsUserId(pk);
122 }
123
124 public Serializable getPrimaryKeyObj() {
125 return new Long(_statsUserId);
126 }
127
128 public long getStatsUserId() {
129 return _statsUserId;
130 }
131
132 public void setStatsUserId(long statsUserId) {
133 if (statsUserId != _statsUserId) {
134 _statsUserId = statsUserId;
135 }
136 }
137
138 public long getGroupId() {
139 return _groupId;
140 }
141
142 public void setGroupId(long groupId) {
143 if (groupId != _groupId) {
144 _groupId = groupId;
145 }
146 }
147
148 public long getUserId() {
149 return _userId;
150 }
151
152 public void setUserId(long userId) {
153 if (userId != _userId) {
154 _userId = userId;
155 }
156 }
157
158 public int getMessageCount() {
159 return _messageCount;
160 }
161
162 public void setMessageCount(int messageCount) {
163 if (messageCount != _messageCount) {
164 _messageCount = messageCount;
165 }
166 }
167
168 public Date getLastPostDate() {
169 return _lastPostDate;
170 }
171
172 public void setLastPostDate(Date lastPostDate) {
173 if (((lastPostDate == null) && (_lastPostDate != null)) ||
174 ((lastPostDate != null) && (_lastPostDate == null)) ||
175 ((lastPostDate != null) && (_lastPostDate != null) &&
176 !lastPostDate.equals(_lastPostDate))) {
177 _lastPostDate = lastPostDate;
178 }
179 }
180
181 public MBStatsUser toEscapedModel() {
182 if (isEscapedModel()) {
183 return (MBStatsUser)this;
184 }
185 else {
186 MBStatsUser model = new MBStatsUserImpl();
187
188 model.setNew(isNew());
189 model.setEscapedModel(true);
190
191 model.setStatsUserId(getStatsUserId());
192 model.setGroupId(getGroupId());
193 model.setUserId(getUserId());
194 model.setMessageCount(getMessageCount());
195 model.setLastPostDate(getLastPostDate());
196
197 model = (MBStatsUser)Proxy.newProxyInstance(MBStatsUser.class.getClassLoader(),
198 new Class[] { MBStatsUser.class },
199 new ReadOnlyBeanHandler(model));
200
201 return model;
202 }
203 }
204
205 public Object clone() {
206 MBStatsUserImpl clone = new MBStatsUserImpl();
207
208 clone.setStatsUserId(getStatsUserId());
209 clone.setGroupId(getGroupId());
210 clone.setUserId(getUserId());
211 clone.setMessageCount(getMessageCount());
212 clone.setLastPostDate(getLastPostDate());
213
214 return clone;
215 }
216
217 public int compareTo(Object obj) {
218 if (obj == null) {
219 return -1;
220 }
221
222 MBStatsUserImpl mbStatsUser = (MBStatsUserImpl)obj;
223
224 int value = 0;
225
226 if (getMessageCount() < mbStatsUser.getMessageCount()) {
227 value = -1;
228 }
229 else if (getMessageCount() > mbStatsUser.getMessageCount()) {
230 value = 1;
231 }
232 else {
233 value = 0;
234 }
235
236 value = value * -1;
237
238 if (value != 0) {
239 return value;
240 }
241
242 return 0;
243 }
244
245 public boolean equals(Object obj) {
246 if (obj == null) {
247 return false;
248 }
249
250 MBStatsUserImpl mbStatsUser = null;
251
252 try {
253 mbStatsUser = (MBStatsUserImpl)obj;
254 }
255 catch (ClassCastException cce) {
256 return false;
257 }
258
259 long pk = mbStatsUser.getPrimaryKey();
260
261 if (getPrimaryKey() == pk) {
262 return true;
263 }
264 else {
265 return false;
266 }
267 }
268
269 public int hashCode() {
270 return (int)getPrimaryKey();
271 }
272
273 private long _statsUserId;
274 private long _groupId;
275 private long _userId;
276 private int _messageCount;
277 private Date _lastPostDate;
278 }