1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
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.dao.orm.DynamicQuery;
28  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
29  import com.liferay.portal.kernel.dao.orm.Query;
30  import com.liferay.portal.kernel.dao.orm.QueryPos;
31  import com.liferay.portal.kernel.dao.orm.QueryUtil;
32  import com.liferay.portal.kernel.dao.orm.Session;
33  import com.liferay.portal.kernel.log.Log;
34  import com.liferay.portal.kernel.log.LogFactoryUtil;
35  import com.liferay.portal.kernel.util.GetterUtil;
36  import com.liferay.portal.kernel.util.OrderByComparator;
37  import com.liferay.portal.kernel.util.StringPool;
38  import com.liferay.portal.kernel.util.StringUtil;
39  import com.liferay.portal.kernel.util.Validator;
40  import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
41  import com.liferay.portal.model.ModelListener;
42  import com.liferay.portal.service.persistence.BatchSessionUtil;
43  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
44  
45  import com.liferay.portlet.messageboards.NoSuchMessageException;
46  import com.liferay.portlet.messageboards.model.MBMessage;
47  import com.liferay.portlet.messageboards.model.impl.MBMessageImpl;
48  import com.liferay.portlet.messageboards.model.impl.MBMessageModelImpl;
49  
50  import java.util.ArrayList;
51  import java.util.Collections;
52  import java.util.Iterator;
53  import java.util.List;
54  
55  /**
56   * <a href="MBMessagePersistenceImpl.java.html"><b><i>View Source</i></b></a>
57   *
58   * @author Brian Wing Shun Chan
59   *
60   */
61  public class MBMessagePersistenceImpl extends BasePersistenceImpl
62      implements MBMessagePersistence {
63      public MBMessage create(long messageId) {
64          MBMessage mbMessage = new MBMessageImpl();
65  
66          mbMessage.setNew(true);
67          mbMessage.setPrimaryKey(messageId);
68  
69          String uuid = PortalUUIDUtil.generate();
70  
71          mbMessage.setUuid(uuid);
72  
73          return mbMessage;
74      }
75  
76      public MBMessage remove(long messageId)
77          throws NoSuchMessageException, SystemException {
78          Session session = null;
79  
80          try {
81              session = openSession();
82  
83              MBMessage mbMessage = (MBMessage)session.get(MBMessageImpl.class,
84                      new Long(messageId));
85  
86              if (mbMessage == null) {
87                  if (_log.isWarnEnabled()) {
88                      _log.warn("No MBMessage exists with the primary key " +
89                          messageId);
90                  }
91  
92                  throw new NoSuchMessageException(
93                      "No MBMessage exists with the primary key " + messageId);
94              }
95  
96              return remove(mbMessage);
97          }
98          catch (NoSuchMessageException nsee) {
99              throw nsee;
100         }
101         catch (Exception e) {
102             throw processException(e);
103         }
104         finally {
105             closeSession(session);
106         }
107     }
108 
109     public MBMessage remove(MBMessage mbMessage) throws SystemException {
110         for (ModelListener listener : listeners) {
111             listener.onBeforeRemove(mbMessage);
112         }
113 
114         mbMessage = removeImpl(mbMessage);
115 
116         for (ModelListener listener : listeners) {
117             listener.onAfterRemove(mbMessage);
118         }
119 
120         return mbMessage;
121     }
122 
123     protected MBMessage removeImpl(MBMessage mbMessage)
124         throws SystemException {
125         Session session = null;
126 
127         try {
128             session = openSession();
129 
130             if (BatchSessionUtil.isEnabled()) {
131                 Object staleObject = session.get(MBMessageImpl.class,
132                         mbMessage.getPrimaryKeyObj());
133 
134                 if (staleObject != null) {
135                     session.evict(staleObject);
136                 }
137             }
138 
139             session.delete(mbMessage);
140 
141             session.flush();
142 
143             return mbMessage;
144         }
145         catch (Exception e) {
146             throw processException(e);
147         }
148         finally {
149             closeSession(session);
150 
151             FinderCacheUtil.clearCache(MBMessage.class.getName());
152         }
153     }
154 
155     /**
156      * @deprecated Use <code>update(MBMessage mbMessage, boolean merge)</code>.
157      */
158     public MBMessage update(MBMessage mbMessage) throws SystemException {
159         if (_log.isWarnEnabled()) {
160             _log.warn(
161                 "Using the deprecated update(MBMessage mbMessage) method. Use update(MBMessage mbMessage, boolean merge) instead.");
162         }
163 
164         return update(mbMessage, false);
165     }
166 
167     /**
168      * Add, update, or merge, the entity. This method also calls the model
169      * listeners to trigger the proper events associated with adding, deleting,
170      * or updating an entity.
171      *
172      * @param        mbMessage the entity to add, update, or merge
173      * @param        merge boolean value for whether to merge the entity. The
174      *                default value is false. Setting merge to true is more
175      *                expensive and should only be true when mbMessage is
176      *                transient. See LEP-5473 for a detailed discussion of this
177      *                method.
178      * @return        true if the portlet can be displayed via Ajax
179      */
180     public MBMessage update(MBMessage mbMessage, boolean merge)
181         throws SystemException {
182         boolean isNew = mbMessage.isNew();
183 
184         for (ModelListener listener : listeners) {
185             if (isNew) {
186                 listener.onBeforeCreate(mbMessage);
187             }
188             else {
189                 listener.onBeforeUpdate(mbMessage);
190             }
191         }
192 
193         mbMessage = updateImpl(mbMessage, merge);
194 
195         for (ModelListener listener : listeners) {
196             if (isNew) {
197                 listener.onAfterCreate(mbMessage);
198             }
199             else {
200                 listener.onAfterUpdate(mbMessage);
201             }
202         }
203 
204         return mbMessage;
205     }
206 
207     public MBMessage updateImpl(
208         com.liferay.portlet.messageboards.model.MBMessage mbMessage,
209         boolean merge) throws SystemException {
210         if (Validator.isNull(mbMessage.getUuid())) {
211             String uuid = PortalUUIDUtil.generate();
212 
213             mbMessage.setUuid(uuid);
214         }
215 
216         Session session = null;
217 
218         try {
219             session = openSession();
220 
221             BatchSessionUtil.update(session, mbMessage, merge);
222 
223             mbMessage.setNew(false);
224 
225             return mbMessage;
226         }
227         catch (Exception e) {
228             throw processException(e);
229         }
230         finally {
231             closeSession(session);
232 
233             FinderCacheUtil.clearCache(MBMessage.class.getName());
234         }
235     }
236 
237     public MBMessage findByPrimaryKey(long messageId)
238         throws NoSuchMessageException, SystemException {
239         MBMessage mbMessage = fetchByPrimaryKey(messageId);
240 
241         if (mbMessage == null) {
242             if (_log.isWarnEnabled()) {
243                 _log.warn("No MBMessage exists with the primary key " +
244                     messageId);
245             }
246 
247             throw new NoSuchMessageException(
248                 "No MBMessage exists with the primary key " + messageId);
249         }
250 
251         return mbMessage;
252     }
253 
254     public MBMessage fetchByPrimaryKey(long messageId)
255         throws SystemException {
256         Session session = null;
257 
258         try {
259             session = openSession();
260 
261             return (MBMessage)session.get(MBMessageImpl.class,
262                 new Long(messageId));
263         }
264         catch (Exception e) {
265             throw processException(e);
266         }
267         finally {
268             closeSession(session);
269         }
270     }
271 
272     public List<MBMessage> findByUuid(String uuid) throws SystemException {
273         boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
274         String finderClassName = MBMessage.class.getName();
275         String finderMethodName = "findByUuid";
276         String[] finderParams = new String[] { String.class.getName() };
277         Object[] finderArgs = new Object[] { uuid };
278 
279         Object result = null;
280 
281         if (finderClassNameCacheEnabled) {
282             result = FinderCacheUtil.getResult(finderClassName,
283                     finderMethodName, finderParams, finderArgs, this);
284         }
285 
286         if (result == null) {
287             Session session = null;
288 
289             try {
290                 session = openSession();
291 
292                 StringBuilder query = new StringBuilder();
293 
294                 query.append(
295                     "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
296 
297                 if (uuid == null) {
298                     query.append("uuid_ IS NULL");
299                 }
300                 else {
301                     query.append("uuid_ = ?");
302                 }
303 
304                 query.append(" ");
305 
306                 query.append("ORDER BY ");
307 
308                 query.append("createDate ASC, ");
309                 query.append("messageId ASC");
310 
311                 Query q = session.createQuery(query.toString());
312 
313                 QueryPos qPos = QueryPos.getInstance(q);
314 
315                 if (uuid != null) {
316                     qPos.add(uuid);
317                 }
318 
319                 List<MBMessage> list = q.list();
320 
321                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
322                     finderClassName, finderMethodName, finderParams,
323                     finderArgs, list);
324 
325                 return list;
326             }
327             catch (Exception e) {
328                 throw processException(e);
329             }
330             finally {
331                 closeSession(session);
332             }
333         }
334         else {
335             return (List<MBMessage>)result;
336         }
337     }
338 
339     public List<MBMessage> findByUuid(String uuid, int start, int end)
340         throws SystemException {
341         return findByUuid(uuid, start, end, null);
342     }
343 
344     public List<MBMessage> findByUuid(String uuid, int start, int end,
345         OrderByComparator obc) throws SystemException {
346         boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
347         String finderClassName = MBMessage.class.getName();
348         String finderMethodName = "findByUuid";
349         String[] finderParams = new String[] {
350                 String.class.getName(),
351                 
352                 "java.lang.Integer", "java.lang.Integer",
353                 "com.liferay.portal.kernel.util.OrderByComparator"
354             };
355         Object[] finderArgs = new Object[] {
356                 uuid,
357                 
358                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
359             };
360 
361         Object result = null;
362 
363         if (finderClassNameCacheEnabled) {
364             result = FinderCacheUtil.getResult(finderClassName,
365                     finderMethodName, finderParams, finderArgs, this);
366         }
367 
368         if (result == null) {
369             Session session = null;
370 
371             try {
372                 session = openSession();
373 
374                 StringBuilder query = new StringBuilder();
375 
376                 query.append(
377                     "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
378 
379                 if (uuid == null) {
380                     query.append("uuid_ IS NULL");
381                 }
382                 else {
383                     query.append("uuid_ = ?");
384                 }
385 
386                 query.append(" ");
387 
388                 if (obc != null) {
389                     query.append("ORDER BY ");
390                     query.append(obc.getOrderBy());
391                 }
392 
393                 else {
394                     query.append("ORDER BY ");
395 
396                     query.append("createDate ASC, ");
397                     query.append("messageId ASC");
398                 }
399 
400                 Query q = session.createQuery(query.toString());
401 
402                 QueryPos qPos = QueryPos.getInstance(q);
403 
404                 if (uuid != null) {
405                     qPos.add(uuid);
406                 }
407 
408                 List<MBMessage> list = (List<MBMessage>)QueryUtil.list(q,
409                         getDialect(), start, end);
410 
411                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
412                     finderClassName, finderMethodName, finderParams,
413                     finderArgs, list);
414 
415                 return list;
416             }
417             catch (Exception e) {
418                 throw processException(e);
419             }
420             finally {
421                 closeSession(session);
422             }
423         }
424         else {
425             return (List<MBMessage>)result;
426         }
427     }
428 
429     public MBMessage findByUuid_First(String uuid, OrderByComparator obc)
430         throws NoSuchMessageException, SystemException {
431         List<MBMessage> list = findByUuid(uuid, 0, 1, obc);
432 
433         if (list.size() == 0) {
434             StringBuilder msg = new StringBuilder();
435 
436             msg.append("No MBMessage exists with the key {");
437 
438             msg.append("uuid=" + uuid);
439 
440             msg.append(StringPool.CLOSE_CURLY_BRACE);
441 
442             throw new NoSuchMessageException(msg.toString());
443         }
444         else {
445             return list.get(0);
446         }
447     }
448 
449     public MBMessage findByUuid_Last(String uuid, OrderByComparator obc)
450         throws NoSuchMessageException, SystemException {
451         int count = countByUuid(uuid);
452 
453         List<MBMessage> list = findByUuid(uuid, count - 1, count, obc);
454 
455         if (list.size() == 0) {
456             StringBuilder msg = new StringBuilder();
457 
458             msg.append("No MBMessage exists with the key {");
459 
460             msg.append("uuid=" + uuid);
461 
462             msg.append(StringPool.CLOSE_CURLY_BRACE);
463 
464             throw new NoSuchMessageException(msg.toString());
465         }
466         else {
467             return list.get(0);
468         }
469     }
470 
471     public MBMessage[] findByUuid_PrevAndNext(long messageId, String uuid,
472         OrderByComparator obc) throws NoSuchMessageException, SystemException {
473         MBMessage mbMessage = findByPrimaryKey(messageId);
474 
475         int count = countByUuid(uuid);
476 
477         Session session = null;
478 
479         try {
480             session = openSession();
481 
482             StringBuilder query = new StringBuilder();
483 
484             query.append(
485                 "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
486 
487             if (uuid == null) {
488                 query.append("uuid_ IS NULL");
489             }
490             else {
491                 query.append("uuid_ = ?");
492             }
493 
494             query.append(" ");
495 
496             if (obc != null) {
497                 query.append("ORDER BY ");
498                 query.append(obc.getOrderBy());
499             }
500 
501             else {
502                 query.append("ORDER BY ");
503 
504                 query.append("createDate ASC, ");
505                 query.append("messageId ASC");
506             }
507 
508             Query q = session.createQuery(query.toString());
509 
510             QueryPos qPos = QueryPos.getInstance(q);
511 
512             if (uuid != null) {
513                 qPos.add(uuid);
514             }
515 
516             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
517                     mbMessage);
518 
519             MBMessage[] array = new MBMessageImpl[3];
520 
521             array[0] = (MBMessage)objArray[0];
522             array[1] = (MBMessage)objArray[1];
523             array[2] = (MBMessage)objArray[2];
524 
525             return array;
526         }
527         catch (Exception e) {
528             throw processException(e);
529         }
530         finally {
531             closeSession(session);
532         }
533     }
534 
535     public List<MBMessage> findByCompanyId(long companyId)
536         throws SystemException {
537         boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
538         String finderClassName = MBMessage.class.getName();
539         String finderMethodName = "findByCompanyId";
540         String[] finderParams = new String[] { Long.class.getName() };
541         Object[] finderArgs = new Object[] { new Long(companyId) };
542 
543         Object result = null;
544 
545         if (finderClassNameCacheEnabled) {
546             result = FinderCacheUtil.getResult(finderClassName,
547                     finderMethodName, finderParams, finderArgs, this);
548         }
549 
550         if (result == null) {
551             Session session = null;
552 
553             try {
554                 session = openSession();
555 
556                 StringBuilder query = new StringBuilder();
557 
558                 query.append(
559                     "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
560 
561                 query.append("companyId = ?");
562 
563                 query.append(" ");
564 
565                 query.append("ORDER BY ");
566 
567                 query.append("createDate ASC, ");
568                 query.append("messageId ASC");
569 
570                 Query q = session.createQuery(query.toString());
571 
572                 QueryPos qPos = QueryPos.getInstance(q);
573 
574                 qPos.add(companyId);
575 
576                 List<MBMessage> list = q.list();
577 
578                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
579                     finderClassName, finderMethodName, finderParams,
580                     finderArgs, list);
581 
582                 return list;
583             }
584             catch (Exception e) {
585                 throw processException(e);
586             }
587             finally {
588                 closeSession(session);
589             }
590         }
591         else {
592             return (List<MBMessage>)result;
593         }
594     }
595 
596     public List<MBMessage> findByCompanyId(long companyId, int start, int end)
597         throws SystemException {
598         return findByCompanyId(companyId, start, end, null);
599     }
600 
601     public List<MBMessage> findByCompanyId(long companyId, int start, int end,
602         OrderByComparator obc) throws SystemException {
603         boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
604         String finderClassName = MBMessage.class.getName();
605         String finderMethodName = "findByCompanyId";
606         String[] finderParams = new String[] {
607                 Long.class.getName(),
608                 
609                 "java.lang.Integer", "java.lang.Integer",
610                 "com.liferay.portal.kernel.util.OrderByComparator"
611             };
612         Object[] finderArgs = new Object[] {
613                 new Long(companyId),
614                 
615                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
616             };
617 
618         Object result = null;
619 
620         if (finderClassNameCacheEnabled) {
621             result = FinderCacheUtil.getResult(finderClassName,
622                     finderMethodName, finderParams, finderArgs, this);
623         }
624 
625         if (result == null) {
626             Session session = null;
627 
628             try {
629                 session = openSession();
630 
631                 StringBuilder query = new StringBuilder();
632 
633                 query.append(
634                     "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
635 
636                 query.append("companyId = ?");
637 
638                 query.append(" ");
639 
640                 if (obc != null) {
641                     query.append("ORDER BY ");
642                     query.append(obc.getOrderBy());
643                 }
644 
645                 else {
646                     query.append("ORDER BY ");
647 
648                     query.append("createDate ASC, ");
649                     query.append("messageId ASC");
650                 }
651 
652                 Query q = session.createQuery(query.toString());
653 
654                 QueryPos qPos = QueryPos.getInstance(q);
655 
656                 qPos.add(companyId);
657 
658                 List<MBMessage> list = (List<MBMessage>)QueryUtil.list(q,
659                         getDialect(), start, end);
660 
661                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
662                     finderClassName, finderMethodName, finderParams,
663                     finderArgs, list);
664 
665                 return list;
666             }
667             catch (Exception e) {
668                 throw processException(e);
669             }
670             finally {
671                 closeSession(session);
672             }
673         }
674         else {
675             return (List<MBMessage>)result;
676         }
677     }
678 
679     public MBMessage findByCompanyId_First(long companyId, OrderByComparator obc)
680         throws NoSuchMessageException, SystemException {
681         List<MBMessage> list = findByCompanyId(companyId, 0, 1, obc);
682 
683         if (list.size() == 0) {
684             StringBuilder msg = new StringBuilder();
685 
686             msg.append("No MBMessage exists with the key {");
687 
688             msg.append("companyId=" + companyId);
689 
690             msg.append(StringPool.CLOSE_CURLY_BRACE);
691 
692             throw new NoSuchMessageException(msg.toString());
693         }
694         else {
695             return list.get(0);
696         }
697     }
698 
699     public MBMessage findByCompanyId_Last(long companyId, OrderByComparator obc)
700         throws NoSuchMessageException, SystemException {
701         int count = countByCompanyId(companyId);
702 
703         List<MBMessage> list = findByCompanyId(companyId, count - 1, count, obc);
704 
705         if (list.size() == 0) {
706             StringBuilder msg = new StringBuilder();
707 
708             msg.append("No MBMessage exists with the key {");
709 
710             msg.append("companyId=" + companyId);
711 
712             msg.append(StringPool.CLOSE_CURLY_BRACE);
713 
714             throw new NoSuchMessageException(msg.toString());
715         }
716         else {
717             return list.get(0);
718         }
719     }
720 
721     public MBMessage[] findByCompanyId_PrevAndNext(long messageId,
722         long companyId, OrderByComparator obc)
723         throws NoSuchMessageException, SystemException {
724         MBMessage mbMessage = findByPrimaryKey(messageId);
725 
726         int count = countByCompanyId(companyId);
727 
728         Session session = null;
729 
730         try {
731             session = openSession();
732 
733             StringBuilder query = new StringBuilder();
734 
735             query.append(
736                 "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
737 
738             query.append("companyId = ?");
739 
740             query.append(" ");
741 
742             if (obc != null) {
743                 query.append("ORDER BY ");
744                 query.append(obc.getOrderBy());
745             }
746 
747             else {
748                 query.append("ORDER BY ");
749 
750                 query.append("createDate ASC, ");
751                 query.append("messageId ASC");
752             }
753 
754             Query q = session.createQuery(query.toString());
755 
756             QueryPos qPos = QueryPos.getInstance(q);
757 
758             qPos.add(companyId);
759 
760             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
761                     mbMessage);
762 
763             MBMessage[] array = new MBMessageImpl[3];
764 
765             array[0] = (MBMessage)objArray[0];
766             array[1] = (MBMessage)objArray[1];
767             array[2] = (MBMessage)objArray[2];
768 
769             return array;
770         }
771         catch (Exception e) {
772             throw processException(e);
773         }
774         finally {
775             closeSession(session);
776         }
777     }
778 
779     public List<MBMessage> findByCategoryId(long categoryId)
780         throws SystemException {
781         boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
782         String finderClassName = MBMessage.class.getName();
783         String finderMethodName = "findByCategoryId";
784         String[] finderParams = new String[] { Long.class.getName() };
785         Object[] finderArgs = new Object[] { new Long(categoryId) };
786 
787         Object result = null;
788 
789         if (finderClassNameCacheEnabled) {
790             result = FinderCacheUtil.getResult(finderClassName,
791                     finderMethodName, finderParams, finderArgs, this);
792         }
793 
794         if (result == null) {
795             Session session = null;
796 
797             try {
798                 session = openSession();
799 
800                 StringBuilder query = new StringBuilder();
801 
802                 query.append(
803                     "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
804 
805                 query.append("categoryId = ?");
806 
807                 query.append(" ");
808 
809                 query.append("ORDER BY ");
810 
811                 query.append("createDate ASC, ");
812                 query.append("messageId ASC");
813 
814                 Query q = session.createQuery(query.toString());
815 
816                 QueryPos qPos = QueryPos.getInstance(q);
817 
818                 qPos.add(categoryId);
819 
820                 List<MBMessage> list = q.list();
821 
822                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
823                     finderClassName, finderMethodName, finderParams,
824                     finderArgs, list);
825 
826                 return list;
827             }
828             catch (Exception e) {
829                 throw processException(e);
830             }
831             finally {
832                 closeSession(session);
833             }
834         }
835         else {
836             return (List<MBMessage>)result;
837         }
838     }
839 
840     public List<MBMessage> findByCategoryId(long categoryId, int start, int end)
841         throws SystemException {
842         return findByCategoryId(categoryId, start, end, null);
843     }
844 
845     public List<MBMessage> findByCategoryId(long categoryId, int start,
846         int end, OrderByComparator obc) throws SystemException {
847         boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
848         String finderClassName = MBMessage.class.getName();
849         String finderMethodName = "findByCategoryId";
850         String[] finderParams = new String[] {
851                 Long.class.getName(),
852                 
853                 "java.lang.Integer", "java.lang.Integer",
854                 "com.liferay.portal.kernel.util.OrderByComparator"
855             };
856         Object[] finderArgs = new Object[] {
857                 new Long(categoryId),
858                 
859                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
860             };
861 
862         Object result = null;
863 
864         if (finderClassNameCacheEnabled) {
865             result = FinderCacheUtil.getResult(finderClassName,
866                     finderMethodName, finderParams, finderArgs, this);
867         }
868 
869         if (result == null) {
870             Session session = null;
871 
872             try {
873                 session = openSession();
874 
875                 StringBuilder query = new StringBuilder();
876 
877                 query.append(
878                     "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
879 
880                 query.append("categoryId = ?");
881 
882                 query.append(" ");
883 
884                 if (obc != null) {
885                     query.append("ORDER BY ");
886                     query.append(obc.getOrderBy());
887                 }
888 
889                 else {
890                     query.append("ORDER BY ");
891 
892                     query.append("createDate ASC, ");
893                     query.append("messageId ASC");
894                 }
895 
896                 Query q = session.createQuery(query.toString());
897 
898                 QueryPos qPos = QueryPos.getInstance(q);
899 
900                 qPos.add(categoryId);
901 
902                 List<MBMessage> list = (List<MBMessage>)QueryUtil.list(q,
903                         getDialect(), start, end);
904 
905                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
906                     finderClassName, finderMethodName, finderParams,
907                     finderArgs, list);
908 
909                 return list;
910             }
911             catch (Exception e) {
912                 throw processException(e);
913             }
914             finally {
915                 closeSession(session);
916             }
917         }
918         else {
919             return (List<MBMessage>)result;
920         }
921     }
922 
923     public MBMessage findByCategoryId_First(long categoryId,
924         OrderByComparator obc) throws NoSuchMessageException, SystemException {
925         List<MBMessage> list = findByCategoryId(categoryId, 0, 1, obc);
926 
927         if (list.size() == 0) {
928             StringBuilder msg = new StringBuilder();
929 
930             msg.append("No MBMessage exists with the key {");
931 
932             msg.append("categoryId=" + categoryId);
933 
934             msg.append(StringPool.CLOSE_CURLY_BRACE);
935 
936             throw new NoSuchMessageException(msg.toString());
937         }
938         else {
939             return list.get(0);
940         }
941     }
942 
943     public MBMessage findByCategoryId_Last(long categoryId,
944         OrderByComparator obc) throws NoSuchMessageException, SystemException {
945         int count = countByCategoryId(categoryId);
946 
947         List<MBMessage> list = findByCategoryId(categoryId, count - 1, count,
948                 obc);
949 
950         if (list.size() == 0) {
951             StringBuilder msg = new StringBuilder();
952 
953             msg.append("No MBMessage exists with the key {");
954 
955             msg.append("categoryId=" + categoryId);
956 
957             msg.append(StringPool.CLOSE_CURLY_BRACE);
958 
959             throw new NoSuchMessageException(msg.toString());
960         }
961         else {
962             return list.get(0);
963         }
964     }
965 
966     public MBMessage[] findByCategoryId_PrevAndNext(long messageId,
967         long categoryId, OrderByComparator obc)
968         throws NoSuchMessageException, SystemException {
969         MBMessage mbMessage = findByPrimaryKey(messageId);
970 
971         int count = countByCategoryId(categoryId);
972 
973         Session session = null;
974 
975         try {
976             session = openSession();
977 
978             StringBuilder query = new StringBuilder();
979 
980             query.append(
981                 "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
982 
983             query.append("categoryId = ?");
984 
985             query.append(" ");
986 
987             if (obc != null) {
988                 query.append("ORDER BY ");
989                 query.append(obc.getOrderBy());
990             }
991 
992             else {
993                 query.append("ORDER BY ");
994 
995                 query.append("createDate ASC, ");
996                 query.append("messageId ASC");
997             }
998 
999             Query q = session.createQuery(query.toString());
1000
1001            QueryPos qPos = QueryPos.getInstance(q);
1002
1003            qPos.add(categoryId);
1004
1005            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1006                    mbMessage);
1007
1008            MBMessage[] array = new MBMessageImpl[3];
1009
1010            array[0] = (MBMessage)objArray[0];
1011            array[1] = (MBMessage)objArray[1];
1012            array[2] = (MBMessage)objArray[2];
1013
1014            return array;
1015        }
1016        catch (Exception e) {
1017            throw processException(e);
1018        }
1019        finally {
1020            closeSession(session);
1021        }
1022    }
1023
1024    public List<MBMessage> findByThreadId(long threadId)
1025        throws SystemException {
1026        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
1027        String finderClassName = MBMessage.class.getName();
1028        String finderMethodName = "findByThreadId";
1029        String[] finderParams = new String[] { Long.class.getName() };
1030        Object[] finderArgs = new Object[] { new Long(threadId) };
1031
1032        Object result = null;
1033
1034        if (finderClassNameCacheEnabled) {
1035            result = FinderCacheUtil.getResult(finderClassName,
1036                    finderMethodName, finderParams, finderArgs, this);
1037        }
1038
1039        if (result == null) {
1040            Session session = null;
1041
1042            try {
1043                session = openSession();
1044
1045                StringBuilder query = new StringBuilder();
1046
1047                query.append(
1048                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
1049
1050                query.append("threadId = ?");
1051
1052                query.append(" ");
1053
1054                query.append("ORDER BY ");
1055
1056                query.append("createDate ASC, ");
1057                query.append("messageId ASC");
1058
1059                Query q = session.createQuery(query.toString());
1060
1061                QueryPos qPos = QueryPos.getInstance(q);
1062
1063                qPos.add(threadId);
1064
1065                List<MBMessage> list = q.list();
1066
1067                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1068                    finderClassName, finderMethodName, finderParams,
1069                    finderArgs, list);
1070
1071                return list;
1072            }
1073            catch (Exception e) {
1074                throw processException(e);
1075            }
1076            finally {
1077                closeSession(session);
1078            }
1079        }
1080        else {
1081            return (List<MBMessage>)result;
1082        }
1083    }
1084
1085    public List<MBMessage> findByThreadId(long threadId, int start, int end)
1086        throws SystemException {
1087        return findByThreadId(threadId, start, end, null);
1088    }
1089
1090    public List<MBMessage> findByThreadId(long threadId, int start, int end,
1091        OrderByComparator obc) throws SystemException {
1092        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
1093        String finderClassName = MBMessage.class.getName();
1094        String finderMethodName = "findByThreadId";
1095        String[] finderParams = new String[] {
1096                Long.class.getName(),
1097                
1098                "java.lang.Integer", "java.lang.Integer",
1099                "com.liferay.portal.kernel.util.OrderByComparator"
1100            };
1101        Object[] finderArgs = new Object[] {
1102                new Long(threadId),
1103                
1104                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1105            };
1106
1107        Object result = null;
1108
1109        if (finderClassNameCacheEnabled) {
1110            result = FinderCacheUtil.getResult(finderClassName,
1111                    finderMethodName, finderParams, finderArgs, this);
1112        }
1113
1114        if (result == null) {
1115            Session session = null;
1116
1117            try {
1118                session = openSession();
1119
1120                StringBuilder query = new StringBuilder();
1121
1122                query.append(
1123                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
1124
1125                query.append("threadId = ?");
1126
1127                query.append(" ");
1128
1129                if (obc != null) {
1130                    query.append("ORDER BY ");
1131                    query.append(obc.getOrderBy());
1132                }
1133
1134                else {
1135                    query.append("ORDER BY ");
1136
1137                    query.append("createDate ASC, ");
1138                    query.append("messageId ASC");
1139                }
1140
1141                Query q = session.createQuery(query.toString());
1142
1143                QueryPos qPos = QueryPos.getInstance(q);
1144
1145                qPos.add(threadId);
1146
1147                List<MBMessage> list = (List<MBMessage>)QueryUtil.list(q,
1148                        getDialect(), start, end);
1149
1150                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1151                    finderClassName, finderMethodName, finderParams,
1152                    finderArgs, list);
1153
1154                return list;
1155            }
1156            catch (Exception e) {
1157                throw processException(e);
1158            }
1159            finally {
1160                closeSession(session);
1161            }
1162        }
1163        else {
1164            return (List<MBMessage>)result;
1165        }
1166    }
1167
1168    public MBMessage findByThreadId_First(long threadId, OrderByComparator obc)
1169        throws NoSuchMessageException, SystemException {
1170        List<MBMessage> list = findByThreadId(threadId, 0, 1, obc);
1171
1172        if (list.size() == 0) {
1173            StringBuilder msg = new StringBuilder();
1174
1175            msg.append("No MBMessage exists with the key {");
1176
1177            msg.append("threadId=" + threadId);
1178
1179            msg.append(StringPool.CLOSE_CURLY_BRACE);
1180
1181            throw new NoSuchMessageException(msg.toString());
1182        }
1183        else {
1184            return list.get(0);
1185        }
1186    }
1187
1188    public MBMessage findByThreadId_Last(long threadId, OrderByComparator obc)
1189        throws NoSuchMessageException, SystemException {
1190        int count = countByThreadId(threadId);
1191
1192        List<MBMessage> list = findByThreadId(threadId, count - 1, count, obc);
1193
1194        if (list.size() == 0) {
1195            StringBuilder msg = new StringBuilder();
1196
1197            msg.append("No MBMessage exists with the key {");
1198
1199            msg.append("threadId=" + threadId);
1200
1201            msg.append(StringPool.CLOSE_CURLY_BRACE);
1202
1203            throw new NoSuchMessageException(msg.toString());
1204        }
1205        else {
1206            return list.get(0);
1207        }
1208    }
1209
1210    public MBMessage[] findByThreadId_PrevAndNext(long messageId,
1211        long threadId, OrderByComparator obc)
1212        throws NoSuchMessageException, SystemException {
1213        MBMessage mbMessage = findByPrimaryKey(messageId);
1214
1215        int count = countByThreadId(threadId);
1216
1217        Session session = null;
1218
1219        try {
1220            session = openSession();
1221
1222            StringBuilder query = new StringBuilder();
1223
1224            query.append(
1225                "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
1226
1227            query.append("threadId = ?");
1228
1229            query.append(" ");
1230
1231            if (obc != null) {
1232                query.append("ORDER BY ");
1233                query.append(obc.getOrderBy());
1234            }
1235
1236            else {
1237                query.append("ORDER BY ");
1238
1239                query.append("createDate ASC, ");
1240                query.append("messageId ASC");
1241            }
1242
1243            Query q = session.createQuery(query.toString());
1244
1245            QueryPos qPos = QueryPos.getInstance(q);
1246
1247            qPos.add(threadId);
1248
1249            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1250                    mbMessage);
1251
1252            MBMessage[] array = new MBMessageImpl[3];
1253
1254            array[0] = (MBMessage)objArray[0];
1255            array[1] = (MBMessage)objArray[1];
1256            array[2] = (MBMessage)objArray[2];
1257
1258            return array;
1259        }
1260        catch (Exception e) {
1261            throw processException(e);
1262        }
1263        finally {
1264            closeSession(session);
1265        }
1266    }
1267
1268    public List<MBMessage> findByC_T(long categoryId, long threadId)
1269        throws SystemException {
1270        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
1271        String finderClassName = MBMessage.class.getName();
1272        String finderMethodName = "findByC_T";
1273        String[] finderParams = new String[] {
1274                Long.class.getName(), Long.class.getName()
1275            };
1276        Object[] finderArgs = new Object[] {
1277                new Long(categoryId), new Long(threadId)
1278            };
1279
1280        Object result = null;
1281
1282        if (finderClassNameCacheEnabled) {
1283            result = FinderCacheUtil.getResult(finderClassName,
1284                    finderMethodName, finderParams, finderArgs, this);
1285        }
1286
1287        if (result == null) {
1288            Session session = null;
1289
1290            try {
1291                session = openSession();
1292
1293                StringBuilder query = new StringBuilder();
1294
1295                query.append(
1296                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
1297
1298                query.append("categoryId = ?");
1299
1300                query.append(" AND ");
1301
1302                query.append("threadId = ?");
1303
1304                query.append(" ");
1305
1306                query.append("ORDER BY ");
1307
1308                query.append("createDate ASC, ");
1309                query.append("messageId ASC");
1310
1311                Query q = session.createQuery(query.toString());
1312
1313                QueryPos qPos = QueryPos.getInstance(q);
1314
1315                qPos.add(categoryId);
1316
1317                qPos.add(threadId);
1318
1319                List<MBMessage> list = q.list();
1320
1321                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1322                    finderClassName, finderMethodName, finderParams,
1323                    finderArgs, list);
1324
1325                return list;
1326            }
1327            catch (Exception e) {
1328                throw processException(e);
1329            }
1330            finally {
1331                closeSession(session);
1332            }
1333        }
1334        else {
1335            return (List<MBMessage>)result;
1336        }
1337    }
1338
1339    public List<MBMessage> findByC_T(long categoryId, long threadId, int start,
1340        int end) throws SystemException {
1341        return findByC_T(categoryId, threadId, start, end, null);
1342    }
1343
1344    public List<MBMessage> findByC_T(long categoryId, long threadId, int start,
1345        int end, OrderByComparator obc) throws SystemException {
1346        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
1347        String finderClassName = MBMessage.class.getName();
1348        String finderMethodName = "findByC_T";
1349        String[] finderParams = new String[] {
1350                Long.class.getName(), Long.class.getName(),
1351                
1352                "java.lang.Integer", "java.lang.Integer",
1353                "com.liferay.portal.kernel.util.OrderByComparator"
1354            };
1355        Object[] finderArgs = new Object[] {
1356                new Long(categoryId), new Long(threadId),
1357                
1358                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1359            };
1360
1361        Object result = null;
1362
1363        if (finderClassNameCacheEnabled) {
1364            result = FinderCacheUtil.getResult(finderClassName,
1365                    finderMethodName, finderParams, finderArgs, this);
1366        }
1367
1368        if (result == null) {
1369            Session session = null;
1370
1371            try {
1372                session = openSession();
1373
1374                StringBuilder query = new StringBuilder();
1375
1376                query.append(
1377                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
1378
1379                query.append("categoryId = ?");
1380
1381                query.append(" AND ");
1382
1383                query.append("threadId = ?");
1384
1385                query.append(" ");
1386
1387                if (obc != null) {
1388                    query.append("ORDER BY ");
1389                    query.append(obc.getOrderBy());
1390                }
1391
1392                else {
1393                    query.append("ORDER BY ");
1394
1395                    query.append("createDate ASC, ");
1396                    query.append("messageId ASC");
1397                }
1398
1399                Query q = session.createQuery(query.toString());
1400
1401                QueryPos qPos = QueryPos.getInstance(q);
1402
1403                qPos.add(categoryId);
1404
1405                qPos.add(threadId);
1406
1407                List<MBMessage> list = (List<MBMessage>)QueryUtil.list(q,
1408                        getDialect(), start, end);
1409
1410                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1411                    finderClassName, finderMethodName, finderParams,
1412                    finderArgs, list);
1413
1414                return list;
1415            }
1416            catch (Exception e) {
1417                throw processException(e);
1418            }
1419            finally {
1420                closeSession(session);
1421            }
1422        }
1423        else {
1424            return (List<MBMessage>)result;
1425        }
1426    }
1427
1428    public MBMessage findByC_T_First(long categoryId, long threadId,
1429        OrderByComparator obc) throws NoSuchMessageException, SystemException {
1430        List<MBMessage> list = findByC_T(categoryId, threadId, 0, 1, obc);
1431
1432        if (list.size() == 0) {
1433            StringBuilder msg = new StringBuilder();
1434
1435            msg.append("No MBMessage exists with the key {");
1436
1437            msg.append("categoryId=" + categoryId);
1438
1439            msg.append(", ");
1440            msg.append("threadId=" + threadId);
1441
1442            msg.append(StringPool.CLOSE_CURLY_BRACE);
1443
1444            throw new NoSuchMessageException(msg.toString());
1445        }
1446        else {
1447            return list.get(0);
1448        }
1449    }
1450
1451    public MBMessage findByC_T_Last(long categoryId, long threadId,
1452        OrderByComparator obc) throws NoSuchMessageException, SystemException {
1453        int count = countByC_T(categoryId, threadId);
1454
1455        List<MBMessage> list = findByC_T(categoryId, threadId, count - 1,
1456                count, obc);
1457
1458        if (list.size() == 0) {
1459            StringBuilder msg = new StringBuilder();
1460
1461            msg.append("No MBMessage exists with the key {");
1462
1463            msg.append("categoryId=" + categoryId);
1464
1465            msg.append(", ");
1466            msg.append("threadId=" + threadId);
1467
1468            msg.append(StringPool.CLOSE_CURLY_BRACE);
1469
1470            throw new NoSuchMessageException(msg.toString());
1471        }
1472        else {
1473            return list.get(0);
1474        }
1475    }
1476
1477    public MBMessage[] findByC_T_PrevAndNext(long messageId, long categoryId,
1478        long threadId, OrderByComparator obc)
1479        throws NoSuchMessageException, SystemException {
1480        MBMessage mbMessage = findByPrimaryKey(messageId);
1481
1482        int count = countByC_T(categoryId, threadId);
1483
1484        Session session = null;
1485
1486        try {
1487            session = openSession();
1488
1489            StringBuilder query = new StringBuilder();
1490
1491            query.append(
1492                "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
1493
1494            query.append("categoryId = ?");
1495
1496            query.append(" AND ");
1497
1498            query.append("threadId = ?");
1499
1500            query.append(" ");
1501
1502            if (obc != null) {
1503                query.append("ORDER BY ");
1504                query.append(obc.getOrderBy());
1505            }
1506
1507            else {
1508                query.append("ORDER BY ");
1509
1510                query.append("createDate ASC, ");
1511                query.append("messageId ASC");
1512            }
1513
1514            Query q = session.createQuery(query.toString());
1515
1516            QueryPos qPos = QueryPos.getInstance(q);
1517
1518            qPos.add(categoryId);
1519
1520            qPos.add(threadId);
1521
1522            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1523                    mbMessage);
1524
1525            MBMessage[] array = new MBMessageImpl[3];
1526
1527            array[0] = (MBMessage)objArray[0];
1528            array[1] = (MBMessage)objArray[1];
1529            array[2] = (MBMessage)objArray[2];
1530
1531            return array;
1532        }
1533        catch (Exception e) {
1534            throw processException(e);
1535        }
1536        finally {
1537            closeSession(session);
1538        }
1539    }
1540
1541    public List<MBMessage> findByT_P(long threadId, long parentMessageId)
1542        throws SystemException {
1543        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
1544        String finderClassName = MBMessage.class.getName();
1545        String finderMethodName = "findByT_P";
1546        String[] finderParams = new String[] {
1547                Long.class.getName(), Long.class.getName()
1548            };
1549        Object[] finderArgs = new Object[] {
1550                new Long(threadId), new Long(parentMessageId)
1551            };
1552
1553        Object result = null;
1554
1555        if (finderClassNameCacheEnabled) {
1556            result = FinderCacheUtil.getResult(finderClassName,
1557                    finderMethodName, finderParams, finderArgs, this);
1558        }
1559
1560        if (result == null) {
1561            Session session = null;
1562
1563            try {
1564                session = openSession();
1565
1566                StringBuilder query = new StringBuilder();
1567
1568                query.append(
1569                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
1570
1571                query.append("threadId = ?");
1572
1573                query.append(" AND ");
1574
1575                query.append("parentMessageId = ?");
1576
1577                query.append(" ");
1578
1579                query.append("ORDER BY ");
1580
1581                query.append("createDate ASC, ");
1582                query.append("messageId ASC");
1583
1584                Query q = session.createQuery(query.toString());
1585
1586                QueryPos qPos = QueryPos.getInstance(q);
1587
1588                qPos.add(threadId);
1589
1590                qPos.add(parentMessageId);
1591
1592                List<MBMessage> list = q.list();
1593
1594                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1595                    finderClassName, finderMethodName, finderParams,
1596                    finderArgs, list);
1597
1598                return list;
1599            }
1600            catch (Exception e) {
1601                throw processException(e);
1602            }
1603            finally {
1604                closeSession(session);
1605            }
1606        }
1607        else {
1608            return (List<MBMessage>)result;
1609        }
1610    }
1611
1612    public List<MBMessage> findByT_P(long threadId, long parentMessageId,
1613        int start, int end) throws SystemException {
1614        return findByT_P(threadId, parentMessageId, start, end, null);
1615    }
1616
1617    public List<MBMessage> findByT_P(long threadId, long parentMessageId,
1618        int start, int end, OrderByComparator obc) throws SystemException {
1619        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
1620        String finderClassName = MBMessage.class.getName();
1621        String finderMethodName = "findByT_P";
1622        String[] finderParams = new String[] {
1623                Long.class.getName(), Long.class.getName(),
1624                
1625                "java.lang.Integer", "java.lang.Integer",
1626                "com.liferay.portal.kernel.util.OrderByComparator"
1627            };
1628        Object[] finderArgs = new Object[] {
1629                new Long(threadId), new Long(parentMessageId),
1630                
1631                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1632            };
1633
1634        Object result = null;
1635
1636        if (finderClassNameCacheEnabled) {
1637            result = FinderCacheUtil.getResult(finderClassName,
1638                    finderMethodName, finderParams, finderArgs, this);
1639        }
1640
1641        if (result == null) {
1642            Session session = null;
1643
1644            try {
1645                session = openSession();
1646
1647                StringBuilder query = new StringBuilder();
1648
1649                query.append(
1650                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
1651
1652                query.append("threadId = ?");
1653
1654                query.append(" AND ");
1655
1656                query.append("parentMessageId = ?");
1657
1658                query.append(" ");
1659
1660                if (obc != null) {
1661                    query.append("ORDER BY ");
1662                    query.append(obc.getOrderBy());
1663                }
1664
1665                else {
1666                    query.append("ORDER BY ");
1667
1668                    query.append("createDate ASC, ");
1669                    query.append("messageId ASC");
1670                }
1671
1672                Query q = session.createQuery(query.toString());
1673
1674                QueryPos qPos = QueryPos.getInstance(q);
1675
1676                qPos.add(threadId);
1677
1678                qPos.add(parentMessageId);
1679
1680                List<MBMessage> list = (List<MBMessage>)QueryUtil.list(q,
1681                        getDialect(), start, end);
1682
1683                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1684                    finderClassName, finderMethodName, finderParams,
1685                    finderArgs, list);
1686
1687                return list;
1688            }
1689            catch (Exception e) {
1690                throw processException(e);
1691            }
1692            finally {
1693                closeSession(session);
1694            }
1695        }
1696        else {
1697            return (List<MBMessage>)result;
1698        }
1699    }
1700
1701    public MBMessage findByT_P_First(long threadId, long parentMessageId,
1702        OrderByComparator obc) throws NoSuchMessageException, SystemException {
1703        List<MBMessage> list = findByT_P(threadId, parentMessageId, 0, 1, obc);
1704
1705        if (list.size() == 0) {
1706            StringBuilder msg = new StringBuilder();
1707
1708            msg.append("No MBMessage exists with the key {");
1709
1710            msg.append("threadId=" + threadId);
1711
1712            msg.append(", ");
1713            msg.append("parentMessageId=" + parentMessageId);
1714
1715            msg.append(StringPool.CLOSE_CURLY_BRACE);
1716
1717            throw new NoSuchMessageException(msg.toString());
1718        }
1719        else {
1720            return list.get(0);
1721        }
1722    }
1723
1724    public MBMessage findByT_P_Last(long threadId, long parentMessageId,
1725        OrderByComparator obc) throws NoSuchMessageException, SystemException {
1726        int count = countByT_P(threadId, parentMessageId);
1727
1728        List<MBMessage> list = findByT_P(threadId, parentMessageId, count - 1,
1729                count, obc);
1730
1731        if (list.size() == 0) {
1732            StringBuilder msg = new StringBuilder();
1733
1734            msg.append("No MBMessage exists with the key {");
1735
1736            msg.append("threadId=" + threadId);
1737
1738            msg.append(", ");
1739            msg.append("parentMessageId=" + parentMessageId);
1740
1741            msg.append(StringPool.CLOSE_CURLY_BRACE);
1742
1743            throw new NoSuchMessageException(msg.toString());
1744        }
1745        else {
1746            return list.get(0);
1747        }
1748    }
1749
1750    public MBMessage[] findByT_P_PrevAndNext(long messageId, long threadId,
1751        long parentMessageId, OrderByComparator obc)
1752        throws NoSuchMessageException, SystemException {
1753        MBMessage mbMessage = findByPrimaryKey(messageId);
1754
1755        int count = countByT_P(threadId, parentMessageId);
1756
1757        Session session = null;
1758
1759        try {
1760            session = openSession();
1761
1762            StringBuilder query = new StringBuilder();
1763
1764            query.append(
1765                "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
1766
1767            query.append("threadId = ?");
1768
1769            query.append(" AND ");
1770
1771            query.append("parentMessageId = ?");
1772
1773            query.append(" ");
1774
1775            if (obc != null) {
1776                query.append("ORDER BY ");
1777                query.append(obc.getOrderBy());
1778            }
1779
1780            else {
1781                query.append("ORDER BY ");
1782
1783                query.append("createDate ASC, ");
1784                query.append("messageId ASC");
1785            }
1786
1787            Query q = session.createQuery(query.toString());
1788
1789            QueryPos qPos = QueryPos.getInstance(q);
1790
1791            qPos.add(threadId);
1792
1793            qPos.add(parentMessageId);
1794
1795            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1796                    mbMessage);
1797
1798            MBMessage[] array = new MBMessageImpl[3];
1799
1800            array[0] = (MBMessage)objArray[0];
1801            array[1] = (MBMessage)objArray[1];
1802            array[2] = (MBMessage)objArray[2];
1803
1804            return array;
1805        }
1806        catch (Exception e) {
1807            throw processException(e);
1808        }
1809        finally {
1810            closeSession(session);
1811        }
1812    }
1813
1814    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1815        throws SystemException {
1816        Session session = null;
1817
1818        try {
1819            session = openSession();
1820
1821            dynamicQuery.compile(session);
1822
1823            return dynamicQuery.list();
1824        }
1825        catch (Exception e) {
1826            throw processException(e);
1827        }
1828        finally {
1829            closeSession(session);
1830        }
1831    }
1832
1833    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1834        int start, int end) throws SystemException {
1835        Session session = null;
1836
1837        try {
1838            session = openSession();
1839
1840            dynamicQuery.setLimit(start, end);
1841
1842            dynamicQuery.compile(session);
1843
1844            return dynamicQuery.list();
1845        }
1846        catch (Exception e) {
1847            throw processException(e);
1848        }
1849        finally {
1850            closeSession(session);
1851        }
1852    }
1853
1854    public List<MBMessage> findAll() throws SystemException {
1855        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1856    }
1857
1858    public List<MBMessage> findAll(int start, int end)
1859        throws SystemException {
1860        return findAll(start, end, null);
1861    }
1862
1863    public List<MBMessage> findAll(int start, int end, OrderByComparator obc)
1864        throws SystemException {
1865        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
1866        String finderClassName = MBMessage.class.getName();
1867        String finderMethodName = "findAll";
1868        String[] finderParams = new String[] {
1869                "java.lang.Integer", "java.lang.Integer",
1870                "com.liferay.portal.kernel.util.OrderByComparator"
1871            };
1872        Object[] finderArgs = new Object[] {
1873                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1874            };
1875
1876        Object result = null;
1877
1878        if (finderClassNameCacheEnabled) {
1879            result = FinderCacheUtil.getResult(finderClassName,
1880                    finderMethodName, finderParams, finderArgs, this);
1881        }
1882
1883        if (result == null) {
1884            Session session = null;
1885
1886            try {
1887                session = openSession();
1888
1889                StringBuilder query = new StringBuilder();
1890
1891                query.append(
1892                    "FROM com.liferay.portlet.messageboards.model.MBMessage ");
1893
1894                if (obc != null) {
1895                    query.append("ORDER BY ");
1896                    query.append(obc.getOrderBy());
1897                }
1898
1899                else {
1900                    query.append("ORDER BY ");
1901
1902                    query.append("createDate ASC, ");
1903                    query.append("messageId ASC");
1904                }
1905
1906                Query q = session.createQuery(query.toString());
1907
1908                List<MBMessage> list = null;
1909
1910                if (obc == null) {
1911                    list = (List<MBMessage>)QueryUtil.list(q, getDialect(),
1912                            start, end, false);
1913
1914                    Collections.sort(list);
1915                }
1916                else {
1917                    list = (List<MBMessage>)QueryUtil.list(q, getDialect(),
1918                            start, end);
1919                }
1920
1921                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1922                    finderClassName, finderMethodName, finderParams,
1923                    finderArgs, list);
1924
1925                return list;
1926            }
1927            catch (Exception e) {
1928                throw processException(e);
1929            }
1930            finally {
1931                closeSession(session);
1932            }
1933        }
1934        else {
1935            return (List<MBMessage>)result;
1936        }
1937    }
1938
1939    public void removeByUuid(String uuid) throws SystemException {
1940        for (MBMessage mbMessage : findByUuid(uuid)) {
1941            remove(mbMessage);
1942        }
1943    }
1944
1945    public void removeByCompanyId(long companyId) throws SystemException {
1946        for (MBMessage mbMessage : findByCompanyId(companyId)) {
1947            remove(mbMessage);
1948        }
1949    }
1950
1951    public void removeByCategoryId(long categoryId) throws SystemException {
1952        for (MBMessage mbMessage : findByCategoryId(categoryId)) {
1953            remove(mbMessage);
1954        }
1955    }
1956
1957    public void removeByThreadId(long threadId) throws SystemException {
1958        for (MBMessage mbMessage : findByThreadId(threadId)) {
1959            remove(mbMessage);
1960        }
1961    }
1962
1963    public void removeByC_T(long categoryId, long threadId)
1964        throws SystemException {
1965        for (MBMessage mbMessage : findByC_T(categoryId, threadId)) {
1966            remove(mbMessage);
1967        }
1968    }
1969
1970    public void removeByT_P(long threadId, long parentMessageId)
1971        throws SystemException {
1972        for (MBMessage mbMessage : findByT_P(threadId, parentMessageId)) {
1973            remove(mbMessage);
1974        }
1975    }
1976
1977    public void removeAll() throws SystemException {
1978        for (MBMessage mbMessage : findAll()) {
1979            remove(mbMessage);
1980        }
1981    }
1982
1983    public int countByUuid(String uuid) throws SystemException {
1984        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
1985        String finderClassName = MBMessage.class.getName();
1986        String finderMethodName = "countByUuid";
1987        String[] finderParams = new String[] { String.class.getName() };
1988        Object[] finderArgs = new Object[] { uuid };
1989
1990        Object result = null;
1991
1992        if (finderClassNameCacheEnabled) {
1993            result = FinderCacheUtil.getResult(finderClassName,
1994                    finderMethodName, finderParams, finderArgs, this);
1995        }
1996
1997        if (result == null) {
1998            Session session = null;
1999
2000            try {
2001                session = openSession();
2002
2003                StringBuilder query = new StringBuilder();
2004
2005                query.append("SELECT COUNT(*) ");
2006                query.append(
2007                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
2008
2009                if (uuid == null) {
2010                    query.append("uuid_ IS NULL");
2011                }
2012                else {
2013                    query.append("uuid_ = ?");
2014                }
2015
2016                query.append(" ");
2017
2018                Query q = session.createQuery(query.toString());
2019
2020                QueryPos qPos = QueryPos.getInstance(q);
2021
2022                if (uuid != null) {
2023                    qPos.add(uuid);
2024                }
2025
2026                Long count = null;
2027
2028                Iterator<Long> itr = q.list().iterator();
2029
2030                if (itr.hasNext()) {
2031                    count = itr.next();
2032                }
2033
2034                if (count == null) {
2035                    count = new Long(0);
2036                }
2037
2038                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2039                    finderClassName, finderMethodName, finderParams,
2040                    finderArgs, count);
2041
2042                return count.intValue();
2043            }
2044            catch (Exception e) {
2045                throw processException(e);
2046            }
2047            finally {
2048                closeSession(session);
2049            }
2050        }
2051        else {
2052            return ((Long)result).intValue();
2053        }
2054    }
2055
2056    public int countByCompanyId(long companyId) throws SystemException {
2057        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
2058        String finderClassName = MBMessage.class.getName();
2059        String finderMethodName = "countByCompanyId";
2060        String[] finderParams = new String[] { Long.class.getName() };
2061        Object[] finderArgs = new Object[] { new Long(companyId) };
2062
2063        Object result = null;
2064
2065        if (finderClassNameCacheEnabled) {
2066            result = FinderCacheUtil.getResult(finderClassName,
2067                    finderMethodName, finderParams, finderArgs, this);
2068        }
2069
2070        if (result == null) {
2071            Session session = null;
2072
2073            try {
2074                session = openSession();
2075
2076                StringBuilder query = new StringBuilder();
2077
2078                query.append("SELECT COUNT(*) ");
2079                query.append(
2080                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
2081
2082                query.append("companyId = ?");
2083
2084                query.append(" ");
2085
2086                Query q = session.createQuery(query.toString());
2087
2088                QueryPos qPos = QueryPos.getInstance(q);
2089
2090                qPos.add(companyId);
2091
2092                Long count = null;
2093
2094                Iterator<Long> itr = q.list().iterator();
2095
2096                if (itr.hasNext()) {
2097                    count = itr.next();
2098                }
2099
2100                if (count == null) {
2101                    count = new Long(0);
2102                }
2103
2104                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2105                    finderClassName, finderMethodName, finderParams,
2106                    finderArgs, count);
2107
2108                return count.intValue();
2109            }
2110            catch (Exception e) {
2111                throw processException(e);
2112            }
2113            finally {
2114                closeSession(session);
2115            }
2116        }
2117        else {
2118            return ((Long)result).intValue();
2119        }
2120    }
2121
2122    public int countByCategoryId(long categoryId) throws SystemException {
2123        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
2124        String finderClassName = MBMessage.class.getName();
2125        String finderMethodName = "countByCategoryId";
2126        String[] finderParams = new String[] { Long.class.getName() };
2127        Object[] finderArgs = new Object[] { new Long(categoryId) };
2128
2129        Object result = null;
2130
2131        if (finderClassNameCacheEnabled) {
2132            result = FinderCacheUtil.getResult(finderClassName,
2133                    finderMethodName, finderParams, finderArgs, this);
2134        }
2135
2136        if (result == null) {
2137            Session session = null;
2138
2139            try {
2140                session = openSession();
2141
2142                StringBuilder query = new StringBuilder();
2143
2144                query.append("SELECT COUNT(*) ");
2145                query.append(
2146                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
2147
2148                query.append("categoryId = ?");
2149
2150                query.append(" ");
2151
2152                Query q = session.createQuery(query.toString());
2153
2154                QueryPos qPos = QueryPos.getInstance(q);
2155
2156                qPos.add(categoryId);
2157
2158                Long count = null;
2159
2160                Iterator<Long> itr = q.list().iterator();
2161
2162                if (itr.hasNext()) {
2163                    count = itr.next();
2164                }
2165
2166                if (count == null) {
2167                    count = new Long(0);
2168                }
2169
2170                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2171                    finderClassName, finderMethodName, finderParams,
2172                    finderArgs, count);
2173
2174                return count.intValue();
2175            }
2176            catch (Exception e) {
2177                throw processException(e);
2178            }
2179            finally {
2180                closeSession(session);
2181            }
2182        }
2183        else {
2184            return ((Long)result).intValue();
2185        }
2186    }
2187
2188    public int countByThreadId(long threadId) throws SystemException {
2189        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
2190        String finderClassName = MBMessage.class.getName();
2191        String finderMethodName = "countByThreadId";
2192        String[] finderParams = new String[] { Long.class.getName() };
2193        Object[] finderArgs = new Object[] { new Long(threadId) };
2194
2195        Object result = null;
2196
2197        if (finderClassNameCacheEnabled) {
2198            result = FinderCacheUtil.getResult(finderClassName,
2199                    finderMethodName, finderParams, finderArgs, this);
2200        }
2201
2202        if (result == null) {
2203            Session session = null;
2204
2205            try {
2206                session = openSession();
2207
2208                StringBuilder query = new StringBuilder();
2209
2210                query.append("SELECT COUNT(*) ");
2211                query.append(
2212                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
2213
2214                query.append("threadId = ?");
2215
2216                query.append(" ");
2217
2218                Query q = session.createQuery(query.toString());
2219
2220                QueryPos qPos = QueryPos.getInstance(q);
2221
2222                qPos.add(threadId);
2223
2224                Long count = null;
2225
2226                Iterator<Long> itr = q.list().iterator();
2227
2228                if (itr.hasNext()) {
2229                    count = itr.next();
2230                }
2231
2232                if (count == null) {
2233                    count = new Long(0);
2234                }
2235
2236                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2237                    finderClassName, finderMethodName, finderParams,
2238                    finderArgs, count);
2239
2240                return count.intValue();
2241            }
2242            catch (Exception e) {
2243                throw processException(e);
2244            }
2245            finally {
2246                closeSession(session);
2247            }
2248        }
2249        else {
2250            return ((Long)result).intValue();
2251        }
2252    }
2253
2254    public int countByC_T(long categoryId, long threadId)
2255        throws SystemException {
2256        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
2257        String finderClassName = MBMessage.class.getName();
2258        String finderMethodName = "countByC_T";
2259        String[] finderParams = new String[] {
2260                Long.class.getName(), Long.class.getName()
2261            };
2262        Object[] finderArgs = new Object[] {
2263                new Long(categoryId), new Long(threadId)
2264            };
2265
2266        Object result = null;
2267
2268        if (finderClassNameCacheEnabled) {
2269            result = FinderCacheUtil.getResult(finderClassName,
2270                    finderMethodName, finderParams, finderArgs, this);
2271        }
2272
2273        if (result == null) {
2274            Session session = null;
2275
2276            try {
2277                session = openSession();
2278
2279                StringBuilder query = new StringBuilder();
2280
2281                query.append("SELECT COUNT(*) ");
2282                query.append(
2283                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
2284
2285                query.append("categoryId = ?");
2286
2287                query.append(" AND ");
2288
2289                query.append("threadId = ?");
2290
2291                query.append(" ");
2292
2293                Query q = session.createQuery(query.toString());
2294
2295                QueryPos qPos = QueryPos.getInstance(q);
2296
2297                qPos.add(categoryId);
2298
2299                qPos.add(threadId);
2300
2301                Long count = null;
2302
2303                Iterator<Long> itr = q.list().iterator();
2304
2305                if (itr.hasNext()) {
2306                    count = itr.next();
2307                }
2308
2309                if (count == null) {
2310                    count = new Long(0);
2311                }
2312
2313                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2314                    finderClassName, finderMethodName, finderParams,
2315                    finderArgs, count);
2316
2317                return count.intValue();
2318            }
2319            catch (Exception e) {
2320                throw processException(e);
2321            }
2322            finally {
2323                closeSession(session);
2324            }
2325        }
2326        else {
2327            return ((Long)result).intValue();
2328        }
2329    }
2330
2331    public int countByT_P(long threadId, long parentMessageId)
2332        throws SystemException {
2333        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
2334        String finderClassName = MBMessage.class.getName();
2335        String finderMethodName = "countByT_P";
2336        String[] finderParams = new String[] {
2337                Long.class.getName(), Long.class.getName()
2338            };
2339        Object[] finderArgs = new Object[] {
2340                new Long(threadId), new Long(parentMessageId)
2341            };
2342
2343        Object result = null;
2344
2345        if (finderClassNameCacheEnabled) {
2346            result = FinderCacheUtil.getResult(finderClassName,
2347                    finderMethodName, finderParams, finderArgs, this);
2348        }
2349
2350        if (result == null) {
2351            Session session = null;
2352
2353            try {
2354                session = openSession();
2355
2356                StringBuilder query = new StringBuilder();
2357
2358                query.append("SELECT COUNT(*) ");
2359                query.append(
2360                    "FROM com.liferay.portlet.messageboards.model.MBMessage WHERE ");
2361
2362                query.append("threadId = ?");
2363
2364                query.append(" AND ");
2365
2366                query.append("parentMessageId = ?");
2367
2368                query.append(" ");
2369
2370                Query q = session.createQuery(query.toString());
2371
2372                QueryPos qPos = QueryPos.getInstance(q);
2373
2374                qPos.add(threadId);
2375
2376                qPos.add(parentMessageId);
2377
2378                Long count = null;
2379
2380                Iterator<Long> itr = q.list().iterator();
2381
2382                if (itr.hasNext()) {
2383                    count = itr.next();
2384                }
2385
2386                if (count == null) {
2387                    count = new Long(0);
2388                }
2389
2390                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2391                    finderClassName, finderMethodName, finderParams,
2392                    finderArgs, count);
2393
2394                return count.intValue();
2395            }
2396            catch (Exception e) {
2397                throw processException(e);
2398            }
2399            finally {
2400                closeSession(session);
2401            }
2402        }
2403        else {
2404            return ((Long)result).intValue();
2405        }
2406    }
2407
2408    public int countAll() throws SystemException {
2409        boolean finderClassNameCacheEnabled = MBMessageModelImpl.CACHE_ENABLED;
2410        String finderClassName = MBMessage.class.getName();
2411        String finderMethodName = "countAll";
2412        String[] finderParams = new String[] {  };
2413        Object[] finderArgs = new Object[] {  };
2414
2415        Object result = null;
2416
2417        if (finderClassNameCacheEnabled) {
2418            result = FinderCacheUtil.getResult(finderClassName,
2419                    finderMethodName, finderParams, finderArgs, this);
2420        }
2421
2422        if (result == null) {
2423            Session session = null;
2424
2425            try {
2426                session = openSession();
2427
2428                Query q = session.createQuery(
2429                        "SELECT COUNT(*) FROM com.liferay.portlet.messageboards.model.MBMessage");
2430
2431                Long count = null;
2432
2433                Iterator<Long> itr = q.list().iterator();
2434
2435                if (itr.hasNext()) {
2436                    count = itr.next();
2437                }
2438
2439                if (count == null) {
2440                    count = new Long(0);
2441                }
2442
2443                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2444                    finderClassName, finderMethodName, finderParams,
2445                    finderArgs, count);
2446
2447                return count.intValue();
2448            }
2449            catch (Exception e) {
2450                throw processException(e);
2451            }
2452            finally {
2453                closeSession(session);
2454            }
2455        }
2456        else {
2457            return ((Long)result).intValue();
2458        }
2459    }
2460
2461    public void afterPropertiesSet() {
2462        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2463                    com.liferay.portal.util.PropsUtil.get(
2464                        "value.object.listener.com.liferay.portlet.messageboards.model.MBMessage")));
2465
2466        if (listenerClassNames.length > 0) {
2467            try {
2468                List<ModelListener> listenersList = new ArrayList<ModelListener>();
2469
2470                for (String listenerClassName : listenerClassNames) {
2471                    listenersList.add((ModelListener)Class.forName(
2472                            listenerClassName).newInstance());
2473                }
2474
2475                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2476            }
2477            catch (Exception e) {
2478                _log.error(e);
2479            }
2480        }
2481    }
2482
2483    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBBanPersistence.impl")
2484    protected com.liferay.portlet.messageboards.service.persistence.MBBanPersistence mbBanPersistence;
2485    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBCategoryPersistence.impl")
2486    protected com.liferay.portlet.messageboards.service.persistence.MBCategoryPersistence mbCategoryPersistence;
2487    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBDiscussionPersistence.impl")
2488    protected com.liferay.portlet.messageboards.service.persistence.MBDiscussionPersistence mbDiscussionPersistence;
2489    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMailingListPersistence.impl")
2490    protected com.liferay.portlet.messageboards.service.persistence.MBMailingListPersistence mbMailingListPersistence;
2491    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence.impl")
2492    protected com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence mbMessagePersistence;
2493    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessageFlagPersistence.impl")
2494    protected com.liferay.portlet.messageboards.service.persistence.MBMessageFlagPersistence mbMessageFlagPersistence;
2495    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBStatsUserPersistence.impl")
2496    protected com.liferay.portlet.messageboards.service.persistence.MBStatsUserPersistence mbStatsUserPersistence;
2497    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBThreadPersistence.impl")
2498    protected com.liferay.portlet.messageboards.service.persistence.MBThreadPersistence mbThreadPersistence;
2499    @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
2500    protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
2501    @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
2502    protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
2503    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
2504    protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
2505    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
2506    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
2507    @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence.impl")
2508    protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
2509    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
2510    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
2511    @BeanReference(name = "com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence.impl")
2512    protected com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence blogsEntryPersistence;
2513    @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence.impl")
2514    protected com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence ratingsStatsPersistence;
2515    @BeanReference(name = "com.liferay.portlet.social.service.persistence.SocialActivityPersistence.impl")
2516    protected com.liferay.portlet.social.service.persistence.SocialActivityPersistence socialActivityPersistence;
2517    @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsAssetPersistence.impl")
2518    protected com.liferay.portlet.tags.service.persistence.TagsAssetPersistence tagsAssetPersistence;
2519    @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsEntryPersistence.impl")
2520    protected com.liferay.portlet.tags.service.persistence.TagsEntryPersistence tagsEntryPersistence;
2521    private static Log _log = LogFactoryUtil.getLog(MBMessagePersistenceImpl.class);
2522}