001
014
015 package com.liferay.portlet.messageboards.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.expando.kernel.model.ExpandoBridge;
020 import com.liferay.expando.kernel.util.ExpandoBridgeFactoryUtil;
021
022 import com.liferay.exportimport.kernel.lar.StagedModelType;
023
024 import com.liferay.message.boards.kernel.model.MBBan;
025 import com.liferay.message.boards.kernel.model.MBBanModel;
026 import com.liferay.message.boards.kernel.model.MBBanSoap;
027
028 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
029 import com.liferay.portal.kernel.exception.PortalException;
030 import com.liferay.portal.kernel.json.JSON;
031 import com.liferay.portal.kernel.model.CacheModel;
032 import com.liferay.portal.kernel.model.User;
033 import com.liferay.portal.kernel.model.impl.BaseModelImpl;
034 import com.liferay.portal.kernel.service.ServiceContext;
035 import com.liferay.portal.kernel.service.UserLocalServiceUtil;
036 import com.liferay.portal.kernel.util.GetterUtil;
037 import com.liferay.portal.kernel.util.PortalUtil;
038 import com.liferay.portal.kernel.util.ProxyUtil;
039 import com.liferay.portal.kernel.util.StringBundler;
040 import com.liferay.portal.kernel.util.StringPool;
041
042 import java.io.Serializable;
043
044 import java.sql.Types;
045
046 import java.util.ArrayList;
047 import java.util.Date;
048 import java.util.HashMap;
049 import java.util.List;
050 import java.util.Map;
051
052
065 @JSON(strict = true)
066 @ProviderType
067 public class MBBanModelImpl extends BaseModelImpl<MBBan> implements MBBanModel {
068
073 public static final String TABLE_NAME = "MBBan";
074 public static final Object[][] TABLE_COLUMNS = {
075 { "uuid_", Types.VARCHAR },
076 { "banId", Types.BIGINT },
077 { "groupId", Types.BIGINT },
078 { "companyId", Types.BIGINT },
079 { "userId", Types.BIGINT },
080 { "userName", Types.VARCHAR },
081 { "createDate", Types.TIMESTAMP },
082 { "modifiedDate", Types.TIMESTAMP },
083 { "banUserId", Types.BIGINT },
084 { "lastPublishDate", Types.TIMESTAMP }
085 };
086 public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
087
088 static {
089 TABLE_COLUMNS_MAP.put("uuid_", Types.VARCHAR);
090 TABLE_COLUMNS_MAP.put("banId", Types.BIGINT);
091 TABLE_COLUMNS_MAP.put("groupId", Types.BIGINT);
092 TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT);
093 TABLE_COLUMNS_MAP.put("userId", Types.BIGINT);
094 TABLE_COLUMNS_MAP.put("userName", Types.VARCHAR);
095 TABLE_COLUMNS_MAP.put("createDate", Types.TIMESTAMP);
096 TABLE_COLUMNS_MAP.put("modifiedDate", Types.TIMESTAMP);
097 TABLE_COLUMNS_MAP.put("banUserId", Types.BIGINT);
098 TABLE_COLUMNS_MAP.put("lastPublishDate", Types.TIMESTAMP);
099 }
100
101 public static final String TABLE_SQL_CREATE = "create table MBBan (uuid_ VARCHAR(75) null,banId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,banUserId LONG,lastPublishDate DATE null)";
102 public static final String TABLE_SQL_DROP = "drop table MBBan";
103 public static final String ORDER_BY_JPQL = " ORDER BY mbBan.banId ASC";
104 public static final String ORDER_BY_SQL = " ORDER BY MBBan.banId ASC";
105 public static final String DATA_SOURCE = "liferayDataSource";
106 public static final String SESSION_FACTORY = "liferaySessionFactory";
107 public static final String TX_MANAGER = "liferayTransactionManager";
108 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
109 "value.object.entity.cache.enabled.com.liferay.message.boards.kernel.model.MBBan"),
110 true);
111 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
112 "value.object.finder.cache.enabled.com.liferay.message.boards.kernel.model.MBBan"),
113 true);
114 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
115 "value.object.column.bitmask.enabled.com.liferay.message.boards.kernel.model.MBBan"),
116 true);
117 public static final long BANUSERID_COLUMN_BITMASK = 1L;
118 public static final long COMPANYID_COLUMN_BITMASK = 2L;
119 public static final long GROUPID_COLUMN_BITMASK = 4L;
120 public static final long USERID_COLUMN_BITMASK = 8L;
121 public static final long UUID_COLUMN_BITMASK = 16L;
122 public static final long BANID_COLUMN_BITMASK = 32L;
123
124
130 public static MBBan toModel(MBBanSoap soapModel) {
131 if (soapModel == null) {
132 return null;
133 }
134
135 MBBan model = new MBBanImpl();
136
137 model.setUuid(soapModel.getUuid());
138 model.setBanId(soapModel.getBanId());
139 model.setGroupId(soapModel.getGroupId());
140 model.setCompanyId(soapModel.getCompanyId());
141 model.setUserId(soapModel.getUserId());
142 model.setUserName(soapModel.getUserName());
143 model.setCreateDate(soapModel.getCreateDate());
144 model.setModifiedDate(soapModel.getModifiedDate());
145 model.setBanUserId(soapModel.getBanUserId());
146 model.setLastPublishDate(soapModel.getLastPublishDate());
147
148 return model;
149 }
150
151
157 public static List<MBBan> toModels(MBBanSoap[] soapModels) {
158 if (soapModels == null) {
159 return null;
160 }
161
162 List<MBBan> models = new ArrayList<MBBan>(soapModels.length);
163
164 for (MBBanSoap soapModel : soapModels) {
165 models.add(toModel(soapModel));
166 }
167
168 return models;
169 }
170
171 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
172 "lock.expiration.time.com.liferay.message.boards.kernel.model.MBBan"));
173
174 public MBBanModelImpl() {
175 }
176
177 @Override
178 public long getPrimaryKey() {
179 return _banId;
180 }
181
182 @Override
183 public void setPrimaryKey(long primaryKey) {
184 setBanId(primaryKey);
185 }
186
187 @Override
188 public Serializable getPrimaryKeyObj() {
189 return _banId;
190 }
191
192 @Override
193 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
194 setPrimaryKey(((Long)primaryKeyObj).longValue());
195 }
196
197 @Override
198 public Class<?> getModelClass() {
199 return MBBan.class;
200 }
201
202 @Override
203 public String getModelClassName() {
204 return MBBan.class.getName();
205 }
206
207 @Override
208 public Map<String, Object> getModelAttributes() {
209 Map<String, Object> attributes = new HashMap<String, Object>();
210
211 attributes.put("uuid", getUuid());
212 attributes.put("banId", getBanId());
213 attributes.put("groupId", getGroupId());
214 attributes.put("companyId", getCompanyId());
215 attributes.put("userId", getUserId());
216 attributes.put("userName", getUserName());
217 attributes.put("createDate", getCreateDate());
218 attributes.put("modifiedDate", getModifiedDate());
219 attributes.put("banUserId", getBanUserId());
220 attributes.put("lastPublishDate", getLastPublishDate());
221
222 attributes.put("entityCacheEnabled", isEntityCacheEnabled());
223 attributes.put("finderCacheEnabled", isFinderCacheEnabled());
224
225 return attributes;
226 }
227
228 @Override
229 public void setModelAttributes(Map<String, Object> attributes) {
230 String uuid = (String)attributes.get("uuid");
231
232 if (uuid != null) {
233 setUuid(uuid);
234 }
235
236 Long banId = (Long)attributes.get("banId");
237
238 if (banId != null) {
239 setBanId(banId);
240 }
241
242 Long groupId = (Long)attributes.get("groupId");
243
244 if (groupId != null) {
245 setGroupId(groupId);
246 }
247
248 Long companyId = (Long)attributes.get("companyId");
249
250 if (companyId != null) {
251 setCompanyId(companyId);
252 }
253
254 Long userId = (Long)attributes.get("userId");
255
256 if (userId != null) {
257 setUserId(userId);
258 }
259
260 String userName = (String)attributes.get("userName");
261
262 if (userName != null) {
263 setUserName(userName);
264 }
265
266 Date createDate = (Date)attributes.get("createDate");
267
268 if (createDate != null) {
269 setCreateDate(createDate);
270 }
271
272 Date modifiedDate = (Date)attributes.get("modifiedDate");
273
274 if (modifiedDate != null) {
275 setModifiedDate(modifiedDate);
276 }
277
278 Long banUserId = (Long)attributes.get("banUserId");
279
280 if (banUserId != null) {
281 setBanUserId(banUserId);
282 }
283
284 Date lastPublishDate = (Date)attributes.get("lastPublishDate");
285
286 if (lastPublishDate != null) {
287 setLastPublishDate(lastPublishDate);
288 }
289 }
290
291 @JSON
292 @Override
293 public String getUuid() {
294 if (_uuid == null) {
295 return StringPool.BLANK;
296 }
297 else {
298 return _uuid;
299 }
300 }
301
302 @Override
303 public void setUuid(String uuid) {
304 if (_originalUuid == null) {
305 _originalUuid = _uuid;
306 }
307
308 _uuid = uuid;
309 }
310
311 public String getOriginalUuid() {
312 return GetterUtil.getString(_originalUuid);
313 }
314
315 @JSON
316 @Override
317 public long getBanId() {
318 return _banId;
319 }
320
321 @Override
322 public void setBanId(long banId) {
323 _banId = banId;
324 }
325
326 @JSON
327 @Override
328 public long getGroupId() {
329 return _groupId;
330 }
331
332 @Override
333 public void setGroupId(long groupId) {
334 _columnBitmask |= GROUPID_COLUMN_BITMASK;
335
336 if (!_setOriginalGroupId) {
337 _setOriginalGroupId = true;
338
339 _originalGroupId = _groupId;
340 }
341
342 _groupId = groupId;
343 }
344
345 public long getOriginalGroupId() {
346 return _originalGroupId;
347 }
348
349 @JSON
350 @Override
351 public long getCompanyId() {
352 return _companyId;
353 }
354
355 @Override
356 public void setCompanyId(long companyId) {
357 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
358
359 if (!_setOriginalCompanyId) {
360 _setOriginalCompanyId = true;
361
362 _originalCompanyId = _companyId;
363 }
364
365 _companyId = companyId;
366 }
367
368 public long getOriginalCompanyId() {
369 return _originalCompanyId;
370 }
371
372 @JSON
373 @Override
374 public long getUserId() {
375 return _userId;
376 }
377
378 @Override
379 public void setUserId(long userId) {
380 _columnBitmask |= USERID_COLUMN_BITMASK;
381
382 if (!_setOriginalUserId) {
383 _setOriginalUserId = true;
384
385 _originalUserId = _userId;
386 }
387
388 _userId = userId;
389 }
390
391 @Override
392 public String getUserUuid() {
393 try {
394 User user = UserLocalServiceUtil.getUserById(getUserId());
395
396 return user.getUuid();
397 }
398 catch (PortalException pe) {
399 return StringPool.BLANK;
400 }
401 }
402
403 @Override
404 public void setUserUuid(String userUuid) {
405 }
406
407 public long getOriginalUserId() {
408 return _originalUserId;
409 }
410
411 @JSON
412 @Override
413 public String getUserName() {
414 if (_userName == null) {
415 return StringPool.BLANK;
416 }
417 else {
418 return _userName;
419 }
420 }
421
422 @Override
423 public void setUserName(String userName) {
424 _userName = userName;
425 }
426
427 @JSON
428 @Override
429 public Date getCreateDate() {
430 return _createDate;
431 }
432
433 @Override
434 public void setCreateDate(Date createDate) {
435 _createDate = createDate;
436 }
437
438 @JSON
439 @Override
440 public Date getModifiedDate() {
441 return _modifiedDate;
442 }
443
444 public boolean hasSetModifiedDate() {
445 return _setModifiedDate;
446 }
447
448 @Override
449 public void setModifiedDate(Date modifiedDate) {
450 _setModifiedDate = true;
451
452 _modifiedDate = modifiedDate;
453 }
454
455 @JSON
456 @Override
457 public long getBanUserId() {
458 return _banUserId;
459 }
460
461 @Override
462 public void setBanUserId(long banUserId) {
463 _columnBitmask |= BANUSERID_COLUMN_BITMASK;
464
465 if (!_setOriginalBanUserId) {
466 _setOriginalBanUserId = true;
467
468 _originalBanUserId = _banUserId;
469 }
470
471 _banUserId = banUserId;
472 }
473
474 @Override
475 public String getBanUserUuid() {
476 try {
477 User user = UserLocalServiceUtil.getUserById(getBanUserId());
478
479 return user.getUuid();
480 }
481 catch (PortalException pe) {
482 return StringPool.BLANK;
483 }
484 }
485
486 @Override
487 public void setBanUserUuid(String banUserUuid) {
488 }
489
490 public long getOriginalBanUserId() {
491 return _originalBanUserId;
492 }
493
494 @JSON
495 @Override
496 public Date getLastPublishDate() {
497 return _lastPublishDate;
498 }
499
500 @Override
501 public void setLastPublishDate(Date lastPublishDate) {
502 _lastPublishDate = lastPublishDate;
503 }
504
505 @Override
506 public StagedModelType getStagedModelType() {
507 return new StagedModelType(PortalUtil.getClassNameId(
508 MBBan.class.getName()));
509 }
510
511 public long getColumnBitmask() {
512 return _columnBitmask;
513 }
514
515 @Override
516 public ExpandoBridge getExpandoBridge() {
517 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
518 MBBan.class.getName(), getPrimaryKey());
519 }
520
521 @Override
522 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
523 ExpandoBridge expandoBridge = getExpandoBridge();
524
525 expandoBridge.setAttributes(serviceContext);
526 }
527
528 @Override
529 public MBBan toEscapedModel() {
530 if (_escapedModel == null) {
531 _escapedModel = (MBBan)ProxyUtil.newProxyInstance(_classLoader,
532 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
533 }
534
535 return _escapedModel;
536 }
537
538 @Override
539 public Object clone() {
540 MBBanImpl mbBanImpl = new MBBanImpl();
541
542 mbBanImpl.setUuid(getUuid());
543 mbBanImpl.setBanId(getBanId());
544 mbBanImpl.setGroupId(getGroupId());
545 mbBanImpl.setCompanyId(getCompanyId());
546 mbBanImpl.setUserId(getUserId());
547 mbBanImpl.setUserName(getUserName());
548 mbBanImpl.setCreateDate(getCreateDate());
549 mbBanImpl.setModifiedDate(getModifiedDate());
550 mbBanImpl.setBanUserId(getBanUserId());
551 mbBanImpl.setLastPublishDate(getLastPublishDate());
552
553 mbBanImpl.resetOriginalValues();
554
555 return mbBanImpl;
556 }
557
558 @Override
559 public int compareTo(MBBan mbBan) {
560 long primaryKey = mbBan.getPrimaryKey();
561
562 if (getPrimaryKey() < primaryKey) {
563 return -1;
564 }
565 else if (getPrimaryKey() > primaryKey) {
566 return 1;
567 }
568 else {
569 return 0;
570 }
571 }
572
573 @Override
574 public boolean equals(Object obj) {
575 if (this == obj) {
576 return true;
577 }
578
579 if (!(obj instanceof MBBan)) {
580 return false;
581 }
582
583 MBBan mbBan = (MBBan)obj;
584
585 long primaryKey = mbBan.getPrimaryKey();
586
587 if (getPrimaryKey() == primaryKey) {
588 return true;
589 }
590 else {
591 return false;
592 }
593 }
594
595 @Override
596 public int hashCode() {
597 return (int)getPrimaryKey();
598 }
599
600 @Override
601 public boolean isEntityCacheEnabled() {
602 return ENTITY_CACHE_ENABLED;
603 }
604
605 @Override
606 public boolean isFinderCacheEnabled() {
607 return FINDER_CACHE_ENABLED;
608 }
609
610 @Override
611 public void resetOriginalValues() {
612 MBBanModelImpl mbBanModelImpl = this;
613
614 mbBanModelImpl._originalUuid = mbBanModelImpl._uuid;
615
616 mbBanModelImpl._originalGroupId = mbBanModelImpl._groupId;
617
618 mbBanModelImpl._setOriginalGroupId = false;
619
620 mbBanModelImpl._originalCompanyId = mbBanModelImpl._companyId;
621
622 mbBanModelImpl._setOriginalCompanyId = false;
623
624 mbBanModelImpl._originalUserId = mbBanModelImpl._userId;
625
626 mbBanModelImpl._setOriginalUserId = false;
627
628 mbBanModelImpl._setModifiedDate = false;
629
630 mbBanModelImpl._originalBanUserId = mbBanModelImpl._banUserId;
631
632 mbBanModelImpl._setOriginalBanUserId = false;
633
634 mbBanModelImpl._columnBitmask = 0;
635 }
636
637 @Override
638 public CacheModel<MBBan> toCacheModel() {
639 MBBanCacheModel mbBanCacheModel = new MBBanCacheModel();
640
641 mbBanCacheModel.uuid = getUuid();
642
643 String uuid = mbBanCacheModel.uuid;
644
645 if ((uuid != null) && (uuid.length() == 0)) {
646 mbBanCacheModel.uuid = null;
647 }
648
649 mbBanCacheModel.banId = getBanId();
650
651 mbBanCacheModel.groupId = getGroupId();
652
653 mbBanCacheModel.companyId = getCompanyId();
654
655 mbBanCacheModel.userId = getUserId();
656
657 mbBanCacheModel.userName = getUserName();
658
659 String userName = mbBanCacheModel.userName;
660
661 if ((userName != null) && (userName.length() == 0)) {
662 mbBanCacheModel.userName = null;
663 }
664
665 Date createDate = getCreateDate();
666
667 if (createDate != null) {
668 mbBanCacheModel.createDate = createDate.getTime();
669 }
670 else {
671 mbBanCacheModel.createDate = Long.MIN_VALUE;
672 }
673
674 Date modifiedDate = getModifiedDate();
675
676 if (modifiedDate != null) {
677 mbBanCacheModel.modifiedDate = modifiedDate.getTime();
678 }
679 else {
680 mbBanCacheModel.modifiedDate = Long.MIN_VALUE;
681 }
682
683 mbBanCacheModel.banUserId = getBanUserId();
684
685 Date lastPublishDate = getLastPublishDate();
686
687 if (lastPublishDate != null) {
688 mbBanCacheModel.lastPublishDate = lastPublishDate.getTime();
689 }
690 else {
691 mbBanCacheModel.lastPublishDate = Long.MIN_VALUE;
692 }
693
694 return mbBanCacheModel;
695 }
696
697 @Override
698 public String toString() {
699 StringBundler sb = new StringBundler(21);
700
701 sb.append("{uuid=");
702 sb.append(getUuid());
703 sb.append(", banId=");
704 sb.append(getBanId());
705 sb.append(", groupId=");
706 sb.append(getGroupId());
707 sb.append(", companyId=");
708 sb.append(getCompanyId());
709 sb.append(", userId=");
710 sb.append(getUserId());
711 sb.append(", userName=");
712 sb.append(getUserName());
713 sb.append(", createDate=");
714 sb.append(getCreateDate());
715 sb.append(", modifiedDate=");
716 sb.append(getModifiedDate());
717 sb.append(", banUserId=");
718 sb.append(getBanUserId());
719 sb.append(", lastPublishDate=");
720 sb.append(getLastPublishDate());
721 sb.append("}");
722
723 return sb.toString();
724 }
725
726 @Override
727 public String toXmlString() {
728 StringBundler sb = new StringBundler(34);
729
730 sb.append("<model><model-name>");
731 sb.append("com.liferay.message.boards.kernel.model.MBBan");
732 sb.append("</model-name>");
733
734 sb.append(
735 "<column><column-name>uuid</column-name><column-value><![CDATA[");
736 sb.append(getUuid());
737 sb.append("]]></column-value></column>");
738 sb.append(
739 "<column><column-name>banId</column-name><column-value><![CDATA[");
740 sb.append(getBanId());
741 sb.append("]]></column-value></column>");
742 sb.append(
743 "<column><column-name>groupId</column-name><column-value><![CDATA[");
744 sb.append(getGroupId());
745 sb.append("]]></column-value></column>");
746 sb.append(
747 "<column><column-name>companyId</column-name><column-value><![CDATA[");
748 sb.append(getCompanyId());
749 sb.append("]]></column-value></column>");
750 sb.append(
751 "<column><column-name>userId</column-name><column-value><![CDATA[");
752 sb.append(getUserId());
753 sb.append("]]></column-value></column>");
754 sb.append(
755 "<column><column-name>userName</column-name><column-value><![CDATA[");
756 sb.append(getUserName());
757 sb.append("]]></column-value></column>");
758 sb.append(
759 "<column><column-name>createDate</column-name><column-value><![CDATA[");
760 sb.append(getCreateDate());
761 sb.append("]]></column-value></column>");
762 sb.append(
763 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
764 sb.append(getModifiedDate());
765 sb.append("]]></column-value></column>");
766 sb.append(
767 "<column><column-name>banUserId</column-name><column-value><![CDATA[");
768 sb.append(getBanUserId());
769 sb.append("]]></column-value></column>");
770 sb.append(
771 "<column><column-name>lastPublishDate</column-name><column-value><![CDATA[");
772 sb.append(getLastPublishDate());
773 sb.append("]]></column-value></column>");
774
775 sb.append("</model>");
776
777 return sb.toString();
778 }
779
780 private static final ClassLoader _classLoader = MBBan.class.getClassLoader();
781 private static final Class<?>[] _escapedModelInterfaces = new Class[] {
782 MBBan.class
783 };
784 private String _uuid;
785 private String _originalUuid;
786 private long _banId;
787 private long _groupId;
788 private long _originalGroupId;
789 private boolean _setOriginalGroupId;
790 private long _companyId;
791 private long _originalCompanyId;
792 private boolean _setOriginalCompanyId;
793 private long _userId;
794 private long _originalUserId;
795 private boolean _setOriginalUserId;
796 private String _userName;
797 private Date _createDate;
798 private Date _modifiedDate;
799 private boolean _setModifiedDate;
800 private long _banUserId;
801 private long _originalBanUserId;
802 private boolean _setOriginalBanUserId;
803 private Date _lastPublishDate;
804 private long _columnBitmask;
805 private MBBan _escapedModel;
806 }