001
014
015 package com.liferay.portlet.social.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.GetterUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.model.impl.BaseModelImpl;
023 import com.liferay.portal.service.ServiceContext;
024 import com.liferay.portal.util.PortalUtil;
025
026 import com.liferay.portlet.expando.model.ExpandoBridge;
027 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028 import com.liferay.portlet.social.model.SocialActivity;
029 import com.liferay.portlet.social.model.SocialActivityModel;
030
031 import java.io.Serializable;
032
033 import java.lang.reflect.Proxy;
034
035 import java.sql.Types;
036
037
054 public class SocialActivityModelImpl extends BaseModelImpl<SocialActivity>
055 implements SocialActivityModel {
056 public static final String TABLE_NAME = "SocialActivity";
057 public static final Object[][] TABLE_COLUMNS = {
058 { "activityId", new Integer(Types.BIGINT) },
059 { "groupId", new Integer(Types.BIGINT) },
060 { "companyId", new Integer(Types.BIGINT) },
061 { "userId", new Integer(Types.BIGINT) },
062 { "createDate", new Integer(Types.BIGINT) },
063 { "mirrorActivityId", new Integer(Types.BIGINT) },
064 { "classNameId", new Integer(Types.BIGINT) },
065 { "classPK", new Integer(Types.BIGINT) },
066 { "type_", new Integer(Types.INTEGER) },
067 { "extraData", new Integer(Types.VARCHAR) },
068 { "receiverUserId", new Integer(Types.BIGINT) }
069 };
070 public static final String TABLE_SQL_CREATE = "create table SocialActivity (activityId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,createDate LONG,mirrorActivityId LONG,classNameId LONG,classPK LONG,type_ INTEGER,extraData STRING null,receiverUserId LONG)";
071 public static final String TABLE_SQL_DROP = "drop table SocialActivity";
072 public static final String ORDER_BY_JPQL = " ORDER BY socialActivity.createDate DESC";
073 public static final String ORDER_BY_SQL = " ORDER BY SocialActivity.createDate DESC";
074 public static final String DATA_SOURCE = "liferayDataSource";
075 public static final String SESSION_FACTORY = "liferaySessionFactory";
076 public static final String TX_MANAGER = "liferayTransactionManager";
077 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
078 "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialActivity"),
079 true);
080 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
081 "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialActivity"),
082 true);
083 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
084 "lock.expiration.time.com.liferay.portlet.social.model.SocialActivity"));
085
086 public SocialActivityModelImpl() {
087 }
088
089 public long getPrimaryKey() {
090 return _activityId;
091 }
092
093 public void setPrimaryKey(long pk) {
094 setActivityId(pk);
095 }
096
097 public Serializable getPrimaryKeyObj() {
098 return new Long(_activityId);
099 }
100
101 public long getActivityId() {
102 return _activityId;
103 }
104
105 public void setActivityId(long activityId) {
106 _activityId = activityId;
107 }
108
109 public long getGroupId() {
110 return _groupId;
111 }
112
113 public void setGroupId(long groupId) {
114 _groupId = groupId;
115
116 if (!_setOriginalGroupId) {
117 _setOriginalGroupId = true;
118
119 _originalGroupId = groupId;
120 }
121 }
122
123 public long getOriginalGroupId() {
124 return _originalGroupId;
125 }
126
127 public long getCompanyId() {
128 return _companyId;
129 }
130
131 public void setCompanyId(long companyId) {
132 _companyId = companyId;
133 }
134
135 public long getUserId() {
136 return _userId;
137 }
138
139 public void setUserId(long userId) {
140 _userId = userId;
141
142 if (!_setOriginalUserId) {
143 _setOriginalUserId = true;
144
145 _originalUserId = userId;
146 }
147 }
148
149 public String getUserUuid() throws SystemException {
150 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
151 }
152
153 public void setUserUuid(String userUuid) {
154 _userUuid = userUuid;
155 }
156
157 public long getOriginalUserId() {
158 return _originalUserId;
159 }
160
161 public long getCreateDate() {
162 return _createDate;
163 }
164
165 public void setCreateDate(long createDate) {
166 _createDate = createDate;
167
168 if (!_setOriginalCreateDate) {
169 _setOriginalCreateDate = true;
170
171 _originalCreateDate = createDate;
172 }
173 }
174
175 public long getOriginalCreateDate() {
176 return _originalCreateDate;
177 }
178
179 public long getMirrorActivityId() {
180 return _mirrorActivityId;
181 }
182
183 public void setMirrorActivityId(long mirrorActivityId) {
184 _mirrorActivityId = mirrorActivityId;
185
186 if (!_setOriginalMirrorActivityId) {
187 _setOriginalMirrorActivityId = true;
188
189 _originalMirrorActivityId = mirrorActivityId;
190 }
191 }
192
193 public long getOriginalMirrorActivityId() {
194 return _originalMirrorActivityId;
195 }
196
197 public String getClassName() {
198 if (getClassNameId() <= 0) {
199 return StringPool.BLANK;
200 }
201
202 return PortalUtil.getClassName(getClassNameId());
203 }
204
205 public long getClassNameId() {
206 return _classNameId;
207 }
208
209 public void setClassNameId(long classNameId) {
210 _classNameId = classNameId;
211
212 if (!_setOriginalClassNameId) {
213 _setOriginalClassNameId = true;
214
215 _originalClassNameId = classNameId;
216 }
217 }
218
219 public long getOriginalClassNameId() {
220 return _originalClassNameId;
221 }
222
223 public long getClassPK() {
224 return _classPK;
225 }
226
227 public void setClassPK(long classPK) {
228 _classPK = classPK;
229
230 if (!_setOriginalClassPK) {
231 _setOriginalClassPK = true;
232
233 _originalClassPK = classPK;
234 }
235 }
236
237 public long getOriginalClassPK() {
238 return _originalClassPK;
239 }
240
241 public int getType() {
242 return _type;
243 }
244
245 public void setType(int type) {
246 _type = type;
247
248 if (!_setOriginalType) {
249 _setOriginalType = true;
250
251 _originalType = type;
252 }
253 }
254
255 public int getOriginalType() {
256 return _originalType;
257 }
258
259 public String getExtraData() {
260 if (_extraData == null) {
261 return StringPool.BLANK;
262 }
263 else {
264 return _extraData;
265 }
266 }
267
268 public void setExtraData(String extraData) {
269 _extraData = extraData;
270 }
271
272 public long getReceiverUserId() {
273 return _receiverUserId;
274 }
275
276 public void setReceiverUserId(long receiverUserId) {
277 _receiverUserId = receiverUserId;
278
279 if (!_setOriginalReceiverUserId) {
280 _setOriginalReceiverUserId = true;
281
282 _originalReceiverUserId = receiverUserId;
283 }
284 }
285
286 public String getReceiverUserUuid() throws SystemException {
287 return PortalUtil.getUserValue(getReceiverUserId(), "uuid",
288 _receiverUserUuid);
289 }
290
291 public void setReceiverUserUuid(String receiverUserUuid) {
292 _receiverUserUuid = receiverUserUuid;
293 }
294
295 public long getOriginalReceiverUserId() {
296 return _originalReceiverUserId;
297 }
298
299 public SocialActivity toEscapedModel() {
300 if (isEscapedModel()) {
301 return (SocialActivity)this;
302 }
303 else {
304 return (SocialActivity)Proxy.newProxyInstance(SocialActivity.class.getClassLoader(),
305 new Class[] { SocialActivity.class },
306 new AutoEscapeBeanHandler(this));
307 }
308 }
309
310 public ExpandoBridge getExpandoBridge() {
311 if (_expandoBridge == null) {
312 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
313 SocialActivity.class.getName(), getPrimaryKey());
314 }
315
316 return _expandoBridge;
317 }
318
319 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
320 getExpandoBridge().setAttributes(serviceContext);
321 }
322
323 public Object clone() {
324 SocialActivityImpl clone = new SocialActivityImpl();
325
326 clone.setActivityId(getActivityId());
327 clone.setGroupId(getGroupId());
328 clone.setCompanyId(getCompanyId());
329 clone.setUserId(getUserId());
330 clone.setCreateDate(getCreateDate());
331 clone.setMirrorActivityId(getMirrorActivityId());
332 clone.setClassNameId(getClassNameId());
333 clone.setClassPK(getClassPK());
334 clone.setType(getType());
335 clone.setExtraData(getExtraData());
336 clone.setReceiverUserId(getReceiverUserId());
337
338 return clone;
339 }
340
341 public int compareTo(SocialActivity socialActivity) {
342 int value = 0;
343
344 if (getCreateDate() < socialActivity.getCreateDate()) {
345 value = -1;
346 }
347 else if (getCreateDate() > socialActivity.getCreateDate()) {
348 value = 1;
349 }
350 else {
351 value = 0;
352 }
353
354 value = value * -1;
355
356 if (value != 0) {
357 return value;
358 }
359
360 return 0;
361 }
362
363 public boolean equals(Object obj) {
364 if (obj == null) {
365 return false;
366 }
367
368 SocialActivity socialActivity = null;
369
370 try {
371 socialActivity = (SocialActivity)obj;
372 }
373 catch (ClassCastException cce) {
374 return false;
375 }
376
377 long pk = socialActivity.getPrimaryKey();
378
379 if (getPrimaryKey() == pk) {
380 return true;
381 }
382 else {
383 return false;
384 }
385 }
386
387 public int hashCode() {
388 return (int)getPrimaryKey();
389 }
390
391 public String toString() {
392 StringBundler sb = new StringBundler(23);
393
394 sb.append("{activityId=");
395 sb.append(getActivityId());
396 sb.append(", groupId=");
397 sb.append(getGroupId());
398 sb.append(", companyId=");
399 sb.append(getCompanyId());
400 sb.append(", userId=");
401 sb.append(getUserId());
402 sb.append(", createDate=");
403 sb.append(getCreateDate());
404 sb.append(", mirrorActivityId=");
405 sb.append(getMirrorActivityId());
406 sb.append(", classNameId=");
407 sb.append(getClassNameId());
408 sb.append(", classPK=");
409 sb.append(getClassPK());
410 sb.append(", type=");
411 sb.append(getType());
412 sb.append(", extraData=");
413 sb.append(getExtraData());
414 sb.append(", receiverUserId=");
415 sb.append(getReceiverUserId());
416 sb.append("}");
417
418 return sb.toString();
419 }
420
421 public String toXmlString() {
422 StringBundler sb = new StringBundler(37);
423
424 sb.append("<model><model-name>");
425 sb.append("com.liferay.portlet.social.model.SocialActivity");
426 sb.append("</model-name>");
427
428 sb.append(
429 "<column><column-name>activityId</column-name><column-value><![CDATA[");
430 sb.append(getActivityId());
431 sb.append("]]></column-value></column>");
432 sb.append(
433 "<column><column-name>groupId</column-name><column-value><![CDATA[");
434 sb.append(getGroupId());
435 sb.append("]]></column-value></column>");
436 sb.append(
437 "<column><column-name>companyId</column-name><column-value><![CDATA[");
438 sb.append(getCompanyId());
439 sb.append("]]></column-value></column>");
440 sb.append(
441 "<column><column-name>userId</column-name><column-value><![CDATA[");
442 sb.append(getUserId());
443 sb.append("]]></column-value></column>");
444 sb.append(
445 "<column><column-name>createDate</column-name><column-value><![CDATA[");
446 sb.append(getCreateDate());
447 sb.append("]]></column-value></column>");
448 sb.append(
449 "<column><column-name>mirrorActivityId</column-name><column-value><![CDATA[");
450 sb.append(getMirrorActivityId());
451 sb.append("]]></column-value></column>");
452 sb.append(
453 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
454 sb.append(getClassNameId());
455 sb.append("]]></column-value></column>");
456 sb.append(
457 "<column><column-name>classPK</column-name><column-value><![CDATA[");
458 sb.append(getClassPK());
459 sb.append("]]></column-value></column>");
460 sb.append(
461 "<column><column-name>type</column-name><column-value><![CDATA[");
462 sb.append(getType());
463 sb.append("]]></column-value></column>");
464 sb.append(
465 "<column><column-name>extraData</column-name><column-value><![CDATA[");
466 sb.append(getExtraData());
467 sb.append("]]></column-value></column>");
468 sb.append(
469 "<column><column-name>receiverUserId</column-name><column-value><![CDATA[");
470 sb.append(getReceiverUserId());
471 sb.append("]]></column-value></column>");
472
473 sb.append("</model>");
474
475 return sb.toString();
476 }
477
478 private long _activityId;
479 private long _groupId;
480 private long _originalGroupId;
481 private boolean _setOriginalGroupId;
482 private long _companyId;
483 private long _userId;
484 private String _userUuid;
485 private long _originalUserId;
486 private boolean _setOriginalUserId;
487 private long _createDate;
488 private long _originalCreateDate;
489 private boolean _setOriginalCreateDate;
490 private long _mirrorActivityId;
491 private long _originalMirrorActivityId;
492 private boolean _setOriginalMirrorActivityId;
493 private long _classNameId;
494 private long _originalClassNameId;
495 private boolean _setOriginalClassNameId;
496 private long _classPK;
497 private long _originalClassPK;
498 private boolean _setOriginalClassPK;
499 private int _type;
500 private int _originalType;
501 private boolean _setOriginalType;
502 private String _extraData;
503 private long _receiverUserId;
504 private String _receiverUserUuid;
505 private long _originalReceiverUserId;
506 private boolean _setOriginalReceiverUserId;
507 private transient ExpandoBridge _expandoBridge;
508 }