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