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