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.ProxyUtil;
021 import com.liferay.portal.kernel.util.StringBundler;
022 import com.liferay.portal.kernel.util.StringPool;
023 import com.liferay.portal.kernel.util.Validator;
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.social.model.SocialActivityLimit;
032 import com.liferay.portlet.social.model.SocialActivityLimitModel;
033
034 import java.io.Serializable;
035
036 import java.sql.Types;
037
038 import java.util.HashMap;
039 import java.util.Map;
040
041
054 public class SocialActivityLimitModelImpl extends BaseModelImpl<SocialActivityLimit>
055 implements SocialActivityLimitModel {
056
061 public static final String TABLE_NAME = "SocialActivityLimit";
062 public static final Object[][] TABLE_COLUMNS = {
063 { "activityLimitId", Types.BIGINT },
064 { "groupId", Types.BIGINT },
065 { "companyId", Types.BIGINT },
066 { "userId", Types.BIGINT },
067 { "classNameId", Types.BIGINT },
068 { "classPK", Types.BIGINT },
069 { "activityType", Types.INTEGER },
070 { "activityCounterName", Types.VARCHAR },
071 { "value", Types.VARCHAR }
072 };
073 public static final String TABLE_SQL_CREATE = "create table SocialActivityLimit (activityLimitId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,classNameId LONG,classPK LONG,activityType INTEGER,activityCounterName VARCHAR(75) null,value VARCHAR(75) null)";
074 public static final String TABLE_SQL_DROP = "drop table SocialActivityLimit";
075 public static final String DATA_SOURCE = "liferayDataSource";
076 public static final String SESSION_FACTORY = "liferaySessionFactory";
077 public static final String TX_MANAGER = "liferayTransactionManager";
078 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
079 "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialActivityLimit"),
080 true);
081 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
082 "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialActivityLimit"),
083 true);
084 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
085 "value.object.column.bitmask.enabled.com.liferay.portlet.social.model.SocialActivityLimit"),
086 true);
087 public static long ACTIVITYCOUNTERNAME_COLUMN_BITMASK = 1L;
088 public static long ACTIVITYTYPE_COLUMN_BITMASK = 2L;
089 public static long CLASSNAMEID_COLUMN_BITMASK = 4L;
090 public static long CLASSPK_COLUMN_BITMASK = 8L;
091 public static long GROUPID_COLUMN_BITMASK = 16L;
092 public static long USERID_COLUMN_BITMASK = 32L;
093 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
094 "lock.expiration.time.com.liferay.portlet.social.model.SocialActivityLimit"));
095
096 public SocialActivityLimitModelImpl() {
097 }
098
099 public long getPrimaryKey() {
100 return _activityLimitId;
101 }
102
103 public void setPrimaryKey(long primaryKey) {
104 setActivityLimitId(primaryKey);
105 }
106
107 public Serializable getPrimaryKeyObj() {
108 return new Long(_activityLimitId);
109 }
110
111 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
112 setPrimaryKey(((Long)primaryKeyObj).longValue());
113 }
114
115 public Class<?> getModelClass() {
116 return SocialActivityLimit.class;
117 }
118
119 public String getModelClassName() {
120 return SocialActivityLimit.class.getName();
121 }
122
123 @Override
124 public Map<String, Object> getModelAttributes() {
125 Map<String, Object> attributes = new HashMap<String, Object>();
126
127 attributes.put("activityLimitId", getActivityLimitId());
128 attributes.put("groupId", getGroupId());
129 attributes.put("companyId", getCompanyId());
130 attributes.put("userId", getUserId());
131 attributes.put("classNameId", getClassNameId());
132 attributes.put("classPK", getClassPK());
133 attributes.put("activityType", getActivityType());
134 attributes.put("activityCounterName", getActivityCounterName());
135 attributes.put("value", getValue());
136
137 return attributes;
138 }
139
140 @Override
141 public void setModelAttributes(Map<String, Object> attributes) {
142 Long activityLimitId = (Long)attributes.get("activityLimitId");
143
144 if (activityLimitId != null) {
145 setActivityLimitId(activityLimitId);
146 }
147
148 Long groupId = (Long)attributes.get("groupId");
149
150 if (groupId != null) {
151 setGroupId(groupId);
152 }
153
154 Long companyId = (Long)attributes.get("companyId");
155
156 if (companyId != null) {
157 setCompanyId(companyId);
158 }
159
160 Long userId = (Long)attributes.get("userId");
161
162 if (userId != null) {
163 setUserId(userId);
164 }
165
166 Long classNameId = (Long)attributes.get("classNameId");
167
168 if (classNameId != null) {
169 setClassNameId(classNameId);
170 }
171
172 Long classPK = (Long)attributes.get("classPK");
173
174 if (classPK != null) {
175 setClassPK(classPK);
176 }
177
178 Integer activityType = (Integer)attributes.get("activityType");
179
180 if (activityType != null) {
181 setActivityType(activityType);
182 }
183
184 String activityCounterName = (String)attributes.get(
185 "activityCounterName");
186
187 if (activityCounterName != null) {
188 setActivityCounterName(activityCounterName);
189 }
190
191 String value = (String)attributes.get("value");
192
193 if (value != null) {
194 setValue(value);
195 }
196 }
197
198 public long getActivityLimitId() {
199 return _activityLimitId;
200 }
201
202 public void setActivityLimitId(long activityLimitId) {
203 _activityLimitId = activityLimitId;
204 }
205
206 public long getGroupId() {
207 return _groupId;
208 }
209
210 public void setGroupId(long groupId) {
211 _columnBitmask |= GROUPID_COLUMN_BITMASK;
212
213 if (!_setOriginalGroupId) {
214 _setOriginalGroupId = true;
215
216 _originalGroupId = _groupId;
217 }
218
219 _groupId = groupId;
220 }
221
222 public long getOriginalGroupId() {
223 return _originalGroupId;
224 }
225
226 public long getCompanyId() {
227 return _companyId;
228 }
229
230 public void setCompanyId(long companyId) {
231 _companyId = companyId;
232 }
233
234 public long getUserId() {
235 return _userId;
236 }
237
238 public void setUserId(long userId) {
239 _columnBitmask |= USERID_COLUMN_BITMASK;
240
241 if (!_setOriginalUserId) {
242 _setOriginalUserId = true;
243
244 _originalUserId = _userId;
245 }
246
247 _userId = userId;
248 }
249
250 public String getUserUuid() throws SystemException {
251 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
252 }
253
254 public void setUserUuid(String userUuid) {
255 _userUuid = userUuid;
256 }
257
258 public long getOriginalUserId() {
259 return _originalUserId;
260 }
261
262 public String getClassName() {
263 if (getClassNameId() <= 0) {
264 return StringPool.BLANK;
265 }
266
267 return PortalUtil.getClassName(getClassNameId());
268 }
269
270 public void setClassName(String className) {
271 long classNameId = 0;
272
273 if (Validator.isNotNull(className)) {
274 classNameId = PortalUtil.getClassNameId(className);
275 }
276
277 setClassNameId(classNameId);
278 }
279
280 public long getClassNameId() {
281 return _classNameId;
282 }
283
284 public void setClassNameId(long classNameId) {
285 _columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
286
287 if (!_setOriginalClassNameId) {
288 _setOriginalClassNameId = true;
289
290 _originalClassNameId = _classNameId;
291 }
292
293 _classNameId = classNameId;
294 }
295
296 public long getOriginalClassNameId() {
297 return _originalClassNameId;
298 }
299
300 public long getClassPK() {
301 return _classPK;
302 }
303
304 public void setClassPK(long classPK) {
305 _columnBitmask |= CLASSPK_COLUMN_BITMASK;
306
307 if (!_setOriginalClassPK) {
308 _setOriginalClassPK = true;
309
310 _originalClassPK = _classPK;
311 }
312
313 _classPK = classPK;
314 }
315
316 public long getOriginalClassPK() {
317 return _originalClassPK;
318 }
319
320 public int getActivityType() {
321 return _activityType;
322 }
323
324 public void setActivityType(int activityType) {
325 _columnBitmask |= ACTIVITYTYPE_COLUMN_BITMASK;
326
327 if (!_setOriginalActivityType) {
328 _setOriginalActivityType = true;
329
330 _originalActivityType = _activityType;
331 }
332
333 _activityType = activityType;
334 }
335
336 public int getOriginalActivityType() {
337 return _originalActivityType;
338 }
339
340 public String getActivityCounterName() {
341 if (_activityCounterName == null) {
342 return StringPool.BLANK;
343 }
344 else {
345 return _activityCounterName;
346 }
347 }
348
349 public void setActivityCounterName(String activityCounterName) {
350 _columnBitmask |= ACTIVITYCOUNTERNAME_COLUMN_BITMASK;
351
352 if (_originalActivityCounterName == null) {
353 _originalActivityCounterName = _activityCounterName;
354 }
355
356 _activityCounterName = activityCounterName;
357 }
358
359 public String getOriginalActivityCounterName() {
360 return GetterUtil.getString(_originalActivityCounterName);
361 }
362
363 public String getValue() {
364 if (_value == null) {
365 return StringPool.BLANK;
366 }
367 else {
368 return _value;
369 }
370 }
371
372 public void setValue(String value) {
373 _value = value;
374 }
375
376 public long getColumnBitmask() {
377 return _columnBitmask;
378 }
379
380 @Override
381 public ExpandoBridge getExpandoBridge() {
382 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
383 SocialActivityLimit.class.getName(), getPrimaryKey());
384 }
385
386 @Override
387 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
388 ExpandoBridge expandoBridge = getExpandoBridge();
389
390 expandoBridge.setAttributes(serviceContext);
391 }
392
393 @Override
394 public SocialActivityLimit toEscapedModel() {
395 if (_escapedModel == null) {
396 _escapedModel = (SocialActivityLimit)ProxyUtil.newProxyInstance(_classLoader,
397 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
398 }
399
400 return _escapedModel;
401 }
402
403 public SocialActivityLimit toUnescapedModel() {
404 return (SocialActivityLimit)this;
405 }
406
407 @Override
408 public Object clone() {
409 SocialActivityLimitImpl socialActivityLimitImpl = new SocialActivityLimitImpl();
410
411 socialActivityLimitImpl.setActivityLimitId(getActivityLimitId());
412 socialActivityLimitImpl.setGroupId(getGroupId());
413 socialActivityLimitImpl.setCompanyId(getCompanyId());
414 socialActivityLimitImpl.setUserId(getUserId());
415 socialActivityLimitImpl.setClassNameId(getClassNameId());
416 socialActivityLimitImpl.setClassPK(getClassPK());
417 socialActivityLimitImpl.setActivityType(getActivityType());
418 socialActivityLimitImpl.setActivityCounterName(getActivityCounterName());
419 socialActivityLimitImpl.setValue(getValue());
420
421 socialActivityLimitImpl.resetOriginalValues();
422
423 return socialActivityLimitImpl;
424 }
425
426 public int compareTo(SocialActivityLimit socialActivityLimit) {
427 long primaryKey = socialActivityLimit.getPrimaryKey();
428
429 if (getPrimaryKey() < primaryKey) {
430 return -1;
431 }
432 else if (getPrimaryKey() > primaryKey) {
433 return 1;
434 }
435 else {
436 return 0;
437 }
438 }
439
440 @Override
441 public boolean equals(Object obj) {
442 if (this == obj) {
443 return true;
444 }
445
446 if (!(obj instanceof SocialActivityLimit)) {
447 return false;
448 }
449
450 SocialActivityLimit socialActivityLimit = (SocialActivityLimit)obj;
451
452 long primaryKey = socialActivityLimit.getPrimaryKey();
453
454 if (getPrimaryKey() == primaryKey) {
455 return true;
456 }
457 else {
458 return false;
459 }
460 }
461
462 @Override
463 public int hashCode() {
464 return (int)getPrimaryKey();
465 }
466
467 @Override
468 public void resetOriginalValues() {
469 SocialActivityLimitModelImpl socialActivityLimitModelImpl = this;
470
471 socialActivityLimitModelImpl._originalGroupId = socialActivityLimitModelImpl._groupId;
472
473 socialActivityLimitModelImpl._setOriginalGroupId = false;
474
475 socialActivityLimitModelImpl._originalUserId = socialActivityLimitModelImpl._userId;
476
477 socialActivityLimitModelImpl._setOriginalUserId = false;
478
479 socialActivityLimitModelImpl._originalClassNameId = socialActivityLimitModelImpl._classNameId;
480
481 socialActivityLimitModelImpl._setOriginalClassNameId = false;
482
483 socialActivityLimitModelImpl._originalClassPK = socialActivityLimitModelImpl._classPK;
484
485 socialActivityLimitModelImpl._setOriginalClassPK = false;
486
487 socialActivityLimitModelImpl._originalActivityType = socialActivityLimitModelImpl._activityType;
488
489 socialActivityLimitModelImpl._setOriginalActivityType = false;
490
491 socialActivityLimitModelImpl._originalActivityCounterName = socialActivityLimitModelImpl._activityCounterName;
492
493 socialActivityLimitModelImpl._columnBitmask = 0;
494 }
495
496 @Override
497 public CacheModel<SocialActivityLimit> toCacheModel() {
498 SocialActivityLimitCacheModel socialActivityLimitCacheModel = new SocialActivityLimitCacheModel();
499
500 socialActivityLimitCacheModel.activityLimitId = getActivityLimitId();
501
502 socialActivityLimitCacheModel.groupId = getGroupId();
503
504 socialActivityLimitCacheModel.companyId = getCompanyId();
505
506 socialActivityLimitCacheModel.userId = getUserId();
507
508 socialActivityLimitCacheModel.classNameId = getClassNameId();
509
510 socialActivityLimitCacheModel.classPK = getClassPK();
511
512 socialActivityLimitCacheModel.activityType = getActivityType();
513
514 socialActivityLimitCacheModel.activityCounterName = getActivityCounterName();
515
516 String activityCounterName = socialActivityLimitCacheModel.activityCounterName;
517
518 if ((activityCounterName != null) &&
519 (activityCounterName.length() == 0)) {
520 socialActivityLimitCacheModel.activityCounterName = null;
521 }
522
523 socialActivityLimitCacheModel.value = getValue();
524
525 String value = socialActivityLimitCacheModel.value;
526
527 if ((value != null) && (value.length() == 0)) {
528 socialActivityLimitCacheModel.value = null;
529 }
530
531 return socialActivityLimitCacheModel;
532 }
533
534 @Override
535 public String toString() {
536 StringBundler sb = new StringBundler(19);
537
538 sb.append("{activityLimitId=");
539 sb.append(getActivityLimitId());
540 sb.append(", groupId=");
541 sb.append(getGroupId());
542 sb.append(", companyId=");
543 sb.append(getCompanyId());
544 sb.append(", userId=");
545 sb.append(getUserId());
546 sb.append(", classNameId=");
547 sb.append(getClassNameId());
548 sb.append(", classPK=");
549 sb.append(getClassPK());
550 sb.append(", activityType=");
551 sb.append(getActivityType());
552 sb.append(", activityCounterName=");
553 sb.append(getActivityCounterName());
554 sb.append(", value=");
555 sb.append(getValue());
556 sb.append("}");
557
558 return sb.toString();
559 }
560
561 public String toXmlString() {
562 StringBundler sb = new StringBundler(31);
563
564 sb.append("<model><model-name>");
565 sb.append("com.liferay.portlet.social.model.SocialActivityLimit");
566 sb.append("</model-name>");
567
568 sb.append(
569 "<column><column-name>activityLimitId</column-name><column-value><![CDATA[");
570 sb.append(getActivityLimitId());
571 sb.append("]]></column-value></column>");
572 sb.append(
573 "<column><column-name>groupId</column-name><column-value><![CDATA[");
574 sb.append(getGroupId());
575 sb.append("]]></column-value></column>");
576 sb.append(
577 "<column><column-name>companyId</column-name><column-value><![CDATA[");
578 sb.append(getCompanyId());
579 sb.append("]]></column-value></column>");
580 sb.append(
581 "<column><column-name>userId</column-name><column-value><![CDATA[");
582 sb.append(getUserId());
583 sb.append("]]></column-value></column>");
584 sb.append(
585 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
586 sb.append(getClassNameId());
587 sb.append("]]></column-value></column>");
588 sb.append(
589 "<column><column-name>classPK</column-name><column-value><![CDATA[");
590 sb.append(getClassPK());
591 sb.append("]]></column-value></column>");
592 sb.append(
593 "<column><column-name>activityType</column-name><column-value><![CDATA[");
594 sb.append(getActivityType());
595 sb.append("]]></column-value></column>");
596 sb.append(
597 "<column><column-name>activityCounterName</column-name><column-value><![CDATA[");
598 sb.append(getActivityCounterName());
599 sb.append("]]></column-value></column>");
600 sb.append(
601 "<column><column-name>value</column-name><column-value><![CDATA[");
602 sb.append(getValue());
603 sb.append("]]></column-value></column>");
604
605 sb.append("</model>");
606
607 return sb.toString();
608 }
609
610 private static ClassLoader _classLoader = SocialActivityLimit.class.getClassLoader();
611 private static Class<?>[] _escapedModelInterfaces = new Class[] {
612 SocialActivityLimit.class
613 };
614 private long _activityLimitId;
615 private long _groupId;
616 private long _originalGroupId;
617 private boolean _setOriginalGroupId;
618 private long _companyId;
619 private long _userId;
620 private String _userUuid;
621 private long _originalUserId;
622 private boolean _setOriginalUserId;
623 private long _classNameId;
624 private long _originalClassNameId;
625 private boolean _setOriginalClassNameId;
626 private long _classPK;
627 private long _originalClassPK;
628 private boolean _setOriginalClassPK;
629 private int _activityType;
630 private int _originalActivityType;
631 private boolean _setOriginalActivityType;
632 private String _activityCounterName;
633 private String _originalActivityCounterName;
634 private String _value;
635 private long _columnBitmask;
636 private SocialActivityLimit _escapedModel;
637 }