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