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.ProxyUtil;
021 import com.liferay.portal.kernel.util.StringBundler;
022 import com.liferay.portal.kernel.util.StringPool;
023 import com.liferay.portal.kernel.util.Validator;
024 import com.liferay.portal.model.CacheModel;
025 import com.liferay.portal.model.impl.BaseModelImpl;
026 import com.liferay.portal.service.ServiceContext;
027 import com.liferay.portal.util.PortalUtil;
028
029 import com.liferay.portlet.expando.model.ExpandoBridge;
030 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
031 import com.liferay.portlet.social.model.SocialActivity;
032 import com.liferay.portlet.social.model.SocialActivityModel;
033
034 import java.io.Serializable;
035
036 import java.sql.Types;
037
038 import java.util.HashMap;
039 import java.util.Map;
040
041
054 public class SocialActivityModelImpl extends BaseModelImpl<SocialActivity>
055 implements SocialActivityModel {
056
061 public static final String TABLE_NAME = "SocialActivity";
062 public static final Object[][] TABLE_COLUMNS = {
063 { "activityId", Types.BIGINT },
064 { "groupId", Types.BIGINT },
065 { "companyId", Types.BIGINT },
066 { "userId", Types.BIGINT },
067 { "createDate", Types.BIGINT },
068 { "mirrorActivityId", Types.BIGINT },
069 { "classNameId", Types.BIGINT },
070 { "classPK", Types.BIGINT },
071 { "type_", Types.INTEGER },
072 { "extraData", Types.VARCHAR },
073 { "receiverUserId", Types.BIGINT }
074 };
075 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)";
076 public static final String TABLE_SQL_DROP = "drop table SocialActivity";
077 public static final String ORDER_BY_JPQL = " ORDER BY socialActivity.createDate DESC";
078 public static final String ORDER_BY_SQL = " ORDER BY SocialActivity.createDate DESC";
079 public static final String DATA_SOURCE = "liferayDataSource";
080 public static final String SESSION_FACTORY = "liferaySessionFactory";
081 public static final String TX_MANAGER = "liferayTransactionManager";
082 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
083 "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialActivity"),
084 true);
085 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
086 "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialActivity"),
087 true);
088 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
089 "value.object.column.bitmask.enabled.com.liferay.portlet.social.model.SocialActivity"),
090 true);
091 public static long CLASSNAMEID_COLUMN_BITMASK = 1L;
092 public static long CLASSPK_COLUMN_BITMASK = 2L;
093 public static long COMPANYID_COLUMN_BITMASK = 4L;
094 public static long CREATEDATE_COLUMN_BITMASK = 8L;
095 public static long GROUPID_COLUMN_BITMASK = 16L;
096 public static long MIRRORACTIVITYID_COLUMN_BITMASK = 32L;
097 public static long RECEIVERUSERID_COLUMN_BITMASK = 64L;
098 public static long TYPE_COLUMN_BITMASK = 128L;
099 public static long USERID_COLUMN_BITMASK = 256L;
100 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
101 "lock.expiration.time.com.liferay.portlet.social.model.SocialActivity"));
102
103 public SocialActivityModelImpl() {
104 }
105
106 public long getPrimaryKey() {
107 return _activityId;
108 }
109
110 public void setPrimaryKey(long primaryKey) {
111 setActivityId(primaryKey);
112 }
113
114 public Serializable getPrimaryKeyObj() {
115 return new Long(_activityId);
116 }
117
118 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
119 setPrimaryKey(((Long)primaryKeyObj).longValue());
120 }
121
122 public Class<?> getModelClass() {
123 return SocialActivity.class;
124 }
125
126 public String getModelClassName() {
127 return SocialActivity.class.getName();
128 }
129
130 @Override
131 public Map<String, Object> getModelAttributes() {
132 Map<String, Object> attributes = new HashMap<String, Object>();
133
134 attributes.put("activityId", getActivityId());
135 attributes.put("groupId", getGroupId());
136 attributes.put("companyId", getCompanyId());
137 attributes.put("userId", getUserId());
138 attributes.put("createDate", getCreateDate());
139 attributes.put("mirrorActivityId", getMirrorActivityId());
140 attributes.put("classNameId", getClassNameId());
141 attributes.put("classPK", getClassPK());
142 attributes.put("type", getType());
143 attributes.put("extraData", getExtraData());
144 attributes.put("receiverUserId", getReceiverUserId());
145
146 return attributes;
147 }
148
149 @Override
150 public void setModelAttributes(Map<String, Object> attributes) {
151 Long activityId = (Long)attributes.get("activityId");
152
153 if (activityId != null) {
154 setActivityId(activityId);
155 }
156
157 Long groupId = (Long)attributes.get("groupId");
158
159 if (groupId != null) {
160 setGroupId(groupId);
161 }
162
163 Long companyId = (Long)attributes.get("companyId");
164
165 if (companyId != null) {
166 setCompanyId(companyId);
167 }
168
169 Long userId = (Long)attributes.get("userId");
170
171 if (userId != null) {
172 setUserId(userId);
173 }
174
175 Long createDate = (Long)attributes.get("createDate");
176
177 if (createDate != null) {
178 setCreateDate(createDate);
179 }
180
181 Long mirrorActivityId = (Long)attributes.get("mirrorActivityId");
182
183 if (mirrorActivityId != null) {
184 setMirrorActivityId(mirrorActivityId);
185 }
186
187 Long classNameId = (Long)attributes.get("classNameId");
188
189 if (classNameId != null) {
190 setClassNameId(classNameId);
191 }
192
193 Long classPK = (Long)attributes.get("classPK");
194
195 if (classPK != null) {
196 setClassPK(classPK);
197 }
198
199 Integer type = (Integer)attributes.get("type");
200
201 if (type != null) {
202 setType(type);
203 }
204
205 String extraData = (String)attributes.get("extraData");
206
207 if (extraData != null) {
208 setExtraData(extraData);
209 }
210
211 Long receiverUserId = (Long)attributes.get("receiverUserId");
212
213 if (receiverUserId != null) {
214 setReceiverUserId(receiverUserId);
215 }
216 }
217
218 public long getActivityId() {
219 return _activityId;
220 }
221
222 public void setActivityId(long activityId) {
223 _activityId = activityId;
224 }
225
226 public long getGroupId() {
227 return _groupId;
228 }
229
230 public void setGroupId(long groupId) {
231 _columnBitmask |= GROUPID_COLUMN_BITMASK;
232
233 if (!_setOriginalGroupId) {
234 _setOriginalGroupId = true;
235
236 _originalGroupId = _groupId;
237 }
238
239 _groupId = groupId;
240 }
241
242 public long getOriginalGroupId() {
243 return _originalGroupId;
244 }
245
246 public long getCompanyId() {
247 return _companyId;
248 }
249
250 public void setCompanyId(long companyId) {
251 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
252
253 if (!_setOriginalCompanyId) {
254 _setOriginalCompanyId = true;
255
256 _originalCompanyId = _companyId;
257 }
258
259 _companyId = companyId;
260 }
261
262 public long getOriginalCompanyId() {
263 return _originalCompanyId;
264 }
265
266 public long getUserId() {
267 return _userId;
268 }
269
270 public void setUserId(long userId) {
271 _columnBitmask |= USERID_COLUMN_BITMASK;
272
273 if (!_setOriginalUserId) {
274 _setOriginalUserId = true;
275
276 _originalUserId = _userId;
277 }
278
279 _userId = userId;
280 }
281
282 public String getUserUuid() throws SystemException {
283 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
284 }
285
286 public void setUserUuid(String userUuid) {
287 _userUuid = userUuid;
288 }
289
290 public long getOriginalUserId() {
291 return _originalUserId;
292 }
293
294 public long getCreateDate() {
295 return _createDate;
296 }
297
298 public void setCreateDate(long createDate) {
299 _columnBitmask = -1L;
300
301 if (!_setOriginalCreateDate) {
302 _setOriginalCreateDate = true;
303
304 _originalCreateDate = _createDate;
305 }
306
307 _createDate = createDate;
308 }
309
310 public long getOriginalCreateDate() {
311 return _originalCreateDate;
312 }
313
314 public long getMirrorActivityId() {
315 return _mirrorActivityId;
316 }
317
318 public void setMirrorActivityId(long mirrorActivityId) {
319 _columnBitmask |= MIRRORACTIVITYID_COLUMN_BITMASK;
320
321 if (!_setOriginalMirrorActivityId) {
322 _setOriginalMirrorActivityId = true;
323
324 _originalMirrorActivityId = _mirrorActivityId;
325 }
326
327 _mirrorActivityId = mirrorActivityId;
328 }
329
330 public long getOriginalMirrorActivityId() {
331 return _originalMirrorActivityId;
332 }
333
334 public String getClassName() {
335 if (getClassNameId() <= 0) {
336 return StringPool.BLANK;
337 }
338
339 return PortalUtil.getClassName(getClassNameId());
340 }
341
342 public void setClassName(String className) {
343 long classNameId = 0;
344
345 if (Validator.isNotNull(className)) {
346 classNameId = PortalUtil.getClassNameId(className);
347 }
348
349 setClassNameId(classNameId);
350 }
351
352 public long getClassNameId() {
353 return _classNameId;
354 }
355
356 public void setClassNameId(long classNameId) {
357 _columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
358
359 if (!_setOriginalClassNameId) {
360 _setOriginalClassNameId = true;
361
362 _originalClassNameId = _classNameId;
363 }
364
365 _classNameId = classNameId;
366 }
367
368 public long getOriginalClassNameId() {
369 return _originalClassNameId;
370 }
371
372 public long getClassPK() {
373 return _classPK;
374 }
375
376 public void setClassPK(long classPK) {
377 _columnBitmask |= CLASSPK_COLUMN_BITMASK;
378
379 if (!_setOriginalClassPK) {
380 _setOriginalClassPK = true;
381
382 _originalClassPK = _classPK;
383 }
384
385 _classPK = classPK;
386 }
387
388 public long getOriginalClassPK() {
389 return _originalClassPK;
390 }
391
392 public int getType() {
393 return _type;
394 }
395
396 public void setType(int type) {
397 _columnBitmask |= TYPE_COLUMN_BITMASK;
398
399 if (!_setOriginalType) {
400 _setOriginalType = true;
401
402 _originalType = _type;
403 }
404
405 _type = type;
406 }
407
408 public int getOriginalType() {
409 return _originalType;
410 }
411
412 public String getExtraData() {
413 if (_extraData == null) {
414 return StringPool.BLANK;
415 }
416 else {
417 return _extraData;
418 }
419 }
420
421 public void setExtraData(String extraData) {
422 _extraData = extraData;
423 }
424
425 public long getReceiverUserId() {
426 return _receiverUserId;
427 }
428
429 public void setReceiverUserId(long receiverUserId) {
430 _columnBitmask |= RECEIVERUSERID_COLUMN_BITMASK;
431
432 if (!_setOriginalReceiverUserId) {
433 _setOriginalReceiverUserId = true;
434
435 _originalReceiverUserId = _receiverUserId;
436 }
437
438 _receiverUserId = receiverUserId;
439 }
440
441 public String getReceiverUserUuid() throws SystemException {
442 return PortalUtil.getUserValue(getReceiverUserId(), "uuid",
443 _receiverUserUuid);
444 }
445
446 public void setReceiverUserUuid(String receiverUserUuid) {
447 _receiverUserUuid = receiverUserUuid;
448 }
449
450 public long getOriginalReceiverUserId() {
451 return _originalReceiverUserId;
452 }
453
454 public long getColumnBitmask() {
455 return _columnBitmask;
456 }
457
458 @Override
459 public ExpandoBridge getExpandoBridge() {
460 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
461 SocialActivity.class.getName(), getPrimaryKey());
462 }
463
464 @Override
465 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
466 ExpandoBridge expandoBridge = getExpandoBridge();
467
468 expandoBridge.setAttributes(serviceContext);
469 }
470
471 @Override
472 public SocialActivity toEscapedModel() {
473 if (_escapedModel == null) {
474 _escapedModel = (SocialActivity)ProxyUtil.newProxyInstance(_classLoader,
475 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
476 }
477
478 return _escapedModel;
479 }
480
481 public SocialActivity toUnescapedModel() {
482 return (SocialActivity)this;
483 }
484
485 @Override
486 public Object clone() {
487 SocialActivityImpl socialActivityImpl = new SocialActivityImpl();
488
489 socialActivityImpl.setActivityId(getActivityId());
490 socialActivityImpl.setGroupId(getGroupId());
491 socialActivityImpl.setCompanyId(getCompanyId());
492 socialActivityImpl.setUserId(getUserId());
493 socialActivityImpl.setCreateDate(getCreateDate());
494 socialActivityImpl.setMirrorActivityId(getMirrorActivityId());
495 socialActivityImpl.setClassNameId(getClassNameId());
496 socialActivityImpl.setClassPK(getClassPK());
497 socialActivityImpl.setType(getType());
498 socialActivityImpl.setExtraData(getExtraData());
499 socialActivityImpl.setReceiverUserId(getReceiverUserId());
500
501 socialActivityImpl.resetOriginalValues();
502
503 return socialActivityImpl;
504 }
505
506 public int compareTo(SocialActivity socialActivity) {
507 int value = 0;
508
509 if (getCreateDate() < socialActivity.getCreateDate()) {
510 value = -1;
511 }
512 else if (getCreateDate() > socialActivity.getCreateDate()) {
513 value = 1;
514 }
515 else {
516 value = 0;
517 }
518
519 value = value * -1;
520
521 if (value != 0) {
522 return value;
523 }
524
525 return 0;
526 }
527
528 @Override
529 public boolean equals(Object obj) {
530 if (this == obj) {
531 return true;
532 }
533
534 if (!(obj instanceof SocialActivity)) {
535 return false;
536 }
537
538 SocialActivity socialActivity = (SocialActivity)obj;
539
540 long primaryKey = socialActivity.getPrimaryKey();
541
542 if (getPrimaryKey() == primaryKey) {
543 return true;
544 }
545 else {
546 return false;
547 }
548 }
549
550 @Override
551 public int hashCode() {
552 return (int)getPrimaryKey();
553 }
554
555 @Override
556 public void resetOriginalValues() {
557 SocialActivityModelImpl socialActivityModelImpl = this;
558
559 socialActivityModelImpl._originalGroupId = socialActivityModelImpl._groupId;
560
561 socialActivityModelImpl._setOriginalGroupId = false;
562
563 socialActivityModelImpl._originalCompanyId = socialActivityModelImpl._companyId;
564
565 socialActivityModelImpl._setOriginalCompanyId = false;
566
567 socialActivityModelImpl._originalUserId = socialActivityModelImpl._userId;
568
569 socialActivityModelImpl._setOriginalUserId = false;
570
571 socialActivityModelImpl._originalCreateDate = socialActivityModelImpl._createDate;
572
573 socialActivityModelImpl._setOriginalCreateDate = false;
574
575 socialActivityModelImpl._originalMirrorActivityId = socialActivityModelImpl._mirrorActivityId;
576
577 socialActivityModelImpl._setOriginalMirrorActivityId = false;
578
579 socialActivityModelImpl._originalClassNameId = socialActivityModelImpl._classNameId;
580
581 socialActivityModelImpl._setOriginalClassNameId = false;
582
583 socialActivityModelImpl._originalClassPK = socialActivityModelImpl._classPK;
584
585 socialActivityModelImpl._setOriginalClassPK = false;
586
587 socialActivityModelImpl._originalType = socialActivityModelImpl._type;
588
589 socialActivityModelImpl._setOriginalType = false;
590
591 socialActivityModelImpl._originalReceiverUserId = socialActivityModelImpl._receiverUserId;
592
593 socialActivityModelImpl._setOriginalReceiverUserId = false;
594
595 socialActivityModelImpl._columnBitmask = 0;
596 }
597
598 @Override
599 public CacheModel<SocialActivity> toCacheModel() {
600 SocialActivityCacheModel socialActivityCacheModel = new SocialActivityCacheModel();
601
602 socialActivityCacheModel.activityId = getActivityId();
603
604 socialActivityCacheModel.groupId = getGroupId();
605
606 socialActivityCacheModel.companyId = getCompanyId();
607
608 socialActivityCacheModel.userId = getUserId();
609
610 socialActivityCacheModel.createDate = getCreateDate();
611
612 socialActivityCacheModel.mirrorActivityId = getMirrorActivityId();
613
614 socialActivityCacheModel.classNameId = getClassNameId();
615
616 socialActivityCacheModel.classPK = getClassPK();
617
618 socialActivityCacheModel.type = getType();
619
620 socialActivityCacheModel.extraData = getExtraData();
621
622 String extraData = socialActivityCacheModel.extraData;
623
624 if ((extraData != null) && (extraData.length() == 0)) {
625 socialActivityCacheModel.extraData = null;
626 }
627
628 socialActivityCacheModel.receiverUserId = getReceiverUserId();
629
630 return socialActivityCacheModel;
631 }
632
633 @Override
634 public String toString() {
635 StringBundler sb = new StringBundler(23);
636
637 sb.append("{activityId=");
638 sb.append(getActivityId());
639 sb.append(", groupId=");
640 sb.append(getGroupId());
641 sb.append(", companyId=");
642 sb.append(getCompanyId());
643 sb.append(", userId=");
644 sb.append(getUserId());
645 sb.append(", createDate=");
646 sb.append(getCreateDate());
647 sb.append(", mirrorActivityId=");
648 sb.append(getMirrorActivityId());
649 sb.append(", classNameId=");
650 sb.append(getClassNameId());
651 sb.append(", classPK=");
652 sb.append(getClassPK());
653 sb.append(", type=");
654 sb.append(getType());
655 sb.append(", extraData=");
656 sb.append(getExtraData());
657 sb.append(", receiverUserId=");
658 sb.append(getReceiverUserId());
659 sb.append("}");
660
661 return sb.toString();
662 }
663
664 public String toXmlString() {
665 StringBundler sb = new StringBundler(37);
666
667 sb.append("<model><model-name>");
668 sb.append("com.liferay.portlet.social.model.SocialActivity");
669 sb.append("</model-name>");
670
671 sb.append(
672 "<column><column-name>activityId</column-name><column-value><![CDATA[");
673 sb.append(getActivityId());
674 sb.append("]]></column-value></column>");
675 sb.append(
676 "<column><column-name>groupId</column-name><column-value><![CDATA[");
677 sb.append(getGroupId());
678 sb.append("]]></column-value></column>");
679 sb.append(
680 "<column><column-name>companyId</column-name><column-value><![CDATA[");
681 sb.append(getCompanyId());
682 sb.append("]]></column-value></column>");
683 sb.append(
684 "<column><column-name>userId</column-name><column-value><![CDATA[");
685 sb.append(getUserId());
686 sb.append("]]></column-value></column>");
687 sb.append(
688 "<column><column-name>createDate</column-name><column-value><![CDATA[");
689 sb.append(getCreateDate());
690 sb.append("]]></column-value></column>");
691 sb.append(
692 "<column><column-name>mirrorActivityId</column-name><column-value><![CDATA[");
693 sb.append(getMirrorActivityId());
694 sb.append("]]></column-value></column>");
695 sb.append(
696 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
697 sb.append(getClassNameId());
698 sb.append("]]></column-value></column>");
699 sb.append(
700 "<column><column-name>classPK</column-name><column-value><![CDATA[");
701 sb.append(getClassPK());
702 sb.append("]]></column-value></column>");
703 sb.append(
704 "<column><column-name>type</column-name><column-value><![CDATA[");
705 sb.append(getType());
706 sb.append("]]></column-value></column>");
707 sb.append(
708 "<column><column-name>extraData</column-name><column-value><![CDATA[");
709 sb.append(getExtraData());
710 sb.append("]]></column-value></column>");
711 sb.append(
712 "<column><column-name>receiverUserId</column-name><column-value><![CDATA[");
713 sb.append(getReceiverUserId());
714 sb.append("]]></column-value></column>");
715
716 sb.append("</model>");
717
718 return sb.toString();
719 }
720
721 private static ClassLoader _classLoader = SocialActivity.class.getClassLoader();
722 private static Class<?>[] _escapedModelInterfaces = new Class[] {
723 SocialActivity.class
724 };
725 private long _activityId;
726 private long _groupId;
727 private long _originalGroupId;
728 private boolean _setOriginalGroupId;
729 private long _companyId;
730 private long _originalCompanyId;
731 private boolean _setOriginalCompanyId;
732 private long _userId;
733 private String _userUuid;
734 private long _originalUserId;
735 private boolean _setOriginalUserId;
736 private long _createDate;
737 private long _originalCreateDate;
738 private boolean _setOriginalCreateDate;
739 private long _mirrorActivityId;
740 private long _originalMirrorActivityId;
741 private boolean _setOriginalMirrorActivityId;
742 private long _classNameId;
743 private long _originalClassNameId;
744 private boolean _setOriginalClassNameId;
745 private long _classPK;
746 private long _originalClassPK;
747 private boolean _setOriginalClassPK;
748 private int _type;
749 private int _originalType;
750 private boolean _setOriginalType;
751 private String _extraData;
752 private long _receiverUserId;
753 private String _receiverUserUuid;
754 private long _originalReceiverUserId;
755 private boolean _setOriginalReceiverUserId;
756 private long _columnBitmask;
757 private SocialActivity _escapedModel;
758 }