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