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