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