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