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