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.journal.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.journal.NoSuchArticleException;
46  import com.liferay.portlet.journal.model.JournalArticle;
47  import com.liferay.portlet.journal.model.impl.JournalArticleImpl;
48  import com.liferay.portlet.journal.model.impl.JournalArticleModelImpl;
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="JournalArticlePersistenceImpl.java.html"><b><i>View Source</i></b></a>
57   *
58   * @author Brian Wing Shun Chan
59   *
60   */
61  public class JournalArticlePersistenceImpl extends BasePersistenceImpl
62      implements JournalArticlePersistence {
63      public JournalArticle create(long id) {
64          JournalArticle journalArticle = new JournalArticleImpl();
65  
66          journalArticle.setNew(true);
67          journalArticle.setPrimaryKey(id);
68  
69          String uuid = PortalUUIDUtil.generate();
70  
71          journalArticle.setUuid(uuid);
72  
73          return journalArticle;
74      }
75  
76      public JournalArticle remove(long id)
77          throws NoSuchArticleException, SystemException {
78          Session session = null;
79  
80          try {
81              session = openSession();
82  
83              JournalArticle journalArticle = (JournalArticle)session.get(JournalArticleImpl.class,
84                      new Long(id));
85  
86              if (journalArticle == null) {
87                  if (_log.isWarnEnabled()) {
88                      _log.warn("No JournalArticle exists with the primary key " +
89                          id);
90                  }
91  
92                  throw new NoSuchArticleException(
93                      "No JournalArticle exists with the primary key " + id);
94              }
95  
96              return remove(journalArticle);
97          }
98          catch (NoSuchArticleException nsee) {
99              throw nsee;
100         }
101         catch (Exception e) {
102             throw processException(e);
103         }
104         finally {
105             closeSession(session);
106         }
107     }
108 
109     public JournalArticle remove(JournalArticle journalArticle)
110         throws SystemException {
111         for (ModelListener listener : listeners) {
112             listener.onBeforeRemove(journalArticle);
113         }
114 
115         journalArticle = removeImpl(journalArticle);
116 
117         for (ModelListener listener : listeners) {
118             listener.onAfterRemove(journalArticle);
119         }
120 
121         return journalArticle;
122     }
123 
124     protected JournalArticle removeImpl(JournalArticle journalArticle)
125         throws SystemException {
126         Session session = null;
127 
128         try {
129             session = openSession();
130 
131             if (BatchSessionUtil.isEnabled()) {
132                 Object staleObject = session.get(JournalArticleImpl.class,
133                         journalArticle.getPrimaryKeyObj());
134 
135                 if (staleObject != null) {
136                     session.evict(staleObject);
137                 }
138             }
139 
140             session.delete(journalArticle);
141 
142             session.flush();
143 
144             return journalArticle;
145         }
146         catch (Exception e) {
147             throw processException(e);
148         }
149         finally {
150             closeSession(session);
151 
152             FinderCacheUtil.clearCache(JournalArticle.class.getName());
153         }
154     }
155 
156     /**
157      * @deprecated Use <code>update(JournalArticle journalArticle, boolean merge)</code>.
158      */
159     public JournalArticle update(JournalArticle journalArticle)
160         throws SystemException {
161         if (_log.isWarnEnabled()) {
162             _log.warn(
163                 "Using the deprecated update(JournalArticle journalArticle) method. Use update(JournalArticle journalArticle, boolean merge) instead.");
164         }
165 
166         return update(journalArticle, false);
167     }
168 
169     /**
170      * Add, update, or merge, the entity. This method also calls the model
171      * listeners to trigger the proper events associated with adding, deleting,
172      * or updating an entity.
173      *
174      * @param        journalArticle the entity to add, update, or merge
175      * @param        merge boolean value for whether to merge the entity. The
176      *                default value is false. Setting merge to true is more
177      *                expensive and should only be true when journalArticle is
178      *                transient. See LEP-5473 for a detailed discussion of this
179      *                method.
180      * @return        true if the portlet can be displayed via Ajax
181      */
182     public JournalArticle update(JournalArticle journalArticle, boolean merge)
183         throws SystemException {
184         boolean isNew = journalArticle.isNew();
185 
186         for (ModelListener listener : listeners) {
187             if (isNew) {
188                 listener.onBeforeCreate(journalArticle);
189             }
190             else {
191                 listener.onBeforeUpdate(journalArticle);
192             }
193         }
194 
195         journalArticle = updateImpl(journalArticle, merge);
196 
197         for (ModelListener listener : listeners) {
198             if (isNew) {
199                 listener.onAfterCreate(journalArticle);
200             }
201             else {
202                 listener.onAfterUpdate(journalArticle);
203             }
204         }
205 
206         return journalArticle;
207     }
208 
209     public JournalArticle updateImpl(
210         com.liferay.portlet.journal.model.JournalArticle journalArticle,
211         boolean merge) throws SystemException {
212         if (Validator.isNull(journalArticle.getUuid())) {
213             String uuid = PortalUUIDUtil.generate();
214 
215             journalArticle.setUuid(uuid);
216         }
217 
218         Session session = null;
219 
220         try {
221             session = openSession();
222 
223             BatchSessionUtil.update(session, journalArticle, merge);
224 
225             journalArticle.setNew(false);
226 
227             return journalArticle;
228         }
229         catch (Exception e) {
230             throw processException(e);
231         }
232         finally {
233             closeSession(session);
234 
235             FinderCacheUtil.clearCache(JournalArticle.class.getName());
236         }
237     }
238 
239     public JournalArticle findByPrimaryKey(long id)
240         throws NoSuchArticleException, SystemException {
241         JournalArticle journalArticle = fetchByPrimaryKey(id);
242 
243         if (journalArticle == null) {
244             if (_log.isWarnEnabled()) {
245                 _log.warn("No JournalArticle exists with the primary key " +
246                     id);
247             }
248 
249             throw new NoSuchArticleException(
250                 "No JournalArticle exists with the primary key " + id);
251         }
252 
253         return journalArticle;
254     }
255 
256     public JournalArticle fetchByPrimaryKey(long id) throws SystemException {
257         Session session = null;
258 
259         try {
260             session = openSession();
261 
262             return (JournalArticle)session.get(JournalArticleImpl.class,
263                 new Long(id));
264         }
265         catch (Exception e) {
266             throw processException(e);
267         }
268         finally {
269             closeSession(session);
270         }
271     }
272 
273     public List<JournalArticle> findByUuid(String uuid)
274         throws SystemException {
275         boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
276         String finderClassName = JournalArticle.class.getName();
277         String finderMethodName = "findByUuid";
278         String[] finderParams = new String[] { String.class.getName() };
279         Object[] finderArgs = new Object[] { uuid };
280 
281         Object result = null;
282 
283         if (finderClassNameCacheEnabled) {
284             result = FinderCacheUtil.getResult(finderClassName,
285                     finderMethodName, finderParams, finderArgs, this);
286         }
287 
288         if (result == null) {
289             Session session = null;
290 
291             try {
292                 session = openSession();
293 
294                 StringBuilder query = new StringBuilder();
295 
296                 query.append(
297                     "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
298 
299                 if (uuid == null) {
300                     query.append("uuid_ IS NULL");
301                 }
302                 else {
303                     query.append("uuid_ = ?");
304                 }
305 
306                 query.append(" ");
307 
308                 query.append("ORDER BY ");
309 
310                 query.append("articleId ASC, ");
311                 query.append("version DESC");
312 
313                 Query q = session.createQuery(query.toString());
314 
315                 QueryPos qPos = QueryPos.getInstance(q);
316 
317                 if (uuid != null) {
318                     qPos.add(uuid);
319                 }
320 
321                 List<JournalArticle> list = q.list();
322 
323                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
324                     finderClassName, finderMethodName, finderParams,
325                     finderArgs, list);
326 
327                 return list;
328             }
329             catch (Exception e) {
330                 throw processException(e);
331             }
332             finally {
333                 closeSession(session);
334             }
335         }
336         else {
337             return (List<JournalArticle>)result;
338         }
339     }
340 
341     public List<JournalArticle> findByUuid(String uuid, int start, int end)
342         throws SystemException {
343         return findByUuid(uuid, start, end, null);
344     }
345 
346     public List<JournalArticle> findByUuid(String uuid, int start, int end,
347         OrderByComparator obc) throws SystemException {
348         boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
349         String finderClassName = JournalArticle.class.getName();
350         String finderMethodName = "findByUuid";
351         String[] finderParams = new String[] {
352                 String.class.getName(),
353                 
354                 "java.lang.Integer", "java.lang.Integer",
355                 "com.liferay.portal.kernel.util.OrderByComparator"
356             };
357         Object[] finderArgs = new Object[] {
358                 uuid,
359                 
360                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
361             };
362 
363         Object result = null;
364 
365         if (finderClassNameCacheEnabled) {
366             result = FinderCacheUtil.getResult(finderClassName,
367                     finderMethodName, finderParams, finderArgs, this);
368         }
369 
370         if (result == null) {
371             Session session = null;
372 
373             try {
374                 session = openSession();
375 
376                 StringBuilder query = new StringBuilder();
377 
378                 query.append(
379                     "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
380 
381                 if (uuid == null) {
382                     query.append("uuid_ IS NULL");
383                 }
384                 else {
385                     query.append("uuid_ = ?");
386                 }
387 
388                 query.append(" ");
389 
390                 if (obc != null) {
391                     query.append("ORDER BY ");
392                     query.append(obc.getOrderBy());
393                 }
394 
395                 else {
396                     query.append("ORDER BY ");
397 
398                     query.append("articleId ASC, ");
399                     query.append("version DESC");
400                 }
401 
402                 Query q = session.createQuery(query.toString());
403 
404                 QueryPos qPos = QueryPos.getInstance(q);
405 
406                 if (uuid != null) {
407                     qPos.add(uuid);
408                 }
409 
410                 List<JournalArticle> list = (List<JournalArticle>)QueryUtil.list(q,
411                         getDialect(), start, end);
412 
413                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
414                     finderClassName, finderMethodName, finderParams,
415                     finderArgs, list);
416 
417                 return list;
418             }
419             catch (Exception e) {
420                 throw processException(e);
421             }
422             finally {
423                 closeSession(session);
424             }
425         }
426         else {
427             return (List<JournalArticle>)result;
428         }
429     }
430 
431     public JournalArticle findByUuid_First(String uuid, OrderByComparator obc)
432         throws NoSuchArticleException, SystemException {
433         List<JournalArticle> list = findByUuid(uuid, 0, 1, obc);
434 
435         if (list.size() == 0) {
436             StringBuilder msg = new StringBuilder();
437 
438             msg.append("No JournalArticle exists with the key {");
439 
440             msg.append("uuid=" + uuid);
441 
442             msg.append(StringPool.CLOSE_CURLY_BRACE);
443 
444             throw new NoSuchArticleException(msg.toString());
445         }
446         else {
447             return list.get(0);
448         }
449     }
450 
451     public JournalArticle findByUuid_Last(String uuid, OrderByComparator obc)
452         throws NoSuchArticleException, SystemException {
453         int count = countByUuid(uuid);
454 
455         List<JournalArticle> list = findByUuid(uuid, count - 1, count, obc);
456 
457         if (list.size() == 0) {
458             StringBuilder msg = new StringBuilder();
459 
460             msg.append("No JournalArticle exists with the key {");
461 
462             msg.append("uuid=" + uuid);
463 
464             msg.append(StringPool.CLOSE_CURLY_BRACE);
465 
466             throw new NoSuchArticleException(msg.toString());
467         }
468         else {
469             return list.get(0);
470         }
471     }
472 
473     public JournalArticle[] findByUuid_PrevAndNext(long id, String uuid,
474         OrderByComparator obc) throws NoSuchArticleException, SystemException {
475         JournalArticle journalArticle = findByPrimaryKey(id);
476 
477         int count = countByUuid(uuid);
478 
479         Session session = null;
480 
481         try {
482             session = openSession();
483 
484             StringBuilder query = new StringBuilder();
485 
486             query.append(
487                 "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
488 
489             if (uuid == null) {
490                 query.append("uuid_ IS NULL");
491             }
492             else {
493                 query.append("uuid_ = ?");
494             }
495 
496             query.append(" ");
497 
498             if (obc != null) {
499                 query.append("ORDER BY ");
500                 query.append(obc.getOrderBy());
501             }
502 
503             else {
504                 query.append("ORDER BY ");
505 
506                 query.append("articleId ASC, ");
507                 query.append("version DESC");
508             }
509 
510             Query q = session.createQuery(query.toString());
511 
512             QueryPos qPos = QueryPos.getInstance(q);
513 
514             if (uuid != null) {
515                 qPos.add(uuid);
516             }
517 
518             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
519                     journalArticle);
520 
521             JournalArticle[] array = new JournalArticleImpl[3];
522 
523             array[0] = (JournalArticle)objArray[0];
524             array[1] = (JournalArticle)objArray[1];
525             array[2] = (JournalArticle)objArray[2];
526 
527             return array;
528         }
529         catch (Exception e) {
530             throw processException(e);
531         }
532         finally {
533             closeSession(session);
534         }
535     }
536 
537     public JournalArticle findByUUID_G(String uuid, long groupId)
538         throws NoSuchArticleException, SystemException {
539         JournalArticle journalArticle = fetchByUUID_G(uuid, groupId);
540 
541         if (journalArticle == null) {
542             StringBuilder msg = new StringBuilder();
543 
544             msg.append("No JournalArticle exists with the key {");
545 
546             msg.append("uuid=" + uuid);
547 
548             msg.append(", ");
549             msg.append("groupId=" + groupId);
550 
551             msg.append(StringPool.CLOSE_CURLY_BRACE);
552 
553             if (_log.isWarnEnabled()) {
554                 _log.warn(msg.toString());
555             }
556 
557             throw new NoSuchArticleException(msg.toString());
558         }
559 
560         return journalArticle;
561     }
562 
563     public JournalArticle fetchByUUID_G(String uuid, long groupId)
564         throws SystemException {
565         boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
566         String finderClassName = JournalArticle.class.getName();
567         String finderMethodName = "fetchByUUID_G";
568         String[] finderParams = new String[] {
569                 String.class.getName(), Long.class.getName()
570             };
571         Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
572 
573         Object result = null;
574 
575         if (finderClassNameCacheEnabled) {
576             result = FinderCacheUtil.getResult(finderClassName,
577                     finderMethodName, finderParams, finderArgs, this);
578         }
579 
580         if (result == null) {
581             Session session = null;
582 
583             try {
584                 session = openSession();
585 
586                 StringBuilder query = new StringBuilder();
587 
588                 query.append(
589                     "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
590 
591                 if (uuid == null) {
592                     query.append("uuid_ IS NULL");
593                 }
594                 else {
595                     query.append("uuid_ = ?");
596                 }
597 
598                 query.append(" AND ");
599 
600                 query.append("groupId = ?");
601 
602                 query.append(" ");
603 
604                 query.append("ORDER BY ");
605 
606                 query.append("articleId ASC, ");
607                 query.append("version DESC");
608 
609                 Query q = session.createQuery(query.toString());
610 
611                 QueryPos qPos = QueryPos.getInstance(q);
612 
613                 if (uuid != null) {
614                     qPos.add(uuid);
615                 }
616 
617                 qPos.add(groupId);
618 
619                 List<JournalArticle> list = q.list();
620 
621                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
622                     finderClassName, finderMethodName, finderParams,
623                     finderArgs, list);
624 
625                 if (list.size() == 0) {
626                     return null;
627                 }
628                 else {
629                     return list.get(0);
630                 }
631             }
632             catch (Exception e) {
633                 throw processException(e);
634             }
635             finally {
636                 closeSession(session);
637             }
638         }
639         else {
640             List<JournalArticle> list = (List<JournalArticle>)result;
641 
642             if (list.size() == 0) {
643                 return null;
644             }
645             else {
646                 return list.get(0);
647             }
648         }
649     }
650 
651     public List<JournalArticle> findByGroupId(long groupId)
652         throws SystemException {
653         boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
654         String finderClassName = JournalArticle.class.getName();
655         String finderMethodName = "findByGroupId";
656         String[] finderParams = new String[] { Long.class.getName() };
657         Object[] finderArgs = new Object[] { new Long(groupId) };
658 
659         Object result = null;
660 
661         if (finderClassNameCacheEnabled) {
662             result = FinderCacheUtil.getResult(finderClassName,
663                     finderMethodName, finderParams, finderArgs, this);
664         }
665 
666         if (result == null) {
667             Session session = null;
668 
669             try {
670                 session = openSession();
671 
672                 StringBuilder query = new StringBuilder();
673 
674                 query.append(
675                     "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
676 
677                 query.append("groupId = ?");
678 
679                 query.append(" ");
680 
681                 query.append("ORDER BY ");
682 
683                 query.append("articleId ASC, ");
684                 query.append("version DESC");
685 
686                 Query q = session.createQuery(query.toString());
687 
688                 QueryPos qPos = QueryPos.getInstance(q);
689 
690                 qPos.add(groupId);
691 
692                 List<JournalArticle> list = q.list();
693 
694                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
695                     finderClassName, finderMethodName, finderParams,
696                     finderArgs, list);
697 
698                 return list;
699             }
700             catch (Exception e) {
701                 throw processException(e);
702             }
703             finally {
704                 closeSession(session);
705             }
706         }
707         else {
708             return (List<JournalArticle>)result;
709         }
710     }
711 
712     public List<JournalArticle> findByGroupId(long groupId, int start, int end)
713         throws SystemException {
714         return findByGroupId(groupId, start, end, null);
715     }
716 
717     public List<JournalArticle> findByGroupId(long groupId, int start, int end,
718         OrderByComparator obc) throws SystemException {
719         boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
720         String finderClassName = JournalArticle.class.getName();
721         String finderMethodName = "findByGroupId";
722         String[] finderParams = new String[] {
723                 Long.class.getName(),
724                 
725                 "java.lang.Integer", "java.lang.Integer",
726                 "com.liferay.portal.kernel.util.OrderByComparator"
727             };
728         Object[] finderArgs = new Object[] {
729                 new Long(groupId),
730                 
731                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
732             };
733 
734         Object result = null;
735 
736         if (finderClassNameCacheEnabled) {
737             result = FinderCacheUtil.getResult(finderClassName,
738                     finderMethodName, finderParams, finderArgs, this);
739         }
740 
741         if (result == null) {
742             Session session = null;
743 
744             try {
745                 session = openSession();
746 
747                 StringBuilder query = new StringBuilder();
748 
749                 query.append(
750                     "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
751 
752                 query.append("groupId = ?");
753 
754                 query.append(" ");
755 
756                 if (obc != null) {
757                     query.append("ORDER BY ");
758                     query.append(obc.getOrderBy());
759                 }
760 
761                 else {
762                     query.append("ORDER BY ");
763 
764                     query.append("articleId ASC, ");
765                     query.append("version DESC");
766                 }
767 
768                 Query q = session.createQuery(query.toString());
769 
770                 QueryPos qPos = QueryPos.getInstance(q);
771 
772                 qPos.add(groupId);
773 
774                 List<JournalArticle> list = (List<JournalArticle>)QueryUtil.list(q,
775                         getDialect(), start, end);
776 
777                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
778                     finderClassName, finderMethodName, finderParams,
779                     finderArgs, list);
780 
781                 return list;
782             }
783             catch (Exception e) {
784                 throw processException(e);
785             }
786             finally {
787                 closeSession(session);
788             }
789         }
790         else {
791             return (List<JournalArticle>)result;
792         }
793     }
794 
795     public JournalArticle findByGroupId_First(long groupId,
796         OrderByComparator obc) throws NoSuchArticleException, SystemException {
797         List<JournalArticle> list = findByGroupId(groupId, 0, 1, obc);
798 
799         if (list.size() == 0) {
800             StringBuilder msg = new StringBuilder();
801 
802             msg.append("No JournalArticle exists with the key {");
803 
804             msg.append("groupId=" + groupId);
805 
806             msg.append(StringPool.CLOSE_CURLY_BRACE);
807 
808             throw new NoSuchArticleException(msg.toString());
809         }
810         else {
811             return list.get(0);
812         }
813     }
814 
815     public JournalArticle findByGroupId_Last(long groupId, OrderByComparator obc)
816         throws NoSuchArticleException, SystemException {
817         int count = countByGroupId(groupId);
818 
819         List<JournalArticle> list = findByGroupId(groupId, count - 1, count, obc);
820 
821         if (list.size() == 0) {
822             StringBuilder msg = new StringBuilder();
823 
824             msg.append("No JournalArticle exists with the key {");
825 
826             msg.append("groupId=" + groupId);
827 
828             msg.append(StringPool.CLOSE_CURLY_BRACE);
829 
830             throw new NoSuchArticleException(msg.toString());
831         }
832         else {
833             return list.get(0);
834         }
835     }
836 
837     public JournalArticle[] findByGroupId_PrevAndNext(long id, long groupId,
838         OrderByComparator obc) throws NoSuchArticleException, SystemException {
839         JournalArticle journalArticle = findByPrimaryKey(id);
840 
841         int count = countByGroupId(groupId);
842 
843         Session session = null;
844 
845         try {
846             session = openSession();
847 
848             StringBuilder query = new StringBuilder();
849 
850             query.append(
851                 "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
852 
853             query.append("groupId = ?");
854 
855             query.append(" ");
856 
857             if (obc != null) {
858                 query.append("ORDER BY ");
859                 query.append(obc.getOrderBy());
860             }
861 
862             else {
863                 query.append("ORDER BY ");
864 
865                 query.append("articleId ASC, ");
866                 query.append("version DESC");
867             }
868 
869             Query q = session.createQuery(query.toString());
870 
871             QueryPos qPos = QueryPos.getInstance(q);
872 
873             qPos.add(groupId);
874 
875             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
876                     journalArticle);
877 
878             JournalArticle[] array = new JournalArticleImpl[3];
879 
880             array[0] = (JournalArticle)objArray[0];
881             array[1] = (JournalArticle)objArray[1];
882             array[2] = (JournalArticle)objArray[2];
883 
884             return array;
885         }
886         catch (Exception e) {
887             throw processException(e);
888         }
889         finally {
890             closeSession(session);
891         }
892     }
893 
894     public List<JournalArticle> findByCompanyId(long companyId)
895         throws SystemException {
896         boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
897         String finderClassName = JournalArticle.class.getName();
898         String finderMethodName = "findByCompanyId";
899         String[] finderParams = new String[] { Long.class.getName() };
900         Object[] finderArgs = new Object[] { new Long(companyId) };
901 
902         Object result = null;
903 
904         if (finderClassNameCacheEnabled) {
905             result = FinderCacheUtil.getResult(finderClassName,
906                     finderMethodName, finderParams, finderArgs, this);
907         }
908 
909         if (result == null) {
910             Session session = null;
911 
912             try {
913                 session = openSession();
914 
915                 StringBuilder query = new StringBuilder();
916 
917                 query.append(
918                     "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
919 
920                 query.append("companyId = ?");
921 
922                 query.append(" ");
923 
924                 query.append("ORDER BY ");
925 
926                 query.append("articleId ASC, ");
927                 query.append("version DESC");
928 
929                 Query q = session.createQuery(query.toString());
930 
931                 QueryPos qPos = QueryPos.getInstance(q);
932 
933                 qPos.add(companyId);
934 
935                 List<JournalArticle> list = q.list();
936 
937                 FinderCacheUtil.putResult(finderClassNameCacheEnabled,
938                     finderClassName, finderMethodName, finderParams,
939                     finderArgs, list);
940 
941                 return list;
942             }
943             catch (Exception e) {
944                 throw processException(e);
945             }
946             finally {
947                 closeSession(session);
948             }
949         }
950         else {
951             return (List<JournalArticle>)result;
952         }
953     }
954 
955     public List<JournalArticle> findByCompanyId(long companyId, int start,
956         int end) throws SystemException {
957         return findByCompanyId(companyId, start, end, null);
958     }
959 
960     public List<JournalArticle> findByCompanyId(long companyId, int start,
961         int end, OrderByComparator obc) throws SystemException {
962         boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
963         String finderClassName = JournalArticle.class.getName();
964         String finderMethodName = "findByCompanyId";
965         String[] finderParams = new String[] {
966                 Long.class.getName(),
967                 
968                 "java.lang.Integer", "java.lang.Integer",
969                 "com.liferay.portal.kernel.util.OrderByComparator"
970             };
971         Object[] finderArgs = new Object[] {
972                 new Long(companyId),
973                 
974                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
975             };
976 
977         Object result = null;
978 
979         if (finderClassNameCacheEnabled) {
980             result = FinderCacheUtil.getResult(finderClassName,
981                     finderMethodName, finderParams, finderArgs, this);
982         }
983 
984         if (result == null) {
985             Session session = null;
986 
987             try {
988                 session = openSession();
989 
990                 StringBuilder query = new StringBuilder();
991 
992                 query.append(
993                     "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
994 
995                 query.append("companyId = ?");
996 
997                 query.append(" ");
998 
999                 if (obc != null) {
1000                    query.append("ORDER BY ");
1001                    query.append(obc.getOrderBy());
1002                }
1003
1004                else {
1005                    query.append("ORDER BY ");
1006
1007                    query.append("articleId ASC, ");
1008                    query.append("version DESC");
1009                }
1010
1011                Query q = session.createQuery(query.toString());
1012
1013                QueryPos qPos = QueryPos.getInstance(q);
1014
1015                qPos.add(companyId);
1016
1017                List<JournalArticle> list = (List<JournalArticle>)QueryUtil.list(q,
1018                        getDialect(), start, end);
1019
1020                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1021                    finderClassName, finderMethodName, finderParams,
1022                    finderArgs, list);
1023
1024                return list;
1025            }
1026            catch (Exception e) {
1027                throw processException(e);
1028            }
1029            finally {
1030                closeSession(session);
1031            }
1032        }
1033        else {
1034            return (List<JournalArticle>)result;
1035        }
1036    }
1037
1038    public JournalArticle findByCompanyId_First(long companyId,
1039        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1040        List<JournalArticle> list = findByCompanyId(companyId, 0, 1, obc);
1041
1042        if (list.size() == 0) {
1043            StringBuilder msg = new StringBuilder();
1044
1045            msg.append("No JournalArticle exists with the key {");
1046
1047            msg.append("companyId=" + companyId);
1048
1049            msg.append(StringPool.CLOSE_CURLY_BRACE);
1050
1051            throw new NoSuchArticleException(msg.toString());
1052        }
1053        else {
1054            return list.get(0);
1055        }
1056    }
1057
1058    public JournalArticle findByCompanyId_Last(long companyId,
1059        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1060        int count = countByCompanyId(companyId);
1061
1062        List<JournalArticle> list = findByCompanyId(companyId, count - 1,
1063                count, obc);
1064
1065        if (list.size() == 0) {
1066            StringBuilder msg = new StringBuilder();
1067
1068            msg.append("No JournalArticle exists with the key {");
1069
1070            msg.append("companyId=" + companyId);
1071
1072            msg.append(StringPool.CLOSE_CURLY_BRACE);
1073
1074            throw new NoSuchArticleException(msg.toString());
1075        }
1076        else {
1077            return list.get(0);
1078        }
1079    }
1080
1081    public JournalArticle[] findByCompanyId_PrevAndNext(long id,
1082        long companyId, OrderByComparator obc)
1083        throws NoSuchArticleException, SystemException {
1084        JournalArticle journalArticle = findByPrimaryKey(id);
1085
1086        int count = countByCompanyId(companyId);
1087
1088        Session session = null;
1089
1090        try {
1091            session = openSession();
1092
1093            StringBuilder query = new StringBuilder();
1094
1095            query.append(
1096                "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
1097
1098            query.append("companyId = ?");
1099
1100            query.append(" ");
1101
1102            if (obc != null) {
1103                query.append("ORDER BY ");
1104                query.append(obc.getOrderBy());
1105            }
1106
1107            else {
1108                query.append("ORDER BY ");
1109
1110                query.append("articleId ASC, ");
1111                query.append("version DESC");
1112            }
1113
1114            Query q = session.createQuery(query.toString());
1115
1116            QueryPos qPos = QueryPos.getInstance(q);
1117
1118            qPos.add(companyId);
1119
1120            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1121                    journalArticle);
1122
1123            JournalArticle[] array = new JournalArticleImpl[3];
1124
1125            array[0] = (JournalArticle)objArray[0];
1126            array[1] = (JournalArticle)objArray[1];
1127            array[2] = (JournalArticle)objArray[2];
1128
1129            return array;
1130        }
1131        catch (Exception e) {
1132            throw processException(e);
1133        }
1134        finally {
1135            closeSession(session);
1136        }
1137    }
1138
1139    public List<JournalArticle> findBySmallImageId(long smallImageId)
1140        throws SystemException {
1141        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
1142        String finderClassName = JournalArticle.class.getName();
1143        String finderMethodName = "findBySmallImageId";
1144        String[] finderParams = new String[] { Long.class.getName() };
1145        Object[] finderArgs = new Object[] { new Long(smallImageId) };
1146
1147        Object result = null;
1148
1149        if (finderClassNameCacheEnabled) {
1150            result = FinderCacheUtil.getResult(finderClassName,
1151                    finderMethodName, finderParams, finderArgs, this);
1152        }
1153
1154        if (result == null) {
1155            Session session = null;
1156
1157            try {
1158                session = openSession();
1159
1160                StringBuilder query = new StringBuilder();
1161
1162                query.append(
1163                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
1164
1165                query.append("smallImageId = ?");
1166
1167                query.append(" ");
1168
1169                query.append("ORDER BY ");
1170
1171                query.append("articleId ASC, ");
1172                query.append("version DESC");
1173
1174                Query q = session.createQuery(query.toString());
1175
1176                QueryPos qPos = QueryPos.getInstance(q);
1177
1178                qPos.add(smallImageId);
1179
1180                List<JournalArticle> list = q.list();
1181
1182                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1183                    finderClassName, finderMethodName, finderParams,
1184                    finderArgs, list);
1185
1186                return list;
1187            }
1188            catch (Exception e) {
1189                throw processException(e);
1190            }
1191            finally {
1192                closeSession(session);
1193            }
1194        }
1195        else {
1196            return (List<JournalArticle>)result;
1197        }
1198    }
1199
1200    public List<JournalArticle> findBySmallImageId(long smallImageId,
1201        int start, int end) throws SystemException {
1202        return findBySmallImageId(smallImageId, start, end, null);
1203    }
1204
1205    public List<JournalArticle> findBySmallImageId(long smallImageId,
1206        int start, int end, OrderByComparator obc) throws SystemException {
1207        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
1208        String finderClassName = JournalArticle.class.getName();
1209        String finderMethodName = "findBySmallImageId";
1210        String[] finderParams = new String[] {
1211                Long.class.getName(),
1212                
1213                "java.lang.Integer", "java.lang.Integer",
1214                "com.liferay.portal.kernel.util.OrderByComparator"
1215            };
1216        Object[] finderArgs = new Object[] {
1217                new Long(smallImageId),
1218                
1219                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1220            };
1221
1222        Object result = null;
1223
1224        if (finderClassNameCacheEnabled) {
1225            result = FinderCacheUtil.getResult(finderClassName,
1226                    finderMethodName, finderParams, finderArgs, this);
1227        }
1228
1229        if (result == null) {
1230            Session session = null;
1231
1232            try {
1233                session = openSession();
1234
1235                StringBuilder query = new StringBuilder();
1236
1237                query.append(
1238                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
1239
1240                query.append("smallImageId = ?");
1241
1242                query.append(" ");
1243
1244                if (obc != null) {
1245                    query.append("ORDER BY ");
1246                    query.append(obc.getOrderBy());
1247                }
1248
1249                else {
1250                    query.append("ORDER BY ");
1251
1252                    query.append("articleId ASC, ");
1253                    query.append("version DESC");
1254                }
1255
1256                Query q = session.createQuery(query.toString());
1257
1258                QueryPos qPos = QueryPos.getInstance(q);
1259
1260                qPos.add(smallImageId);
1261
1262                List<JournalArticle> list = (List<JournalArticle>)QueryUtil.list(q,
1263                        getDialect(), start, end);
1264
1265                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1266                    finderClassName, finderMethodName, finderParams,
1267                    finderArgs, list);
1268
1269                return list;
1270            }
1271            catch (Exception e) {
1272                throw processException(e);
1273            }
1274            finally {
1275                closeSession(session);
1276            }
1277        }
1278        else {
1279            return (List<JournalArticle>)result;
1280        }
1281    }
1282
1283    public JournalArticle findBySmallImageId_First(long smallImageId,
1284        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1285        List<JournalArticle> list = findBySmallImageId(smallImageId, 0, 1, obc);
1286
1287        if (list.size() == 0) {
1288            StringBuilder msg = new StringBuilder();
1289
1290            msg.append("No JournalArticle exists with the key {");
1291
1292            msg.append("smallImageId=" + smallImageId);
1293
1294            msg.append(StringPool.CLOSE_CURLY_BRACE);
1295
1296            throw new NoSuchArticleException(msg.toString());
1297        }
1298        else {
1299            return list.get(0);
1300        }
1301    }
1302
1303    public JournalArticle findBySmallImageId_Last(long smallImageId,
1304        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1305        int count = countBySmallImageId(smallImageId);
1306
1307        List<JournalArticle> list = findBySmallImageId(smallImageId, count - 1,
1308                count, obc);
1309
1310        if (list.size() == 0) {
1311            StringBuilder msg = new StringBuilder();
1312
1313            msg.append("No JournalArticle exists with the key {");
1314
1315            msg.append("smallImageId=" + smallImageId);
1316
1317            msg.append(StringPool.CLOSE_CURLY_BRACE);
1318
1319            throw new NoSuchArticleException(msg.toString());
1320        }
1321        else {
1322            return list.get(0);
1323        }
1324    }
1325
1326    public JournalArticle[] findBySmallImageId_PrevAndNext(long id,
1327        long smallImageId, OrderByComparator obc)
1328        throws NoSuchArticleException, SystemException {
1329        JournalArticle journalArticle = findByPrimaryKey(id);
1330
1331        int count = countBySmallImageId(smallImageId);
1332
1333        Session session = null;
1334
1335        try {
1336            session = openSession();
1337
1338            StringBuilder query = new StringBuilder();
1339
1340            query.append(
1341                "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
1342
1343            query.append("smallImageId = ?");
1344
1345            query.append(" ");
1346
1347            if (obc != null) {
1348                query.append("ORDER BY ");
1349                query.append(obc.getOrderBy());
1350            }
1351
1352            else {
1353                query.append("ORDER BY ");
1354
1355                query.append("articleId ASC, ");
1356                query.append("version DESC");
1357            }
1358
1359            Query q = session.createQuery(query.toString());
1360
1361            QueryPos qPos = QueryPos.getInstance(q);
1362
1363            qPos.add(smallImageId);
1364
1365            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1366                    journalArticle);
1367
1368            JournalArticle[] array = new JournalArticleImpl[3];
1369
1370            array[0] = (JournalArticle)objArray[0];
1371            array[1] = (JournalArticle)objArray[1];
1372            array[2] = (JournalArticle)objArray[2];
1373
1374            return array;
1375        }
1376        catch (Exception e) {
1377            throw processException(e);
1378        }
1379        finally {
1380            closeSession(session);
1381        }
1382    }
1383
1384    public List<JournalArticle> findByR_A(long resourcePrimKey, boolean approved)
1385        throws SystemException {
1386        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
1387        String finderClassName = JournalArticle.class.getName();
1388        String finderMethodName = "findByR_A";
1389        String[] finderParams = new String[] {
1390                Long.class.getName(), Boolean.class.getName()
1391            };
1392        Object[] finderArgs = new Object[] {
1393                new Long(resourcePrimKey), Boolean.valueOf(approved)
1394            };
1395
1396        Object result = null;
1397
1398        if (finderClassNameCacheEnabled) {
1399            result = FinderCacheUtil.getResult(finderClassName,
1400                    finderMethodName, finderParams, finderArgs, this);
1401        }
1402
1403        if (result == null) {
1404            Session session = null;
1405
1406            try {
1407                session = openSession();
1408
1409                StringBuilder query = new StringBuilder();
1410
1411                query.append(
1412                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
1413
1414                query.append("resourcePrimKey = ?");
1415
1416                query.append(" AND ");
1417
1418                query.append("approved = ?");
1419
1420                query.append(" ");
1421
1422                query.append("ORDER BY ");
1423
1424                query.append("articleId ASC, ");
1425                query.append("version DESC");
1426
1427                Query q = session.createQuery(query.toString());
1428
1429                QueryPos qPos = QueryPos.getInstance(q);
1430
1431                qPos.add(resourcePrimKey);
1432
1433                qPos.add(approved);
1434
1435                List<JournalArticle> list = q.list();
1436
1437                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1438                    finderClassName, finderMethodName, finderParams,
1439                    finderArgs, list);
1440
1441                return list;
1442            }
1443            catch (Exception e) {
1444                throw processException(e);
1445            }
1446            finally {
1447                closeSession(session);
1448            }
1449        }
1450        else {
1451            return (List<JournalArticle>)result;
1452        }
1453    }
1454
1455    public List<JournalArticle> findByR_A(long resourcePrimKey,
1456        boolean approved, int start, int end) throws SystemException {
1457        return findByR_A(resourcePrimKey, approved, start, end, null);
1458    }
1459
1460    public List<JournalArticle> findByR_A(long resourcePrimKey,
1461        boolean approved, int start, int end, OrderByComparator obc)
1462        throws SystemException {
1463        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
1464        String finderClassName = JournalArticle.class.getName();
1465        String finderMethodName = "findByR_A";
1466        String[] finderParams = new String[] {
1467                Long.class.getName(), Boolean.class.getName(),
1468                
1469                "java.lang.Integer", "java.lang.Integer",
1470                "com.liferay.portal.kernel.util.OrderByComparator"
1471            };
1472        Object[] finderArgs = new Object[] {
1473                new Long(resourcePrimKey), Boolean.valueOf(approved),
1474                
1475                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1476            };
1477
1478        Object result = null;
1479
1480        if (finderClassNameCacheEnabled) {
1481            result = FinderCacheUtil.getResult(finderClassName,
1482                    finderMethodName, finderParams, finderArgs, this);
1483        }
1484
1485        if (result == null) {
1486            Session session = null;
1487
1488            try {
1489                session = openSession();
1490
1491                StringBuilder query = new StringBuilder();
1492
1493                query.append(
1494                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
1495
1496                query.append("resourcePrimKey = ?");
1497
1498                query.append(" AND ");
1499
1500                query.append("approved = ?");
1501
1502                query.append(" ");
1503
1504                if (obc != null) {
1505                    query.append("ORDER BY ");
1506                    query.append(obc.getOrderBy());
1507                }
1508
1509                else {
1510                    query.append("ORDER BY ");
1511
1512                    query.append("articleId ASC, ");
1513                    query.append("version DESC");
1514                }
1515
1516                Query q = session.createQuery(query.toString());
1517
1518                QueryPos qPos = QueryPos.getInstance(q);
1519
1520                qPos.add(resourcePrimKey);
1521
1522                qPos.add(approved);
1523
1524                List<JournalArticle> list = (List<JournalArticle>)QueryUtil.list(q,
1525                        getDialect(), start, end);
1526
1527                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1528                    finderClassName, finderMethodName, finderParams,
1529                    finderArgs, list);
1530
1531                return list;
1532            }
1533            catch (Exception e) {
1534                throw processException(e);
1535            }
1536            finally {
1537                closeSession(session);
1538            }
1539        }
1540        else {
1541            return (List<JournalArticle>)result;
1542        }
1543    }
1544
1545    public JournalArticle findByR_A_First(long resourcePrimKey,
1546        boolean approved, OrderByComparator obc)
1547        throws NoSuchArticleException, SystemException {
1548        List<JournalArticle> list = findByR_A(resourcePrimKey, approved, 0, 1,
1549                obc);
1550
1551        if (list.size() == 0) {
1552            StringBuilder msg = new StringBuilder();
1553
1554            msg.append("No JournalArticle exists with the key {");
1555
1556            msg.append("resourcePrimKey=" + resourcePrimKey);
1557
1558            msg.append(", ");
1559            msg.append("approved=" + approved);
1560
1561            msg.append(StringPool.CLOSE_CURLY_BRACE);
1562
1563            throw new NoSuchArticleException(msg.toString());
1564        }
1565        else {
1566            return list.get(0);
1567        }
1568    }
1569
1570    public JournalArticle findByR_A_Last(long resourcePrimKey,
1571        boolean approved, OrderByComparator obc)
1572        throws NoSuchArticleException, SystemException {
1573        int count = countByR_A(resourcePrimKey, approved);
1574
1575        List<JournalArticle> list = findByR_A(resourcePrimKey, approved,
1576                count - 1, count, obc);
1577
1578        if (list.size() == 0) {
1579            StringBuilder msg = new StringBuilder();
1580
1581            msg.append("No JournalArticle exists with the key {");
1582
1583            msg.append("resourcePrimKey=" + resourcePrimKey);
1584
1585            msg.append(", ");
1586            msg.append("approved=" + approved);
1587
1588            msg.append(StringPool.CLOSE_CURLY_BRACE);
1589
1590            throw new NoSuchArticleException(msg.toString());
1591        }
1592        else {
1593            return list.get(0);
1594        }
1595    }
1596
1597    public JournalArticle[] findByR_A_PrevAndNext(long id,
1598        long resourcePrimKey, boolean approved, OrderByComparator obc)
1599        throws NoSuchArticleException, SystemException {
1600        JournalArticle journalArticle = findByPrimaryKey(id);
1601
1602        int count = countByR_A(resourcePrimKey, approved);
1603
1604        Session session = null;
1605
1606        try {
1607            session = openSession();
1608
1609            StringBuilder query = new StringBuilder();
1610
1611            query.append(
1612                "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
1613
1614            query.append("resourcePrimKey = ?");
1615
1616            query.append(" AND ");
1617
1618            query.append("approved = ?");
1619
1620            query.append(" ");
1621
1622            if (obc != null) {
1623                query.append("ORDER BY ");
1624                query.append(obc.getOrderBy());
1625            }
1626
1627            else {
1628                query.append("ORDER BY ");
1629
1630                query.append("articleId ASC, ");
1631                query.append("version DESC");
1632            }
1633
1634            Query q = session.createQuery(query.toString());
1635
1636            QueryPos qPos = QueryPos.getInstance(q);
1637
1638            qPos.add(resourcePrimKey);
1639
1640            qPos.add(approved);
1641
1642            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1643                    journalArticle);
1644
1645            JournalArticle[] array = new JournalArticleImpl[3];
1646
1647            array[0] = (JournalArticle)objArray[0];
1648            array[1] = (JournalArticle)objArray[1];
1649            array[2] = (JournalArticle)objArray[2];
1650
1651            return array;
1652        }
1653        catch (Exception e) {
1654            throw processException(e);
1655        }
1656        finally {
1657            closeSession(session);
1658        }
1659    }
1660
1661    public List<JournalArticle> findByG_A(long groupId, String articleId)
1662        throws SystemException {
1663        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
1664        String finderClassName = JournalArticle.class.getName();
1665        String finderMethodName = "findByG_A";
1666        String[] finderParams = new String[] {
1667                Long.class.getName(), String.class.getName()
1668            };
1669        Object[] finderArgs = new Object[] { new Long(groupId), articleId };
1670
1671        Object result = null;
1672
1673        if (finderClassNameCacheEnabled) {
1674            result = FinderCacheUtil.getResult(finderClassName,
1675                    finderMethodName, finderParams, finderArgs, this);
1676        }
1677
1678        if (result == null) {
1679            Session session = null;
1680
1681            try {
1682                session = openSession();
1683
1684                StringBuilder query = new StringBuilder();
1685
1686                query.append(
1687                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
1688
1689                query.append("groupId = ?");
1690
1691                query.append(" AND ");
1692
1693                if (articleId == null) {
1694                    query.append("articleId IS NULL");
1695                }
1696                else {
1697                    query.append("articleId = ?");
1698                }
1699
1700                query.append(" ");
1701
1702                query.append("ORDER BY ");
1703
1704                query.append("articleId ASC, ");
1705                query.append("version DESC");
1706
1707                Query q = session.createQuery(query.toString());
1708
1709                QueryPos qPos = QueryPos.getInstance(q);
1710
1711                qPos.add(groupId);
1712
1713                if (articleId != null) {
1714                    qPos.add(articleId);
1715                }
1716
1717                List<JournalArticle> list = q.list();
1718
1719                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1720                    finderClassName, finderMethodName, finderParams,
1721                    finderArgs, list);
1722
1723                return list;
1724            }
1725            catch (Exception e) {
1726                throw processException(e);
1727            }
1728            finally {
1729                closeSession(session);
1730            }
1731        }
1732        else {
1733            return (List<JournalArticle>)result;
1734        }
1735    }
1736
1737    public List<JournalArticle> findByG_A(long groupId, String articleId,
1738        int start, int end) throws SystemException {
1739        return findByG_A(groupId, articleId, start, end, null);
1740    }
1741
1742    public List<JournalArticle> findByG_A(long groupId, String articleId,
1743        int start, int end, OrderByComparator obc) throws SystemException {
1744        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
1745        String finderClassName = JournalArticle.class.getName();
1746        String finderMethodName = "findByG_A";
1747        String[] finderParams = new String[] {
1748                Long.class.getName(), String.class.getName(),
1749                
1750                "java.lang.Integer", "java.lang.Integer",
1751                "com.liferay.portal.kernel.util.OrderByComparator"
1752            };
1753        Object[] finderArgs = new Object[] {
1754                new Long(groupId),
1755                
1756                articleId,
1757                
1758                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1759            };
1760
1761        Object result = null;
1762
1763        if (finderClassNameCacheEnabled) {
1764            result = FinderCacheUtil.getResult(finderClassName,
1765                    finderMethodName, finderParams, finderArgs, this);
1766        }
1767
1768        if (result == null) {
1769            Session session = null;
1770
1771            try {
1772                session = openSession();
1773
1774                StringBuilder query = new StringBuilder();
1775
1776                query.append(
1777                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
1778
1779                query.append("groupId = ?");
1780
1781                query.append(" AND ");
1782
1783                if (articleId == null) {
1784                    query.append("articleId IS NULL");
1785                }
1786                else {
1787                    query.append("articleId = ?");
1788                }
1789
1790                query.append(" ");
1791
1792                if (obc != null) {
1793                    query.append("ORDER BY ");
1794                    query.append(obc.getOrderBy());
1795                }
1796
1797                else {
1798                    query.append("ORDER BY ");
1799
1800                    query.append("articleId ASC, ");
1801                    query.append("version DESC");
1802                }
1803
1804                Query q = session.createQuery(query.toString());
1805
1806                QueryPos qPos = QueryPos.getInstance(q);
1807
1808                qPos.add(groupId);
1809
1810                if (articleId != null) {
1811                    qPos.add(articleId);
1812                }
1813
1814                List<JournalArticle> list = (List<JournalArticle>)QueryUtil.list(q,
1815                        getDialect(), start, end);
1816
1817                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
1818                    finderClassName, finderMethodName, finderParams,
1819                    finderArgs, list);
1820
1821                return list;
1822            }
1823            catch (Exception e) {
1824                throw processException(e);
1825            }
1826            finally {
1827                closeSession(session);
1828            }
1829        }
1830        else {
1831            return (List<JournalArticle>)result;
1832        }
1833    }
1834
1835    public JournalArticle findByG_A_First(long groupId, String articleId,
1836        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1837        List<JournalArticle> list = findByG_A(groupId, articleId, 0, 1, obc);
1838
1839        if (list.size() == 0) {
1840            StringBuilder msg = new StringBuilder();
1841
1842            msg.append("No JournalArticle exists with the key {");
1843
1844            msg.append("groupId=" + groupId);
1845
1846            msg.append(", ");
1847            msg.append("articleId=" + articleId);
1848
1849            msg.append(StringPool.CLOSE_CURLY_BRACE);
1850
1851            throw new NoSuchArticleException(msg.toString());
1852        }
1853        else {
1854            return list.get(0);
1855        }
1856    }
1857
1858    public JournalArticle findByG_A_Last(long groupId, String articleId,
1859        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1860        int count = countByG_A(groupId, articleId);
1861
1862        List<JournalArticle> list = findByG_A(groupId, articleId, count - 1,
1863                count, obc);
1864
1865        if (list.size() == 0) {
1866            StringBuilder msg = new StringBuilder();
1867
1868            msg.append("No JournalArticle exists with the key {");
1869
1870            msg.append("groupId=" + groupId);
1871
1872            msg.append(", ");
1873            msg.append("articleId=" + articleId);
1874
1875            msg.append(StringPool.CLOSE_CURLY_BRACE);
1876
1877            throw new NoSuchArticleException(msg.toString());
1878        }
1879        else {
1880            return list.get(0);
1881        }
1882    }
1883
1884    public JournalArticle[] findByG_A_PrevAndNext(long id, long groupId,
1885        String articleId, OrderByComparator obc)
1886        throws NoSuchArticleException, SystemException {
1887        JournalArticle journalArticle = findByPrimaryKey(id);
1888
1889        int count = countByG_A(groupId, articleId);
1890
1891        Session session = null;
1892
1893        try {
1894            session = openSession();
1895
1896            StringBuilder query = new StringBuilder();
1897
1898            query.append(
1899                "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
1900
1901            query.append("groupId = ?");
1902
1903            query.append(" AND ");
1904
1905            if (articleId == null) {
1906                query.append("articleId IS NULL");
1907            }
1908            else {
1909                query.append("articleId = ?");
1910            }
1911
1912            query.append(" ");
1913
1914            if (obc != null) {
1915                query.append("ORDER BY ");
1916                query.append(obc.getOrderBy());
1917            }
1918
1919            else {
1920                query.append("ORDER BY ");
1921
1922                query.append("articleId ASC, ");
1923                query.append("version DESC");
1924            }
1925
1926            Query q = session.createQuery(query.toString());
1927
1928            QueryPos qPos = QueryPos.getInstance(q);
1929
1930            qPos.add(groupId);
1931
1932            if (articleId != null) {
1933                qPos.add(articleId);
1934            }
1935
1936            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1937                    journalArticle);
1938
1939            JournalArticle[] array = new JournalArticleImpl[3];
1940
1941            array[0] = (JournalArticle)objArray[0];
1942            array[1] = (JournalArticle)objArray[1];
1943            array[2] = (JournalArticle)objArray[2];
1944
1945            return array;
1946        }
1947        catch (Exception e) {
1948            throw processException(e);
1949        }
1950        finally {
1951            closeSession(session);
1952        }
1953    }
1954
1955    public List<JournalArticle> findByG_S(long groupId, String structureId)
1956        throws SystemException {
1957        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
1958        String finderClassName = JournalArticle.class.getName();
1959        String finderMethodName = "findByG_S";
1960        String[] finderParams = new String[] {
1961                Long.class.getName(), String.class.getName()
1962            };
1963        Object[] finderArgs = new Object[] { new Long(groupId), structureId };
1964
1965        Object result = null;
1966
1967        if (finderClassNameCacheEnabled) {
1968            result = FinderCacheUtil.getResult(finderClassName,
1969                    finderMethodName, finderParams, finderArgs, this);
1970        }
1971
1972        if (result == null) {
1973            Session session = null;
1974
1975            try {
1976                session = openSession();
1977
1978                StringBuilder query = new StringBuilder();
1979
1980                query.append(
1981                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
1982
1983                query.append("groupId = ?");
1984
1985                query.append(" AND ");
1986
1987                if (structureId == null) {
1988                    query.append("structureId IS NULL");
1989                }
1990                else {
1991                    query.append("structureId = ?");
1992                }
1993
1994                query.append(" ");
1995
1996                query.append("ORDER BY ");
1997
1998                query.append("articleId ASC, ");
1999                query.append("version DESC");
2000
2001                Query q = session.createQuery(query.toString());
2002
2003                QueryPos qPos = QueryPos.getInstance(q);
2004
2005                qPos.add(groupId);
2006
2007                if (structureId != null) {
2008                    qPos.add(structureId);
2009                }
2010
2011                List<JournalArticle> list = q.list();
2012
2013                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2014                    finderClassName, finderMethodName, finderParams,
2015                    finderArgs, list);
2016
2017                return list;
2018            }
2019            catch (Exception e) {
2020                throw processException(e);
2021            }
2022            finally {
2023                closeSession(session);
2024            }
2025        }
2026        else {
2027            return (List<JournalArticle>)result;
2028        }
2029    }
2030
2031    public List<JournalArticle> findByG_S(long groupId, String structureId,
2032        int start, int end) throws SystemException {
2033        return findByG_S(groupId, structureId, start, end, null);
2034    }
2035
2036    public List<JournalArticle> findByG_S(long groupId, String structureId,
2037        int start, int end, OrderByComparator obc) throws SystemException {
2038        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
2039        String finderClassName = JournalArticle.class.getName();
2040        String finderMethodName = "findByG_S";
2041        String[] finderParams = new String[] {
2042                Long.class.getName(), String.class.getName(),
2043                
2044                "java.lang.Integer", "java.lang.Integer",
2045                "com.liferay.portal.kernel.util.OrderByComparator"
2046            };
2047        Object[] finderArgs = new Object[] {
2048                new Long(groupId),
2049                
2050                structureId,
2051                
2052                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2053            };
2054
2055        Object result = null;
2056
2057        if (finderClassNameCacheEnabled) {
2058            result = FinderCacheUtil.getResult(finderClassName,
2059                    finderMethodName, finderParams, finderArgs, this);
2060        }
2061
2062        if (result == null) {
2063            Session session = null;
2064
2065            try {
2066                session = openSession();
2067
2068                StringBuilder query = new StringBuilder();
2069
2070                query.append(
2071                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
2072
2073                query.append("groupId = ?");
2074
2075                query.append(" AND ");
2076
2077                if (structureId == null) {
2078                    query.append("structureId IS NULL");
2079                }
2080                else {
2081                    query.append("structureId = ?");
2082                }
2083
2084                query.append(" ");
2085
2086                if (obc != null) {
2087                    query.append("ORDER BY ");
2088                    query.append(obc.getOrderBy());
2089                }
2090
2091                else {
2092                    query.append("ORDER BY ");
2093
2094                    query.append("articleId ASC, ");
2095                    query.append("version DESC");
2096                }
2097
2098                Query q = session.createQuery(query.toString());
2099
2100                QueryPos qPos = QueryPos.getInstance(q);
2101
2102                qPos.add(groupId);
2103
2104                if (structureId != null) {
2105                    qPos.add(structureId);
2106                }
2107
2108                List<JournalArticle> list = (List<JournalArticle>)QueryUtil.list(q,
2109                        getDialect(), start, end);
2110
2111                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2112                    finderClassName, finderMethodName, finderParams,
2113                    finderArgs, list);
2114
2115                return list;
2116            }
2117            catch (Exception e) {
2118                throw processException(e);
2119            }
2120            finally {
2121                closeSession(session);
2122            }
2123        }
2124        else {
2125            return (List<JournalArticle>)result;
2126        }
2127    }
2128
2129    public JournalArticle findByG_S_First(long groupId, String structureId,
2130        OrderByComparator obc) throws NoSuchArticleException, SystemException {
2131        List<JournalArticle> list = findByG_S(groupId, structureId, 0, 1, obc);
2132
2133        if (list.size() == 0) {
2134            StringBuilder msg = new StringBuilder();
2135
2136            msg.append("No JournalArticle exists with the key {");
2137
2138            msg.append("groupId=" + groupId);
2139
2140            msg.append(", ");
2141            msg.append("structureId=" + structureId);
2142
2143            msg.append(StringPool.CLOSE_CURLY_BRACE);
2144
2145            throw new NoSuchArticleException(msg.toString());
2146        }
2147        else {
2148            return list.get(0);
2149        }
2150    }
2151
2152    public JournalArticle findByG_S_Last(long groupId, String structureId,
2153        OrderByComparator obc) throws NoSuchArticleException, SystemException {
2154        int count = countByG_S(groupId, structureId);
2155
2156        List<JournalArticle> list = findByG_S(groupId, structureId, count - 1,
2157                count, obc);
2158
2159        if (list.size() == 0) {
2160            StringBuilder msg = new StringBuilder();
2161
2162            msg.append("No JournalArticle exists with the key {");
2163
2164            msg.append("groupId=" + groupId);
2165
2166            msg.append(", ");
2167            msg.append("structureId=" + structureId);
2168
2169            msg.append(StringPool.CLOSE_CURLY_BRACE);
2170
2171            throw new NoSuchArticleException(msg.toString());
2172        }
2173        else {
2174            return list.get(0);
2175        }
2176    }
2177
2178    public JournalArticle[] findByG_S_PrevAndNext(long id, long groupId,
2179        String structureId, OrderByComparator obc)
2180        throws NoSuchArticleException, SystemException {
2181        JournalArticle journalArticle = findByPrimaryKey(id);
2182
2183        int count = countByG_S(groupId, structureId);
2184
2185        Session session = null;
2186
2187        try {
2188            session = openSession();
2189
2190            StringBuilder query = new StringBuilder();
2191
2192            query.append(
2193                "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
2194
2195            query.append("groupId = ?");
2196
2197            query.append(" AND ");
2198
2199            if (structureId == null) {
2200                query.append("structureId IS NULL");
2201            }
2202            else {
2203                query.append("structureId = ?");
2204            }
2205
2206            query.append(" ");
2207
2208            if (obc != null) {
2209                query.append("ORDER BY ");
2210                query.append(obc.getOrderBy());
2211            }
2212
2213            else {
2214                query.append("ORDER BY ");
2215
2216                query.append("articleId ASC, ");
2217                query.append("version DESC");
2218            }
2219
2220            Query q = session.createQuery(query.toString());
2221
2222            QueryPos qPos = QueryPos.getInstance(q);
2223
2224            qPos.add(groupId);
2225
2226            if (structureId != null) {
2227                qPos.add(structureId);
2228            }
2229
2230            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2231                    journalArticle);
2232
2233            JournalArticle[] array = new JournalArticleImpl[3];
2234
2235            array[0] = (JournalArticle)objArray[0];
2236            array[1] = (JournalArticle)objArray[1];
2237            array[2] = (JournalArticle)objArray[2];
2238
2239            return array;
2240        }
2241        catch (Exception e) {
2242            throw processException(e);
2243        }
2244        finally {
2245            closeSession(session);
2246        }
2247    }
2248
2249    public List<JournalArticle> findByG_T(long groupId, String templateId)
2250        throws SystemException {
2251        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
2252        String finderClassName = JournalArticle.class.getName();
2253        String finderMethodName = "findByG_T";
2254        String[] finderParams = new String[] {
2255                Long.class.getName(), String.class.getName()
2256            };
2257        Object[] finderArgs = new Object[] { new Long(groupId), templateId };
2258
2259        Object result = null;
2260
2261        if (finderClassNameCacheEnabled) {
2262            result = FinderCacheUtil.getResult(finderClassName,
2263                    finderMethodName, finderParams, finderArgs, this);
2264        }
2265
2266        if (result == null) {
2267            Session session = null;
2268
2269            try {
2270                session = openSession();
2271
2272                StringBuilder query = new StringBuilder();
2273
2274                query.append(
2275                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
2276
2277                query.append("groupId = ?");
2278
2279                query.append(" AND ");
2280
2281                if (templateId == null) {
2282                    query.append("templateId IS NULL");
2283                }
2284                else {
2285                    query.append("templateId = ?");
2286                }
2287
2288                query.append(" ");
2289
2290                query.append("ORDER BY ");
2291
2292                query.append("articleId ASC, ");
2293                query.append("version DESC");
2294
2295                Query q = session.createQuery(query.toString());
2296
2297                QueryPos qPos = QueryPos.getInstance(q);
2298
2299                qPos.add(groupId);
2300
2301                if (templateId != null) {
2302                    qPos.add(templateId);
2303                }
2304
2305                List<JournalArticle> list = q.list();
2306
2307                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2308                    finderClassName, finderMethodName, finderParams,
2309                    finderArgs, list);
2310
2311                return list;
2312            }
2313            catch (Exception e) {
2314                throw processException(e);
2315            }
2316            finally {
2317                closeSession(session);
2318            }
2319        }
2320        else {
2321            return (List<JournalArticle>)result;
2322        }
2323    }
2324
2325    public List<JournalArticle> findByG_T(long groupId, String templateId,
2326        int start, int end) throws SystemException {
2327        return findByG_T(groupId, templateId, start, end, null);
2328    }
2329
2330    public List<JournalArticle> findByG_T(long groupId, String templateId,
2331        int start, int end, OrderByComparator obc) throws SystemException {
2332        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
2333        String finderClassName = JournalArticle.class.getName();
2334        String finderMethodName = "findByG_T";
2335        String[] finderParams = new String[] {
2336                Long.class.getName(), String.class.getName(),
2337                
2338                "java.lang.Integer", "java.lang.Integer",
2339                "com.liferay.portal.kernel.util.OrderByComparator"
2340            };
2341        Object[] finderArgs = new Object[] {
2342                new Long(groupId),
2343                
2344                templateId,
2345                
2346                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2347            };
2348
2349        Object result = null;
2350
2351        if (finderClassNameCacheEnabled) {
2352            result = FinderCacheUtil.getResult(finderClassName,
2353                    finderMethodName, finderParams, finderArgs, this);
2354        }
2355
2356        if (result == null) {
2357            Session session = null;
2358
2359            try {
2360                session = openSession();
2361
2362                StringBuilder query = new StringBuilder();
2363
2364                query.append(
2365                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
2366
2367                query.append("groupId = ?");
2368
2369                query.append(" AND ");
2370
2371                if (templateId == null) {
2372                    query.append("templateId IS NULL");
2373                }
2374                else {
2375                    query.append("templateId = ?");
2376                }
2377
2378                query.append(" ");
2379
2380                if (obc != null) {
2381                    query.append("ORDER BY ");
2382                    query.append(obc.getOrderBy());
2383                }
2384
2385                else {
2386                    query.append("ORDER BY ");
2387
2388                    query.append("articleId ASC, ");
2389                    query.append("version DESC");
2390                }
2391
2392                Query q = session.createQuery(query.toString());
2393
2394                QueryPos qPos = QueryPos.getInstance(q);
2395
2396                qPos.add(groupId);
2397
2398                if (templateId != null) {
2399                    qPos.add(templateId);
2400                }
2401
2402                List<JournalArticle> list = (List<JournalArticle>)QueryUtil.list(q,
2403                        getDialect(), start, end);
2404
2405                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2406                    finderClassName, finderMethodName, finderParams,
2407                    finderArgs, list);
2408
2409                return list;
2410            }
2411            catch (Exception e) {
2412                throw processException(e);
2413            }
2414            finally {
2415                closeSession(session);
2416            }
2417        }
2418        else {
2419            return (List<JournalArticle>)result;
2420        }
2421    }
2422
2423    public JournalArticle findByG_T_First(long groupId, String templateId,
2424        OrderByComparator obc) throws NoSuchArticleException, SystemException {
2425        List<JournalArticle> list = findByG_T(groupId, templateId, 0, 1, obc);
2426
2427        if (list.size() == 0) {
2428            StringBuilder msg = new StringBuilder();
2429
2430            msg.append("No JournalArticle exists with the key {");
2431
2432            msg.append("groupId=" + groupId);
2433
2434            msg.append(", ");
2435            msg.append("templateId=" + templateId);
2436
2437            msg.append(StringPool.CLOSE_CURLY_BRACE);
2438
2439            throw new NoSuchArticleException(msg.toString());
2440        }
2441        else {
2442            return list.get(0);
2443        }
2444    }
2445
2446    public JournalArticle findByG_T_Last(long groupId, String templateId,
2447        OrderByComparator obc) throws NoSuchArticleException, SystemException {
2448        int count = countByG_T(groupId, templateId);
2449
2450        List<JournalArticle> list = findByG_T(groupId, templateId, count - 1,
2451                count, obc);
2452
2453        if (list.size() == 0) {
2454            StringBuilder msg = new StringBuilder();
2455
2456            msg.append("No JournalArticle exists with the key {");
2457
2458            msg.append("groupId=" + groupId);
2459
2460            msg.append(", ");
2461            msg.append("templateId=" + templateId);
2462
2463            msg.append(StringPool.CLOSE_CURLY_BRACE);
2464
2465            throw new NoSuchArticleException(msg.toString());
2466        }
2467        else {
2468            return list.get(0);
2469        }
2470    }
2471
2472    public JournalArticle[] findByG_T_PrevAndNext(long id, long groupId,
2473        String templateId, OrderByComparator obc)
2474        throws NoSuchArticleException, SystemException {
2475        JournalArticle journalArticle = findByPrimaryKey(id);
2476
2477        int count = countByG_T(groupId, templateId);
2478
2479        Session session = null;
2480
2481        try {
2482            session = openSession();
2483
2484            StringBuilder query = new StringBuilder();
2485
2486            query.append(
2487                "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
2488
2489            query.append("groupId = ?");
2490
2491            query.append(" AND ");
2492
2493            if (templateId == null) {
2494                query.append("templateId IS NULL");
2495            }
2496            else {
2497                query.append("templateId = ?");
2498            }
2499
2500            query.append(" ");
2501
2502            if (obc != null) {
2503                query.append("ORDER BY ");
2504                query.append(obc.getOrderBy());
2505            }
2506
2507            else {
2508                query.append("ORDER BY ");
2509
2510                query.append("articleId ASC, ");
2511                query.append("version DESC");
2512            }
2513
2514            Query q = session.createQuery(query.toString());
2515
2516            QueryPos qPos = QueryPos.getInstance(q);
2517
2518            qPos.add(groupId);
2519
2520            if (templateId != null) {
2521                qPos.add(templateId);
2522            }
2523
2524            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2525                    journalArticle);
2526
2527            JournalArticle[] array = new JournalArticleImpl[3];
2528
2529            array[0] = (JournalArticle)objArray[0];
2530            array[1] = (JournalArticle)objArray[1];
2531            array[2] = (JournalArticle)objArray[2];
2532
2533            return array;
2534        }
2535        catch (Exception e) {
2536            throw processException(e);
2537        }
2538        finally {
2539            closeSession(session);
2540        }
2541    }
2542
2543    public JournalArticle findByG_A_V(long groupId, String articleId,
2544        double version) throws NoSuchArticleException, SystemException {
2545        JournalArticle journalArticle = fetchByG_A_V(groupId, articleId, version);
2546
2547        if (journalArticle == null) {
2548            StringBuilder msg = new StringBuilder();
2549
2550            msg.append("No JournalArticle exists with the key {");
2551
2552            msg.append("groupId=" + groupId);
2553
2554            msg.append(", ");
2555            msg.append("articleId=" + articleId);
2556
2557            msg.append(", ");
2558            msg.append("version=" + version);
2559
2560            msg.append(StringPool.CLOSE_CURLY_BRACE);
2561
2562            if (_log.isWarnEnabled()) {
2563                _log.warn(msg.toString());
2564            }
2565
2566            throw new NoSuchArticleException(msg.toString());
2567        }
2568
2569        return journalArticle;
2570    }
2571
2572    public JournalArticle fetchByG_A_V(long groupId, String articleId,
2573        double version) throws SystemException {
2574        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
2575        String finderClassName = JournalArticle.class.getName();
2576        String finderMethodName = "fetchByG_A_V";
2577        String[] finderParams = new String[] {
2578                Long.class.getName(), String.class.getName(),
2579                Double.class.getName()
2580            };
2581        Object[] finderArgs = new Object[] {
2582                new Long(groupId),
2583                
2584                articleId, new Double(version)
2585            };
2586
2587        Object result = null;
2588
2589        if (finderClassNameCacheEnabled) {
2590            result = FinderCacheUtil.getResult(finderClassName,
2591                    finderMethodName, finderParams, finderArgs, this);
2592        }
2593
2594        if (result == null) {
2595            Session session = null;
2596
2597            try {
2598                session = openSession();
2599
2600                StringBuilder query = new StringBuilder();
2601
2602                query.append(
2603                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
2604
2605                query.append("groupId = ?");
2606
2607                query.append(" AND ");
2608
2609                if (articleId == null) {
2610                    query.append("articleId IS NULL");
2611                }
2612                else {
2613                    query.append("articleId = ?");
2614                }
2615
2616                query.append(" AND ");
2617
2618                query.append("version = ?");
2619
2620                query.append(" ");
2621
2622                query.append("ORDER BY ");
2623
2624                query.append("articleId ASC, ");
2625                query.append("version DESC");
2626
2627                Query q = session.createQuery(query.toString());
2628
2629                QueryPos qPos = QueryPos.getInstance(q);
2630
2631                qPos.add(groupId);
2632
2633                if (articleId != null) {
2634                    qPos.add(articleId);
2635                }
2636
2637                qPos.add(version);
2638
2639                List<JournalArticle> list = q.list();
2640
2641                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2642                    finderClassName, finderMethodName, finderParams,
2643                    finderArgs, list);
2644
2645                if (list.size() == 0) {
2646                    return null;
2647                }
2648                else {
2649                    return list.get(0);
2650                }
2651            }
2652            catch (Exception e) {
2653                throw processException(e);
2654            }
2655            finally {
2656                closeSession(session);
2657            }
2658        }
2659        else {
2660            List<JournalArticle> list = (List<JournalArticle>)result;
2661
2662            if (list.size() == 0) {
2663                return null;
2664            }
2665            else {
2666                return list.get(0);
2667            }
2668        }
2669    }
2670
2671    public List<JournalArticle> findByG_A_A(long groupId, String articleId,
2672        boolean approved) throws SystemException {
2673        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
2674        String finderClassName = JournalArticle.class.getName();
2675        String finderMethodName = "findByG_A_A";
2676        String[] finderParams = new String[] {
2677                Long.class.getName(), String.class.getName(),
2678                Boolean.class.getName()
2679            };
2680        Object[] finderArgs = new Object[] {
2681                new Long(groupId),
2682                
2683                articleId, Boolean.valueOf(approved)
2684            };
2685
2686        Object result = null;
2687
2688        if (finderClassNameCacheEnabled) {
2689            result = FinderCacheUtil.getResult(finderClassName,
2690                    finderMethodName, finderParams, finderArgs, this);
2691        }
2692
2693        if (result == null) {
2694            Session session = null;
2695
2696            try {
2697                session = openSession();
2698
2699                StringBuilder query = new StringBuilder();
2700
2701                query.append(
2702                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
2703
2704                query.append("groupId = ?");
2705
2706                query.append(" AND ");
2707
2708                if (articleId == null) {
2709                    query.append("articleId IS NULL");
2710                }
2711                else {
2712                    query.append("articleId = ?");
2713                }
2714
2715                query.append(" AND ");
2716
2717                query.append("approved = ?");
2718
2719                query.append(" ");
2720
2721                query.append("ORDER BY ");
2722
2723                query.append("articleId ASC, ");
2724                query.append("version DESC");
2725
2726                Query q = session.createQuery(query.toString());
2727
2728                QueryPos qPos = QueryPos.getInstance(q);
2729
2730                qPos.add(groupId);
2731
2732                if (articleId != null) {
2733                    qPos.add(articleId);
2734                }
2735
2736                qPos.add(approved);
2737
2738                List<JournalArticle> list = q.list();
2739
2740                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2741                    finderClassName, finderMethodName, finderParams,
2742                    finderArgs, list);
2743
2744                return list;
2745            }
2746            catch (Exception e) {
2747                throw processException(e);
2748            }
2749            finally {
2750                closeSession(session);
2751            }
2752        }
2753        else {
2754            return (List<JournalArticle>)result;
2755        }
2756    }
2757
2758    public List<JournalArticle> findByG_A_A(long groupId, String articleId,
2759        boolean approved, int start, int end) throws SystemException {
2760        return findByG_A_A(groupId, articleId, approved, start, end, null);
2761    }
2762
2763    public List<JournalArticle> findByG_A_A(long groupId, String articleId,
2764        boolean approved, int start, int end, OrderByComparator obc)
2765        throws SystemException {
2766        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
2767        String finderClassName = JournalArticle.class.getName();
2768        String finderMethodName = "findByG_A_A";
2769        String[] finderParams = new String[] {
2770                Long.class.getName(), String.class.getName(),
2771                Boolean.class.getName(),
2772                
2773                "java.lang.Integer", "java.lang.Integer",
2774                "com.liferay.portal.kernel.util.OrderByComparator"
2775            };
2776        Object[] finderArgs = new Object[] {
2777                new Long(groupId),
2778                
2779                articleId, Boolean.valueOf(approved),
2780                
2781                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2782            };
2783
2784        Object result = null;
2785
2786        if (finderClassNameCacheEnabled) {
2787            result = FinderCacheUtil.getResult(finderClassName,
2788                    finderMethodName, finderParams, finderArgs, this);
2789        }
2790
2791        if (result == null) {
2792            Session session = null;
2793
2794            try {
2795                session = openSession();
2796
2797                StringBuilder query = new StringBuilder();
2798
2799                query.append(
2800                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
2801
2802                query.append("groupId = ?");
2803
2804                query.append(" AND ");
2805
2806                if (articleId == null) {
2807                    query.append("articleId IS NULL");
2808                }
2809                else {
2810                    query.append("articleId = ?");
2811                }
2812
2813                query.append(" AND ");
2814
2815                query.append("approved = ?");
2816
2817                query.append(" ");
2818
2819                if (obc != null) {
2820                    query.append("ORDER BY ");
2821                    query.append(obc.getOrderBy());
2822                }
2823
2824                else {
2825                    query.append("ORDER BY ");
2826
2827                    query.append("articleId ASC, ");
2828                    query.append("version DESC");
2829                }
2830
2831                Query q = session.createQuery(query.toString());
2832
2833                QueryPos qPos = QueryPos.getInstance(q);
2834
2835                qPos.add(groupId);
2836
2837                if (articleId != null) {
2838                    qPos.add(articleId);
2839                }
2840
2841                qPos.add(approved);
2842
2843                List<JournalArticle> list = (List<JournalArticle>)QueryUtil.list(q,
2844                        getDialect(), start, end);
2845
2846                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
2847                    finderClassName, finderMethodName, finderParams,
2848                    finderArgs, list);
2849
2850                return list;
2851            }
2852            catch (Exception e) {
2853                throw processException(e);
2854            }
2855            finally {
2856                closeSession(session);
2857            }
2858        }
2859        else {
2860            return (List<JournalArticle>)result;
2861        }
2862    }
2863
2864    public JournalArticle findByG_A_A_First(long groupId, String articleId,
2865        boolean approved, OrderByComparator obc)
2866        throws NoSuchArticleException, SystemException {
2867        List<JournalArticle> list = findByG_A_A(groupId, articleId, approved,
2868                0, 1, obc);
2869
2870        if (list.size() == 0) {
2871            StringBuilder msg = new StringBuilder();
2872
2873            msg.append("No JournalArticle exists with the key {");
2874
2875            msg.append("groupId=" + groupId);
2876
2877            msg.append(", ");
2878            msg.append("articleId=" + articleId);
2879
2880            msg.append(", ");
2881            msg.append("approved=" + approved);
2882
2883            msg.append(StringPool.CLOSE_CURLY_BRACE);
2884
2885            throw new NoSuchArticleException(msg.toString());
2886        }
2887        else {
2888            return list.get(0);
2889        }
2890    }
2891
2892    public JournalArticle findByG_A_A_Last(long groupId, String articleId,
2893        boolean approved, OrderByComparator obc)
2894        throws NoSuchArticleException, SystemException {
2895        int count = countByG_A_A(groupId, articleId, approved);
2896
2897        List<JournalArticle> list = findByG_A_A(groupId, articleId, approved,
2898                count - 1, count, obc);
2899
2900        if (list.size() == 0) {
2901            StringBuilder msg = new StringBuilder();
2902
2903            msg.append("No JournalArticle exists with the key {");
2904
2905            msg.append("groupId=" + groupId);
2906
2907            msg.append(", ");
2908            msg.append("articleId=" + articleId);
2909
2910            msg.append(", ");
2911            msg.append("approved=" + approved);
2912
2913            msg.append(StringPool.CLOSE_CURLY_BRACE);
2914
2915            throw new NoSuchArticleException(msg.toString());
2916        }
2917        else {
2918            return list.get(0);
2919        }
2920    }
2921
2922    public JournalArticle[] findByG_A_A_PrevAndNext(long id, long groupId,
2923        String articleId, boolean approved, OrderByComparator obc)
2924        throws NoSuchArticleException, SystemException {
2925        JournalArticle journalArticle = findByPrimaryKey(id);
2926
2927        int count = countByG_A_A(groupId, articleId, approved);
2928
2929        Session session = null;
2930
2931        try {
2932            session = openSession();
2933
2934            StringBuilder query = new StringBuilder();
2935
2936            query.append(
2937                "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
2938
2939            query.append("groupId = ?");
2940
2941            query.append(" AND ");
2942
2943            if (articleId == null) {
2944                query.append("articleId IS NULL");
2945            }
2946            else {
2947                query.append("articleId = ?");
2948            }
2949
2950            query.append(" AND ");
2951
2952            query.append("approved = ?");
2953
2954            query.append(" ");
2955
2956            if (obc != null) {
2957                query.append("ORDER BY ");
2958                query.append(obc.getOrderBy());
2959            }
2960
2961            else {
2962                query.append("ORDER BY ");
2963
2964                query.append("articleId ASC, ");
2965                query.append("version DESC");
2966            }
2967
2968            Query q = session.createQuery(query.toString());
2969
2970            QueryPos qPos = QueryPos.getInstance(q);
2971
2972            qPos.add(groupId);
2973
2974            if (articleId != null) {
2975                qPos.add(articleId);
2976            }
2977
2978            qPos.add(approved);
2979
2980            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2981                    journalArticle);
2982
2983            JournalArticle[] array = new JournalArticleImpl[3];
2984
2985            array[0] = (JournalArticle)objArray[0];
2986            array[1] = (JournalArticle)objArray[1];
2987            array[2] = (JournalArticle)objArray[2];
2988
2989            return array;
2990        }
2991        catch (Exception e) {
2992            throw processException(e);
2993        }
2994        finally {
2995            closeSession(session);
2996        }
2997    }
2998
2999    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
3000        throws SystemException {
3001        Session session = null;
3002
3003        try {
3004            session = openSession();
3005
3006            dynamicQuery.compile(session);
3007
3008            return dynamicQuery.list();
3009        }
3010        catch (Exception e) {
3011            throw processException(e);
3012        }
3013        finally {
3014            closeSession(session);
3015        }
3016    }
3017
3018    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
3019        int start, int end) throws SystemException {
3020        Session session = null;
3021
3022        try {
3023            session = openSession();
3024
3025            dynamicQuery.setLimit(start, end);
3026
3027            dynamicQuery.compile(session);
3028
3029            return dynamicQuery.list();
3030        }
3031        catch (Exception e) {
3032            throw processException(e);
3033        }
3034        finally {
3035            closeSession(session);
3036        }
3037    }
3038
3039    public List<JournalArticle> findAll() throws SystemException {
3040        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3041    }
3042
3043    public List<JournalArticle> findAll(int start, int end)
3044        throws SystemException {
3045        return findAll(start, end, null);
3046    }
3047
3048    public List<JournalArticle> findAll(int start, int end,
3049        OrderByComparator obc) throws SystemException {
3050        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3051        String finderClassName = JournalArticle.class.getName();
3052        String finderMethodName = "findAll";
3053        String[] finderParams = new String[] {
3054                "java.lang.Integer", "java.lang.Integer",
3055                "com.liferay.portal.kernel.util.OrderByComparator"
3056            };
3057        Object[] finderArgs = new Object[] {
3058                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
3059            };
3060
3061        Object result = null;
3062
3063        if (finderClassNameCacheEnabled) {
3064            result = FinderCacheUtil.getResult(finderClassName,
3065                    finderMethodName, finderParams, finderArgs, this);
3066        }
3067
3068        if (result == null) {
3069            Session session = null;
3070
3071            try {
3072                session = openSession();
3073
3074                StringBuilder query = new StringBuilder();
3075
3076                query.append(
3077                    "FROM com.liferay.portlet.journal.model.JournalArticle ");
3078
3079                if (obc != null) {
3080                    query.append("ORDER BY ");
3081                    query.append(obc.getOrderBy());
3082                }
3083
3084                else {
3085                    query.append("ORDER BY ");
3086
3087                    query.append("articleId ASC, ");
3088                    query.append("version DESC");
3089                }
3090
3091                Query q = session.createQuery(query.toString());
3092
3093                List<JournalArticle> list = null;
3094
3095                if (obc == null) {
3096                    list = (List<JournalArticle>)QueryUtil.list(q,
3097                            getDialect(), start, end, false);
3098
3099                    Collections.sort(list);
3100                }
3101                else {
3102                    list = (List<JournalArticle>)QueryUtil.list(q,
3103                            getDialect(), start, end);
3104                }
3105
3106                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
3107                    finderClassName, finderMethodName, finderParams,
3108                    finderArgs, list);
3109
3110                return list;
3111            }
3112            catch (Exception e) {
3113                throw processException(e);
3114            }
3115            finally {
3116                closeSession(session);
3117            }
3118        }
3119        else {
3120            return (List<JournalArticle>)result;
3121        }
3122    }
3123
3124    public void removeByUuid(String uuid) throws SystemException {
3125        for (JournalArticle journalArticle : findByUuid(uuid)) {
3126            remove(journalArticle);
3127        }
3128    }
3129
3130    public void removeByUUID_G(String uuid, long groupId)
3131        throws NoSuchArticleException, SystemException {
3132        JournalArticle journalArticle = findByUUID_G(uuid, groupId);
3133
3134        remove(journalArticle);
3135    }
3136
3137    public void removeByGroupId(long groupId) throws SystemException {
3138        for (JournalArticle journalArticle : findByGroupId(groupId)) {
3139            remove(journalArticle);
3140        }
3141    }
3142
3143    public void removeByCompanyId(long companyId) throws SystemException {
3144        for (JournalArticle journalArticle : findByCompanyId(companyId)) {
3145            remove(journalArticle);
3146        }
3147    }
3148
3149    public void removeBySmallImageId(long smallImageId)
3150        throws SystemException {
3151        for (JournalArticle journalArticle : findBySmallImageId(smallImageId)) {
3152            remove(journalArticle);
3153        }
3154    }
3155
3156    public void removeByR_A(long resourcePrimKey, boolean approved)
3157        throws SystemException {
3158        for (JournalArticle journalArticle : findByR_A(resourcePrimKey, approved)) {
3159            remove(journalArticle);
3160        }
3161    }
3162
3163    public void removeByG_A(long groupId, String articleId)
3164        throws SystemException {
3165        for (JournalArticle journalArticle : findByG_A(groupId, articleId)) {
3166            remove(journalArticle);
3167        }
3168    }
3169
3170    public void removeByG_S(long groupId, String structureId)
3171        throws SystemException {
3172        for (JournalArticle journalArticle : findByG_S(groupId, structureId)) {
3173            remove(journalArticle);
3174        }
3175    }
3176
3177    public void removeByG_T(long groupId, String templateId)
3178        throws SystemException {
3179        for (JournalArticle journalArticle : findByG_T(groupId, templateId)) {
3180            remove(journalArticle);
3181        }
3182    }
3183
3184    public void removeByG_A_V(long groupId, String articleId, double version)
3185        throws NoSuchArticleException, SystemException {
3186        JournalArticle journalArticle = findByG_A_V(groupId, articleId, version);
3187
3188        remove(journalArticle);
3189    }
3190
3191    public void removeByG_A_A(long groupId, String articleId, boolean approved)
3192        throws SystemException {
3193        for (JournalArticle journalArticle : findByG_A_A(groupId, articleId,
3194                approved)) {
3195            remove(journalArticle);
3196        }
3197    }
3198
3199    public void removeAll() throws SystemException {
3200        for (JournalArticle journalArticle : findAll()) {
3201            remove(journalArticle);
3202        }
3203    }
3204
3205    public int countByUuid(String uuid) throws SystemException {
3206        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3207        String finderClassName = JournalArticle.class.getName();
3208        String finderMethodName = "countByUuid";
3209        String[] finderParams = new String[] { String.class.getName() };
3210        Object[] finderArgs = new Object[] { uuid };
3211
3212        Object result = null;
3213
3214        if (finderClassNameCacheEnabled) {
3215            result = FinderCacheUtil.getResult(finderClassName,
3216                    finderMethodName, finderParams, finderArgs, this);
3217        }
3218
3219        if (result == null) {
3220            Session session = null;
3221
3222            try {
3223                session = openSession();
3224
3225                StringBuilder query = new StringBuilder();
3226
3227                query.append("SELECT COUNT(*) ");
3228                query.append(
3229                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
3230
3231                if (uuid == null) {
3232                    query.append("uuid_ IS NULL");
3233                }
3234                else {
3235                    query.append("uuid_ = ?");
3236                }
3237
3238                query.append(" ");
3239
3240                Query q = session.createQuery(query.toString());
3241
3242                QueryPos qPos = QueryPos.getInstance(q);
3243
3244                if (uuid != null) {
3245                    qPos.add(uuid);
3246                }
3247
3248                Long count = null;
3249
3250                Iterator<Long> itr = q.list().iterator();
3251
3252                if (itr.hasNext()) {
3253                    count = itr.next();
3254                }
3255
3256                if (count == null) {
3257                    count = new Long(0);
3258                }
3259
3260                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
3261                    finderClassName, finderMethodName, finderParams,
3262                    finderArgs, count);
3263
3264                return count.intValue();
3265            }
3266            catch (Exception e) {
3267                throw processException(e);
3268            }
3269            finally {
3270                closeSession(session);
3271            }
3272        }
3273        else {
3274            return ((Long)result).intValue();
3275        }
3276    }
3277
3278    public int countByUUID_G(String uuid, long groupId)
3279        throws SystemException {
3280        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3281        String finderClassName = JournalArticle.class.getName();
3282        String finderMethodName = "countByUUID_G";
3283        String[] finderParams = new String[] {
3284                String.class.getName(), Long.class.getName()
3285            };
3286        Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
3287
3288        Object result = null;
3289
3290        if (finderClassNameCacheEnabled) {
3291            result = FinderCacheUtil.getResult(finderClassName,
3292                    finderMethodName, finderParams, finderArgs, this);
3293        }
3294
3295        if (result == null) {
3296            Session session = null;
3297
3298            try {
3299                session = openSession();
3300
3301                StringBuilder query = new StringBuilder();
3302
3303                query.append("SELECT COUNT(*) ");
3304                query.append(
3305                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
3306
3307                if (uuid == null) {
3308                    query.append("uuid_ IS NULL");
3309                }
3310                else {
3311                    query.append("uuid_ = ?");
3312                }
3313
3314                query.append(" AND ");
3315
3316                query.append("groupId = ?");
3317
3318                query.append(" ");
3319
3320                Query q = session.createQuery(query.toString());
3321
3322                QueryPos qPos = QueryPos.getInstance(q);
3323
3324                if (uuid != null) {
3325                    qPos.add(uuid);
3326                }
3327
3328                qPos.add(groupId);
3329
3330                Long count = null;
3331
3332                Iterator<Long> itr = q.list().iterator();
3333
3334                if (itr.hasNext()) {
3335                    count = itr.next();
3336                }
3337
3338                if (count == null) {
3339                    count = new Long(0);
3340                }
3341
3342                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
3343                    finderClassName, finderMethodName, finderParams,
3344                    finderArgs, count);
3345
3346                return count.intValue();
3347            }
3348            catch (Exception e) {
3349                throw processException(e);
3350            }
3351            finally {
3352                closeSession(session);
3353            }
3354        }
3355        else {
3356            return ((Long)result).intValue();
3357        }
3358    }
3359
3360    public int countByGroupId(long groupId) throws SystemException {
3361        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3362        String finderClassName = JournalArticle.class.getName();
3363        String finderMethodName = "countByGroupId";
3364        String[] finderParams = new String[] { Long.class.getName() };
3365        Object[] finderArgs = new Object[] { new Long(groupId) };
3366
3367        Object result = null;
3368
3369        if (finderClassNameCacheEnabled) {
3370            result = FinderCacheUtil.getResult(finderClassName,
3371                    finderMethodName, finderParams, finderArgs, this);
3372        }
3373
3374        if (result == null) {
3375            Session session = null;
3376
3377            try {
3378                session = openSession();
3379
3380                StringBuilder query = new StringBuilder();
3381
3382                query.append("SELECT COUNT(*) ");
3383                query.append(
3384                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
3385
3386                query.append("groupId = ?");
3387
3388                query.append(" ");
3389
3390                Query q = session.createQuery(query.toString());
3391
3392                QueryPos qPos = QueryPos.getInstance(q);
3393
3394                qPos.add(groupId);
3395
3396                Long count = null;
3397
3398                Iterator<Long> itr = q.list().iterator();
3399
3400                if (itr.hasNext()) {
3401                    count = itr.next();
3402                }
3403
3404                if (count == null) {
3405                    count = new Long(0);
3406                }
3407
3408                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
3409                    finderClassName, finderMethodName, finderParams,
3410                    finderArgs, count);
3411
3412                return count.intValue();
3413            }
3414            catch (Exception e) {
3415                throw processException(e);
3416            }
3417            finally {
3418                closeSession(session);
3419            }
3420        }
3421        else {
3422            return ((Long)result).intValue();
3423        }
3424    }
3425
3426    public int countByCompanyId(long companyId) throws SystemException {
3427        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3428        String finderClassName = JournalArticle.class.getName();
3429        String finderMethodName = "countByCompanyId";
3430        String[] finderParams = new String[] { Long.class.getName() };
3431        Object[] finderArgs = new Object[] { new Long(companyId) };
3432
3433        Object result = null;
3434
3435        if (finderClassNameCacheEnabled) {
3436            result = FinderCacheUtil.getResult(finderClassName,
3437                    finderMethodName, finderParams, finderArgs, this);
3438        }
3439
3440        if (result == null) {
3441            Session session = null;
3442
3443            try {
3444                session = openSession();
3445
3446                StringBuilder query = new StringBuilder();
3447
3448                query.append("SELECT COUNT(*) ");
3449                query.append(
3450                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
3451
3452                query.append("companyId = ?");
3453
3454                query.append(" ");
3455
3456                Query q = session.createQuery(query.toString());
3457
3458                QueryPos qPos = QueryPos.getInstance(q);
3459
3460                qPos.add(companyId);
3461
3462                Long count = null;
3463
3464                Iterator<Long> itr = q.list().iterator();
3465
3466                if (itr.hasNext()) {
3467                    count = itr.next();
3468                }
3469
3470                if (count == null) {
3471                    count = new Long(0);
3472                }
3473
3474                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
3475                    finderClassName, finderMethodName, finderParams,
3476                    finderArgs, count);
3477
3478                return count.intValue();
3479            }
3480            catch (Exception e) {
3481                throw processException(e);
3482            }
3483            finally {
3484                closeSession(session);
3485            }
3486        }
3487        else {
3488            return ((Long)result).intValue();
3489        }
3490    }
3491
3492    public int countBySmallImageId(long smallImageId) throws SystemException {
3493        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3494        String finderClassName = JournalArticle.class.getName();
3495        String finderMethodName = "countBySmallImageId";
3496        String[] finderParams = new String[] { Long.class.getName() };
3497        Object[] finderArgs = new Object[] { new Long(smallImageId) };
3498
3499        Object result = null;
3500
3501        if (finderClassNameCacheEnabled) {
3502            result = FinderCacheUtil.getResult(finderClassName,
3503                    finderMethodName, finderParams, finderArgs, this);
3504        }
3505
3506        if (result == null) {
3507            Session session = null;
3508
3509            try {
3510                session = openSession();
3511
3512                StringBuilder query = new StringBuilder();
3513
3514                query.append("SELECT COUNT(*) ");
3515                query.append(
3516                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
3517
3518                query.append("smallImageId = ?");
3519
3520                query.append(" ");
3521
3522                Query q = session.createQuery(query.toString());
3523
3524                QueryPos qPos = QueryPos.getInstance(q);
3525
3526                qPos.add(smallImageId);
3527
3528                Long count = null;
3529
3530                Iterator<Long> itr = q.list().iterator();
3531
3532                if (itr.hasNext()) {
3533                    count = itr.next();
3534                }
3535
3536                if (count == null) {
3537                    count = new Long(0);
3538                }
3539
3540                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
3541                    finderClassName, finderMethodName, finderParams,
3542                    finderArgs, count);
3543
3544                return count.intValue();
3545            }
3546            catch (Exception e) {
3547                throw processException(e);
3548            }
3549            finally {
3550                closeSession(session);
3551            }
3552        }
3553        else {
3554            return ((Long)result).intValue();
3555        }
3556    }
3557
3558    public int countByR_A(long resourcePrimKey, boolean approved)
3559        throws SystemException {
3560        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3561        String finderClassName = JournalArticle.class.getName();
3562        String finderMethodName = "countByR_A";
3563        String[] finderParams = new String[] {
3564                Long.class.getName(), Boolean.class.getName()
3565            };
3566        Object[] finderArgs = new Object[] {
3567                new Long(resourcePrimKey), Boolean.valueOf(approved)
3568            };
3569
3570        Object result = null;
3571
3572        if (finderClassNameCacheEnabled) {
3573            result = FinderCacheUtil.getResult(finderClassName,
3574                    finderMethodName, finderParams, finderArgs, this);
3575        }
3576
3577        if (result == null) {
3578            Session session = null;
3579
3580            try {
3581                session = openSession();
3582
3583                StringBuilder query = new StringBuilder();
3584
3585                query.append("SELECT COUNT(*) ");
3586                query.append(
3587                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
3588
3589                query.append("resourcePrimKey = ?");
3590
3591                query.append(" AND ");
3592
3593                query.append("approved = ?");
3594
3595                query.append(" ");
3596
3597                Query q = session.createQuery(query.toString());
3598
3599                QueryPos qPos = QueryPos.getInstance(q);
3600
3601                qPos.add(resourcePrimKey);
3602
3603                qPos.add(approved);
3604
3605                Long count = null;
3606
3607                Iterator<Long> itr = q.list().iterator();
3608
3609                if (itr.hasNext()) {
3610                    count = itr.next();
3611                }
3612
3613                if (count == null) {
3614                    count = new Long(0);
3615                }
3616
3617                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
3618                    finderClassName, finderMethodName, finderParams,
3619                    finderArgs, count);
3620
3621                return count.intValue();
3622            }
3623            catch (Exception e) {
3624                throw processException(e);
3625            }
3626            finally {
3627                closeSession(session);
3628            }
3629        }
3630        else {
3631            return ((Long)result).intValue();
3632        }
3633    }
3634
3635    public int countByG_A(long groupId, String articleId)
3636        throws SystemException {
3637        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3638        String finderClassName = JournalArticle.class.getName();
3639        String finderMethodName = "countByG_A";
3640        String[] finderParams = new String[] {
3641                Long.class.getName(), String.class.getName()
3642            };
3643        Object[] finderArgs = new Object[] { new Long(groupId), articleId };
3644
3645        Object result = null;
3646
3647        if (finderClassNameCacheEnabled) {
3648            result = FinderCacheUtil.getResult(finderClassName,
3649                    finderMethodName, finderParams, finderArgs, this);
3650        }
3651
3652        if (result == null) {
3653            Session session = null;
3654
3655            try {
3656                session = openSession();
3657
3658                StringBuilder query = new StringBuilder();
3659
3660                query.append("SELECT COUNT(*) ");
3661                query.append(
3662                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
3663
3664                query.append("groupId = ?");
3665
3666                query.append(" AND ");
3667
3668                if (articleId == null) {
3669                    query.append("articleId IS NULL");
3670                }
3671                else {
3672                    query.append("articleId = ?");
3673                }
3674
3675                query.append(" ");
3676
3677                Query q = session.createQuery(query.toString());
3678
3679                QueryPos qPos = QueryPos.getInstance(q);
3680
3681                qPos.add(groupId);
3682
3683                if (articleId != null) {
3684                    qPos.add(articleId);
3685                }
3686
3687                Long count = null;
3688
3689                Iterator<Long> itr = q.list().iterator();
3690
3691                if (itr.hasNext()) {
3692                    count = itr.next();
3693                }
3694
3695                if (count == null) {
3696                    count = new Long(0);
3697                }
3698
3699                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
3700                    finderClassName, finderMethodName, finderParams,
3701                    finderArgs, count);
3702
3703                return count.intValue();
3704            }
3705            catch (Exception e) {
3706                throw processException(e);
3707            }
3708            finally {
3709                closeSession(session);
3710            }
3711        }
3712        else {
3713            return ((Long)result).intValue();
3714        }
3715    }
3716
3717    public int countByG_S(long groupId, String structureId)
3718        throws SystemException {
3719        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3720        String finderClassName = JournalArticle.class.getName();
3721        String finderMethodName = "countByG_S";
3722        String[] finderParams = new String[] {
3723                Long.class.getName(), String.class.getName()
3724            };
3725        Object[] finderArgs = new Object[] { new Long(groupId), structureId };
3726
3727        Object result = null;
3728
3729        if (finderClassNameCacheEnabled) {
3730            result = FinderCacheUtil.getResult(finderClassName,
3731                    finderMethodName, finderParams, finderArgs, this);
3732        }
3733
3734        if (result == null) {
3735            Session session = null;
3736
3737            try {
3738                session = openSession();
3739
3740                StringBuilder query = new StringBuilder();
3741
3742                query.append("SELECT COUNT(*) ");
3743                query.append(
3744                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
3745
3746                query.append("groupId = ?");
3747
3748                query.append(" AND ");
3749
3750                if (structureId == null) {
3751                    query.append("structureId IS NULL");
3752                }
3753                else {
3754                    query.append("structureId = ?");
3755                }
3756
3757                query.append(" ");
3758
3759                Query q = session.createQuery(query.toString());
3760
3761                QueryPos qPos = QueryPos.getInstance(q);
3762
3763                qPos.add(groupId);
3764
3765                if (structureId != null) {
3766                    qPos.add(structureId);
3767                }
3768
3769                Long count = null;
3770
3771                Iterator<Long> itr = q.list().iterator();
3772
3773                if (itr.hasNext()) {
3774                    count = itr.next();
3775                }
3776
3777                if (count == null) {
3778                    count = new Long(0);
3779                }
3780
3781                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
3782                    finderClassName, finderMethodName, finderParams,
3783                    finderArgs, count);
3784
3785                return count.intValue();
3786            }
3787            catch (Exception e) {
3788                throw processException(e);
3789            }
3790            finally {
3791                closeSession(session);
3792            }
3793        }
3794        else {
3795            return ((Long)result).intValue();
3796        }
3797    }
3798
3799    public int countByG_T(long groupId, String templateId)
3800        throws SystemException {
3801        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3802        String finderClassName = JournalArticle.class.getName();
3803        String finderMethodName = "countByG_T";
3804        String[] finderParams = new String[] {
3805                Long.class.getName(), String.class.getName()
3806            };
3807        Object[] finderArgs = new Object[] { new Long(groupId), templateId };
3808
3809        Object result = null;
3810
3811        if (finderClassNameCacheEnabled) {
3812            result = FinderCacheUtil.getResult(finderClassName,
3813                    finderMethodName, finderParams, finderArgs, this);
3814        }
3815
3816        if (result == null) {
3817            Session session = null;
3818
3819            try {
3820                session = openSession();
3821
3822                StringBuilder query = new StringBuilder();
3823
3824                query.append("SELECT COUNT(*) ");
3825                query.append(
3826                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
3827
3828                query.append("groupId = ?");
3829
3830                query.append(" AND ");
3831
3832                if (templateId == null) {
3833                    query.append("templateId IS NULL");
3834                }
3835                else {
3836                    query.append("templateId = ?");
3837                }
3838
3839                query.append(" ");
3840
3841                Query q = session.createQuery(query.toString());
3842
3843                QueryPos qPos = QueryPos.getInstance(q);
3844
3845                qPos.add(groupId);
3846
3847                if (templateId != null) {
3848                    qPos.add(templateId);
3849                }
3850
3851                Long count = null;
3852
3853                Iterator<Long> itr = q.list().iterator();
3854
3855                if (itr.hasNext()) {
3856                    count = itr.next();
3857                }
3858
3859                if (count == null) {
3860                    count = new Long(0);
3861                }
3862
3863                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
3864                    finderClassName, finderMethodName, finderParams,
3865                    finderArgs, count);
3866
3867                return count.intValue();
3868            }
3869            catch (Exception e) {
3870                throw processException(e);
3871            }
3872            finally {
3873                closeSession(session);
3874            }
3875        }
3876        else {
3877            return ((Long)result).intValue();
3878        }
3879    }
3880
3881    public int countByG_A_V(long groupId, String articleId, double version)
3882        throws SystemException {
3883        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3884        String finderClassName = JournalArticle.class.getName();
3885        String finderMethodName = "countByG_A_V";
3886        String[] finderParams = new String[] {
3887                Long.class.getName(), String.class.getName(),
3888                Double.class.getName()
3889            };
3890        Object[] finderArgs = new Object[] {
3891                new Long(groupId),
3892                
3893                articleId, new Double(version)
3894            };
3895
3896        Object result = null;
3897
3898        if (finderClassNameCacheEnabled) {
3899            result = FinderCacheUtil.getResult(finderClassName,
3900                    finderMethodName, finderParams, finderArgs, this);
3901        }
3902
3903        if (result == null) {
3904            Session session = null;
3905
3906            try {
3907                session = openSession();
3908
3909                StringBuilder query = new StringBuilder();
3910
3911                query.append("SELECT COUNT(*) ");
3912                query.append(
3913                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
3914
3915                query.append("groupId = ?");
3916
3917                query.append(" AND ");
3918
3919                if (articleId == null) {
3920                    query.append("articleId IS NULL");
3921                }
3922                else {
3923                    query.append("articleId = ?");
3924                }
3925
3926                query.append(" AND ");
3927
3928                query.append("version = ?");
3929
3930                query.append(" ");
3931
3932                Query q = session.createQuery(query.toString());
3933
3934                QueryPos qPos = QueryPos.getInstance(q);
3935
3936                qPos.add(groupId);
3937
3938                if (articleId != null) {
3939                    qPos.add(articleId);
3940                }
3941
3942                qPos.add(version);
3943
3944                Long count = null;
3945
3946                Iterator<Long> itr = q.list().iterator();
3947
3948                if (itr.hasNext()) {
3949                    count = itr.next();
3950                }
3951
3952                if (count == null) {
3953                    count = new Long(0);
3954                }
3955
3956                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
3957                    finderClassName, finderMethodName, finderParams,
3958                    finderArgs, count);
3959
3960                return count.intValue();
3961            }
3962            catch (Exception e) {
3963                throw processException(e);
3964            }
3965            finally {
3966                closeSession(session);
3967            }
3968        }
3969        else {
3970            return ((Long)result).intValue();
3971        }
3972    }
3973
3974    public int countByG_A_A(long groupId, String articleId, boolean approved)
3975        throws SystemException {
3976        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
3977        String finderClassName = JournalArticle.class.getName();
3978        String finderMethodName = "countByG_A_A";
3979        String[] finderParams = new String[] {
3980                Long.class.getName(), String.class.getName(),
3981                Boolean.class.getName()
3982            };
3983        Object[] finderArgs = new Object[] {
3984                new Long(groupId),
3985                
3986                articleId, Boolean.valueOf(approved)
3987            };
3988
3989        Object result = null;
3990
3991        if (finderClassNameCacheEnabled) {
3992            result = FinderCacheUtil.getResult(finderClassName,
3993                    finderMethodName, finderParams, finderArgs, this);
3994        }
3995
3996        if (result == null) {
3997            Session session = null;
3998
3999            try {
4000                session = openSession();
4001
4002                StringBuilder query = new StringBuilder();
4003
4004                query.append("SELECT COUNT(*) ");
4005                query.append(
4006                    "FROM com.liferay.portlet.journal.model.JournalArticle WHERE ");
4007
4008                query.append("groupId = ?");
4009
4010                query.append(" AND ");
4011
4012                if (articleId == null) {
4013                    query.append("articleId IS NULL");
4014                }
4015                else {
4016                    query.append("articleId = ?");
4017                }
4018
4019                query.append(" AND ");
4020
4021                query.append("approved = ?");
4022
4023                query.append(" ");
4024
4025                Query q = session.createQuery(query.toString());
4026
4027                QueryPos qPos = QueryPos.getInstance(q);
4028
4029                qPos.add(groupId);
4030
4031                if (articleId != null) {
4032                    qPos.add(articleId);
4033                }
4034
4035                qPos.add(approved);
4036
4037                Long count = null;
4038
4039                Iterator<Long> itr = q.list().iterator();
4040
4041                if (itr.hasNext()) {
4042                    count = itr.next();
4043                }
4044
4045                if (count == null) {
4046                    count = new Long(0);
4047                }
4048
4049                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
4050                    finderClassName, finderMethodName, finderParams,
4051                    finderArgs, count);
4052
4053                return count.intValue();
4054            }
4055            catch (Exception e) {
4056                throw processException(e);
4057            }
4058            finally {
4059                closeSession(session);
4060            }
4061        }
4062        else {
4063            return ((Long)result).intValue();
4064        }
4065    }
4066
4067    public int countAll() throws SystemException {
4068        boolean finderClassNameCacheEnabled = JournalArticleModelImpl.CACHE_ENABLED;
4069        String finderClassName = JournalArticle.class.getName();
4070        String finderMethodName = "countAll";
4071        String[] finderParams = new String[] {  };
4072        Object[] finderArgs = new Object[] {  };
4073
4074        Object result = null;
4075
4076        if (finderClassNameCacheEnabled) {
4077            result = FinderCacheUtil.getResult(finderClassName,
4078                    finderMethodName, finderParams, finderArgs, this);
4079        }
4080
4081        if (result == null) {
4082            Session session = null;
4083
4084            try {
4085                session = openSession();
4086
4087                Query q = session.createQuery(
4088                        "SELECT COUNT(*) FROM com.liferay.portlet.journal.model.JournalArticle");
4089
4090                Long count = null;
4091
4092                Iterator<Long> itr = q.list().iterator();
4093
4094                if (itr.hasNext()) {
4095                    count = itr.next();
4096                }
4097
4098                if (count == null) {
4099                    count = new Long(0);
4100                }
4101
4102                FinderCacheUtil.putResult(finderClassNameCacheEnabled,
4103                    finderClassName, finderMethodName, finderParams,
4104                    finderArgs, count);
4105
4106                return count.intValue();
4107            }
4108            catch (Exception e) {
4109                throw processException(e);
4110            }
4111            finally {
4112                closeSession(session);
4113            }
4114        }
4115        else {
4116            return ((Long)result).intValue();
4117        }
4118    }
4119
4120    public void afterPropertiesSet() {
4121        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
4122                    com.liferay.portal.util.PropsUtil.get(
4123                        "value.object.listener.com.liferay.portlet.journal.model.JournalArticle")));
4124
4125        if (listenerClassNames.length > 0) {
4126            try {
4127                List<ModelListener> listenersList = new ArrayList<ModelListener>();
4128
4129                for (String listenerClassName : listenerClassNames) {
4130                    listenersList.add((ModelListener)Class.forName(
4131                            listenerClassName).newInstance());
4132                }
4133
4134                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
4135            }
4136            catch (Exception e) {
4137                _log.error(e);
4138            }
4139        }
4140    }
4141
4142    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalArticlePersistence.impl")
4143    protected com.liferay.portlet.journal.service.persistence.JournalArticlePersistence journalArticlePersistence;
4144    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalArticleImagePersistence.impl")
4145    protected com.liferay.portlet.journal.service.persistence.JournalArticleImagePersistence journalArticleImagePersistence;
4146    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalArticleResourcePersistence.impl")
4147    protected com.liferay.portlet.journal.service.persistence.JournalArticleResourcePersistence journalArticleResourcePersistence;
4148    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalContentSearchPersistence.impl")
4149    protected com.liferay.portlet.journal.service.persistence.JournalContentSearchPersistence journalContentSearchPersistence;
4150    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalFeedPersistence.impl")
4151    protected com.liferay.portlet.journal.service.persistence.JournalFeedPersistence journalFeedPersistence;
4152    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalStructurePersistence.impl")
4153    protected com.liferay.portlet.journal.service.persistence.JournalStructurePersistence journalStructurePersistence;
4154    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalTemplatePersistence.impl")
4155    protected com.liferay.portlet.journal.service.persistence.JournalTemplatePersistence journalTemplatePersistence;
4156    @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
4157    protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
4158    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
4159    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
4160    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
4161    protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
4162    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
4163    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
4164    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
4165    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
4166    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence.impl")
4167    protected com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence mbMessagePersistence;
4168    @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence.impl")
4169    protected com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence ratingsStatsPersistence;
4170    @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsAssetPersistence.impl")
4171    protected com.liferay.portlet.tags.service.persistence.TagsAssetPersistence tagsAssetPersistence;
4172    @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsEntryPersistence.impl")
4173    protected com.liferay.portlet.tags.service.persistence.TagsEntryPersistence tagsEntryPersistence;
4174    private static Log _log = LogFactoryUtil.getLog(JournalArticlePersistenceImpl.class);
4175}