1
22
23 package com.liferay.portlet.social.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.DateUtil;
27 import com.liferay.portal.kernel.util.GetterUtil;
28 import com.liferay.portal.kernel.util.HtmlUtil;
29 import com.liferay.portal.model.impl.BaseModelImpl;
30 import com.liferay.portal.util.PortalUtil;
31 import com.liferay.portal.util.PropsUtil;
32
33 import com.liferay.portlet.social.model.SocialActivity;
34 import com.liferay.portlet.social.model.SocialActivitySoap;
35
36 import java.io.Serializable;
37
38 import java.lang.reflect.Proxy;
39
40 import java.sql.Types;
41
42 import java.util.ArrayList;
43 import java.util.Date;
44 import java.util.List;
45
46
66 public class SocialActivityModelImpl extends BaseModelImpl {
67 public static final String TABLE_NAME = "SocialActivity";
68 public static final Object[][] TABLE_COLUMNS = {
69 { "activityId", new Integer(Types.BIGINT) },
70
71
72 { "groupId", new Integer(Types.BIGINT) },
73
74
75 { "companyId", new Integer(Types.BIGINT) },
76
77
78 { "userId", new Integer(Types.BIGINT) },
79
80
81 { "userName", new Integer(Types.VARCHAR) },
82
83
84 { "createDate", new Integer(Types.TIMESTAMP) },
85
86
87 { "classNameId", new Integer(Types.BIGINT) },
88
89
90 { "classPK", new Integer(Types.BIGINT) },
91
92
93 { "type_", new Integer(Types.VARCHAR) },
94
95
96 { "extraData", new Integer(Types.CLOB) },
97
98
99 { "receiverUserId", new Integer(Types.BIGINT) },
100
101
102 { "receiverUserName", new Integer(Types.VARCHAR) }
103 };
104 public static final String TABLE_SQL_CREATE = "create table SocialActivity (activityId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,classNameId LONG,classPK LONG,type_ VARCHAR(75) null,extraData TEXT null,receiverUserId LONG,receiverUserName VARCHAR(75) null)";
105 public static final String TABLE_SQL_DROP = "drop table SocialActivity";
106 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
107 "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialActivity"),
108 true);
109
110 public static SocialActivity toModel(SocialActivitySoap soapModel) {
111 SocialActivity model = new SocialActivityImpl();
112
113 model.setActivityId(soapModel.getActivityId());
114 model.setGroupId(soapModel.getGroupId());
115 model.setCompanyId(soapModel.getCompanyId());
116 model.setUserId(soapModel.getUserId());
117 model.setUserName(soapModel.getUserName());
118 model.setCreateDate(soapModel.getCreateDate());
119 model.setClassNameId(soapModel.getClassNameId());
120 model.setClassPK(soapModel.getClassPK());
121 model.setType(soapModel.getType());
122 model.setExtraData(soapModel.getExtraData());
123 model.setReceiverUserId(soapModel.getReceiverUserId());
124 model.setReceiverUserName(soapModel.getReceiverUserName());
125
126 return model;
127 }
128
129 public static List<SocialActivity> toModels(SocialActivitySoap[] soapModels) {
130 List<SocialActivity> models = new ArrayList<SocialActivity>(soapModels.length);
131
132 for (SocialActivitySoap soapModel : soapModels) {
133 models.add(toModel(soapModel));
134 }
135
136 return models;
137 }
138
139 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
140 "lock.expiration.time.com.liferay.portlet.social.model.SocialActivity"));
141
142 public SocialActivityModelImpl() {
143 }
144
145 public long getPrimaryKey() {
146 return _activityId;
147 }
148
149 public void setPrimaryKey(long pk) {
150 setActivityId(pk);
151 }
152
153 public Serializable getPrimaryKeyObj() {
154 return new Long(_activityId);
155 }
156
157 public long getActivityId() {
158 return _activityId;
159 }
160
161 public void setActivityId(long activityId) {
162 if (activityId != _activityId) {
163 _activityId = activityId;
164 }
165 }
166
167 public long getGroupId() {
168 return _groupId;
169 }
170
171 public void setGroupId(long groupId) {
172 if (groupId != _groupId) {
173 _groupId = groupId;
174 }
175 }
176
177 public long getCompanyId() {
178 return _companyId;
179 }
180
181 public void setCompanyId(long companyId) {
182 if (companyId != _companyId) {
183 _companyId = companyId;
184 }
185 }
186
187 public long getUserId() {
188 return _userId;
189 }
190
191 public void setUserId(long userId) {
192 if (userId != _userId) {
193 _userId = userId;
194 }
195 }
196
197 public String getUserName() {
198 return GetterUtil.getString(_userName);
199 }
200
201 public void setUserName(String userName) {
202 if (((userName == null) && (_userName != null)) ||
203 ((userName != null) && (_userName == null)) ||
204 ((userName != null) && (_userName != null) &&
205 !userName.equals(_userName))) {
206 _userName = userName;
207 }
208 }
209
210 public Date getCreateDate() {
211 return _createDate;
212 }
213
214 public void setCreateDate(Date createDate) {
215 if (((createDate == null) && (_createDate != null)) ||
216 ((createDate != null) && (_createDate == null)) ||
217 ((createDate != null) && (_createDate != null) &&
218 !createDate.equals(_createDate))) {
219 _createDate = createDate;
220 }
221 }
222
223 public String getClassName() {
224 return PortalUtil.getClassName(getClassNameId());
225 }
226
227 public long getClassNameId() {
228 return _classNameId;
229 }
230
231 public void setClassNameId(long classNameId) {
232 if (classNameId != _classNameId) {
233 _classNameId = classNameId;
234 }
235 }
236
237 public long getClassPK() {
238 return _classPK;
239 }
240
241 public void setClassPK(long classPK) {
242 if (classPK != _classPK) {
243 _classPK = classPK;
244 }
245 }
246
247 public String getType() {
248 return GetterUtil.getString(_type);
249 }
250
251 public void setType(String type) {
252 if (((type == null) && (_type != null)) ||
253 ((type != null) && (_type == null)) ||
254 ((type != null) && (_type != null) && !type.equals(_type))) {
255 _type = type;
256 }
257 }
258
259 public String getExtraData() {
260 return GetterUtil.getString(_extraData);
261 }
262
263 public void setExtraData(String extraData) {
264 if (((extraData == null) && (_extraData != null)) ||
265 ((extraData != null) && (_extraData == null)) ||
266 ((extraData != null) && (_extraData != null) &&
267 !extraData.equals(_extraData))) {
268 _extraData = extraData;
269 }
270 }
271
272 public long getReceiverUserId() {
273 return _receiverUserId;
274 }
275
276 public void setReceiverUserId(long receiverUserId) {
277 if (receiverUserId != _receiverUserId) {
278 _receiverUserId = receiverUserId;
279 }
280 }
281
282 public String getReceiverUserName() {
283 return GetterUtil.getString(_receiverUserName);
284 }
285
286 public void setReceiverUserName(String receiverUserName) {
287 if (((receiverUserName == null) && (_receiverUserName != null)) ||
288 ((receiverUserName != null) && (_receiverUserName == null)) ||
289 ((receiverUserName != null) && (_receiverUserName != null) &&
290 !receiverUserName.equals(_receiverUserName))) {
291 _receiverUserName = receiverUserName;
292 }
293 }
294
295 public SocialActivity toEscapedModel() {
296 if (isEscapedModel()) {
297 return (SocialActivity)this;
298 }
299 else {
300 SocialActivity model = new SocialActivityImpl();
301
302 model.setEscapedModel(true);
303
304 model.setActivityId(getActivityId());
305 model.setGroupId(getGroupId());
306 model.setCompanyId(getCompanyId());
307 model.setUserId(getUserId());
308 model.setUserName(HtmlUtil.escape(getUserName()));
309 model.setCreateDate(getCreateDate());
310 model.setClassNameId(getClassNameId());
311 model.setClassPK(getClassPK());
312 model.setType(HtmlUtil.escape(getType()));
313 model.setExtraData(HtmlUtil.escape(getExtraData()));
314 model.setReceiverUserId(getReceiverUserId());
315 model.setReceiverUserName(HtmlUtil.escape(getReceiverUserName()));
316
317 model = (SocialActivity)Proxy.newProxyInstance(SocialActivity.class.getClassLoader(),
318 new Class[] { SocialActivity.class },
319 new ReadOnlyBeanHandler(model));
320
321 return model;
322 }
323 }
324
325 public Object clone() {
326 SocialActivityImpl clone = new SocialActivityImpl();
327
328 clone.setActivityId(getActivityId());
329 clone.setGroupId(getGroupId());
330 clone.setCompanyId(getCompanyId());
331 clone.setUserId(getUserId());
332 clone.setUserName(getUserName());
333 clone.setCreateDate(getCreateDate());
334 clone.setClassNameId(getClassNameId());
335 clone.setClassPK(getClassPK());
336 clone.setType(getType());
337 clone.setExtraData(getExtraData());
338 clone.setReceiverUserId(getReceiverUserId());
339 clone.setReceiverUserName(getReceiverUserName());
340
341 return clone;
342 }
343
344 public int compareTo(Object obj) {
345 if (obj == null) {
346 return -1;
347 }
348
349 SocialActivityImpl socialActivity = (SocialActivityImpl)obj;
350
351 int value = 0;
352
353 value = DateUtil.compareTo(getCreateDate(),
354 socialActivity.getCreateDate());
355
356 value = value * -1;
357
358 if (value != 0) {
359 return value;
360 }
361
362 return 0;
363 }
364
365 public boolean equals(Object obj) {
366 if (obj == null) {
367 return false;
368 }
369
370 SocialActivityImpl socialActivity = null;
371
372 try {
373 socialActivity = (SocialActivityImpl)obj;
374 }
375 catch (ClassCastException cce) {
376 return false;
377 }
378
379 long pk = socialActivity.getPrimaryKey();
380
381 if (getPrimaryKey() == pk) {
382 return true;
383 }
384 else {
385 return false;
386 }
387 }
388
389 public int hashCode() {
390 return (int)getPrimaryKey();
391 }
392
393 private long _activityId;
394 private long _groupId;
395 private long _companyId;
396 private long _userId;
397 private String _userName;
398 private Date _createDate;
399 private long _classNameId;
400 private long _classPK;
401 private String _type;
402 private String _extraData;
403 private long _receiverUserId;
404 private String _receiverUserName;
405 }