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.util.GetterUtil;
019 import com.liferay.portal.kernel.util.ProxyUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.kernel.util.Validator;
023 import com.liferay.portal.model.CacheModel;
024 import com.liferay.portal.model.impl.BaseModelImpl;
025 import com.liferay.portal.service.ServiceContext;
026 import com.liferay.portal.util.PortalUtil;
027
028 import com.liferay.portlet.expando.model.ExpandoBridge;
029 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
030 import com.liferay.portlet.social.model.SocialActivityCounter;
031 import com.liferay.portlet.social.model.SocialActivityCounterModel;
032
033 import java.io.Serializable;
034
035 import java.sql.Types;
036
037 import java.util.HashMap;
038 import java.util.Map;
039
040
053 public class SocialActivityCounterModelImpl extends BaseModelImpl<SocialActivityCounter>
054 implements SocialActivityCounterModel {
055
060 public static final String TABLE_NAME = "SocialActivityCounter";
061 public static final Object[][] TABLE_COLUMNS = {
062 { "activityCounterId", Types.BIGINT },
063 { "groupId", Types.BIGINT },
064 { "companyId", Types.BIGINT },
065 { "classNameId", Types.BIGINT },
066 { "classPK", Types.BIGINT },
067 { "name", Types.VARCHAR },
068 { "ownerType", Types.INTEGER },
069 { "currentValue", Types.INTEGER },
070 { "totalValue", Types.INTEGER },
071 { "graceValue", Types.INTEGER },
072 { "startPeriod", Types.INTEGER },
073 { "endPeriod", Types.INTEGER }
074 };
075 public static final String TABLE_SQL_CREATE = "create table SocialActivityCounter (activityCounterId LONG not null primary key,groupId LONG,companyId LONG,classNameId LONG,classPK LONG,name VARCHAR(75) null,ownerType INTEGER,currentValue INTEGER,totalValue INTEGER,graceValue INTEGER,startPeriod INTEGER,endPeriod INTEGER)";
076 public static final String TABLE_SQL_DROP = "drop table SocialActivityCounter";
077 public static final String DATA_SOURCE = "liferayDataSource";
078 public static final String SESSION_FACTORY = "liferaySessionFactory";
079 public static final String TX_MANAGER = "liferayTransactionManager";
080 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
081 "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialActivityCounter"),
082 true);
083 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
084 "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialActivityCounter"),
085 true);
086 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
087 "value.object.column.bitmask.enabled.com.liferay.portlet.social.model.SocialActivityCounter"),
088 true);
089 public static long CLASSNAMEID_COLUMN_BITMASK = 1L;
090 public static long CLASSPK_COLUMN_BITMASK = 2L;
091 public static long ENDPERIOD_COLUMN_BITMASK = 4L;
092 public static long GROUPID_COLUMN_BITMASK = 8L;
093 public static long NAME_COLUMN_BITMASK = 16L;
094 public static long OWNERTYPE_COLUMN_BITMASK = 32L;
095 public static long STARTPERIOD_COLUMN_BITMASK = 64L;
096 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
097 "lock.expiration.time.com.liferay.portlet.social.model.SocialActivityCounter"));
098
099 public SocialActivityCounterModelImpl() {
100 }
101
102 public long getPrimaryKey() {
103 return _activityCounterId;
104 }
105
106 public void setPrimaryKey(long primaryKey) {
107 setActivityCounterId(primaryKey);
108 }
109
110 public Serializable getPrimaryKeyObj() {
111 return new Long(_activityCounterId);
112 }
113
114 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
115 setPrimaryKey(((Long)primaryKeyObj).longValue());
116 }
117
118 public Class<?> getModelClass() {
119 return SocialActivityCounter.class;
120 }
121
122 public String getModelClassName() {
123 return SocialActivityCounter.class.getName();
124 }
125
126 @Override
127 public Map<String, Object> getModelAttributes() {
128 Map<String, Object> attributes = new HashMap<String, Object>();
129
130 attributes.put("activityCounterId", getActivityCounterId());
131 attributes.put("groupId", getGroupId());
132 attributes.put("companyId", getCompanyId());
133 attributes.put("classNameId", getClassNameId());
134 attributes.put("classPK", getClassPK());
135 attributes.put("name", getName());
136 attributes.put("ownerType", getOwnerType());
137 attributes.put("currentValue", getCurrentValue());
138 attributes.put("totalValue", getTotalValue());
139 attributes.put("graceValue", getGraceValue());
140 attributes.put("startPeriod", getStartPeriod());
141 attributes.put("endPeriod", getEndPeriod());
142
143 return attributes;
144 }
145
146 @Override
147 public void setModelAttributes(Map<String, Object> attributes) {
148 Long activityCounterId = (Long)attributes.get("activityCounterId");
149
150 if (activityCounterId != null) {
151 setActivityCounterId(activityCounterId);
152 }
153
154 Long groupId = (Long)attributes.get("groupId");
155
156 if (groupId != null) {
157 setGroupId(groupId);
158 }
159
160 Long companyId = (Long)attributes.get("companyId");
161
162 if (companyId != null) {
163 setCompanyId(companyId);
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 String name = (String)attributes.get("name");
179
180 if (name != null) {
181 setName(name);
182 }
183
184 Integer ownerType = (Integer)attributes.get("ownerType");
185
186 if (ownerType != null) {
187 setOwnerType(ownerType);
188 }
189
190 Integer currentValue = (Integer)attributes.get("currentValue");
191
192 if (currentValue != null) {
193 setCurrentValue(currentValue);
194 }
195
196 Integer totalValue = (Integer)attributes.get("totalValue");
197
198 if (totalValue != null) {
199 setTotalValue(totalValue);
200 }
201
202 Integer graceValue = (Integer)attributes.get("graceValue");
203
204 if (graceValue != null) {
205 setGraceValue(graceValue);
206 }
207
208 Integer startPeriod = (Integer)attributes.get("startPeriod");
209
210 if (startPeriod != null) {
211 setStartPeriod(startPeriod);
212 }
213
214 Integer endPeriod = (Integer)attributes.get("endPeriod");
215
216 if (endPeriod != null) {
217 setEndPeriod(endPeriod);
218 }
219 }
220
221 public long getActivityCounterId() {
222 return _activityCounterId;
223 }
224
225 public void setActivityCounterId(long activityCounterId) {
226 _activityCounterId = activityCounterId;
227 }
228
229 public long getGroupId() {
230 return _groupId;
231 }
232
233 public void setGroupId(long groupId) {
234 _columnBitmask |= GROUPID_COLUMN_BITMASK;
235
236 if (!_setOriginalGroupId) {
237 _setOriginalGroupId = true;
238
239 _originalGroupId = _groupId;
240 }
241
242 _groupId = groupId;
243 }
244
245 public long getOriginalGroupId() {
246 return _originalGroupId;
247 }
248
249 public long getCompanyId() {
250 return _companyId;
251 }
252
253 public void setCompanyId(long companyId) {
254 _companyId = companyId;
255 }
256
257 public String getClassName() {
258 if (getClassNameId() <= 0) {
259 return StringPool.BLANK;
260 }
261
262 return PortalUtil.getClassName(getClassNameId());
263 }
264
265 public void setClassName(String className) {
266 long classNameId = 0;
267
268 if (Validator.isNotNull(className)) {
269 classNameId = PortalUtil.getClassNameId(className);
270 }
271
272 setClassNameId(classNameId);
273 }
274
275 public long getClassNameId() {
276 return _classNameId;
277 }
278
279 public void setClassNameId(long classNameId) {
280 _columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
281
282 if (!_setOriginalClassNameId) {
283 _setOriginalClassNameId = true;
284
285 _originalClassNameId = _classNameId;
286 }
287
288 _classNameId = classNameId;
289 }
290
291 public long getOriginalClassNameId() {
292 return _originalClassNameId;
293 }
294
295 public long getClassPK() {
296 return _classPK;
297 }
298
299 public void setClassPK(long classPK) {
300 _columnBitmask |= CLASSPK_COLUMN_BITMASK;
301
302 if (!_setOriginalClassPK) {
303 _setOriginalClassPK = true;
304
305 _originalClassPK = _classPK;
306 }
307
308 _classPK = classPK;
309 }
310
311 public long getOriginalClassPK() {
312 return _originalClassPK;
313 }
314
315 public String getName() {
316 if (_name == null) {
317 return StringPool.BLANK;
318 }
319 else {
320 return _name;
321 }
322 }
323
324 public void setName(String name) {
325 _columnBitmask |= NAME_COLUMN_BITMASK;
326
327 if (_originalName == null) {
328 _originalName = _name;
329 }
330
331 _name = name;
332 }
333
334 public String getOriginalName() {
335 return GetterUtil.getString(_originalName);
336 }
337
338 public int getOwnerType() {
339 return _ownerType;
340 }
341
342 public void setOwnerType(int ownerType) {
343 _columnBitmask |= OWNERTYPE_COLUMN_BITMASK;
344
345 if (!_setOriginalOwnerType) {
346 _setOriginalOwnerType = true;
347
348 _originalOwnerType = _ownerType;
349 }
350
351 _ownerType = ownerType;
352 }
353
354 public int getOriginalOwnerType() {
355 return _originalOwnerType;
356 }
357
358 public int getCurrentValue() {
359 return _currentValue;
360 }
361
362 public void setCurrentValue(int currentValue) {
363 _currentValue = currentValue;
364 }
365
366 public int getTotalValue() {
367 return _totalValue;
368 }
369
370 public void setTotalValue(int totalValue) {
371 _totalValue = totalValue;
372 }
373
374 public int getGraceValue() {
375 return _graceValue;
376 }
377
378 public void setGraceValue(int graceValue) {
379 _graceValue = graceValue;
380 }
381
382 public int getStartPeriod() {
383 return _startPeriod;
384 }
385
386 public void setStartPeriod(int startPeriod) {
387 _columnBitmask |= STARTPERIOD_COLUMN_BITMASK;
388
389 if (!_setOriginalStartPeriod) {
390 _setOriginalStartPeriod = true;
391
392 _originalStartPeriod = _startPeriod;
393 }
394
395 _startPeriod = startPeriod;
396 }
397
398 public int getOriginalStartPeriod() {
399 return _originalStartPeriod;
400 }
401
402 public int getEndPeriod() {
403 return _endPeriod;
404 }
405
406 public void setEndPeriod(int endPeriod) {
407 _columnBitmask |= ENDPERIOD_COLUMN_BITMASK;
408
409 if (!_setOriginalEndPeriod) {
410 _setOriginalEndPeriod = true;
411
412 _originalEndPeriod = _endPeriod;
413 }
414
415 _endPeriod = endPeriod;
416 }
417
418 public int getOriginalEndPeriod() {
419 return _originalEndPeriod;
420 }
421
422 public long getColumnBitmask() {
423 return _columnBitmask;
424 }
425
426 @Override
427 public ExpandoBridge getExpandoBridge() {
428 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
429 SocialActivityCounter.class.getName(), getPrimaryKey());
430 }
431
432 @Override
433 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
434 ExpandoBridge expandoBridge = getExpandoBridge();
435
436 expandoBridge.setAttributes(serviceContext);
437 }
438
439 @Override
440 public SocialActivityCounter toEscapedModel() {
441 if (_escapedModel == null) {
442 _escapedModel = (SocialActivityCounter)ProxyUtil.newProxyInstance(_classLoader,
443 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
444 }
445
446 return _escapedModel;
447 }
448
449 public SocialActivityCounter toUnescapedModel() {
450 return (SocialActivityCounter)this;
451 }
452
453 @Override
454 public Object clone() {
455 SocialActivityCounterImpl socialActivityCounterImpl = new SocialActivityCounterImpl();
456
457 socialActivityCounterImpl.setActivityCounterId(getActivityCounterId());
458 socialActivityCounterImpl.setGroupId(getGroupId());
459 socialActivityCounterImpl.setCompanyId(getCompanyId());
460 socialActivityCounterImpl.setClassNameId(getClassNameId());
461 socialActivityCounterImpl.setClassPK(getClassPK());
462 socialActivityCounterImpl.setName(getName());
463 socialActivityCounterImpl.setOwnerType(getOwnerType());
464 socialActivityCounterImpl.setCurrentValue(getCurrentValue());
465 socialActivityCounterImpl.setTotalValue(getTotalValue());
466 socialActivityCounterImpl.setGraceValue(getGraceValue());
467 socialActivityCounterImpl.setStartPeriod(getStartPeriod());
468 socialActivityCounterImpl.setEndPeriod(getEndPeriod());
469
470 socialActivityCounterImpl.resetOriginalValues();
471
472 return socialActivityCounterImpl;
473 }
474
475 public int compareTo(SocialActivityCounter socialActivityCounter) {
476 long primaryKey = socialActivityCounter.getPrimaryKey();
477
478 if (getPrimaryKey() < primaryKey) {
479 return -1;
480 }
481 else if (getPrimaryKey() > primaryKey) {
482 return 1;
483 }
484 else {
485 return 0;
486 }
487 }
488
489 @Override
490 public boolean equals(Object obj) {
491 if (this == obj) {
492 return true;
493 }
494
495 if (!(obj instanceof SocialActivityCounter)) {
496 return false;
497 }
498
499 SocialActivityCounter socialActivityCounter = (SocialActivityCounter)obj;
500
501 long primaryKey = socialActivityCounter.getPrimaryKey();
502
503 if (getPrimaryKey() == primaryKey) {
504 return true;
505 }
506 else {
507 return false;
508 }
509 }
510
511 @Override
512 public int hashCode() {
513 return (int)getPrimaryKey();
514 }
515
516 @Override
517 public void resetOriginalValues() {
518 SocialActivityCounterModelImpl socialActivityCounterModelImpl = this;
519
520 socialActivityCounterModelImpl._originalGroupId = socialActivityCounterModelImpl._groupId;
521
522 socialActivityCounterModelImpl._setOriginalGroupId = false;
523
524 socialActivityCounterModelImpl._originalClassNameId = socialActivityCounterModelImpl._classNameId;
525
526 socialActivityCounterModelImpl._setOriginalClassNameId = false;
527
528 socialActivityCounterModelImpl._originalClassPK = socialActivityCounterModelImpl._classPK;
529
530 socialActivityCounterModelImpl._setOriginalClassPK = false;
531
532 socialActivityCounterModelImpl._originalName = socialActivityCounterModelImpl._name;
533
534 socialActivityCounterModelImpl._originalOwnerType = socialActivityCounterModelImpl._ownerType;
535
536 socialActivityCounterModelImpl._setOriginalOwnerType = false;
537
538 socialActivityCounterModelImpl._originalStartPeriod = socialActivityCounterModelImpl._startPeriod;
539
540 socialActivityCounterModelImpl._setOriginalStartPeriod = false;
541
542 socialActivityCounterModelImpl._originalEndPeriod = socialActivityCounterModelImpl._endPeriod;
543
544 socialActivityCounterModelImpl._setOriginalEndPeriod = false;
545
546 socialActivityCounterModelImpl._columnBitmask = 0;
547 }
548
549 @Override
550 public CacheModel<SocialActivityCounter> toCacheModel() {
551 SocialActivityCounterCacheModel socialActivityCounterCacheModel = new SocialActivityCounterCacheModel();
552
553 socialActivityCounterCacheModel.activityCounterId = getActivityCounterId();
554
555 socialActivityCounterCacheModel.groupId = getGroupId();
556
557 socialActivityCounterCacheModel.companyId = getCompanyId();
558
559 socialActivityCounterCacheModel.classNameId = getClassNameId();
560
561 socialActivityCounterCacheModel.classPK = getClassPK();
562
563 socialActivityCounterCacheModel.name = getName();
564
565 String name = socialActivityCounterCacheModel.name;
566
567 if ((name != null) && (name.length() == 0)) {
568 socialActivityCounterCacheModel.name = null;
569 }
570
571 socialActivityCounterCacheModel.ownerType = getOwnerType();
572
573 socialActivityCounterCacheModel.currentValue = getCurrentValue();
574
575 socialActivityCounterCacheModel.totalValue = getTotalValue();
576
577 socialActivityCounterCacheModel.graceValue = getGraceValue();
578
579 socialActivityCounterCacheModel.startPeriod = getStartPeriod();
580
581 socialActivityCounterCacheModel.endPeriod = getEndPeriod();
582
583 return socialActivityCounterCacheModel;
584 }
585
586 @Override
587 public String toString() {
588 StringBundler sb = new StringBundler(25);
589
590 sb.append("{activityCounterId=");
591 sb.append(getActivityCounterId());
592 sb.append(", groupId=");
593 sb.append(getGroupId());
594 sb.append(", companyId=");
595 sb.append(getCompanyId());
596 sb.append(", classNameId=");
597 sb.append(getClassNameId());
598 sb.append(", classPK=");
599 sb.append(getClassPK());
600 sb.append(", name=");
601 sb.append(getName());
602 sb.append(", ownerType=");
603 sb.append(getOwnerType());
604 sb.append(", currentValue=");
605 sb.append(getCurrentValue());
606 sb.append(", totalValue=");
607 sb.append(getTotalValue());
608 sb.append(", graceValue=");
609 sb.append(getGraceValue());
610 sb.append(", startPeriod=");
611 sb.append(getStartPeriod());
612 sb.append(", endPeriod=");
613 sb.append(getEndPeriod());
614 sb.append("}");
615
616 return sb.toString();
617 }
618
619 public String toXmlString() {
620 StringBundler sb = new StringBundler(40);
621
622 sb.append("<model><model-name>");
623 sb.append("com.liferay.portlet.social.model.SocialActivityCounter");
624 sb.append("</model-name>");
625
626 sb.append(
627 "<column><column-name>activityCounterId</column-name><column-value><![CDATA[");
628 sb.append(getActivityCounterId());
629 sb.append("]]></column-value></column>");
630 sb.append(
631 "<column><column-name>groupId</column-name><column-value><![CDATA[");
632 sb.append(getGroupId());
633 sb.append("]]></column-value></column>");
634 sb.append(
635 "<column><column-name>companyId</column-name><column-value><![CDATA[");
636 sb.append(getCompanyId());
637 sb.append("]]></column-value></column>");
638 sb.append(
639 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
640 sb.append(getClassNameId());
641 sb.append("]]></column-value></column>");
642 sb.append(
643 "<column><column-name>classPK</column-name><column-value><![CDATA[");
644 sb.append(getClassPK());
645 sb.append("]]></column-value></column>");
646 sb.append(
647 "<column><column-name>name</column-name><column-value><![CDATA[");
648 sb.append(getName());
649 sb.append("]]></column-value></column>");
650 sb.append(
651 "<column><column-name>ownerType</column-name><column-value><![CDATA[");
652 sb.append(getOwnerType());
653 sb.append("]]></column-value></column>");
654 sb.append(
655 "<column><column-name>currentValue</column-name><column-value><![CDATA[");
656 sb.append(getCurrentValue());
657 sb.append("]]></column-value></column>");
658 sb.append(
659 "<column><column-name>totalValue</column-name><column-value><![CDATA[");
660 sb.append(getTotalValue());
661 sb.append("]]></column-value></column>");
662 sb.append(
663 "<column><column-name>graceValue</column-name><column-value><![CDATA[");
664 sb.append(getGraceValue());
665 sb.append("]]></column-value></column>");
666 sb.append(
667 "<column><column-name>startPeriod</column-name><column-value><![CDATA[");
668 sb.append(getStartPeriod());
669 sb.append("]]></column-value></column>");
670 sb.append(
671 "<column><column-name>endPeriod</column-name><column-value><![CDATA[");
672 sb.append(getEndPeriod());
673 sb.append("]]></column-value></column>");
674
675 sb.append("</model>");
676
677 return sb.toString();
678 }
679
680 private static ClassLoader _classLoader = SocialActivityCounter.class.getClassLoader();
681 private static Class<?>[] _escapedModelInterfaces = new Class[] {
682 SocialActivityCounter.class
683 };
684 private long _activityCounterId;
685 private long _groupId;
686 private long _originalGroupId;
687 private boolean _setOriginalGroupId;
688 private long _companyId;
689 private long _classNameId;
690 private long _originalClassNameId;
691 private boolean _setOriginalClassNameId;
692 private long _classPK;
693 private long _originalClassPK;
694 private boolean _setOriginalClassPK;
695 private String _name;
696 private String _originalName;
697 private int _ownerType;
698 private int _originalOwnerType;
699 private boolean _setOriginalOwnerType;
700 private int _currentValue;
701 private int _totalValue;
702 private int _graceValue;
703 private int _startPeriod;
704 private int _originalStartPeriod;
705 private boolean _setOriginalStartPeriod;
706 private int _endPeriod;
707 private int _originalEndPeriod;
708 private boolean _setOriginalEndPeriod;
709 private long _columnBitmask;
710 private SocialActivityCounter _escapedModel;
711 }