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