1
22
23 package com.liferay.portlet.messageboards.service.persistence;
24
25 import com.liferay.portal.SystemException;
26 import com.liferay.portal.kernel.annotation.BeanReference;
27 import com.liferay.portal.kernel.cache.CacheRegistry;
28 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
29 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
30 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
31 import com.liferay.portal.kernel.dao.orm.FinderPath;
32 import com.liferay.portal.kernel.dao.orm.Query;
33 import com.liferay.portal.kernel.dao.orm.QueryPos;
34 import com.liferay.portal.kernel.dao.orm.QueryUtil;
35 import com.liferay.portal.kernel.dao.orm.Session;
36 import com.liferay.portal.kernel.log.Log;
37 import com.liferay.portal.kernel.log.LogFactoryUtil;
38 import com.liferay.portal.kernel.util.GetterUtil;
39 import com.liferay.portal.kernel.util.OrderByComparator;
40 import com.liferay.portal.kernel.util.StringPool;
41 import com.liferay.portal.kernel.util.StringUtil;
42 import com.liferay.portal.model.ModelListener;
43 import com.liferay.portal.service.persistence.BatchSessionUtil;
44 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
45
46 import com.liferay.portlet.messageboards.NoSuchStatsUserException;
47 import com.liferay.portlet.messageboards.model.MBStatsUser;
48 import com.liferay.portlet.messageboards.model.impl.MBStatsUserImpl;
49 import com.liferay.portlet.messageboards.model.impl.MBStatsUserModelImpl;
50
51 import java.util.ArrayList;
52 import java.util.Collections;
53 import java.util.List;
54
55
61 public class MBStatsUserPersistenceImpl extends BasePersistenceImpl
62 implements MBStatsUserPersistence {
63 public static final String FINDER_CLASS_NAME_ENTITY = MBStatsUserImpl.class.getName();
64 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
65 ".List";
66 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
67 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
68 "findByGroupId", new String[] { Long.class.getName() });
69 public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
70 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
71 "findByGroupId",
72 new String[] {
73 Long.class.getName(),
74
75 "java.lang.Integer", "java.lang.Integer",
76 "com.liferay.portal.kernel.util.OrderByComparator"
77 });
78 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
79 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
80 "countByGroupId", new String[] { Long.class.getName() });
81 public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
82 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
83 "findByUserId", new String[] { Long.class.getName() });
84 public static final FinderPath FINDER_PATH_FIND_BY_OBC_USERID = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
85 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
86 "findByUserId",
87 new String[] {
88 Long.class.getName(),
89
90 "java.lang.Integer", "java.lang.Integer",
91 "com.liferay.portal.kernel.util.OrderByComparator"
92 });
93 public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
94 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
95 "countByUserId", new String[] { Long.class.getName() });
96 public static final FinderPath FINDER_PATH_FETCH_BY_G_U = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
97 MBStatsUserModelImpl.FINDER_CACHE_ENABLED,
98 FINDER_CLASS_NAME_ENTITY, "fetchByG_U",
99 new String[] { Long.class.getName(), Long.class.getName() });
100 public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
101 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
102 "countByG_U",
103 new String[] { Long.class.getName(), Long.class.getName() });
104 public static final FinderPath FINDER_PATH_FIND_BY_G_M = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
105 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
106 "findByG_M",
107 new String[] { Long.class.getName(), Integer.class.getName() });
108 public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_M = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
109 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
110 "findByG_M",
111 new String[] {
112 Long.class.getName(), Integer.class.getName(),
113
114 "java.lang.Integer", "java.lang.Integer",
115 "com.liferay.portal.kernel.util.OrderByComparator"
116 });
117 public static final FinderPath FINDER_PATH_COUNT_BY_G_M = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
118 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
119 "countByG_M",
120 new String[] { Long.class.getName(), Integer.class.getName() });
121 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
122 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
123 "findAll", new String[0]);
124 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
125 MBStatsUserModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
126 "countAll", new String[0]);
127
128 public void cacheResult(MBStatsUser mbStatsUser) {
129 EntityCacheUtil.putResult(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
130 MBStatsUserImpl.class, mbStatsUser.getPrimaryKey(), mbStatsUser);
131
132 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
133 new Object[] {
134 new Long(mbStatsUser.getGroupId()),
135 new Long(mbStatsUser.getUserId())
136 }, mbStatsUser);
137 }
138
139 public void cacheResult(List<MBStatsUser> mbStatsUsers) {
140 for (MBStatsUser mbStatsUser : mbStatsUsers) {
141 if (EntityCacheUtil.getResult(
142 MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
143 MBStatsUserImpl.class, mbStatsUser.getPrimaryKey(), this) == null) {
144 cacheResult(mbStatsUser);
145 }
146 }
147 }
148
149 public void clearCache() {
150 CacheRegistry.clear(MBStatsUserImpl.class.getName());
151 EntityCacheUtil.clearCache(MBStatsUserImpl.class.getName());
152 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
153 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
154 }
155
156 public MBStatsUser create(long statsUserId) {
157 MBStatsUser mbStatsUser = new MBStatsUserImpl();
158
159 mbStatsUser.setNew(true);
160 mbStatsUser.setPrimaryKey(statsUserId);
161
162 return mbStatsUser;
163 }
164
165 public MBStatsUser remove(long statsUserId)
166 throws NoSuchStatsUserException, SystemException {
167 Session session = null;
168
169 try {
170 session = openSession();
171
172 MBStatsUser mbStatsUser = (MBStatsUser)session.get(MBStatsUserImpl.class,
173 new Long(statsUserId));
174
175 if (mbStatsUser == null) {
176 if (_log.isWarnEnabled()) {
177 _log.warn("No MBStatsUser exists with the primary key " +
178 statsUserId);
179 }
180
181 throw new NoSuchStatsUserException(
182 "No MBStatsUser exists with the primary key " +
183 statsUserId);
184 }
185
186 return remove(mbStatsUser);
187 }
188 catch (NoSuchStatsUserException nsee) {
189 throw nsee;
190 }
191 catch (Exception e) {
192 throw processException(e);
193 }
194 finally {
195 closeSession(session);
196 }
197 }
198
199 public MBStatsUser remove(MBStatsUser mbStatsUser)
200 throws SystemException {
201 for (ModelListener<MBStatsUser> listener : listeners) {
202 listener.onBeforeRemove(mbStatsUser);
203 }
204
205 mbStatsUser = removeImpl(mbStatsUser);
206
207 for (ModelListener<MBStatsUser> listener : listeners) {
208 listener.onAfterRemove(mbStatsUser);
209 }
210
211 return mbStatsUser;
212 }
213
214 protected MBStatsUser removeImpl(MBStatsUser mbStatsUser)
215 throws SystemException {
216 Session session = null;
217
218 try {
219 session = openSession();
220
221 if (mbStatsUser.isCachedModel() || BatchSessionUtil.isEnabled()) {
222 Object staleObject = session.get(MBStatsUserImpl.class,
223 mbStatsUser.getPrimaryKeyObj());
224
225 if (staleObject != null) {
226 session.evict(staleObject);
227 }
228 }
229
230 session.delete(mbStatsUser);
231
232 session.flush();
233 }
234 catch (Exception e) {
235 throw processException(e);
236 }
237 finally {
238 closeSession(session);
239 }
240
241 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
242
243 MBStatsUserModelImpl mbStatsUserModelImpl = (MBStatsUserModelImpl)mbStatsUser;
244
245 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
246 new Object[] {
247 new Long(mbStatsUserModelImpl.getOriginalGroupId()),
248 new Long(mbStatsUserModelImpl.getOriginalUserId())
249 });
250
251 EntityCacheUtil.removeResult(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
252 MBStatsUserImpl.class, mbStatsUser.getPrimaryKey());
253
254 return mbStatsUser;
255 }
256
257
260 public MBStatsUser update(MBStatsUser mbStatsUser)
261 throws SystemException {
262 if (_log.isWarnEnabled()) {
263 _log.warn(
264 "Using the deprecated update(MBStatsUser mbStatsUser) method. Use update(MBStatsUser mbStatsUser, boolean merge) instead.");
265 }
266
267 return update(mbStatsUser, false);
268 }
269
270
283 public MBStatsUser update(MBStatsUser mbStatsUser, boolean merge)
284 throws SystemException {
285 boolean isNew = mbStatsUser.isNew();
286
287 for (ModelListener<MBStatsUser> listener : listeners) {
288 if (isNew) {
289 listener.onBeforeCreate(mbStatsUser);
290 }
291 else {
292 listener.onBeforeUpdate(mbStatsUser);
293 }
294 }
295
296 mbStatsUser = updateImpl(mbStatsUser, merge);
297
298 for (ModelListener<MBStatsUser> listener : listeners) {
299 if (isNew) {
300 listener.onAfterCreate(mbStatsUser);
301 }
302 else {
303 listener.onAfterUpdate(mbStatsUser);
304 }
305 }
306
307 return mbStatsUser;
308 }
309
310 public MBStatsUser updateImpl(
311 com.liferay.portlet.messageboards.model.MBStatsUser mbStatsUser,
312 boolean merge) throws SystemException {
313 boolean isNew = mbStatsUser.isNew();
314
315 MBStatsUserModelImpl mbStatsUserModelImpl = (MBStatsUserModelImpl)mbStatsUser;
316
317 Session session = null;
318
319 try {
320 session = openSession();
321
322 BatchSessionUtil.update(session, mbStatsUser, merge);
323
324 mbStatsUser.setNew(false);
325 }
326 catch (Exception e) {
327 throw processException(e);
328 }
329 finally {
330 closeSession(session);
331 }
332
333 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
334
335 EntityCacheUtil.putResult(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
336 MBStatsUserImpl.class, mbStatsUser.getPrimaryKey(), mbStatsUser);
337
338 if (!isNew &&
339 ((mbStatsUser.getGroupId() != mbStatsUserModelImpl.getOriginalGroupId()) ||
340 (mbStatsUser.getUserId() != mbStatsUserModelImpl.getOriginalUserId()))) {
341 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
342 new Object[] {
343 new Long(mbStatsUserModelImpl.getOriginalGroupId()),
344 new Long(mbStatsUserModelImpl.getOriginalUserId())
345 });
346 }
347
348 if (isNew ||
349 ((mbStatsUser.getGroupId() != mbStatsUserModelImpl.getOriginalGroupId()) ||
350 (mbStatsUser.getUserId() != mbStatsUserModelImpl.getOriginalUserId()))) {
351 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
352 new Object[] {
353 new Long(mbStatsUser.getGroupId()),
354 new Long(mbStatsUser.getUserId())
355 }, mbStatsUser);
356 }
357
358 return mbStatsUser;
359 }
360
361 public MBStatsUser findByPrimaryKey(long statsUserId)
362 throws NoSuchStatsUserException, SystemException {
363 MBStatsUser mbStatsUser = fetchByPrimaryKey(statsUserId);
364
365 if (mbStatsUser == null) {
366 if (_log.isWarnEnabled()) {
367 _log.warn("No MBStatsUser exists with the primary key " +
368 statsUserId);
369 }
370
371 throw new NoSuchStatsUserException(
372 "No MBStatsUser exists with the primary key " + statsUserId);
373 }
374
375 return mbStatsUser;
376 }
377
378 public MBStatsUser fetchByPrimaryKey(long statsUserId)
379 throws SystemException {
380 MBStatsUser mbStatsUser = (MBStatsUser)EntityCacheUtil.getResult(MBStatsUserModelImpl.ENTITY_CACHE_ENABLED,
381 MBStatsUserImpl.class, statsUserId, this);
382
383 if (mbStatsUser == null) {
384 Session session = null;
385
386 try {
387 session = openSession();
388
389 mbStatsUser = (MBStatsUser)session.get(MBStatsUserImpl.class,
390 new Long(statsUserId));
391 }
392 catch (Exception e) {
393 throw processException(e);
394 }
395 finally {
396 if (mbStatsUser != null) {
397 cacheResult(mbStatsUser);
398 }
399
400 closeSession(session);
401 }
402 }
403
404 return mbStatsUser;
405 }
406
407 public List<MBStatsUser> findByGroupId(long groupId)
408 throws SystemException {
409 Object[] finderArgs = new Object[] { new Long(groupId) };
410
411 List<MBStatsUser> list = (List<MBStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
412 finderArgs, this);
413
414 if (list == null) {
415 Session session = null;
416
417 try {
418 session = openSession();
419
420 StringBuilder query = new StringBuilder();
421
422 query.append(
423 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
424
425 query.append("groupId = ?");
426
427 query.append(" ");
428
429 query.append("ORDER BY ");
430
431 query.append("messageCount DESC");
432
433 Query q = session.createQuery(query.toString());
434
435 QueryPos qPos = QueryPos.getInstance(q);
436
437 qPos.add(groupId);
438
439 list = q.list();
440 }
441 catch (Exception e) {
442 throw processException(e);
443 }
444 finally {
445 if (list == null) {
446 list = new ArrayList<MBStatsUser>();
447 }
448
449 cacheResult(list);
450
451 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
452 finderArgs, list);
453
454 closeSession(session);
455 }
456 }
457
458 return list;
459 }
460
461 public List<MBStatsUser> findByGroupId(long groupId, int start, int end)
462 throws SystemException {
463 return findByGroupId(groupId, start, end, null);
464 }
465
466 public List<MBStatsUser> findByGroupId(long groupId, int start, int end,
467 OrderByComparator obc) throws SystemException {
468 Object[] finderArgs = new Object[] {
469 new Long(groupId),
470
471 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
472 };
473
474 List<MBStatsUser> list = (List<MBStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
475 finderArgs, this);
476
477 if (list == null) {
478 Session session = null;
479
480 try {
481 session = openSession();
482
483 StringBuilder query = new StringBuilder();
484
485 query.append(
486 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
487
488 query.append("groupId = ?");
489
490 query.append(" ");
491
492 if (obc != null) {
493 query.append("ORDER BY ");
494 query.append(obc.getOrderBy());
495 }
496
497 else {
498 query.append("ORDER BY ");
499
500 query.append("messageCount DESC");
501 }
502
503 Query q = session.createQuery(query.toString());
504
505 QueryPos qPos = QueryPos.getInstance(q);
506
507 qPos.add(groupId);
508
509 list = (List<MBStatsUser>)QueryUtil.list(q, getDialect(),
510 start, end);
511 }
512 catch (Exception e) {
513 throw processException(e);
514 }
515 finally {
516 if (list == null) {
517 list = new ArrayList<MBStatsUser>();
518 }
519
520 cacheResult(list);
521
522 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
523 finderArgs, list);
524
525 closeSession(session);
526 }
527 }
528
529 return list;
530 }
531
532 public MBStatsUser findByGroupId_First(long groupId, OrderByComparator obc)
533 throws NoSuchStatsUserException, SystemException {
534 List<MBStatsUser> list = findByGroupId(groupId, 0, 1, obc);
535
536 if (list.isEmpty()) {
537 StringBuilder msg = new StringBuilder();
538
539 msg.append("No MBStatsUser exists with the key {");
540
541 msg.append("groupId=" + groupId);
542
543 msg.append(StringPool.CLOSE_CURLY_BRACE);
544
545 throw new NoSuchStatsUserException(msg.toString());
546 }
547 else {
548 return list.get(0);
549 }
550 }
551
552 public MBStatsUser findByGroupId_Last(long groupId, OrderByComparator obc)
553 throws NoSuchStatsUserException, SystemException {
554 int count = countByGroupId(groupId);
555
556 List<MBStatsUser> list = findByGroupId(groupId, count - 1, count, obc);
557
558 if (list.isEmpty()) {
559 StringBuilder msg = new StringBuilder();
560
561 msg.append("No MBStatsUser exists with the key {");
562
563 msg.append("groupId=" + groupId);
564
565 msg.append(StringPool.CLOSE_CURLY_BRACE);
566
567 throw new NoSuchStatsUserException(msg.toString());
568 }
569 else {
570 return list.get(0);
571 }
572 }
573
574 public MBStatsUser[] findByGroupId_PrevAndNext(long statsUserId,
575 long groupId, OrderByComparator obc)
576 throws NoSuchStatsUserException, SystemException {
577 MBStatsUser mbStatsUser = findByPrimaryKey(statsUserId);
578
579 int count = countByGroupId(groupId);
580
581 Session session = null;
582
583 try {
584 session = openSession();
585
586 StringBuilder query = new StringBuilder();
587
588 query.append(
589 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
590
591 query.append("groupId = ?");
592
593 query.append(" ");
594
595 if (obc != null) {
596 query.append("ORDER BY ");
597 query.append(obc.getOrderBy());
598 }
599
600 else {
601 query.append("ORDER BY ");
602
603 query.append("messageCount DESC");
604 }
605
606 Query q = session.createQuery(query.toString());
607
608 QueryPos qPos = QueryPos.getInstance(q);
609
610 qPos.add(groupId);
611
612 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
613 mbStatsUser);
614
615 MBStatsUser[] array = new MBStatsUserImpl[3];
616
617 array[0] = (MBStatsUser)objArray[0];
618 array[1] = (MBStatsUser)objArray[1];
619 array[2] = (MBStatsUser)objArray[2];
620
621 return array;
622 }
623 catch (Exception e) {
624 throw processException(e);
625 }
626 finally {
627 closeSession(session);
628 }
629 }
630
631 public List<MBStatsUser> findByUserId(long userId)
632 throws SystemException {
633 Object[] finderArgs = new Object[] { new Long(userId) };
634
635 List<MBStatsUser> list = (List<MBStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
636 finderArgs, this);
637
638 if (list == null) {
639 Session session = null;
640
641 try {
642 session = openSession();
643
644 StringBuilder query = new StringBuilder();
645
646 query.append(
647 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
648
649 query.append("userId = ?");
650
651 query.append(" ");
652
653 query.append("ORDER BY ");
654
655 query.append("messageCount DESC");
656
657 Query q = session.createQuery(query.toString());
658
659 QueryPos qPos = QueryPos.getInstance(q);
660
661 qPos.add(userId);
662
663 list = q.list();
664 }
665 catch (Exception e) {
666 throw processException(e);
667 }
668 finally {
669 if (list == null) {
670 list = new ArrayList<MBStatsUser>();
671 }
672
673 cacheResult(list);
674
675 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
676 finderArgs, list);
677
678 closeSession(session);
679 }
680 }
681
682 return list;
683 }
684
685 public List<MBStatsUser> findByUserId(long userId, int start, int end)
686 throws SystemException {
687 return findByUserId(userId, start, end, null);
688 }
689
690 public List<MBStatsUser> findByUserId(long userId, int start, int end,
691 OrderByComparator obc) throws SystemException {
692 Object[] finderArgs = new Object[] {
693 new Long(userId),
694
695 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
696 };
697
698 List<MBStatsUser> list = (List<MBStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_USERID,
699 finderArgs, this);
700
701 if (list == null) {
702 Session session = null;
703
704 try {
705 session = openSession();
706
707 StringBuilder query = new StringBuilder();
708
709 query.append(
710 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
711
712 query.append("userId = ?");
713
714 query.append(" ");
715
716 if (obc != null) {
717 query.append("ORDER BY ");
718 query.append(obc.getOrderBy());
719 }
720
721 else {
722 query.append("ORDER BY ");
723
724 query.append("messageCount DESC");
725 }
726
727 Query q = session.createQuery(query.toString());
728
729 QueryPos qPos = QueryPos.getInstance(q);
730
731 qPos.add(userId);
732
733 list = (List<MBStatsUser>)QueryUtil.list(q, getDialect(),
734 start, end);
735 }
736 catch (Exception e) {
737 throw processException(e);
738 }
739 finally {
740 if (list == null) {
741 list = new ArrayList<MBStatsUser>();
742 }
743
744 cacheResult(list);
745
746 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_USERID,
747 finderArgs, list);
748
749 closeSession(session);
750 }
751 }
752
753 return list;
754 }
755
756 public MBStatsUser findByUserId_First(long userId, OrderByComparator obc)
757 throws NoSuchStatsUserException, SystemException {
758 List<MBStatsUser> list = findByUserId(userId, 0, 1, obc);
759
760 if (list.isEmpty()) {
761 StringBuilder msg = new StringBuilder();
762
763 msg.append("No MBStatsUser exists with the key {");
764
765 msg.append("userId=" + userId);
766
767 msg.append(StringPool.CLOSE_CURLY_BRACE);
768
769 throw new NoSuchStatsUserException(msg.toString());
770 }
771 else {
772 return list.get(0);
773 }
774 }
775
776 public MBStatsUser findByUserId_Last(long userId, OrderByComparator obc)
777 throws NoSuchStatsUserException, SystemException {
778 int count = countByUserId(userId);
779
780 List<MBStatsUser> list = findByUserId(userId, count - 1, count, obc);
781
782 if (list.isEmpty()) {
783 StringBuilder msg = new StringBuilder();
784
785 msg.append("No MBStatsUser exists with the key {");
786
787 msg.append("userId=" + userId);
788
789 msg.append(StringPool.CLOSE_CURLY_BRACE);
790
791 throw new NoSuchStatsUserException(msg.toString());
792 }
793 else {
794 return list.get(0);
795 }
796 }
797
798 public MBStatsUser[] findByUserId_PrevAndNext(long statsUserId,
799 long userId, OrderByComparator obc)
800 throws NoSuchStatsUserException, SystemException {
801 MBStatsUser mbStatsUser = findByPrimaryKey(statsUserId);
802
803 int count = countByUserId(userId);
804
805 Session session = null;
806
807 try {
808 session = openSession();
809
810 StringBuilder query = new StringBuilder();
811
812 query.append(
813 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
814
815 query.append("userId = ?");
816
817 query.append(" ");
818
819 if (obc != null) {
820 query.append("ORDER BY ");
821 query.append(obc.getOrderBy());
822 }
823
824 else {
825 query.append("ORDER BY ");
826
827 query.append("messageCount DESC");
828 }
829
830 Query q = session.createQuery(query.toString());
831
832 QueryPos qPos = QueryPos.getInstance(q);
833
834 qPos.add(userId);
835
836 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
837 mbStatsUser);
838
839 MBStatsUser[] array = new MBStatsUserImpl[3];
840
841 array[0] = (MBStatsUser)objArray[0];
842 array[1] = (MBStatsUser)objArray[1];
843 array[2] = (MBStatsUser)objArray[2];
844
845 return array;
846 }
847 catch (Exception e) {
848 throw processException(e);
849 }
850 finally {
851 closeSession(session);
852 }
853 }
854
855 public MBStatsUser findByG_U(long groupId, long userId)
856 throws NoSuchStatsUserException, SystemException {
857 MBStatsUser mbStatsUser = fetchByG_U(groupId, userId);
858
859 if (mbStatsUser == null) {
860 StringBuilder msg = new StringBuilder();
861
862 msg.append("No MBStatsUser exists with the key {");
863
864 msg.append("groupId=" + groupId);
865
866 msg.append(", ");
867 msg.append("userId=" + userId);
868
869 msg.append(StringPool.CLOSE_CURLY_BRACE);
870
871 if (_log.isWarnEnabled()) {
872 _log.warn(msg.toString());
873 }
874
875 throw new NoSuchStatsUserException(msg.toString());
876 }
877
878 return mbStatsUser;
879 }
880
881 public MBStatsUser fetchByG_U(long groupId, long userId)
882 throws SystemException {
883 return fetchByG_U(groupId, userId, true);
884 }
885
886 public MBStatsUser fetchByG_U(long groupId, long userId,
887 boolean retrieveFromCache) throws SystemException {
888 Object[] finderArgs = new Object[] { new Long(groupId), new Long(userId) };
889
890 Object result = null;
891
892 if (retrieveFromCache) {
893 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_U,
894 finderArgs, this);
895 }
896
897 if (result == null) {
898 Session session = null;
899
900 try {
901 session = openSession();
902
903 StringBuilder query = new StringBuilder();
904
905 query.append(
906 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
907
908 query.append("groupId = ?");
909
910 query.append(" AND ");
911
912 query.append("userId = ?");
913
914 query.append(" ");
915
916 query.append("ORDER BY ");
917
918 query.append("messageCount DESC");
919
920 Query q = session.createQuery(query.toString());
921
922 QueryPos qPos = QueryPos.getInstance(q);
923
924 qPos.add(groupId);
925
926 qPos.add(userId);
927
928 List<MBStatsUser> list = q.list();
929
930 result = list;
931
932 MBStatsUser mbStatsUser = null;
933
934 if (list.isEmpty()) {
935 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
936 finderArgs, list);
937 }
938 else {
939 mbStatsUser = list.get(0);
940
941 cacheResult(mbStatsUser);
942
943 if ((mbStatsUser.getGroupId() != groupId) ||
944 (mbStatsUser.getUserId() != userId)) {
945 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
946 finderArgs, mbStatsUser);
947 }
948 }
949
950 return mbStatsUser;
951 }
952 catch (Exception e) {
953 throw processException(e);
954 }
955 finally {
956 if (result == null) {
957 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
958 finderArgs, new ArrayList<MBStatsUser>());
959 }
960
961 closeSession(session);
962 }
963 }
964 else {
965 if (result instanceof List) {
966 return null;
967 }
968 else {
969 return (MBStatsUser)result;
970 }
971 }
972 }
973
974 public List<MBStatsUser> findByG_M(long groupId, int messageCount)
975 throws SystemException {
976 Object[] finderArgs = new Object[] {
977 new Long(groupId), new Integer(messageCount)
978 };
979
980 List<MBStatsUser> list = (List<MBStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_M,
981 finderArgs, this);
982
983 if (list == null) {
984 Session session = null;
985
986 try {
987 session = openSession();
988
989 StringBuilder query = new StringBuilder();
990
991 query.append(
992 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
993
994 query.append("groupId = ?");
995
996 query.append(" AND ");
997
998 query.append("messageCount != ?");
999
1000 query.append(" ");
1001
1002 query.append("ORDER BY ");
1003
1004 query.append("messageCount DESC");
1005
1006 Query q = session.createQuery(query.toString());
1007
1008 QueryPos qPos = QueryPos.getInstance(q);
1009
1010 qPos.add(groupId);
1011
1012 qPos.add(messageCount);
1013
1014 list = q.list();
1015 }
1016 catch (Exception e) {
1017 throw processException(e);
1018 }
1019 finally {
1020 if (list == null) {
1021 list = new ArrayList<MBStatsUser>();
1022 }
1023
1024 cacheResult(list);
1025
1026 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_M, finderArgs,
1027 list);
1028
1029 closeSession(session);
1030 }
1031 }
1032
1033 return list;
1034 }
1035
1036 public List<MBStatsUser> findByG_M(long groupId, int messageCount,
1037 int start, int end) throws SystemException {
1038 return findByG_M(groupId, messageCount, start, end, null);
1039 }
1040
1041 public List<MBStatsUser> findByG_M(long groupId, int messageCount,
1042 int start, int end, OrderByComparator obc) throws SystemException {
1043 Object[] finderArgs = new Object[] {
1044 new Long(groupId), new Integer(messageCount),
1045
1046 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1047 };
1048
1049 List<MBStatsUser> list = (List<MBStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_M,
1050 finderArgs, this);
1051
1052 if (list == null) {
1053 Session session = null;
1054
1055 try {
1056 session = openSession();
1057
1058 StringBuilder query = new StringBuilder();
1059
1060 query.append(
1061 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
1062
1063 query.append("groupId = ?");
1064
1065 query.append(" AND ");
1066
1067 query.append("messageCount != ?");
1068
1069 query.append(" ");
1070
1071 if (obc != null) {
1072 query.append("ORDER BY ");
1073 query.append(obc.getOrderBy());
1074 }
1075
1076 else {
1077 query.append("ORDER BY ");
1078
1079 query.append("messageCount DESC");
1080 }
1081
1082 Query q = session.createQuery(query.toString());
1083
1084 QueryPos qPos = QueryPos.getInstance(q);
1085
1086 qPos.add(groupId);
1087
1088 qPos.add(messageCount);
1089
1090 list = (List<MBStatsUser>)QueryUtil.list(q, getDialect(),
1091 start, end);
1092 }
1093 catch (Exception e) {
1094 throw processException(e);
1095 }
1096 finally {
1097 if (list == null) {
1098 list = new ArrayList<MBStatsUser>();
1099 }
1100
1101 cacheResult(list);
1102
1103 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_M,
1104 finderArgs, list);
1105
1106 closeSession(session);
1107 }
1108 }
1109
1110 return list;
1111 }
1112
1113 public MBStatsUser findByG_M_First(long groupId, int messageCount,
1114 OrderByComparator obc) throws NoSuchStatsUserException, SystemException {
1115 List<MBStatsUser> list = findByG_M(groupId, messageCount, 0, 1, obc);
1116
1117 if (list.isEmpty()) {
1118 StringBuilder msg = new StringBuilder();
1119
1120 msg.append("No MBStatsUser exists with the key {");
1121
1122 msg.append("groupId=" + groupId);
1123
1124 msg.append(", ");
1125 msg.append("messageCount=" + messageCount);
1126
1127 msg.append(StringPool.CLOSE_CURLY_BRACE);
1128
1129 throw new NoSuchStatsUserException(msg.toString());
1130 }
1131 else {
1132 return list.get(0);
1133 }
1134 }
1135
1136 public MBStatsUser findByG_M_Last(long groupId, int messageCount,
1137 OrderByComparator obc) throws NoSuchStatsUserException, SystemException {
1138 int count = countByG_M(groupId, messageCount);
1139
1140 List<MBStatsUser> list = findByG_M(groupId, messageCount, count - 1,
1141 count, obc);
1142
1143 if (list.isEmpty()) {
1144 StringBuilder msg = new StringBuilder();
1145
1146 msg.append("No MBStatsUser exists with the key {");
1147
1148 msg.append("groupId=" + groupId);
1149
1150 msg.append(", ");
1151 msg.append("messageCount=" + messageCount);
1152
1153 msg.append(StringPool.CLOSE_CURLY_BRACE);
1154
1155 throw new NoSuchStatsUserException(msg.toString());
1156 }
1157 else {
1158 return list.get(0);
1159 }
1160 }
1161
1162 public MBStatsUser[] findByG_M_PrevAndNext(long statsUserId, long groupId,
1163 int messageCount, OrderByComparator obc)
1164 throws NoSuchStatsUserException, SystemException {
1165 MBStatsUser mbStatsUser = findByPrimaryKey(statsUserId);
1166
1167 int count = countByG_M(groupId, messageCount);
1168
1169 Session session = null;
1170
1171 try {
1172 session = openSession();
1173
1174 StringBuilder query = new StringBuilder();
1175
1176 query.append(
1177 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
1178
1179 query.append("groupId = ?");
1180
1181 query.append(" AND ");
1182
1183 query.append("messageCount != ?");
1184
1185 query.append(" ");
1186
1187 if (obc != null) {
1188 query.append("ORDER BY ");
1189 query.append(obc.getOrderBy());
1190 }
1191
1192 else {
1193 query.append("ORDER BY ");
1194
1195 query.append("messageCount DESC");
1196 }
1197
1198 Query q = session.createQuery(query.toString());
1199
1200 QueryPos qPos = QueryPos.getInstance(q);
1201
1202 qPos.add(groupId);
1203
1204 qPos.add(messageCount);
1205
1206 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1207 mbStatsUser);
1208
1209 MBStatsUser[] array = new MBStatsUserImpl[3];
1210
1211 array[0] = (MBStatsUser)objArray[0];
1212 array[1] = (MBStatsUser)objArray[1];
1213 array[2] = (MBStatsUser)objArray[2];
1214
1215 return array;
1216 }
1217 catch (Exception e) {
1218 throw processException(e);
1219 }
1220 finally {
1221 closeSession(session);
1222 }
1223 }
1224
1225 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1226 throws SystemException {
1227 Session session = null;
1228
1229 try {
1230 session = openSession();
1231
1232 dynamicQuery.compile(session);
1233
1234 return dynamicQuery.list();
1235 }
1236 catch (Exception e) {
1237 throw processException(e);
1238 }
1239 finally {
1240 closeSession(session);
1241 }
1242 }
1243
1244 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1245 int start, int end) throws SystemException {
1246 Session session = null;
1247
1248 try {
1249 session = openSession();
1250
1251 dynamicQuery.setLimit(start, end);
1252
1253 dynamicQuery.compile(session);
1254
1255 return dynamicQuery.list();
1256 }
1257 catch (Exception e) {
1258 throw processException(e);
1259 }
1260 finally {
1261 closeSession(session);
1262 }
1263 }
1264
1265 public List<MBStatsUser> findAll() throws SystemException {
1266 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1267 }
1268
1269 public List<MBStatsUser> findAll(int start, int end)
1270 throws SystemException {
1271 return findAll(start, end, null);
1272 }
1273
1274 public List<MBStatsUser> findAll(int start, int end, OrderByComparator obc)
1275 throws SystemException {
1276 Object[] finderArgs = new Object[] {
1277 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1278 };
1279
1280 List<MBStatsUser> list = (List<MBStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1281 finderArgs, this);
1282
1283 if (list == null) {
1284 Session session = null;
1285
1286 try {
1287 session = openSession();
1288
1289 StringBuilder query = new StringBuilder();
1290
1291 query.append(
1292 "FROM com.liferay.portlet.messageboards.model.MBStatsUser ");
1293
1294 if (obc != null) {
1295 query.append("ORDER BY ");
1296 query.append(obc.getOrderBy());
1297 }
1298
1299 else {
1300 query.append("ORDER BY ");
1301
1302 query.append("messageCount DESC");
1303 }
1304
1305 Query q = session.createQuery(query.toString());
1306
1307 if (obc == null) {
1308 list = (List<MBStatsUser>)QueryUtil.list(q, getDialect(),
1309 start, end, false);
1310
1311 Collections.sort(list);
1312 }
1313 else {
1314 list = (List<MBStatsUser>)QueryUtil.list(q, getDialect(),
1315 start, end);
1316 }
1317 }
1318 catch (Exception e) {
1319 throw processException(e);
1320 }
1321 finally {
1322 if (list == null) {
1323 list = new ArrayList<MBStatsUser>();
1324 }
1325
1326 cacheResult(list);
1327
1328 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1329
1330 closeSession(session);
1331 }
1332 }
1333
1334 return list;
1335 }
1336
1337 public void removeByGroupId(long groupId) throws SystemException {
1338 for (MBStatsUser mbStatsUser : findByGroupId(groupId)) {
1339 remove(mbStatsUser);
1340 }
1341 }
1342
1343 public void removeByUserId(long userId) throws SystemException {
1344 for (MBStatsUser mbStatsUser : findByUserId(userId)) {
1345 remove(mbStatsUser);
1346 }
1347 }
1348
1349 public void removeByG_U(long groupId, long userId)
1350 throws NoSuchStatsUserException, SystemException {
1351 MBStatsUser mbStatsUser = findByG_U(groupId, userId);
1352
1353 remove(mbStatsUser);
1354 }
1355
1356 public void removeByG_M(long groupId, int messageCount)
1357 throws SystemException {
1358 for (MBStatsUser mbStatsUser : findByG_M(groupId, messageCount)) {
1359 remove(mbStatsUser);
1360 }
1361 }
1362
1363 public void removeAll() throws SystemException {
1364 for (MBStatsUser mbStatsUser : findAll()) {
1365 remove(mbStatsUser);
1366 }
1367 }
1368
1369 public int countByGroupId(long groupId) throws SystemException {
1370 Object[] finderArgs = new Object[] { new Long(groupId) };
1371
1372 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1373 finderArgs, this);
1374
1375 if (count == null) {
1376 Session session = null;
1377
1378 try {
1379 session = openSession();
1380
1381 StringBuilder query = new StringBuilder();
1382
1383 query.append("SELECT COUNT(*) ");
1384 query.append(
1385 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
1386
1387 query.append("groupId = ?");
1388
1389 query.append(" ");
1390
1391 Query q = session.createQuery(query.toString());
1392
1393 QueryPos qPos = QueryPos.getInstance(q);
1394
1395 qPos.add(groupId);
1396
1397 count = (Long)q.uniqueResult();
1398 }
1399 catch (Exception e) {
1400 throw processException(e);
1401 }
1402 finally {
1403 if (count == null) {
1404 count = Long.valueOf(0);
1405 }
1406
1407 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1408 finderArgs, count);
1409
1410 closeSession(session);
1411 }
1412 }
1413
1414 return count.intValue();
1415 }
1416
1417 public int countByUserId(long userId) throws SystemException {
1418 Object[] finderArgs = new Object[] { new Long(userId) };
1419
1420 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
1421 finderArgs, this);
1422
1423 if (count == null) {
1424 Session session = null;
1425
1426 try {
1427 session = openSession();
1428
1429 StringBuilder query = new StringBuilder();
1430
1431 query.append("SELECT COUNT(*) ");
1432 query.append(
1433 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
1434
1435 query.append("userId = ?");
1436
1437 query.append(" ");
1438
1439 Query q = session.createQuery(query.toString());
1440
1441 QueryPos qPos = QueryPos.getInstance(q);
1442
1443 qPos.add(userId);
1444
1445 count = (Long)q.uniqueResult();
1446 }
1447 catch (Exception e) {
1448 throw processException(e);
1449 }
1450 finally {
1451 if (count == null) {
1452 count = Long.valueOf(0);
1453 }
1454
1455 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
1456 finderArgs, count);
1457
1458 closeSession(session);
1459 }
1460 }
1461
1462 return count.intValue();
1463 }
1464
1465 public int countByG_U(long groupId, long userId) throws SystemException {
1466 Object[] finderArgs = new Object[] { new Long(groupId), new Long(userId) };
1467
1468 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
1469 finderArgs, this);
1470
1471 if (count == null) {
1472 Session session = null;
1473
1474 try {
1475 session = openSession();
1476
1477 StringBuilder query = new StringBuilder();
1478
1479 query.append("SELECT COUNT(*) ");
1480 query.append(
1481 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
1482
1483 query.append("groupId = ?");
1484
1485 query.append(" AND ");
1486
1487 query.append("userId = ?");
1488
1489 query.append(" ");
1490
1491 Query q = session.createQuery(query.toString());
1492
1493 QueryPos qPos = QueryPos.getInstance(q);
1494
1495 qPos.add(groupId);
1496
1497 qPos.add(userId);
1498
1499 count = (Long)q.uniqueResult();
1500 }
1501 catch (Exception e) {
1502 throw processException(e);
1503 }
1504 finally {
1505 if (count == null) {
1506 count = Long.valueOf(0);
1507 }
1508
1509 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
1510 count);
1511
1512 closeSession(session);
1513 }
1514 }
1515
1516 return count.intValue();
1517 }
1518
1519 public int countByG_M(long groupId, int messageCount)
1520 throws SystemException {
1521 Object[] finderArgs = new Object[] {
1522 new Long(groupId), new Integer(messageCount)
1523 };
1524
1525 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_M,
1526 finderArgs, this);
1527
1528 if (count == null) {
1529 Session session = null;
1530
1531 try {
1532 session = openSession();
1533
1534 StringBuilder query = new StringBuilder();
1535
1536 query.append("SELECT COUNT(*) ");
1537 query.append(
1538 "FROM com.liferay.portlet.messageboards.model.MBStatsUser WHERE ");
1539
1540 query.append("groupId = ?");
1541
1542 query.append(" AND ");
1543
1544 query.append("messageCount != ?");
1545
1546 query.append(" ");
1547
1548 Query q = session.createQuery(query.toString());
1549
1550 QueryPos qPos = QueryPos.getInstance(q);
1551
1552 qPos.add(groupId);
1553
1554 qPos.add(messageCount);
1555
1556 count = (Long)q.uniqueResult();
1557 }
1558 catch (Exception e) {
1559 throw processException(e);
1560 }
1561 finally {
1562 if (count == null) {
1563 count = Long.valueOf(0);
1564 }
1565
1566 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_M, finderArgs,
1567 count);
1568
1569 closeSession(session);
1570 }
1571 }
1572
1573 return count.intValue();
1574 }
1575
1576 public int countAll() throws SystemException {
1577 Object[] finderArgs = new Object[0];
1578
1579 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1580 finderArgs, this);
1581
1582 if (count == null) {
1583 Session session = null;
1584
1585 try {
1586 session = openSession();
1587
1588 Query q = session.createQuery(
1589 "SELECT COUNT(*) FROM com.liferay.portlet.messageboards.model.MBStatsUser");
1590
1591 count = (Long)q.uniqueResult();
1592 }
1593 catch (Exception e) {
1594 throw processException(e);
1595 }
1596 finally {
1597 if (count == null) {
1598 count = Long.valueOf(0);
1599 }
1600
1601 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1602 count);
1603
1604 closeSession(session);
1605 }
1606 }
1607
1608 return count.intValue();
1609 }
1610
1611 public void afterPropertiesSet() {
1612 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1613 com.liferay.portal.util.PropsUtil.get(
1614 "value.object.listener.com.liferay.portlet.messageboards.model.MBStatsUser")));
1615
1616 if (listenerClassNames.length > 0) {
1617 try {
1618 List<ModelListener<MBStatsUser>> listenersList = new ArrayList<ModelListener<MBStatsUser>>();
1619
1620 for (String listenerClassName : listenerClassNames) {
1621 listenersList.add((ModelListener<MBStatsUser>)Class.forName(
1622 listenerClassName).newInstance());
1623 }
1624
1625 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1626 }
1627 catch (Exception e) {
1628 _log.error(e);
1629 }
1630 }
1631 }
1632
1633 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBBanPersistence.impl")
1634 protected com.liferay.portlet.messageboards.service.persistence.MBBanPersistence mbBanPersistence;
1635 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBCategoryPersistence.impl")
1636 protected com.liferay.portlet.messageboards.service.persistence.MBCategoryPersistence mbCategoryPersistence;
1637 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBDiscussionPersistence.impl")
1638 protected com.liferay.portlet.messageboards.service.persistence.MBDiscussionPersistence mbDiscussionPersistence;
1639 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMailingListPersistence.impl")
1640 protected com.liferay.portlet.messageboards.service.persistence.MBMailingListPersistence mbMailingListPersistence;
1641 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence.impl")
1642 protected com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence mbMessagePersistence;
1643 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessageFlagPersistence.impl")
1644 protected com.liferay.portlet.messageboards.service.persistence.MBMessageFlagPersistence mbMessageFlagPersistence;
1645 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBStatsUserPersistence.impl")
1646 protected com.liferay.portlet.messageboards.service.persistence.MBStatsUserPersistence mbStatsUserPersistence;
1647 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBThreadPersistence.impl")
1648 protected com.liferay.portlet.messageboards.service.persistence.MBThreadPersistence mbThreadPersistence;
1649 private static Log _log = LogFactoryUtil.getLog(MBStatsUserPersistenceImpl.class);
1650}