001
014
015 package com.liferay.portlet.messageboards.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.json.JSON;
020 import com.liferay.portal.kernel.util.GetterUtil;
021 import com.liferay.portal.kernel.util.ProxyUtil;
022 import com.liferay.portal.kernel.util.StringBundler;
023 import com.liferay.portal.kernel.util.StringPool;
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.messageboards.model.MBBan;
032 import com.liferay.portlet.messageboards.model.MBBanModel;
033 import com.liferay.portlet.messageboards.model.MBBanSoap;
034
035 import java.io.Serializable;
036
037 import java.sql.Types;
038
039 import java.util.ArrayList;
040 import java.util.Date;
041 import java.util.HashMap;
042 import java.util.List;
043 import java.util.Map;
044
045
058 @JSON(strict = true)
059 public class MBBanModelImpl extends BaseModelImpl<MBBan> implements MBBanModel {
060
065 public static final String TABLE_NAME = "MBBan";
066 public static final Object[][] TABLE_COLUMNS = {
067 { "banId", Types.BIGINT },
068 { "groupId", Types.BIGINT },
069 { "companyId", Types.BIGINT },
070 { "userId", Types.BIGINT },
071 { "userName", Types.VARCHAR },
072 { "createDate", Types.TIMESTAMP },
073 { "modifiedDate", Types.TIMESTAMP },
074 { "banUserId", Types.BIGINT }
075 };
076 public static final String TABLE_SQL_CREATE = "create table MBBan (banId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,banUserId LONG)";
077 public static final String TABLE_SQL_DROP = "drop table MBBan";
078 public static final String ORDER_BY_JPQL = " ORDER BY mbBan.banId ASC";
079 public static final String ORDER_BY_SQL = " ORDER BY MBBan.banId ASC";
080 public static final String DATA_SOURCE = "liferayDataSource";
081 public static final String SESSION_FACTORY = "liferaySessionFactory";
082 public static final String TX_MANAGER = "liferayTransactionManager";
083 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
084 "value.object.entity.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
085 true);
086 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
087 "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
088 true);
089 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
090 "value.object.column.bitmask.enabled.com.liferay.portlet.messageboards.model.MBBan"),
091 true);
092 public static long BANUSERID_COLUMN_BITMASK = 1L;
093 public static long GROUPID_COLUMN_BITMASK = 2L;
094 public static long USERID_COLUMN_BITMASK = 4L;
095 public static long BANID_COLUMN_BITMASK = 8L;
096
097
103 public static MBBan toModel(MBBanSoap soapModel) {
104 if (soapModel == null) {
105 return null;
106 }
107
108 MBBan model = new MBBanImpl();
109
110 model.setBanId(soapModel.getBanId());
111 model.setGroupId(soapModel.getGroupId());
112 model.setCompanyId(soapModel.getCompanyId());
113 model.setUserId(soapModel.getUserId());
114 model.setUserName(soapModel.getUserName());
115 model.setCreateDate(soapModel.getCreateDate());
116 model.setModifiedDate(soapModel.getModifiedDate());
117 model.setBanUserId(soapModel.getBanUserId());
118
119 return model;
120 }
121
122
128 public static List<MBBan> toModels(MBBanSoap[] soapModels) {
129 if (soapModels == null) {
130 return null;
131 }
132
133 List<MBBan> models = new ArrayList<MBBan>(soapModels.length);
134
135 for (MBBanSoap soapModel : soapModels) {
136 models.add(toModel(soapModel));
137 }
138
139 return models;
140 }
141
142 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
143 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBBan"));
144
145 public MBBanModelImpl() {
146 }
147
148 public long getPrimaryKey() {
149 return _banId;
150 }
151
152 public void setPrimaryKey(long primaryKey) {
153 setBanId(primaryKey);
154 }
155
156 public Serializable getPrimaryKeyObj() {
157 return _banId;
158 }
159
160 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
161 setPrimaryKey(((Long)primaryKeyObj).longValue());
162 }
163
164 public Class<?> getModelClass() {
165 return MBBan.class;
166 }
167
168 public String getModelClassName() {
169 return MBBan.class.getName();
170 }
171
172 @Override
173 public Map<String, Object> getModelAttributes() {
174 Map<String, Object> attributes = new HashMap<String, Object>();
175
176 attributes.put("banId", getBanId());
177 attributes.put("groupId", getGroupId());
178 attributes.put("companyId", getCompanyId());
179 attributes.put("userId", getUserId());
180 attributes.put("userName", getUserName());
181 attributes.put("createDate", getCreateDate());
182 attributes.put("modifiedDate", getModifiedDate());
183 attributes.put("banUserId", getBanUserId());
184
185 return attributes;
186 }
187
188 @Override
189 public void setModelAttributes(Map<String, Object> attributes) {
190 Long banId = (Long)attributes.get("banId");
191
192 if (banId != null) {
193 setBanId(banId);
194 }
195
196 Long groupId = (Long)attributes.get("groupId");
197
198 if (groupId != null) {
199 setGroupId(groupId);
200 }
201
202 Long companyId = (Long)attributes.get("companyId");
203
204 if (companyId != null) {
205 setCompanyId(companyId);
206 }
207
208 Long userId = (Long)attributes.get("userId");
209
210 if (userId != null) {
211 setUserId(userId);
212 }
213
214 String userName = (String)attributes.get("userName");
215
216 if (userName != null) {
217 setUserName(userName);
218 }
219
220 Date createDate = (Date)attributes.get("createDate");
221
222 if (createDate != null) {
223 setCreateDate(createDate);
224 }
225
226 Date modifiedDate = (Date)attributes.get("modifiedDate");
227
228 if (modifiedDate != null) {
229 setModifiedDate(modifiedDate);
230 }
231
232 Long banUserId = (Long)attributes.get("banUserId");
233
234 if (banUserId != null) {
235 setBanUserId(banUserId);
236 }
237 }
238
239 @JSON
240 public long getBanId() {
241 return _banId;
242 }
243
244 public void setBanId(long banId) {
245 _banId = banId;
246 }
247
248 @JSON
249 public long getGroupId() {
250 return _groupId;
251 }
252
253 public void setGroupId(long groupId) {
254 _columnBitmask |= GROUPID_COLUMN_BITMASK;
255
256 if (!_setOriginalGroupId) {
257 _setOriginalGroupId = true;
258
259 _originalGroupId = _groupId;
260 }
261
262 _groupId = groupId;
263 }
264
265 public long getOriginalGroupId() {
266 return _originalGroupId;
267 }
268
269 @JSON
270 public long getCompanyId() {
271 return _companyId;
272 }
273
274 public void setCompanyId(long companyId) {
275 _companyId = companyId;
276 }
277
278 @JSON
279 public long getUserId() {
280 return _userId;
281 }
282
283 public void setUserId(long userId) {
284 _columnBitmask |= USERID_COLUMN_BITMASK;
285
286 if (!_setOriginalUserId) {
287 _setOriginalUserId = true;
288
289 _originalUserId = _userId;
290 }
291
292 _userId = userId;
293 }
294
295 public String getUserUuid() throws SystemException {
296 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
297 }
298
299 public void setUserUuid(String userUuid) {
300 _userUuid = userUuid;
301 }
302
303 public long getOriginalUserId() {
304 return _originalUserId;
305 }
306
307 @JSON
308 public String getUserName() {
309 if (_userName == null) {
310 return StringPool.BLANK;
311 }
312 else {
313 return _userName;
314 }
315 }
316
317 public void setUserName(String userName) {
318 _userName = userName;
319 }
320
321 @JSON
322 public Date getCreateDate() {
323 return _createDate;
324 }
325
326 public void setCreateDate(Date createDate) {
327 _createDate = createDate;
328 }
329
330 @JSON
331 public Date getModifiedDate() {
332 return _modifiedDate;
333 }
334
335 public void setModifiedDate(Date modifiedDate) {
336 _modifiedDate = modifiedDate;
337 }
338
339 @JSON
340 public long getBanUserId() {
341 return _banUserId;
342 }
343
344 public void setBanUserId(long banUserId) {
345 _columnBitmask |= BANUSERID_COLUMN_BITMASK;
346
347 if (!_setOriginalBanUserId) {
348 _setOriginalBanUserId = true;
349
350 _originalBanUserId = _banUserId;
351 }
352
353 _banUserId = banUserId;
354 }
355
356 public String getBanUserUuid() throws SystemException {
357 return PortalUtil.getUserValue(getBanUserId(), "uuid", _banUserUuid);
358 }
359
360 public void setBanUserUuid(String banUserUuid) {
361 _banUserUuid = banUserUuid;
362 }
363
364 public long getOriginalBanUserId() {
365 return _originalBanUserId;
366 }
367
368 public long getColumnBitmask() {
369 return _columnBitmask;
370 }
371
372 @Override
373 public ExpandoBridge getExpandoBridge() {
374 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
375 MBBan.class.getName(), getPrimaryKey());
376 }
377
378 @Override
379 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
380 ExpandoBridge expandoBridge = getExpandoBridge();
381
382 expandoBridge.setAttributes(serviceContext);
383 }
384
385 @Override
386 public MBBan toEscapedModel() {
387 if (_escapedModel == null) {
388 _escapedModel = (MBBan)ProxyUtil.newProxyInstance(_classLoader,
389 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
390 }
391
392 return _escapedModel;
393 }
394
395 @Override
396 public Object clone() {
397 MBBanImpl mbBanImpl = new MBBanImpl();
398
399 mbBanImpl.setBanId(getBanId());
400 mbBanImpl.setGroupId(getGroupId());
401 mbBanImpl.setCompanyId(getCompanyId());
402 mbBanImpl.setUserId(getUserId());
403 mbBanImpl.setUserName(getUserName());
404 mbBanImpl.setCreateDate(getCreateDate());
405 mbBanImpl.setModifiedDate(getModifiedDate());
406 mbBanImpl.setBanUserId(getBanUserId());
407
408 mbBanImpl.resetOriginalValues();
409
410 return mbBanImpl;
411 }
412
413 public int compareTo(MBBan mbBan) {
414 long primaryKey = mbBan.getPrimaryKey();
415
416 if (getPrimaryKey() < primaryKey) {
417 return -1;
418 }
419 else if (getPrimaryKey() > primaryKey) {
420 return 1;
421 }
422 else {
423 return 0;
424 }
425 }
426
427 @Override
428 public boolean equals(Object obj) {
429 if (obj == null) {
430 return false;
431 }
432
433 MBBan mbBan = null;
434
435 try {
436 mbBan = (MBBan)obj;
437 }
438 catch (ClassCastException cce) {
439 return false;
440 }
441
442 long primaryKey = mbBan.getPrimaryKey();
443
444 if (getPrimaryKey() == primaryKey) {
445 return true;
446 }
447 else {
448 return false;
449 }
450 }
451
452 @Override
453 public int hashCode() {
454 return (int)getPrimaryKey();
455 }
456
457 @Override
458 public void resetOriginalValues() {
459 MBBanModelImpl mbBanModelImpl = this;
460
461 mbBanModelImpl._originalGroupId = mbBanModelImpl._groupId;
462
463 mbBanModelImpl._setOriginalGroupId = false;
464
465 mbBanModelImpl._originalUserId = mbBanModelImpl._userId;
466
467 mbBanModelImpl._setOriginalUserId = false;
468
469 mbBanModelImpl._originalBanUserId = mbBanModelImpl._banUserId;
470
471 mbBanModelImpl._setOriginalBanUserId = false;
472
473 mbBanModelImpl._columnBitmask = 0;
474 }
475
476 @Override
477 public CacheModel<MBBan> toCacheModel() {
478 MBBanCacheModel mbBanCacheModel = new MBBanCacheModel();
479
480 mbBanCacheModel.banId = getBanId();
481
482 mbBanCacheModel.groupId = getGroupId();
483
484 mbBanCacheModel.companyId = getCompanyId();
485
486 mbBanCacheModel.userId = getUserId();
487
488 mbBanCacheModel.userName = getUserName();
489
490 String userName = mbBanCacheModel.userName;
491
492 if ((userName != null) && (userName.length() == 0)) {
493 mbBanCacheModel.userName = null;
494 }
495
496 Date createDate = getCreateDate();
497
498 if (createDate != null) {
499 mbBanCacheModel.createDate = createDate.getTime();
500 }
501 else {
502 mbBanCacheModel.createDate = Long.MIN_VALUE;
503 }
504
505 Date modifiedDate = getModifiedDate();
506
507 if (modifiedDate != null) {
508 mbBanCacheModel.modifiedDate = modifiedDate.getTime();
509 }
510 else {
511 mbBanCacheModel.modifiedDate = Long.MIN_VALUE;
512 }
513
514 mbBanCacheModel.banUserId = getBanUserId();
515
516 return mbBanCacheModel;
517 }
518
519 @Override
520 public String toString() {
521 StringBundler sb = new StringBundler(17);
522
523 sb.append("{banId=");
524 sb.append(getBanId());
525 sb.append(", groupId=");
526 sb.append(getGroupId());
527 sb.append(", companyId=");
528 sb.append(getCompanyId());
529 sb.append(", userId=");
530 sb.append(getUserId());
531 sb.append(", userName=");
532 sb.append(getUserName());
533 sb.append(", createDate=");
534 sb.append(getCreateDate());
535 sb.append(", modifiedDate=");
536 sb.append(getModifiedDate());
537 sb.append(", banUserId=");
538 sb.append(getBanUserId());
539 sb.append("}");
540
541 return sb.toString();
542 }
543
544 public String toXmlString() {
545 StringBundler sb = new StringBundler(28);
546
547 sb.append("<model><model-name>");
548 sb.append("com.liferay.portlet.messageboards.model.MBBan");
549 sb.append("</model-name>");
550
551 sb.append(
552 "<column><column-name>banId</column-name><column-value><![CDATA[");
553 sb.append(getBanId());
554 sb.append("]]></column-value></column>");
555 sb.append(
556 "<column><column-name>groupId</column-name><column-value><![CDATA[");
557 sb.append(getGroupId());
558 sb.append("]]></column-value></column>");
559 sb.append(
560 "<column><column-name>companyId</column-name><column-value><![CDATA[");
561 sb.append(getCompanyId());
562 sb.append("]]></column-value></column>");
563 sb.append(
564 "<column><column-name>userId</column-name><column-value><![CDATA[");
565 sb.append(getUserId());
566 sb.append("]]></column-value></column>");
567 sb.append(
568 "<column><column-name>userName</column-name><column-value><![CDATA[");
569 sb.append(getUserName());
570 sb.append("]]></column-value></column>");
571 sb.append(
572 "<column><column-name>createDate</column-name><column-value><![CDATA[");
573 sb.append(getCreateDate());
574 sb.append("]]></column-value></column>");
575 sb.append(
576 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
577 sb.append(getModifiedDate());
578 sb.append("]]></column-value></column>");
579 sb.append(
580 "<column><column-name>banUserId</column-name><column-value><![CDATA[");
581 sb.append(getBanUserId());
582 sb.append("]]></column-value></column>");
583
584 sb.append("</model>");
585
586 return sb.toString();
587 }
588
589 private static ClassLoader _classLoader = MBBan.class.getClassLoader();
590 private static Class<?>[] _escapedModelInterfaces = new Class[] { MBBan.class };
591 private long _banId;
592 private long _groupId;
593 private long _originalGroupId;
594 private boolean _setOriginalGroupId;
595 private long _companyId;
596 private long _userId;
597 private String _userUuid;
598 private long _originalUserId;
599 private boolean _setOriginalUserId;
600 private String _userName;
601 private Date _createDate;
602 private Date _modifiedDate;
603 private long _banUserId;
604 private String _banUserUuid;
605 private long _originalBanUserId;
606 private boolean _setOriginalBanUserId;
607 private long _columnBitmask;
608 private MBBan _escapedModel;
609 }