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