001
014
015 package com.liferay.portal.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.DateUtil;
021 import com.liferay.portal.kernel.util.GetterUtil;
022 import com.liferay.portal.kernel.util.ProxyUtil;
023 import com.liferay.portal.kernel.util.StringBundler;
024 import com.liferay.portal.kernel.util.StringPool;
025 import com.liferay.portal.model.CacheModel;
026 import com.liferay.portal.model.MembershipRequest;
027 import com.liferay.portal.model.MembershipRequestModel;
028 import com.liferay.portal.model.MembershipRequestSoap;
029 import com.liferay.portal.service.ServiceContext;
030 import com.liferay.portal.util.PortalUtil;
031
032 import com.liferay.portlet.expando.model.ExpandoBridge;
033 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
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 MembershipRequestModelImpl extends BaseModelImpl<MembershipRequest>
060 implements MembershipRequestModel {
061
066 public static final String TABLE_NAME = "MembershipRequest";
067 public static final Object[][] TABLE_COLUMNS = {
068 { "membershipRequestId", Types.BIGINT },
069 { "groupId", Types.BIGINT },
070 { "companyId", Types.BIGINT },
071 { "userId", Types.BIGINT },
072 { "createDate", Types.TIMESTAMP },
073 { "comments", Types.VARCHAR },
074 { "replyComments", Types.VARCHAR },
075 { "replyDate", Types.TIMESTAMP },
076 { "replierUserId", Types.BIGINT },
077 { "statusId", Types.INTEGER }
078 };
079 public static final String TABLE_SQL_CREATE = "create table MembershipRequest (membershipRequestId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,createDate DATE null,comments STRING null,replyComments STRING null,replyDate DATE null,replierUserId LONG,statusId INTEGER)";
080 public static final String TABLE_SQL_DROP = "drop table MembershipRequest";
081 public static final String ORDER_BY_JPQL = " ORDER BY membershipRequest.createDate DESC";
082 public static final String ORDER_BY_SQL = " ORDER BY MembershipRequest.createDate DESC";
083 public static final String DATA_SOURCE = "liferayDataSource";
084 public static final String SESSION_FACTORY = "liferaySessionFactory";
085 public static final String TX_MANAGER = "liferayTransactionManager";
086 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
087 "value.object.entity.cache.enabled.com.liferay.portal.model.MembershipRequest"),
088 true);
089 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
090 "value.object.finder.cache.enabled.com.liferay.portal.model.MembershipRequest"),
091 true);
092 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
093 "value.object.column.bitmask.enabled.com.liferay.portal.model.MembershipRequest"),
094 true);
095 public static long GROUPID_COLUMN_BITMASK = 1L;
096 public static long STATUSID_COLUMN_BITMASK = 2L;
097 public static long USERID_COLUMN_BITMASK = 4L;
098
099
105 public static MembershipRequest toModel(MembershipRequestSoap soapModel) {
106 if (soapModel == null) {
107 return null;
108 }
109
110 MembershipRequest model = new MembershipRequestImpl();
111
112 model.setMembershipRequestId(soapModel.getMembershipRequestId());
113 model.setGroupId(soapModel.getGroupId());
114 model.setCompanyId(soapModel.getCompanyId());
115 model.setUserId(soapModel.getUserId());
116 model.setCreateDate(soapModel.getCreateDate());
117 model.setComments(soapModel.getComments());
118 model.setReplyComments(soapModel.getReplyComments());
119 model.setReplyDate(soapModel.getReplyDate());
120 model.setReplierUserId(soapModel.getReplierUserId());
121 model.setStatusId(soapModel.getStatusId());
122
123 return model;
124 }
125
126
132 public static List<MembershipRequest> toModels(
133 MembershipRequestSoap[] soapModels) {
134 if (soapModels == null) {
135 return null;
136 }
137
138 List<MembershipRequest> models = new ArrayList<MembershipRequest>(soapModels.length);
139
140 for (MembershipRequestSoap soapModel : soapModels) {
141 models.add(toModel(soapModel));
142 }
143
144 return models;
145 }
146
147 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
148 "lock.expiration.time.com.liferay.portal.model.MembershipRequest"));
149
150 public MembershipRequestModelImpl() {
151 }
152
153 public long getPrimaryKey() {
154 return _membershipRequestId;
155 }
156
157 public void setPrimaryKey(long primaryKey) {
158 setMembershipRequestId(primaryKey);
159 }
160
161 public Serializable getPrimaryKeyObj() {
162 return new Long(_membershipRequestId);
163 }
164
165 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
166 setPrimaryKey(((Long)primaryKeyObj).longValue());
167 }
168
169 public Class<?> getModelClass() {
170 return MembershipRequest.class;
171 }
172
173 public String getModelClassName() {
174 return MembershipRequest.class.getName();
175 }
176
177 @Override
178 public Map<String, Object> getModelAttributes() {
179 Map<String, Object> attributes = new HashMap<String, Object>();
180
181 attributes.put("membershipRequestId", getMembershipRequestId());
182 attributes.put("groupId", getGroupId());
183 attributes.put("companyId", getCompanyId());
184 attributes.put("userId", getUserId());
185 attributes.put("createDate", getCreateDate());
186 attributes.put("comments", getComments());
187 attributes.put("replyComments", getReplyComments());
188 attributes.put("replyDate", getReplyDate());
189 attributes.put("replierUserId", getReplierUserId());
190 attributes.put("statusId", getStatusId());
191
192 return attributes;
193 }
194
195 @Override
196 public void setModelAttributes(Map<String, Object> attributes) {
197 Long membershipRequestId = (Long)attributes.get("membershipRequestId");
198
199 if (membershipRequestId != null) {
200 setMembershipRequestId(membershipRequestId);
201 }
202
203 Long groupId = (Long)attributes.get("groupId");
204
205 if (groupId != null) {
206 setGroupId(groupId);
207 }
208
209 Long companyId = (Long)attributes.get("companyId");
210
211 if (companyId != null) {
212 setCompanyId(companyId);
213 }
214
215 Long userId = (Long)attributes.get("userId");
216
217 if (userId != null) {
218 setUserId(userId);
219 }
220
221 Date createDate = (Date)attributes.get("createDate");
222
223 if (createDate != null) {
224 setCreateDate(createDate);
225 }
226
227 String comments = (String)attributes.get("comments");
228
229 if (comments != null) {
230 setComments(comments);
231 }
232
233 String replyComments = (String)attributes.get("replyComments");
234
235 if (replyComments != null) {
236 setReplyComments(replyComments);
237 }
238
239 Date replyDate = (Date)attributes.get("replyDate");
240
241 if (replyDate != null) {
242 setReplyDate(replyDate);
243 }
244
245 Long replierUserId = (Long)attributes.get("replierUserId");
246
247 if (replierUserId != null) {
248 setReplierUserId(replierUserId);
249 }
250
251 Integer statusId = (Integer)attributes.get("statusId");
252
253 if (statusId != null) {
254 setStatusId(statusId);
255 }
256 }
257
258 @JSON
259 public long getMembershipRequestId() {
260 return _membershipRequestId;
261 }
262
263 public void setMembershipRequestId(long membershipRequestId) {
264 _membershipRequestId = membershipRequestId;
265 }
266
267 @JSON
268 public long getGroupId() {
269 return _groupId;
270 }
271
272 public void setGroupId(long groupId) {
273 _columnBitmask |= GROUPID_COLUMN_BITMASK;
274
275 if (!_setOriginalGroupId) {
276 _setOriginalGroupId = true;
277
278 _originalGroupId = _groupId;
279 }
280
281 _groupId = groupId;
282 }
283
284 public long getOriginalGroupId() {
285 return _originalGroupId;
286 }
287
288 @JSON
289 public long getCompanyId() {
290 return _companyId;
291 }
292
293 public void setCompanyId(long companyId) {
294 _companyId = companyId;
295 }
296
297 @JSON
298 public long getUserId() {
299 return _userId;
300 }
301
302 public void setUserId(long userId) {
303 _columnBitmask |= USERID_COLUMN_BITMASK;
304
305 if (!_setOriginalUserId) {
306 _setOriginalUserId = true;
307
308 _originalUserId = _userId;
309 }
310
311 _userId = userId;
312 }
313
314 public String getUserUuid() throws SystemException {
315 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
316 }
317
318 public void setUserUuid(String userUuid) {
319 _userUuid = userUuid;
320 }
321
322 public long getOriginalUserId() {
323 return _originalUserId;
324 }
325
326 @JSON
327 public Date getCreateDate() {
328 return _createDate;
329 }
330
331 public void setCreateDate(Date createDate) {
332 _columnBitmask = -1L;
333
334 _createDate = createDate;
335 }
336
337 @JSON
338 public String getComments() {
339 if (_comments == null) {
340 return StringPool.BLANK;
341 }
342 else {
343 return _comments;
344 }
345 }
346
347 public void setComments(String comments) {
348 _comments = comments;
349 }
350
351 @JSON
352 public String getReplyComments() {
353 if (_replyComments == null) {
354 return StringPool.BLANK;
355 }
356 else {
357 return _replyComments;
358 }
359 }
360
361 public void setReplyComments(String replyComments) {
362 _replyComments = replyComments;
363 }
364
365 @JSON
366 public Date getReplyDate() {
367 return _replyDate;
368 }
369
370 public void setReplyDate(Date replyDate) {
371 _replyDate = replyDate;
372 }
373
374 @JSON
375 public long getReplierUserId() {
376 return _replierUserId;
377 }
378
379 public void setReplierUserId(long replierUserId) {
380 _replierUserId = replierUserId;
381 }
382
383 public String getReplierUserUuid() throws SystemException {
384 return PortalUtil.getUserValue(getReplierUserId(), "uuid",
385 _replierUserUuid);
386 }
387
388 public void setReplierUserUuid(String replierUserUuid) {
389 _replierUserUuid = replierUserUuid;
390 }
391
392 @JSON
393 public int getStatusId() {
394 return _statusId;
395 }
396
397 public void setStatusId(int statusId) {
398 _columnBitmask |= STATUSID_COLUMN_BITMASK;
399
400 if (!_setOriginalStatusId) {
401 _setOriginalStatusId = true;
402
403 _originalStatusId = _statusId;
404 }
405
406 _statusId = statusId;
407 }
408
409 public int getOriginalStatusId() {
410 return _originalStatusId;
411 }
412
413 public long getColumnBitmask() {
414 return _columnBitmask;
415 }
416
417 @Override
418 public ExpandoBridge getExpandoBridge() {
419 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
420 MembershipRequest.class.getName(), getPrimaryKey());
421 }
422
423 @Override
424 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
425 ExpandoBridge expandoBridge = getExpandoBridge();
426
427 expandoBridge.setAttributes(serviceContext);
428 }
429
430 @Override
431 public MembershipRequest toEscapedModel() {
432 if (_escapedModel == null) {
433 _escapedModel = (MembershipRequest)ProxyUtil.newProxyInstance(_classLoader,
434 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
435 }
436
437 return _escapedModel;
438 }
439
440 public MembershipRequest toUnescapedModel() {
441 return (MembershipRequest)this;
442 }
443
444 @Override
445 public Object clone() {
446 MembershipRequestImpl membershipRequestImpl = new MembershipRequestImpl();
447
448 membershipRequestImpl.setMembershipRequestId(getMembershipRequestId());
449 membershipRequestImpl.setGroupId(getGroupId());
450 membershipRequestImpl.setCompanyId(getCompanyId());
451 membershipRequestImpl.setUserId(getUserId());
452 membershipRequestImpl.setCreateDate(getCreateDate());
453 membershipRequestImpl.setComments(getComments());
454 membershipRequestImpl.setReplyComments(getReplyComments());
455 membershipRequestImpl.setReplyDate(getReplyDate());
456 membershipRequestImpl.setReplierUserId(getReplierUserId());
457 membershipRequestImpl.setStatusId(getStatusId());
458
459 membershipRequestImpl.resetOriginalValues();
460
461 return membershipRequestImpl;
462 }
463
464 public int compareTo(MembershipRequest membershipRequest) {
465 int value = 0;
466
467 value = DateUtil.compareTo(getCreateDate(),
468 membershipRequest.getCreateDate());
469
470 value = value * -1;
471
472 if (value != 0) {
473 return value;
474 }
475
476 return 0;
477 }
478
479 @Override
480 public boolean equals(Object obj) {
481 if (this == obj) {
482 return true;
483 }
484
485 if (!(obj instanceof MembershipRequest)) {
486 return false;
487 }
488
489 MembershipRequest membershipRequest = (MembershipRequest)obj;
490
491 long primaryKey = membershipRequest.getPrimaryKey();
492
493 if (getPrimaryKey() == primaryKey) {
494 return true;
495 }
496 else {
497 return false;
498 }
499 }
500
501 @Override
502 public int hashCode() {
503 return (int)getPrimaryKey();
504 }
505
506 @Override
507 public void resetOriginalValues() {
508 MembershipRequestModelImpl membershipRequestModelImpl = this;
509
510 membershipRequestModelImpl._originalGroupId = membershipRequestModelImpl._groupId;
511
512 membershipRequestModelImpl._setOriginalGroupId = false;
513
514 membershipRequestModelImpl._originalUserId = membershipRequestModelImpl._userId;
515
516 membershipRequestModelImpl._setOriginalUserId = false;
517
518 membershipRequestModelImpl._originalStatusId = membershipRequestModelImpl._statusId;
519
520 membershipRequestModelImpl._setOriginalStatusId = false;
521
522 membershipRequestModelImpl._columnBitmask = 0;
523 }
524
525 @Override
526 public CacheModel<MembershipRequest> toCacheModel() {
527 MembershipRequestCacheModel membershipRequestCacheModel = new MembershipRequestCacheModel();
528
529 membershipRequestCacheModel.membershipRequestId = getMembershipRequestId();
530
531 membershipRequestCacheModel.groupId = getGroupId();
532
533 membershipRequestCacheModel.companyId = getCompanyId();
534
535 membershipRequestCacheModel.userId = getUserId();
536
537 Date createDate = getCreateDate();
538
539 if (createDate != null) {
540 membershipRequestCacheModel.createDate = createDate.getTime();
541 }
542 else {
543 membershipRequestCacheModel.createDate = Long.MIN_VALUE;
544 }
545
546 membershipRequestCacheModel.comments = getComments();
547
548 String comments = membershipRequestCacheModel.comments;
549
550 if ((comments != null) && (comments.length() == 0)) {
551 membershipRequestCacheModel.comments = null;
552 }
553
554 membershipRequestCacheModel.replyComments = getReplyComments();
555
556 String replyComments = membershipRequestCacheModel.replyComments;
557
558 if ((replyComments != null) && (replyComments.length() == 0)) {
559 membershipRequestCacheModel.replyComments = null;
560 }
561
562 Date replyDate = getReplyDate();
563
564 if (replyDate != null) {
565 membershipRequestCacheModel.replyDate = replyDate.getTime();
566 }
567 else {
568 membershipRequestCacheModel.replyDate = Long.MIN_VALUE;
569 }
570
571 membershipRequestCacheModel.replierUserId = getReplierUserId();
572
573 membershipRequestCacheModel.statusId = getStatusId();
574
575 return membershipRequestCacheModel;
576 }
577
578 @Override
579 public String toString() {
580 StringBundler sb = new StringBundler(21);
581
582 sb.append("{membershipRequestId=");
583 sb.append(getMembershipRequestId());
584 sb.append(", groupId=");
585 sb.append(getGroupId());
586 sb.append(", companyId=");
587 sb.append(getCompanyId());
588 sb.append(", userId=");
589 sb.append(getUserId());
590 sb.append(", createDate=");
591 sb.append(getCreateDate());
592 sb.append(", comments=");
593 sb.append(getComments());
594 sb.append(", replyComments=");
595 sb.append(getReplyComments());
596 sb.append(", replyDate=");
597 sb.append(getReplyDate());
598 sb.append(", replierUserId=");
599 sb.append(getReplierUserId());
600 sb.append(", statusId=");
601 sb.append(getStatusId());
602 sb.append("}");
603
604 return sb.toString();
605 }
606
607 public String toXmlString() {
608 StringBundler sb = new StringBundler(34);
609
610 sb.append("<model><model-name>");
611 sb.append("com.liferay.portal.model.MembershipRequest");
612 sb.append("</model-name>");
613
614 sb.append(
615 "<column><column-name>membershipRequestId</column-name><column-value><![CDATA[");
616 sb.append(getMembershipRequestId());
617 sb.append("]]></column-value></column>");
618 sb.append(
619 "<column><column-name>groupId</column-name><column-value><![CDATA[");
620 sb.append(getGroupId());
621 sb.append("]]></column-value></column>");
622 sb.append(
623 "<column><column-name>companyId</column-name><column-value><![CDATA[");
624 sb.append(getCompanyId());
625 sb.append("]]></column-value></column>");
626 sb.append(
627 "<column><column-name>userId</column-name><column-value><![CDATA[");
628 sb.append(getUserId());
629 sb.append("]]></column-value></column>");
630 sb.append(
631 "<column><column-name>createDate</column-name><column-value><![CDATA[");
632 sb.append(getCreateDate());
633 sb.append("]]></column-value></column>");
634 sb.append(
635 "<column><column-name>comments</column-name><column-value><![CDATA[");
636 sb.append(getComments());
637 sb.append("]]></column-value></column>");
638 sb.append(
639 "<column><column-name>replyComments</column-name><column-value><![CDATA[");
640 sb.append(getReplyComments());
641 sb.append("]]></column-value></column>");
642 sb.append(
643 "<column><column-name>replyDate</column-name><column-value><![CDATA[");
644 sb.append(getReplyDate());
645 sb.append("]]></column-value></column>");
646 sb.append(
647 "<column><column-name>replierUserId</column-name><column-value><![CDATA[");
648 sb.append(getReplierUserId());
649 sb.append("]]></column-value></column>");
650 sb.append(
651 "<column><column-name>statusId</column-name><column-value><![CDATA[");
652 sb.append(getStatusId());
653 sb.append("]]></column-value></column>");
654
655 sb.append("</model>");
656
657 return sb.toString();
658 }
659
660 private static ClassLoader _classLoader = MembershipRequest.class.getClassLoader();
661 private static Class<?>[] _escapedModelInterfaces = new Class[] {
662 MembershipRequest.class
663 };
664 private long _membershipRequestId;
665 private long _groupId;
666 private long _originalGroupId;
667 private boolean _setOriginalGroupId;
668 private long _companyId;
669 private long _userId;
670 private String _userUuid;
671 private long _originalUserId;
672 private boolean _setOriginalUserId;
673 private Date _createDate;
674 private String _comments;
675 private String _replyComments;
676 private Date _replyDate;
677 private long _replierUserId;
678 private String _replierUserUuid;
679 private int _statusId;
680 private int _originalStatusId;
681 private boolean _setOriginalStatusId;
682 private long _columnBitmask;
683 private MembershipRequest _escapedModel;
684 }