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.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.model.impl.BaseModelImpl;
023 import com.liferay.portal.service.ServiceContext;
024 import com.liferay.portal.util.PortalUtil;
025
026 import com.liferay.portlet.expando.model.ExpandoBridge;
027 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028 import com.liferay.portlet.social.model.SocialRequest;
029 import com.liferay.portlet.social.model.SocialRequestModel;
030
031 import java.io.Serializable;
032
033 import java.lang.reflect.Proxy;
034
035 import java.sql.Types;
036
037
054 public class SocialRequestModelImpl extends BaseModelImpl<SocialRequest>
055 implements SocialRequestModel {
056 public static final String TABLE_NAME = "SocialRequest";
057 public static final Object[][] TABLE_COLUMNS = {
058 { "uuid_", new Integer(Types.VARCHAR) },
059 { "requestId", new Integer(Types.BIGINT) },
060 { "groupId", new Integer(Types.BIGINT) },
061 { "companyId", new Integer(Types.BIGINT) },
062 { "userId", new Integer(Types.BIGINT) },
063 { "createDate", new Integer(Types.BIGINT) },
064 { "modifiedDate", new Integer(Types.BIGINT) },
065 { "classNameId", new Integer(Types.BIGINT) },
066 { "classPK", new Integer(Types.BIGINT) },
067 { "type_", new Integer(Types.INTEGER) },
068 { "extraData", new Integer(Types.VARCHAR) },
069 { "receiverUserId", new Integer(Types.BIGINT) },
070 { "status", new Integer(Types.INTEGER) }
071 };
072 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)";
073 public static final String TABLE_SQL_DROP = "drop table SocialRequest";
074 public static final String ORDER_BY_JPQL = " ORDER BY socialRequest.requestId DESC";
075 public static final String ORDER_BY_SQL = " ORDER BY SocialRequest.requestId DESC";
076 public static final String DATA_SOURCE = "liferayDataSource";
077 public static final String SESSION_FACTORY = "liferaySessionFactory";
078 public static final String TX_MANAGER = "liferayTransactionManager";
079 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
080 "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialRequest"),
081 true);
082 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
083 "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialRequest"),
084 true);
085 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
086 "lock.expiration.time.com.liferay.portlet.social.model.SocialRequest"));
087
088 public SocialRequestModelImpl() {
089 }
090
091 public long getPrimaryKey() {
092 return _requestId;
093 }
094
095 public void setPrimaryKey(long pk) {
096 setRequestId(pk);
097 }
098
099 public Serializable getPrimaryKeyObj() {
100 return new Long(_requestId);
101 }
102
103 public String getUuid() {
104 if (_uuid == null) {
105 return StringPool.BLANK;
106 }
107 else {
108 return _uuid;
109 }
110 }
111
112 public void setUuid(String uuid) {
113 _uuid = uuid;
114
115 if (_originalUuid == null) {
116 _originalUuid = uuid;
117 }
118 }
119
120 public String getOriginalUuid() {
121 return GetterUtil.getString(_originalUuid);
122 }
123
124 public long getRequestId() {
125 return _requestId;
126 }
127
128 public void setRequestId(long requestId) {
129 _requestId = requestId;
130 }
131
132 public long getGroupId() {
133 return _groupId;
134 }
135
136 public void setGroupId(long groupId) {
137 _groupId = groupId;
138
139 if (!_setOriginalGroupId) {
140 _setOriginalGroupId = true;
141
142 _originalGroupId = groupId;
143 }
144 }
145
146 public long getOriginalGroupId() {
147 return _originalGroupId;
148 }
149
150 public long getCompanyId() {
151 return _companyId;
152 }
153
154 public void setCompanyId(long companyId) {
155 _companyId = companyId;
156 }
157
158 public long getUserId() {
159 return _userId;
160 }
161
162 public void setUserId(long userId) {
163 _userId = userId;
164
165 if (!_setOriginalUserId) {
166 _setOriginalUserId = true;
167
168 _originalUserId = userId;
169 }
170 }
171
172 public String getUserUuid() throws SystemException {
173 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
174 }
175
176 public void setUserUuid(String userUuid) {
177 _userUuid = userUuid;
178 }
179
180 public long getOriginalUserId() {
181 return _originalUserId;
182 }
183
184 public long getCreateDate() {
185 return _createDate;
186 }
187
188 public void setCreateDate(long createDate) {
189 _createDate = createDate;
190 }
191
192 public long getModifiedDate() {
193 return _modifiedDate;
194 }
195
196 public void setModifiedDate(long modifiedDate) {
197 _modifiedDate = modifiedDate;
198 }
199
200 public String getClassName() {
201 if (getClassNameId() <= 0) {
202 return StringPool.BLANK;
203 }
204
205 return PortalUtil.getClassName(getClassNameId());
206 }
207
208 public long getClassNameId() {
209 return _classNameId;
210 }
211
212 public void setClassNameId(long classNameId) {
213 _classNameId = classNameId;
214
215 if (!_setOriginalClassNameId) {
216 _setOriginalClassNameId = true;
217
218 _originalClassNameId = classNameId;
219 }
220 }
221
222 public long getOriginalClassNameId() {
223 return _originalClassNameId;
224 }
225
226 public long getClassPK() {
227 return _classPK;
228 }
229
230 public void setClassPK(long classPK) {
231 _classPK = classPK;
232
233 if (!_setOriginalClassPK) {
234 _setOriginalClassPK = true;
235
236 _originalClassPK = classPK;
237 }
238 }
239
240 public long getOriginalClassPK() {
241 return _originalClassPK;
242 }
243
244 public int getType() {
245 return _type;
246 }
247
248 public void setType(int type) {
249 _type = type;
250
251 if (!_setOriginalType) {
252 _setOriginalType = true;
253
254 _originalType = type;
255 }
256 }
257
258 public int getOriginalType() {
259 return _originalType;
260 }
261
262 public String getExtraData() {
263 if (_extraData == null) {
264 return StringPool.BLANK;
265 }
266 else {
267 return _extraData;
268 }
269 }
270
271 public void setExtraData(String extraData) {
272 _extraData = extraData;
273 }
274
275 public long getReceiverUserId() {
276 return _receiverUserId;
277 }
278
279 public void setReceiverUserId(long receiverUserId) {
280 _receiverUserId = receiverUserId;
281
282 if (!_setOriginalReceiverUserId) {
283 _setOriginalReceiverUserId = true;
284
285 _originalReceiverUserId = receiverUserId;
286 }
287 }
288
289 public String getReceiverUserUuid() throws SystemException {
290 return PortalUtil.getUserValue(getReceiverUserId(), "uuid",
291 _receiverUserUuid);
292 }
293
294 public void setReceiverUserUuid(String receiverUserUuid) {
295 _receiverUserUuid = receiverUserUuid;
296 }
297
298 public long getOriginalReceiverUserId() {
299 return _originalReceiverUserId;
300 }
301
302 public int getStatus() {
303 return _status;
304 }
305
306 public void setStatus(int status) {
307 _status = status;
308 }
309
310 public SocialRequest toEscapedModel() {
311 if (isEscapedModel()) {
312 return (SocialRequest)this;
313 }
314 else {
315 return (SocialRequest)Proxy.newProxyInstance(SocialRequest.class.getClassLoader(),
316 new Class[] { SocialRequest.class },
317 new AutoEscapeBeanHandler(this));
318 }
319 }
320
321 public ExpandoBridge getExpandoBridge() {
322 if (_expandoBridge == null) {
323 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
324 SocialRequest.class.getName(), getPrimaryKey());
325 }
326
327 return _expandoBridge;
328 }
329
330 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
331 getExpandoBridge().setAttributes(serviceContext);
332 }
333
334 public Object clone() {
335 SocialRequestImpl clone = new SocialRequestImpl();
336
337 clone.setUuid(getUuid());
338 clone.setRequestId(getRequestId());
339 clone.setGroupId(getGroupId());
340 clone.setCompanyId(getCompanyId());
341 clone.setUserId(getUserId());
342 clone.setCreateDate(getCreateDate());
343 clone.setModifiedDate(getModifiedDate());
344 clone.setClassNameId(getClassNameId());
345 clone.setClassPK(getClassPK());
346 clone.setType(getType());
347 clone.setExtraData(getExtraData());
348 clone.setReceiverUserId(getReceiverUserId());
349 clone.setStatus(getStatus());
350
351 return clone;
352 }
353
354 public int compareTo(SocialRequest socialRequest) {
355 int value = 0;
356
357 if (getRequestId() < socialRequest.getRequestId()) {
358 value = -1;
359 }
360 else if (getRequestId() > socialRequest.getRequestId()) {
361 value = 1;
362 }
363 else {
364 value = 0;
365 }
366
367 value = value * -1;
368
369 if (value != 0) {
370 return value;
371 }
372
373 return 0;
374 }
375
376 public boolean equals(Object obj) {
377 if (obj == null) {
378 return false;
379 }
380
381 SocialRequest socialRequest = null;
382
383 try {
384 socialRequest = (SocialRequest)obj;
385 }
386 catch (ClassCastException cce) {
387 return false;
388 }
389
390 long pk = socialRequest.getPrimaryKey();
391
392 if (getPrimaryKey() == pk) {
393 return true;
394 }
395 else {
396 return false;
397 }
398 }
399
400 public int hashCode() {
401 return (int)getPrimaryKey();
402 }
403
404 public String toString() {
405 StringBundler sb = new StringBundler(27);
406
407 sb.append("{uuid=");
408 sb.append(getUuid());
409 sb.append(", requestId=");
410 sb.append(getRequestId());
411 sb.append(", groupId=");
412 sb.append(getGroupId());
413 sb.append(", companyId=");
414 sb.append(getCompanyId());
415 sb.append(", userId=");
416 sb.append(getUserId());
417 sb.append(", createDate=");
418 sb.append(getCreateDate());
419 sb.append(", modifiedDate=");
420 sb.append(getModifiedDate());
421 sb.append(", classNameId=");
422 sb.append(getClassNameId());
423 sb.append(", classPK=");
424 sb.append(getClassPK());
425 sb.append(", type=");
426 sb.append(getType());
427 sb.append(", extraData=");
428 sb.append(getExtraData());
429 sb.append(", receiverUserId=");
430 sb.append(getReceiverUserId());
431 sb.append(", status=");
432 sb.append(getStatus());
433 sb.append("}");
434
435 return sb.toString();
436 }
437
438 public String toXmlString() {
439 StringBundler sb = new StringBundler(43);
440
441 sb.append("<model><model-name>");
442 sb.append("com.liferay.portlet.social.model.SocialRequest");
443 sb.append("</model-name>");
444
445 sb.append(
446 "<column><column-name>uuid</column-name><column-value><![CDATA[");
447 sb.append(getUuid());
448 sb.append("]]></column-value></column>");
449 sb.append(
450 "<column><column-name>requestId</column-name><column-value><![CDATA[");
451 sb.append(getRequestId());
452 sb.append("]]></column-value></column>");
453 sb.append(
454 "<column><column-name>groupId</column-name><column-value><![CDATA[");
455 sb.append(getGroupId());
456 sb.append("]]></column-value></column>");
457 sb.append(
458 "<column><column-name>companyId</column-name><column-value><![CDATA[");
459 sb.append(getCompanyId());
460 sb.append("]]></column-value></column>");
461 sb.append(
462 "<column><column-name>userId</column-name><column-value><![CDATA[");
463 sb.append(getUserId());
464 sb.append("]]></column-value></column>");
465 sb.append(
466 "<column><column-name>createDate</column-name><column-value><![CDATA[");
467 sb.append(getCreateDate());
468 sb.append("]]></column-value></column>");
469 sb.append(
470 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
471 sb.append(getModifiedDate());
472 sb.append("]]></column-value></column>");
473 sb.append(
474 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
475 sb.append(getClassNameId());
476 sb.append("]]></column-value></column>");
477 sb.append(
478 "<column><column-name>classPK</column-name><column-value><![CDATA[");
479 sb.append(getClassPK());
480 sb.append("]]></column-value></column>");
481 sb.append(
482 "<column><column-name>type</column-name><column-value><![CDATA[");
483 sb.append(getType());
484 sb.append("]]></column-value></column>");
485 sb.append(
486 "<column><column-name>extraData</column-name><column-value><![CDATA[");
487 sb.append(getExtraData());
488 sb.append("]]></column-value></column>");
489 sb.append(
490 "<column><column-name>receiverUserId</column-name><column-value><![CDATA[");
491 sb.append(getReceiverUserId());
492 sb.append("]]></column-value></column>");
493 sb.append(
494 "<column><column-name>status</column-name><column-value><![CDATA[");
495 sb.append(getStatus());
496 sb.append("]]></column-value></column>");
497
498 sb.append("</model>");
499
500 return sb.toString();
501 }
502
503 private String _uuid;
504 private String _originalUuid;
505 private long _requestId;
506 private long _groupId;
507 private long _originalGroupId;
508 private boolean _setOriginalGroupId;
509 private long _companyId;
510 private long _userId;
511 private String _userUuid;
512 private long _originalUserId;
513 private boolean _setOriginalUserId;
514 private long _createDate;
515 private long _modifiedDate;
516 private long _classNameId;
517 private long _originalClassNameId;
518 private boolean _setOriginalClassNameId;
519 private long _classPK;
520 private long _originalClassPK;
521 private boolean _setOriginalClassPK;
522 private int _type;
523 private int _originalType;
524 private boolean _setOriginalType;
525 private String _extraData;
526 private long _receiverUserId;
527 private String _receiverUserUuid;
528 private long _originalReceiverUserId;
529 private boolean _setOriginalReceiverUserId;
530 private int _status;
531 private transient ExpandoBridge _expandoBridge;
532 }