1
22
23 package com.liferay.portlet.wiki.service.persistence;
24
25 import com.liferay.portal.SystemException;
26 import com.liferay.portal.kernel.annotation.BeanReference;
27 import com.liferay.portal.kernel.cache.CacheRegistry;
28 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
29 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
30 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
31 import com.liferay.portal.kernel.dao.orm.FinderPath;
32 import com.liferay.portal.kernel.dao.orm.Query;
33 import com.liferay.portal.kernel.dao.orm.QueryPos;
34 import com.liferay.portal.kernel.dao.orm.QueryUtil;
35 import com.liferay.portal.kernel.dao.orm.Session;
36 import com.liferay.portal.kernel.log.Log;
37 import com.liferay.portal.kernel.log.LogFactoryUtil;
38 import com.liferay.portal.kernel.util.GetterUtil;
39 import com.liferay.portal.kernel.util.OrderByComparator;
40 import com.liferay.portal.kernel.util.StringPool;
41 import com.liferay.portal.kernel.util.StringUtil;
42 import com.liferay.portal.kernel.util.Validator;
43 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
44 import com.liferay.portal.model.ModelListener;
45 import com.liferay.portal.service.persistence.BatchSessionUtil;
46 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
47
48 import com.liferay.portlet.wiki.NoSuchPageException;
49 import com.liferay.portlet.wiki.model.WikiPage;
50 import com.liferay.portlet.wiki.model.impl.WikiPageImpl;
51 import com.liferay.portlet.wiki.model.impl.WikiPageModelImpl;
52
53 import java.util.ArrayList;
54 import java.util.Collections;
55 import java.util.List;
56
57
63 public class WikiPagePersistenceImpl extends BasePersistenceImpl
64 implements WikiPagePersistence {
65 public static final String FINDER_CLASS_NAME_ENTITY = WikiPageImpl.class.getName();
66 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
67 ".List";
68 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
69 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
70 "findByUuid", new String[] { String.class.getName() });
71 public static final FinderPath FINDER_PATH_FIND_BY_OBC_UUID = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
72 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
73 "findByUuid",
74 new String[] {
75 String.class.getName(),
76
77 "java.lang.Integer", "java.lang.Integer",
78 "com.liferay.portal.kernel.util.OrderByComparator"
79 });
80 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
81 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
82 "countByUuid", new String[] { String.class.getName() });
83 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
84 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
85 "fetchByUUID_G",
86 new String[] { String.class.getName(), Long.class.getName() });
87 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
88 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
89 "countByUUID_G",
90 new String[] { String.class.getName(), Long.class.getName() });
91 public static final FinderPath FINDER_PATH_FIND_BY_NODEID = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
92 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
93 "findByNodeId", new String[] { Long.class.getName() });
94 public static final FinderPath FINDER_PATH_FIND_BY_OBC_NODEID = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
95 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
96 "findByNodeId",
97 new String[] {
98 Long.class.getName(),
99
100 "java.lang.Integer", "java.lang.Integer",
101 "com.liferay.portal.kernel.util.OrderByComparator"
102 });
103 public static final FinderPath FINDER_PATH_COUNT_BY_NODEID = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
104 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
105 "countByNodeId", new String[] { Long.class.getName() });
106 public static final FinderPath FINDER_PATH_FIND_BY_FORMAT = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
107 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
108 "findByFormat", new String[] { String.class.getName() });
109 public static final FinderPath FINDER_PATH_FIND_BY_OBC_FORMAT = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
110 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
111 "findByFormat",
112 new String[] {
113 String.class.getName(),
114
115 "java.lang.Integer", "java.lang.Integer",
116 "com.liferay.portal.kernel.util.OrderByComparator"
117 });
118 public static final FinderPath FINDER_PATH_COUNT_BY_FORMAT = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
119 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
120 "countByFormat", new String[] { String.class.getName() });
121 public static final FinderPath FINDER_PATH_FIND_BY_N_T = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
122 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
123 "findByN_T",
124 new String[] { Long.class.getName(), String.class.getName() });
125 public static final FinderPath FINDER_PATH_FIND_BY_OBC_N_T = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
126 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
127 "findByN_T",
128 new String[] {
129 Long.class.getName(), String.class.getName(),
130
131 "java.lang.Integer", "java.lang.Integer",
132 "com.liferay.portal.kernel.util.OrderByComparator"
133 });
134 public static final FinderPath FINDER_PATH_COUNT_BY_N_T = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
135 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
136 "countByN_T",
137 new String[] { Long.class.getName(), String.class.getName() });
138 public static final FinderPath FINDER_PATH_FIND_BY_N_H = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
139 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
140 "findByN_H",
141 new String[] { Long.class.getName(), Boolean.class.getName() });
142 public static final FinderPath FINDER_PATH_FIND_BY_OBC_N_H = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
143 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
144 "findByN_H",
145 new String[] {
146 Long.class.getName(), Boolean.class.getName(),
147
148 "java.lang.Integer", "java.lang.Integer",
149 "com.liferay.portal.kernel.util.OrderByComparator"
150 });
151 public static final FinderPath FINDER_PATH_COUNT_BY_N_H = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
152 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
153 "countByN_H",
154 new String[] { Long.class.getName(), Boolean.class.getName() });
155 public static final FinderPath FINDER_PATH_FIND_BY_N_P = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
156 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
157 "findByN_P",
158 new String[] { Long.class.getName(), String.class.getName() });
159 public static final FinderPath FINDER_PATH_FIND_BY_OBC_N_P = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
160 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
161 "findByN_P",
162 new String[] {
163 Long.class.getName(), String.class.getName(),
164
165 "java.lang.Integer", "java.lang.Integer",
166 "com.liferay.portal.kernel.util.OrderByComparator"
167 });
168 public static final FinderPath FINDER_PATH_COUNT_BY_N_P = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
169 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
170 "countByN_P",
171 new String[] { Long.class.getName(), String.class.getName() });
172 public static final FinderPath FINDER_PATH_FIND_BY_N_R = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
173 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
174 "findByN_R",
175 new String[] { Long.class.getName(), String.class.getName() });
176 public static final FinderPath FINDER_PATH_FIND_BY_OBC_N_R = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
177 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
178 "findByN_R",
179 new String[] {
180 Long.class.getName(), String.class.getName(),
181
182 "java.lang.Integer", "java.lang.Integer",
183 "com.liferay.portal.kernel.util.OrderByComparator"
184 });
185 public static final FinderPath FINDER_PATH_COUNT_BY_N_R = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
186 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
187 "countByN_R",
188 new String[] { Long.class.getName(), String.class.getName() });
189 public static final FinderPath FINDER_PATH_FETCH_BY_N_T_V = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
190 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
191 "fetchByN_T_V",
192 new String[] {
193 Long.class.getName(), String.class.getName(),
194 Double.class.getName()
195 });
196 public static final FinderPath FINDER_PATH_COUNT_BY_N_T_V = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
197 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
198 "countByN_T_V",
199 new String[] {
200 Long.class.getName(), String.class.getName(),
201 Double.class.getName()
202 });
203 public static final FinderPath FINDER_PATH_FIND_BY_N_T_H = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
204 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
205 "findByN_T_H",
206 new String[] {
207 Long.class.getName(), String.class.getName(),
208 Boolean.class.getName()
209 });
210 public static final FinderPath FINDER_PATH_FIND_BY_OBC_N_T_H = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
211 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
212 "findByN_T_H",
213 new String[] {
214 Long.class.getName(), String.class.getName(),
215 Boolean.class.getName(),
216
217 "java.lang.Integer", "java.lang.Integer",
218 "com.liferay.portal.kernel.util.OrderByComparator"
219 });
220 public static final FinderPath FINDER_PATH_COUNT_BY_N_T_H = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
221 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
222 "countByN_T_H",
223 new String[] {
224 Long.class.getName(), String.class.getName(),
225 Boolean.class.getName()
226 });
227 public static final FinderPath FINDER_PATH_FIND_BY_N_H_P = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
228 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
229 "findByN_H_P",
230 new String[] {
231 Long.class.getName(), Boolean.class.getName(),
232 String.class.getName()
233 });
234 public static final FinderPath FINDER_PATH_FIND_BY_OBC_N_H_P = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
235 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
236 "findByN_H_P",
237 new String[] {
238 Long.class.getName(), Boolean.class.getName(),
239 String.class.getName(),
240
241 "java.lang.Integer", "java.lang.Integer",
242 "com.liferay.portal.kernel.util.OrderByComparator"
243 });
244 public static final FinderPath FINDER_PATH_COUNT_BY_N_H_P = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
245 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
246 "countByN_H_P",
247 new String[] {
248 Long.class.getName(), Boolean.class.getName(),
249 String.class.getName()
250 });
251 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
252 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
253 "findAll", new String[0]);
254 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
255 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
256 "countAll", new String[0]);
257
258 public void cacheResult(WikiPage wikiPage) {
259 EntityCacheUtil.putResult(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
260 WikiPageImpl.class, wikiPage.getPrimaryKey(), wikiPage);
261
262 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
263 new Object[] { wikiPage.getUuid(), new Long(wikiPage.getGroupId()) },
264 wikiPage);
265
266 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T_V,
267 new Object[] {
268 new Long(wikiPage.getNodeId()),
269
270 wikiPage.getTitle(), new Double(wikiPage.getVersion())
271 }, wikiPage);
272 }
273
274 public void cacheResult(List<WikiPage> wikiPages) {
275 for (WikiPage wikiPage : wikiPages) {
276 if (EntityCacheUtil.getResult(
277 WikiPageModelImpl.ENTITY_CACHE_ENABLED,
278 WikiPageImpl.class, wikiPage.getPrimaryKey(), this) == null) {
279 cacheResult(wikiPage);
280 }
281 }
282 }
283
284 public void clearCache() {
285 CacheRegistry.clear(WikiPageImpl.class.getName());
286 EntityCacheUtil.clearCache(WikiPageImpl.class.getName());
287 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
288 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
289 }
290
291 public WikiPage create(long pageId) {
292 WikiPage wikiPage = new WikiPageImpl();
293
294 wikiPage.setNew(true);
295 wikiPage.setPrimaryKey(pageId);
296
297 String uuid = PortalUUIDUtil.generate();
298
299 wikiPage.setUuid(uuid);
300
301 return wikiPage;
302 }
303
304 public WikiPage remove(long pageId)
305 throws NoSuchPageException, SystemException {
306 Session session = null;
307
308 try {
309 session = openSession();
310
311 WikiPage wikiPage = (WikiPage)session.get(WikiPageImpl.class,
312 new Long(pageId));
313
314 if (wikiPage == null) {
315 if (_log.isWarnEnabled()) {
316 _log.warn("No WikiPage exists with the primary key " +
317 pageId);
318 }
319
320 throw new NoSuchPageException(
321 "No WikiPage exists with the primary key " + pageId);
322 }
323
324 return remove(wikiPage);
325 }
326 catch (NoSuchPageException nsee) {
327 throw nsee;
328 }
329 catch (Exception e) {
330 throw processException(e);
331 }
332 finally {
333 closeSession(session);
334 }
335 }
336
337 public WikiPage remove(WikiPage wikiPage) throws SystemException {
338 for (ModelListener<WikiPage> listener : listeners) {
339 listener.onBeforeRemove(wikiPage);
340 }
341
342 wikiPage = removeImpl(wikiPage);
343
344 for (ModelListener<WikiPage> listener : listeners) {
345 listener.onAfterRemove(wikiPage);
346 }
347
348 return wikiPage;
349 }
350
351 protected WikiPage removeImpl(WikiPage wikiPage) throws SystemException {
352 Session session = null;
353
354 try {
355 session = openSession();
356
357 if (wikiPage.isCachedModel() || BatchSessionUtil.isEnabled()) {
358 Object staleObject = session.get(WikiPageImpl.class,
359 wikiPage.getPrimaryKeyObj());
360
361 if (staleObject != null) {
362 session.evict(staleObject);
363 }
364 }
365
366 session.delete(wikiPage);
367
368 session.flush();
369 }
370 catch (Exception e) {
371 throw processException(e);
372 }
373 finally {
374 closeSession(session);
375 }
376
377 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
378
379 WikiPageModelImpl wikiPageModelImpl = (WikiPageModelImpl)wikiPage;
380
381 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
382 new Object[] {
383 wikiPageModelImpl.getOriginalUuid(),
384 new Long(wikiPageModelImpl.getOriginalGroupId())
385 });
386
387 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T_V,
388 new Object[] {
389 new Long(wikiPageModelImpl.getOriginalNodeId()),
390
391 wikiPageModelImpl.getOriginalTitle(),
392 new Double(wikiPageModelImpl.getOriginalVersion())
393 });
394
395 EntityCacheUtil.removeResult(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
396 WikiPageImpl.class, wikiPage.getPrimaryKey());
397
398 return wikiPage;
399 }
400
401
404 public WikiPage update(WikiPage wikiPage) throws SystemException {
405 if (_log.isWarnEnabled()) {
406 _log.warn(
407 "Using the deprecated update(WikiPage wikiPage) method. Use update(WikiPage wikiPage, boolean merge) instead.");
408 }
409
410 return update(wikiPage, false);
411 }
412
413
426 public WikiPage update(WikiPage wikiPage, boolean merge)
427 throws SystemException {
428 boolean isNew = wikiPage.isNew();
429
430 for (ModelListener<WikiPage> listener : listeners) {
431 if (isNew) {
432 listener.onBeforeCreate(wikiPage);
433 }
434 else {
435 listener.onBeforeUpdate(wikiPage);
436 }
437 }
438
439 wikiPage = updateImpl(wikiPage, merge);
440
441 for (ModelListener<WikiPage> listener : listeners) {
442 if (isNew) {
443 listener.onAfterCreate(wikiPage);
444 }
445 else {
446 listener.onAfterUpdate(wikiPage);
447 }
448 }
449
450 return wikiPage;
451 }
452
453 public WikiPage updateImpl(
454 com.liferay.portlet.wiki.model.WikiPage wikiPage, boolean merge)
455 throws SystemException {
456 boolean isNew = wikiPage.isNew();
457
458 WikiPageModelImpl wikiPageModelImpl = (WikiPageModelImpl)wikiPage;
459
460 if (Validator.isNull(wikiPage.getUuid())) {
461 String uuid = PortalUUIDUtil.generate();
462
463 wikiPage.setUuid(uuid);
464 }
465
466 Session session = null;
467
468 try {
469 session = openSession();
470
471 BatchSessionUtil.update(session, wikiPage, merge);
472
473 wikiPage.setNew(false);
474 }
475 catch (Exception e) {
476 throw processException(e);
477 }
478 finally {
479 closeSession(session);
480 }
481
482 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
483
484 EntityCacheUtil.putResult(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
485 WikiPageImpl.class, wikiPage.getPrimaryKey(), wikiPage);
486
487 if (!isNew &&
488 (!Validator.equals(wikiPage.getUuid(),
489 wikiPageModelImpl.getOriginalUuid()) ||
490 (wikiPage.getGroupId() != wikiPageModelImpl.getOriginalGroupId()))) {
491 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
492 new Object[] {
493 wikiPageModelImpl.getOriginalUuid(),
494 new Long(wikiPageModelImpl.getOriginalGroupId())
495 });
496 }
497
498 if (isNew ||
499 (!Validator.equals(wikiPage.getUuid(),
500 wikiPageModelImpl.getOriginalUuid()) ||
501 (wikiPage.getGroupId() != wikiPageModelImpl.getOriginalGroupId()))) {
502 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
503 new Object[] { wikiPage.getUuid(), new Long(
504 wikiPage.getGroupId()) }, wikiPage);
505 }
506
507 if (!isNew &&
508 ((wikiPage.getNodeId() != wikiPageModelImpl.getOriginalNodeId()) ||
509 !Validator.equals(wikiPage.getTitle(),
510 wikiPageModelImpl.getOriginalTitle()) ||
511 (wikiPage.getVersion() != wikiPageModelImpl.getOriginalVersion()))) {
512 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T_V,
513 new Object[] {
514 new Long(wikiPageModelImpl.getOriginalNodeId()),
515
516 wikiPageModelImpl.getOriginalTitle(),
517 new Double(wikiPageModelImpl.getOriginalVersion())
518 });
519 }
520
521 if (isNew ||
522 ((wikiPage.getNodeId() != wikiPageModelImpl.getOriginalNodeId()) ||
523 !Validator.equals(wikiPage.getTitle(),
524 wikiPageModelImpl.getOriginalTitle()) ||
525 (wikiPage.getVersion() != wikiPageModelImpl.getOriginalVersion()))) {
526 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T_V,
527 new Object[] {
528 new Long(wikiPage.getNodeId()),
529
530 wikiPage.getTitle(), new Double(wikiPage.getVersion())
531 }, wikiPage);
532 }
533
534 return wikiPage;
535 }
536
537 public WikiPage findByPrimaryKey(long pageId)
538 throws NoSuchPageException, SystemException {
539 WikiPage wikiPage = fetchByPrimaryKey(pageId);
540
541 if (wikiPage == null) {
542 if (_log.isWarnEnabled()) {
543 _log.warn("No WikiPage exists with the primary key " + pageId);
544 }
545
546 throw new NoSuchPageException(
547 "No WikiPage exists with the primary key " + pageId);
548 }
549
550 return wikiPage;
551 }
552
553 public WikiPage fetchByPrimaryKey(long pageId) throws SystemException {
554 WikiPage wikiPage = (WikiPage)EntityCacheUtil.getResult(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
555 WikiPageImpl.class, pageId, this);
556
557 if (wikiPage == null) {
558 Session session = null;
559
560 try {
561 session = openSession();
562
563 wikiPage = (WikiPage)session.get(WikiPageImpl.class,
564 new Long(pageId));
565 }
566 catch (Exception e) {
567 throw processException(e);
568 }
569 finally {
570 if (wikiPage != null) {
571 cacheResult(wikiPage);
572 }
573
574 closeSession(session);
575 }
576 }
577
578 return wikiPage;
579 }
580
581 public List<WikiPage> findByUuid(String uuid) throws SystemException {
582 Object[] finderArgs = new Object[] { uuid };
583
584 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
585 finderArgs, this);
586
587 if (list == null) {
588 Session session = null;
589
590 try {
591 session = openSession();
592
593 StringBuilder query = new StringBuilder();
594
595 query.append(
596 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
597
598 if (uuid == null) {
599 query.append("uuid_ IS NULL");
600 }
601 else {
602 query.append("uuid_ = ?");
603 }
604
605 query.append(" ");
606
607 query.append("ORDER BY ");
608
609 query.append("nodeId ASC, ");
610 query.append("title ASC, ");
611 query.append("version ASC");
612
613 Query q = session.createQuery(query.toString());
614
615 QueryPos qPos = QueryPos.getInstance(q);
616
617 if (uuid != null) {
618 qPos.add(uuid);
619 }
620
621 list = q.list();
622 }
623 catch (Exception e) {
624 throw processException(e);
625 }
626 finally {
627 if (list == null) {
628 list = new ArrayList<WikiPage>();
629 }
630
631 cacheResult(list);
632
633 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
634 list);
635
636 closeSession(session);
637 }
638 }
639
640 return list;
641 }
642
643 public List<WikiPage> findByUuid(String uuid, int start, int end)
644 throws SystemException {
645 return findByUuid(uuid, start, end, null);
646 }
647
648 public List<WikiPage> findByUuid(String uuid, int start, int end,
649 OrderByComparator obc) throws SystemException {
650 Object[] finderArgs = new Object[] {
651 uuid,
652
653 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
654 };
655
656 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_UUID,
657 finderArgs, this);
658
659 if (list == null) {
660 Session session = null;
661
662 try {
663 session = openSession();
664
665 StringBuilder query = new StringBuilder();
666
667 query.append(
668 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
669
670 if (uuid == null) {
671 query.append("uuid_ IS NULL");
672 }
673 else {
674 query.append("uuid_ = ?");
675 }
676
677 query.append(" ");
678
679 if (obc != null) {
680 query.append("ORDER BY ");
681 query.append(obc.getOrderBy());
682 }
683
684 else {
685 query.append("ORDER BY ");
686
687 query.append("nodeId ASC, ");
688 query.append("title ASC, ");
689 query.append("version ASC");
690 }
691
692 Query q = session.createQuery(query.toString());
693
694 QueryPos qPos = QueryPos.getInstance(q);
695
696 if (uuid != null) {
697 qPos.add(uuid);
698 }
699
700 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
701 end);
702 }
703 catch (Exception e) {
704 throw processException(e);
705 }
706 finally {
707 if (list == null) {
708 list = new ArrayList<WikiPage>();
709 }
710
711 cacheResult(list);
712
713 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_UUID,
714 finderArgs, list);
715
716 closeSession(session);
717 }
718 }
719
720 return list;
721 }
722
723 public WikiPage findByUuid_First(String uuid, OrderByComparator obc)
724 throws NoSuchPageException, SystemException {
725 List<WikiPage> list = findByUuid(uuid, 0, 1, obc);
726
727 if (list.isEmpty()) {
728 StringBuilder msg = new StringBuilder();
729
730 msg.append("No WikiPage exists with the key {");
731
732 msg.append("uuid=" + uuid);
733
734 msg.append(StringPool.CLOSE_CURLY_BRACE);
735
736 throw new NoSuchPageException(msg.toString());
737 }
738 else {
739 return list.get(0);
740 }
741 }
742
743 public WikiPage findByUuid_Last(String uuid, OrderByComparator obc)
744 throws NoSuchPageException, SystemException {
745 int count = countByUuid(uuid);
746
747 List<WikiPage> list = findByUuid(uuid, count - 1, count, obc);
748
749 if (list.isEmpty()) {
750 StringBuilder msg = new StringBuilder();
751
752 msg.append("No WikiPage exists with the key {");
753
754 msg.append("uuid=" + uuid);
755
756 msg.append(StringPool.CLOSE_CURLY_BRACE);
757
758 throw new NoSuchPageException(msg.toString());
759 }
760 else {
761 return list.get(0);
762 }
763 }
764
765 public WikiPage[] findByUuid_PrevAndNext(long pageId, String uuid,
766 OrderByComparator obc) throws NoSuchPageException, SystemException {
767 WikiPage wikiPage = findByPrimaryKey(pageId);
768
769 int count = countByUuid(uuid);
770
771 Session session = null;
772
773 try {
774 session = openSession();
775
776 StringBuilder query = new StringBuilder();
777
778 query.append("FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
779
780 if (uuid == null) {
781 query.append("uuid_ IS NULL");
782 }
783 else {
784 query.append("uuid_ = ?");
785 }
786
787 query.append(" ");
788
789 if (obc != null) {
790 query.append("ORDER BY ");
791 query.append(obc.getOrderBy());
792 }
793
794 else {
795 query.append("ORDER BY ");
796
797 query.append("nodeId ASC, ");
798 query.append("title ASC, ");
799 query.append("version ASC");
800 }
801
802 Query q = session.createQuery(query.toString());
803
804 QueryPos qPos = QueryPos.getInstance(q);
805
806 if (uuid != null) {
807 qPos.add(uuid);
808 }
809
810 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiPage);
811
812 WikiPage[] array = new WikiPageImpl[3];
813
814 array[0] = (WikiPage)objArray[0];
815 array[1] = (WikiPage)objArray[1];
816 array[2] = (WikiPage)objArray[2];
817
818 return array;
819 }
820 catch (Exception e) {
821 throw processException(e);
822 }
823 finally {
824 closeSession(session);
825 }
826 }
827
828 public WikiPage findByUUID_G(String uuid, long groupId)
829 throws NoSuchPageException, SystemException {
830 WikiPage wikiPage = fetchByUUID_G(uuid, groupId);
831
832 if (wikiPage == null) {
833 StringBuilder msg = new StringBuilder();
834
835 msg.append("No WikiPage exists with the key {");
836
837 msg.append("uuid=" + uuid);
838
839 msg.append(", ");
840 msg.append("groupId=" + groupId);
841
842 msg.append(StringPool.CLOSE_CURLY_BRACE);
843
844 if (_log.isWarnEnabled()) {
845 _log.warn(msg.toString());
846 }
847
848 throw new NoSuchPageException(msg.toString());
849 }
850
851 return wikiPage;
852 }
853
854 public WikiPage fetchByUUID_G(String uuid, long groupId)
855 throws SystemException {
856 return fetchByUUID_G(uuid, groupId, true);
857 }
858
859 public WikiPage fetchByUUID_G(String uuid, long groupId,
860 boolean retrieveFromCache) throws SystemException {
861 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
862
863 Object result = null;
864
865 if (retrieveFromCache) {
866 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
867 finderArgs, this);
868 }
869
870 if (result == null) {
871 Session session = null;
872
873 try {
874 session = openSession();
875
876 StringBuilder query = new StringBuilder();
877
878 query.append(
879 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
880
881 if (uuid == null) {
882 query.append("uuid_ IS NULL");
883 }
884 else {
885 query.append("uuid_ = ?");
886 }
887
888 query.append(" AND ");
889
890 query.append("groupId = ?");
891
892 query.append(" ");
893
894 query.append("ORDER BY ");
895
896 query.append("nodeId ASC, ");
897 query.append("title ASC, ");
898 query.append("version ASC");
899
900 Query q = session.createQuery(query.toString());
901
902 QueryPos qPos = QueryPos.getInstance(q);
903
904 if (uuid != null) {
905 qPos.add(uuid);
906 }
907
908 qPos.add(groupId);
909
910 List<WikiPage> list = q.list();
911
912 result = list;
913
914 WikiPage wikiPage = null;
915
916 if (list.isEmpty()) {
917 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
918 finderArgs, list);
919 }
920 else {
921 wikiPage = list.get(0);
922
923 cacheResult(wikiPage);
924
925 if ((wikiPage.getUuid() == null) ||
926 !wikiPage.getUuid().equals(uuid) ||
927 (wikiPage.getGroupId() != groupId)) {
928 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
929 finderArgs, wikiPage);
930 }
931 }
932
933 return wikiPage;
934 }
935 catch (Exception e) {
936 throw processException(e);
937 }
938 finally {
939 if (result == null) {
940 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
941 finderArgs, new ArrayList<WikiPage>());
942 }
943
944 closeSession(session);
945 }
946 }
947 else {
948 if (result instanceof List) {
949 return null;
950 }
951 else {
952 return (WikiPage)result;
953 }
954 }
955 }
956
957 public List<WikiPage> findByNodeId(long nodeId) throws SystemException {
958 Object[] finderArgs = new Object[] { new Long(nodeId) };
959
960 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_NODEID,
961 finderArgs, this);
962
963 if (list == null) {
964 Session session = null;
965
966 try {
967 session = openSession();
968
969 StringBuilder query = new StringBuilder();
970
971 query.append(
972 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
973
974 query.append("nodeId = ?");
975
976 query.append(" ");
977
978 query.append("ORDER BY ");
979
980 query.append("nodeId ASC, ");
981 query.append("title ASC, ");
982 query.append("version ASC");
983
984 Query q = session.createQuery(query.toString());
985
986 QueryPos qPos = QueryPos.getInstance(q);
987
988 qPos.add(nodeId);
989
990 list = q.list();
991 }
992 catch (Exception e) {
993 throw processException(e);
994 }
995 finally {
996 if (list == null) {
997 list = new ArrayList<WikiPage>();
998 }
999
1000 cacheResult(list);
1001
1002 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_NODEID,
1003 finderArgs, list);
1004
1005 closeSession(session);
1006 }
1007 }
1008
1009 return list;
1010 }
1011
1012 public List<WikiPage> findByNodeId(long nodeId, int start, int end)
1013 throws SystemException {
1014 return findByNodeId(nodeId, start, end, null);
1015 }
1016
1017 public List<WikiPage> findByNodeId(long nodeId, int start, int end,
1018 OrderByComparator obc) throws SystemException {
1019 Object[] finderArgs = new Object[] {
1020 new Long(nodeId),
1021
1022 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1023 };
1024
1025 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_NODEID,
1026 finderArgs, this);
1027
1028 if (list == null) {
1029 Session session = null;
1030
1031 try {
1032 session = openSession();
1033
1034 StringBuilder query = new StringBuilder();
1035
1036 query.append(
1037 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1038
1039 query.append("nodeId = ?");
1040
1041 query.append(" ");
1042
1043 if (obc != null) {
1044 query.append("ORDER BY ");
1045 query.append(obc.getOrderBy());
1046 }
1047
1048 else {
1049 query.append("ORDER BY ");
1050
1051 query.append("nodeId ASC, ");
1052 query.append("title ASC, ");
1053 query.append("version ASC");
1054 }
1055
1056 Query q = session.createQuery(query.toString());
1057
1058 QueryPos qPos = QueryPos.getInstance(q);
1059
1060 qPos.add(nodeId);
1061
1062 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
1063 end);
1064 }
1065 catch (Exception e) {
1066 throw processException(e);
1067 }
1068 finally {
1069 if (list == null) {
1070 list = new ArrayList<WikiPage>();
1071 }
1072
1073 cacheResult(list);
1074
1075 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_NODEID,
1076 finderArgs, list);
1077
1078 closeSession(session);
1079 }
1080 }
1081
1082 return list;
1083 }
1084
1085 public WikiPage findByNodeId_First(long nodeId, OrderByComparator obc)
1086 throws NoSuchPageException, SystemException {
1087 List<WikiPage> list = findByNodeId(nodeId, 0, 1, obc);
1088
1089 if (list.isEmpty()) {
1090 StringBuilder msg = new StringBuilder();
1091
1092 msg.append("No WikiPage exists with the key {");
1093
1094 msg.append("nodeId=" + nodeId);
1095
1096 msg.append(StringPool.CLOSE_CURLY_BRACE);
1097
1098 throw new NoSuchPageException(msg.toString());
1099 }
1100 else {
1101 return list.get(0);
1102 }
1103 }
1104
1105 public WikiPage findByNodeId_Last(long nodeId, OrderByComparator obc)
1106 throws NoSuchPageException, SystemException {
1107 int count = countByNodeId(nodeId);
1108
1109 List<WikiPage> list = findByNodeId(nodeId, count - 1, count, obc);
1110
1111 if (list.isEmpty()) {
1112 StringBuilder msg = new StringBuilder();
1113
1114 msg.append("No WikiPage exists with the key {");
1115
1116 msg.append("nodeId=" + nodeId);
1117
1118 msg.append(StringPool.CLOSE_CURLY_BRACE);
1119
1120 throw new NoSuchPageException(msg.toString());
1121 }
1122 else {
1123 return list.get(0);
1124 }
1125 }
1126
1127 public WikiPage[] findByNodeId_PrevAndNext(long pageId, long nodeId,
1128 OrderByComparator obc) throws NoSuchPageException, SystemException {
1129 WikiPage wikiPage = findByPrimaryKey(pageId);
1130
1131 int count = countByNodeId(nodeId);
1132
1133 Session session = null;
1134
1135 try {
1136 session = openSession();
1137
1138 StringBuilder query = new StringBuilder();
1139
1140 query.append("FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1141
1142 query.append("nodeId = ?");
1143
1144 query.append(" ");
1145
1146 if (obc != null) {
1147 query.append("ORDER BY ");
1148 query.append(obc.getOrderBy());
1149 }
1150
1151 else {
1152 query.append("ORDER BY ");
1153
1154 query.append("nodeId ASC, ");
1155 query.append("title ASC, ");
1156 query.append("version ASC");
1157 }
1158
1159 Query q = session.createQuery(query.toString());
1160
1161 QueryPos qPos = QueryPos.getInstance(q);
1162
1163 qPos.add(nodeId);
1164
1165 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiPage);
1166
1167 WikiPage[] array = new WikiPageImpl[3];
1168
1169 array[0] = (WikiPage)objArray[0];
1170 array[1] = (WikiPage)objArray[1];
1171 array[2] = (WikiPage)objArray[2];
1172
1173 return array;
1174 }
1175 catch (Exception e) {
1176 throw processException(e);
1177 }
1178 finally {
1179 closeSession(session);
1180 }
1181 }
1182
1183 public List<WikiPage> findByFormat(String format) throws SystemException {
1184 Object[] finderArgs = new Object[] { format };
1185
1186 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_FORMAT,
1187 finderArgs, this);
1188
1189 if (list == null) {
1190 Session session = null;
1191
1192 try {
1193 session = openSession();
1194
1195 StringBuilder query = new StringBuilder();
1196
1197 query.append(
1198 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1199
1200 if (format == null) {
1201 query.append("format IS NULL");
1202 }
1203 else {
1204 query.append("format = ?");
1205 }
1206
1207 query.append(" ");
1208
1209 query.append("ORDER BY ");
1210
1211 query.append("nodeId ASC, ");
1212 query.append("title ASC, ");
1213 query.append("version ASC");
1214
1215 Query q = session.createQuery(query.toString());
1216
1217 QueryPos qPos = QueryPos.getInstance(q);
1218
1219 if (format != null) {
1220 qPos.add(format);
1221 }
1222
1223 list = q.list();
1224 }
1225 catch (Exception e) {
1226 throw processException(e);
1227 }
1228 finally {
1229 if (list == null) {
1230 list = new ArrayList<WikiPage>();
1231 }
1232
1233 cacheResult(list);
1234
1235 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_FORMAT,
1236 finderArgs, list);
1237
1238 closeSession(session);
1239 }
1240 }
1241
1242 return list;
1243 }
1244
1245 public List<WikiPage> findByFormat(String format, int start, int end)
1246 throws SystemException {
1247 return findByFormat(format, start, end, null);
1248 }
1249
1250 public List<WikiPage> findByFormat(String format, int start, int end,
1251 OrderByComparator obc) throws SystemException {
1252 Object[] finderArgs = new Object[] {
1253 format,
1254
1255 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1256 };
1257
1258 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_FORMAT,
1259 finderArgs, this);
1260
1261 if (list == null) {
1262 Session session = null;
1263
1264 try {
1265 session = openSession();
1266
1267 StringBuilder query = new StringBuilder();
1268
1269 query.append(
1270 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1271
1272 if (format == null) {
1273 query.append("format IS NULL");
1274 }
1275 else {
1276 query.append("format = ?");
1277 }
1278
1279 query.append(" ");
1280
1281 if (obc != null) {
1282 query.append("ORDER BY ");
1283 query.append(obc.getOrderBy());
1284 }
1285
1286 else {
1287 query.append("ORDER BY ");
1288
1289 query.append("nodeId ASC, ");
1290 query.append("title ASC, ");
1291 query.append("version ASC");
1292 }
1293
1294 Query q = session.createQuery(query.toString());
1295
1296 QueryPos qPos = QueryPos.getInstance(q);
1297
1298 if (format != null) {
1299 qPos.add(format);
1300 }
1301
1302 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
1303 end);
1304 }
1305 catch (Exception e) {
1306 throw processException(e);
1307 }
1308 finally {
1309 if (list == null) {
1310 list = new ArrayList<WikiPage>();
1311 }
1312
1313 cacheResult(list);
1314
1315 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_FORMAT,
1316 finderArgs, list);
1317
1318 closeSession(session);
1319 }
1320 }
1321
1322 return list;
1323 }
1324
1325 public WikiPage findByFormat_First(String format, OrderByComparator obc)
1326 throws NoSuchPageException, SystemException {
1327 List<WikiPage> list = findByFormat(format, 0, 1, obc);
1328
1329 if (list.isEmpty()) {
1330 StringBuilder msg = new StringBuilder();
1331
1332 msg.append("No WikiPage exists with the key {");
1333
1334 msg.append("format=" + format);
1335
1336 msg.append(StringPool.CLOSE_CURLY_BRACE);
1337
1338 throw new NoSuchPageException(msg.toString());
1339 }
1340 else {
1341 return list.get(0);
1342 }
1343 }
1344
1345 public WikiPage findByFormat_Last(String format, OrderByComparator obc)
1346 throws NoSuchPageException, SystemException {
1347 int count = countByFormat(format);
1348
1349 List<WikiPage> list = findByFormat(format, count - 1, count, obc);
1350
1351 if (list.isEmpty()) {
1352 StringBuilder msg = new StringBuilder();
1353
1354 msg.append("No WikiPage exists with the key {");
1355
1356 msg.append("format=" + format);
1357
1358 msg.append(StringPool.CLOSE_CURLY_BRACE);
1359
1360 throw new NoSuchPageException(msg.toString());
1361 }
1362 else {
1363 return list.get(0);
1364 }
1365 }
1366
1367 public WikiPage[] findByFormat_PrevAndNext(long pageId, String format,
1368 OrderByComparator obc) throws NoSuchPageException, SystemException {
1369 WikiPage wikiPage = findByPrimaryKey(pageId);
1370
1371 int count = countByFormat(format);
1372
1373 Session session = null;
1374
1375 try {
1376 session = openSession();
1377
1378 StringBuilder query = new StringBuilder();
1379
1380 query.append("FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1381
1382 if (format == null) {
1383 query.append("format IS NULL");
1384 }
1385 else {
1386 query.append("format = ?");
1387 }
1388
1389 query.append(" ");
1390
1391 if (obc != null) {
1392 query.append("ORDER BY ");
1393 query.append(obc.getOrderBy());
1394 }
1395
1396 else {
1397 query.append("ORDER BY ");
1398
1399 query.append("nodeId ASC, ");
1400 query.append("title ASC, ");
1401 query.append("version ASC");
1402 }
1403
1404 Query q = session.createQuery(query.toString());
1405
1406 QueryPos qPos = QueryPos.getInstance(q);
1407
1408 if (format != null) {
1409 qPos.add(format);
1410 }
1411
1412 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiPage);
1413
1414 WikiPage[] array = new WikiPageImpl[3];
1415
1416 array[0] = (WikiPage)objArray[0];
1417 array[1] = (WikiPage)objArray[1];
1418 array[2] = (WikiPage)objArray[2];
1419
1420 return array;
1421 }
1422 catch (Exception e) {
1423 throw processException(e);
1424 }
1425 finally {
1426 closeSession(session);
1427 }
1428 }
1429
1430 public List<WikiPage> findByN_T(long nodeId, String title)
1431 throws SystemException {
1432 Object[] finderArgs = new Object[] { new Long(nodeId), title };
1433
1434 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_T,
1435 finderArgs, this);
1436
1437 if (list == null) {
1438 Session session = null;
1439
1440 try {
1441 session = openSession();
1442
1443 StringBuilder query = new StringBuilder();
1444
1445 query.append(
1446 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1447
1448 query.append("nodeId = ?");
1449
1450 query.append(" AND ");
1451
1452 if (title == null) {
1453 query.append("title IS NULL");
1454 }
1455 else {
1456 query.append("title = ?");
1457 }
1458
1459 query.append(" ");
1460
1461 query.append("ORDER BY ");
1462
1463 query.append("nodeId ASC, ");
1464 query.append("title ASC, ");
1465 query.append("version ASC");
1466
1467 Query q = session.createQuery(query.toString());
1468
1469 QueryPos qPos = QueryPos.getInstance(q);
1470
1471 qPos.add(nodeId);
1472
1473 if (title != null) {
1474 qPos.add(title);
1475 }
1476
1477 list = q.list();
1478 }
1479 catch (Exception e) {
1480 throw processException(e);
1481 }
1482 finally {
1483 if (list == null) {
1484 list = new ArrayList<WikiPage>();
1485 }
1486
1487 cacheResult(list);
1488
1489 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_T, finderArgs,
1490 list);
1491
1492 closeSession(session);
1493 }
1494 }
1495
1496 return list;
1497 }
1498
1499 public List<WikiPage> findByN_T(long nodeId, String title, int start,
1500 int end) throws SystemException {
1501 return findByN_T(nodeId, title, start, end, null);
1502 }
1503
1504 public List<WikiPage> findByN_T(long nodeId, String title, int start,
1505 int end, OrderByComparator obc) throws SystemException {
1506 Object[] finderArgs = new Object[] {
1507 new Long(nodeId),
1508
1509 title,
1510
1511 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1512 };
1513
1514 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_N_T,
1515 finderArgs, this);
1516
1517 if (list == null) {
1518 Session session = null;
1519
1520 try {
1521 session = openSession();
1522
1523 StringBuilder query = new StringBuilder();
1524
1525 query.append(
1526 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1527
1528 query.append("nodeId = ?");
1529
1530 query.append(" AND ");
1531
1532 if (title == null) {
1533 query.append("title IS NULL");
1534 }
1535 else {
1536 query.append("title = ?");
1537 }
1538
1539 query.append(" ");
1540
1541 if (obc != null) {
1542 query.append("ORDER BY ");
1543 query.append(obc.getOrderBy());
1544 }
1545
1546 else {
1547 query.append("ORDER BY ");
1548
1549 query.append("nodeId ASC, ");
1550 query.append("title ASC, ");
1551 query.append("version ASC");
1552 }
1553
1554 Query q = session.createQuery(query.toString());
1555
1556 QueryPos qPos = QueryPos.getInstance(q);
1557
1558 qPos.add(nodeId);
1559
1560 if (title != null) {
1561 qPos.add(title);
1562 }
1563
1564 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
1565 end);
1566 }
1567 catch (Exception e) {
1568 throw processException(e);
1569 }
1570 finally {
1571 if (list == null) {
1572 list = new ArrayList<WikiPage>();
1573 }
1574
1575 cacheResult(list);
1576
1577 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_N_T,
1578 finderArgs, list);
1579
1580 closeSession(session);
1581 }
1582 }
1583
1584 return list;
1585 }
1586
1587 public WikiPage findByN_T_First(long nodeId, String title,
1588 OrderByComparator obc) throws NoSuchPageException, SystemException {
1589 List<WikiPage> list = findByN_T(nodeId, title, 0, 1, obc);
1590
1591 if (list.isEmpty()) {
1592 StringBuilder msg = new StringBuilder();
1593
1594 msg.append("No WikiPage exists with the key {");
1595
1596 msg.append("nodeId=" + nodeId);
1597
1598 msg.append(", ");
1599 msg.append("title=" + title);
1600
1601 msg.append(StringPool.CLOSE_CURLY_BRACE);
1602
1603 throw new NoSuchPageException(msg.toString());
1604 }
1605 else {
1606 return list.get(0);
1607 }
1608 }
1609
1610 public WikiPage findByN_T_Last(long nodeId, String title,
1611 OrderByComparator obc) throws NoSuchPageException, SystemException {
1612 int count = countByN_T(nodeId, title);
1613
1614 List<WikiPage> list = findByN_T(nodeId, title, count - 1, count, obc);
1615
1616 if (list.isEmpty()) {
1617 StringBuilder msg = new StringBuilder();
1618
1619 msg.append("No WikiPage exists with the key {");
1620
1621 msg.append("nodeId=" + nodeId);
1622
1623 msg.append(", ");
1624 msg.append("title=" + title);
1625
1626 msg.append(StringPool.CLOSE_CURLY_BRACE);
1627
1628 throw new NoSuchPageException(msg.toString());
1629 }
1630 else {
1631 return list.get(0);
1632 }
1633 }
1634
1635 public WikiPage[] findByN_T_PrevAndNext(long pageId, long nodeId,
1636 String title, OrderByComparator obc)
1637 throws NoSuchPageException, SystemException {
1638 WikiPage wikiPage = findByPrimaryKey(pageId);
1639
1640 int count = countByN_T(nodeId, title);
1641
1642 Session session = null;
1643
1644 try {
1645 session = openSession();
1646
1647 StringBuilder query = new StringBuilder();
1648
1649 query.append("FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1650
1651 query.append("nodeId = ?");
1652
1653 query.append(" AND ");
1654
1655 if (title == null) {
1656 query.append("title IS NULL");
1657 }
1658 else {
1659 query.append("title = ?");
1660 }
1661
1662 query.append(" ");
1663
1664 if (obc != null) {
1665 query.append("ORDER BY ");
1666 query.append(obc.getOrderBy());
1667 }
1668
1669 else {
1670 query.append("ORDER BY ");
1671
1672 query.append("nodeId ASC, ");
1673 query.append("title ASC, ");
1674 query.append("version ASC");
1675 }
1676
1677 Query q = session.createQuery(query.toString());
1678
1679 QueryPos qPos = QueryPos.getInstance(q);
1680
1681 qPos.add(nodeId);
1682
1683 if (title != null) {
1684 qPos.add(title);
1685 }
1686
1687 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiPage);
1688
1689 WikiPage[] array = new WikiPageImpl[3];
1690
1691 array[0] = (WikiPage)objArray[0];
1692 array[1] = (WikiPage)objArray[1];
1693 array[2] = (WikiPage)objArray[2];
1694
1695 return array;
1696 }
1697 catch (Exception e) {
1698 throw processException(e);
1699 }
1700 finally {
1701 closeSession(session);
1702 }
1703 }
1704
1705 public List<WikiPage> findByN_H(long nodeId, boolean head)
1706 throws SystemException {
1707 Object[] finderArgs = new Object[] {
1708 new Long(nodeId), Boolean.valueOf(head)
1709 };
1710
1711 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_H,
1712 finderArgs, this);
1713
1714 if (list == null) {
1715 Session session = null;
1716
1717 try {
1718 session = openSession();
1719
1720 StringBuilder query = new StringBuilder();
1721
1722 query.append(
1723 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1724
1725 query.append("nodeId = ?");
1726
1727 query.append(" AND ");
1728
1729 query.append("head = ?");
1730
1731 query.append(" ");
1732
1733 query.append("ORDER BY ");
1734
1735 query.append("nodeId ASC, ");
1736 query.append("title ASC, ");
1737 query.append("version ASC");
1738
1739 Query q = session.createQuery(query.toString());
1740
1741 QueryPos qPos = QueryPos.getInstance(q);
1742
1743 qPos.add(nodeId);
1744
1745 qPos.add(head);
1746
1747 list = q.list();
1748 }
1749 catch (Exception e) {
1750 throw processException(e);
1751 }
1752 finally {
1753 if (list == null) {
1754 list = new ArrayList<WikiPage>();
1755 }
1756
1757 cacheResult(list);
1758
1759 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_H, finderArgs,
1760 list);
1761
1762 closeSession(session);
1763 }
1764 }
1765
1766 return list;
1767 }
1768
1769 public List<WikiPage> findByN_H(long nodeId, boolean head, int start,
1770 int end) throws SystemException {
1771 return findByN_H(nodeId, head, start, end, null);
1772 }
1773
1774 public List<WikiPage> findByN_H(long nodeId, boolean head, int start,
1775 int end, OrderByComparator obc) throws SystemException {
1776 Object[] finderArgs = new Object[] {
1777 new Long(nodeId), Boolean.valueOf(head),
1778
1779 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1780 };
1781
1782 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_N_H,
1783 finderArgs, this);
1784
1785 if (list == null) {
1786 Session session = null;
1787
1788 try {
1789 session = openSession();
1790
1791 StringBuilder query = new StringBuilder();
1792
1793 query.append(
1794 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1795
1796 query.append("nodeId = ?");
1797
1798 query.append(" AND ");
1799
1800 query.append("head = ?");
1801
1802 query.append(" ");
1803
1804 if (obc != null) {
1805 query.append("ORDER BY ");
1806 query.append(obc.getOrderBy());
1807 }
1808
1809 else {
1810 query.append("ORDER BY ");
1811
1812 query.append("nodeId ASC, ");
1813 query.append("title ASC, ");
1814 query.append("version ASC");
1815 }
1816
1817 Query q = session.createQuery(query.toString());
1818
1819 QueryPos qPos = QueryPos.getInstance(q);
1820
1821 qPos.add(nodeId);
1822
1823 qPos.add(head);
1824
1825 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
1826 end);
1827 }
1828 catch (Exception e) {
1829 throw processException(e);
1830 }
1831 finally {
1832 if (list == null) {
1833 list = new ArrayList<WikiPage>();
1834 }
1835
1836 cacheResult(list);
1837
1838 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_N_H,
1839 finderArgs, list);
1840
1841 closeSession(session);
1842 }
1843 }
1844
1845 return list;
1846 }
1847
1848 public WikiPage findByN_H_First(long nodeId, boolean head,
1849 OrderByComparator obc) throws NoSuchPageException, SystemException {
1850 List<WikiPage> list = findByN_H(nodeId, head, 0, 1, obc);
1851
1852 if (list.isEmpty()) {
1853 StringBuilder msg = new StringBuilder();
1854
1855 msg.append("No WikiPage exists with the key {");
1856
1857 msg.append("nodeId=" + nodeId);
1858
1859 msg.append(", ");
1860 msg.append("head=" + head);
1861
1862 msg.append(StringPool.CLOSE_CURLY_BRACE);
1863
1864 throw new NoSuchPageException(msg.toString());
1865 }
1866 else {
1867 return list.get(0);
1868 }
1869 }
1870
1871 public WikiPage findByN_H_Last(long nodeId, boolean head,
1872 OrderByComparator obc) throws NoSuchPageException, SystemException {
1873 int count = countByN_H(nodeId, head);
1874
1875 List<WikiPage> list = findByN_H(nodeId, head, count - 1, count, obc);
1876
1877 if (list.isEmpty()) {
1878 StringBuilder msg = new StringBuilder();
1879
1880 msg.append("No WikiPage exists with the key {");
1881
1882 msg.append("nodeId=" + nodeId);
1883
1884 msg.append(", ");
1885 msg.append("head=" + head);
1886
1887 msg.append(StringPool.CLOSE_CURLY_BRACE);
1888
1889 throw new NoSuchPageException(msg.toString());
1890 }
1891 else {
1892 return list.get(0);
1893 }
1894 }
1895
1896 public WikiPage[] findByN_H_PrevAndNext(long pageId, long nodeId,
1897 boolean head, OrderByComparator obc)
1898 throws NoSuchPageException, SystemException {
1899 WikiPage wikiPage = findByPrimaryKey(pageId);
1900
1901 int count = countByN_H(nodeId, head);
1902
1903 Session session = null;
1904
1905 try {
1906 session = openSession();
1907
1908 StringBuilder query = new StringBuilder();
1909
1910 query.append("FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1911
1912 query.append("nodeId = ?");
1913
1914 query.append(" AND ");
1915
1916 query.append("head = ?");
1917
1918 query.append(" ");
1919
1920 if (obc != null) {
1921 query.append("ORDER BY ");
1922 query.append(obc.getOrderBy());
1923 }
1924
1925 else {
1926 query.append("ORDER BY ");
1927
1928 query.append("nodeId ASC, ");
1929 query.append("title ASC, ");
1930 query.append("version ASC");
1931 }
1932
1933 Query q = session.createQuery(query.toString());
1934
1935 QueryPos qPos = QueryPos.getInstance(q);
1936
1937 qPos.add(nodeId);
1938
1939 qPos.add(head);
1940
1941 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiPage);
1942
1943 WikiPage[] array = new WikiPageImpl[3];
1944
1945 array[0] = (WikiPage)objArray[0];
1946 array[1] = (WikiPage)objArray[1];
1947 array[2] = (WikiPage)objArray[2];
1948
1949 return array;
1950 }
1951 catch (Exception e) {
1952 throw processException(e);
1953 }
1954 finally {
1955 closeSession(session);
1956 }
1957 }
1958
1959 public List<WikiPage> findByN_P(long nodeId, String parentTitle)
1960 throws SystemException {
1961 Object[] finderArgs = new Object[] { new Long(nodeId), parentTitle };
1962
1963 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_P,
1964 finderArgs, this);
1965
1966 if (list == null) {
1967 Session session = null;
1968
1969 try {
1970 session = openSession();
1971
1972 StringBuilder query = new StringBuilder();
1973
1974 query.append(
1975 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
1976
1977 query.append("nodeId = ?");
1978
1979 query.append(" AND ");
1980
1981 if (parentTitle == null) {
1982 query.append("parentTitle IS NULL");
1983 }
1984 else {
1985 query.append("parentTitle = ?");
1986 }
1987
1988 query.append(" ");
1989
1990 query.append("ORDER BY ");
1991
1992 query.append("nodeId ASC, ");
1993 query.append("title ASC, ");
1994 query.append("version ASC");
1995
1996 Query q = session.createQuery(query.toString());
1997
1998 QueryPos qPos = QueryPos.getInstance(q);
1999
2000 qPos.add(nodeId);
2001
2002 if (parentTitle != null) {
2003 qPos.add(parentTitle);
2004 }
2005
2006 list = q.list();
2007 }
2008 catch (Exception e) {
2009 throw processException(e);
2010 }
2011 finally {
2012 if (list == null) {
2013 list = new ArrayList<WikiPage>();
2014 }
2015
2016 cacheResult(list);
2017
2018 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_P, finderArgs,
2019 list);
2020
2021 closeSession(session);
2022 }
2023 }
2024
2025 return list;
2026 }
2027
2028 public List<WikiPage> findByN_P(long nodeId, String parentTitle, int start,
2029 int end) throws SystemException {
2030 return findByN_P(nodeId, parentTitle, start, end, null);
2031 }
2032
2033 public List<WikiPage> findByN_P(long nodeId, String parentTitle, int start,
2034 int end, OrderByComparator obc) throws SystemException {
2035 Object[] finderArgs = new Object[] {
2036 new Long(nodeId),
2037
2038 parentTitle,
2039
2040 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2041 };
2042
2043 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_N_P,
2044 finderArgs, this);
2045
2046 if (list == null) {
2047 Session session = null;
2048
2049 try {
2050 session = openSession();
2051
2052 StringBuilder query = new StringBuilder();
2053
2054 query.append(
2055 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
2056
2057 query.append("nodeId = ?");
2058
2059 query.append(" AND ");
2060
2061 if (parentTitle == null) {
2062 query.append("parentTitle IS NULL");
2063 }
2064 else {
2065 query.append("parentTitle = ?");
2066 }
2067
2068 query.append(" ");
2069
2070 if (obc != null) {
2071 query.append("ORDER BY ");
2072 query.append(obc.getOrderBy());
2073 }
2074
2075 else {
2076 query.append("ORDER BY ");
2077
2078 query.append("nodeId ASC, ");
2079 query.append("title ASC, ");
2080 query.append("version ASC");
2081 }
2082
2083 Query q = session.createQuery(query.toString());
2084
2085 QueryPos qPos = QueryPos.getInstance(q);
2086
2087 qPos.add(nodeId);
2088
2089 if (parentTitle != null) {
2090 qPos.add(parentTitle);
2091 }
2092
2093 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
2094 end);
2095 }
2096 catch (Exception e) {
2097 throw processException(e);
2098 }
2099 finally {
2100 if (list == null) {
2101 list = new ArrayList<WikiPage>();
2102 }
2103
2104 cacheResult(list);
2105
2106 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_N_P,
2107 finderArgs, list);
2108
2109 closeSession(session);
2110 }
2111 }
2112
2113 return list;
2114 }
2115
2116 public WikiPage findByN_P_First(long nodeId, String parentTitle,
2117 OrderByComparator obc) throws NoSuchPageException, SystemException {
2118 List<WikiPage> list = findByN_P(nodeId, parentTitle, 0, 1, obc);
2119
2120 if (list.isEmpty()) {
2121 StringBuilder msg = new StringBuilder();
2122
2123 msg.append("No WikiPage exists with the key {");
2124
2125 msg.append("nodeId=" + nodeId);
2126
2127 msg.append(", ");
2128 msg.append("parentTitle=" + parentTitle);
2129
2130 msg.append(StringPool.CLOSE_CURLY_BRACE);
2131
2132 throw new NoSuchPageException(msg.toString());
2133 }
2134 else {
2135 return list.get(0);
2136 }
2137 }
2138
2139 public WikiPage findByN_P_Last(long nodeId, String parentTitle,
2140 OrderByComparator obc) throws NoSuchPageException, SystemException {
2141 int count = countByN_P(nodeId, parentTitle);
2142
2143 List<WikiPage> list = findByN_P(nodeId, parentTitle, count - 1, count,
2144 obc);
2145
2146 if (list.isEmpty()) {
2147 StringBuilder msg = new StringBuilder();
2148
2149 msg.append("No WikiPage exists with the key {");
2150
2151 msg.append("nodeId=" + nodeId);
2152
2153 msg.append(", ");
2154 msg.append("parentTitle=" + parentTitle);
2155
2156 msg.append(StringPool.CLOSE_CURLY_BRACE);
2157
2158 throw new NoSuchPageException(msg.toString());
2159 }
2160 else {
2161 return list.get(0);
2162 }
2163 }
2164
2165 public WikiPage[] findByN_P_PrevAndNext(long pageId, long nodeId,
2166 String parentTitle, OrderByComparator obc)
2167 throws NoSuchPageException, SystemException {
2168 WikiPage wikiPage = findByPrimaryKey(pageId);
2169
2170 int count = countByN_P(nodeId, parentTitle);
2171
2172 Session session = null;
2173
2174 try {
2175 session = openSession();
2176
2177 StringBuilder query = new StringBuilder();
2178
2179 query.append("FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
2180
2181 query.append("nodeId = ?");
2182
2183 query.append(" AND ");
2184
2185 if (parentTitle == null) {
2186 query.append("parentTitle IS NULL");
2187 }
2188 else {
2189 query.append("parentTitle = ?");
2190 }
2191
2192 query.append(" ");
2193
2194 if (obc != null) {
2195 query.append("ORDER BY ");
2196 query.append(obc.getOrderBy());
2197 }
2198
2199 else {
2200 query.append("ORDER BY ");
2201
2202 query.append("nodeId ASC, ");
2203 query.append("title ASC, ");
2204 query.append("version ASC");
2205 }
2206
2207 Query q = session.createQuery(query.toString());
2208
2209 QueryPos qPos = QueryPos.getInstance(q);
2210
2211 qPos.add(nodeId);
2212
2213 if (parentTitle != null) {
2214 qPos.add(parentTitle);
2215 }
2216
2217 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiPage);
2218
2219 WikiPage[] array = new WikiPageImpl[3];
2220
2221 array[0] = (WikiPage)objArray[0];
2222 array[1] = (WikiPage)objArray[1];
2223 array[2] = (WikiPage)objArray[2];
2224
2225 return array;
2226 }
2227 catch (Exception e) {
2228 throw processException(e);
2229 }
2230 finally {
2231 closeSession(session);
2232 }
2233 }
2234
2235 public List<WikiPage> findByN_R(long nodeId, String redirectTitle)
2236 throws SystemException {
2237 Object[] finderArgs = new Object[] { new Long(nodeId), redirectTitle };
2238
2239 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_R,
2240 finderArgs, this);
2241
2242 if (list == null) {
2243 Session session = null;
2244
2245 try {
2246 session = openSession();
2247
2248 StringBuilder query = new StringBuilder();
2249
2250 query.append(
2251 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
2252
2253 query.append("nodeId = ?");
2254
2255 query.append(" AND ");
2256
2257 if (redirectTitle == null) {
2258 query.append("redirectTitle IS NULL");
2259 }
2260 else {
2261 query.append("redirectTitle = ?");
2262 }
2263
2264 query.append(" ");
2265
2266 query.append("ORDER BY ");
2267
2268 query.append("nodeId ASC, ");
2269 query.append("title ASC, ");
2270 query.append("version ASC");
2271
2272 Query q = session.createQuery(query.toString());
2273
2274 QueryPos qPos = QueryPos.getInstance(q);
2275
2276 qPos.add(nodeId);
2277
2278 if (redirectTitle != null) {
2279 qPos.add(redirectTitle);
2280 }
2281
2282 list = q.list();
2283 }
2284 catch (Exception e) {
2285 throw processException(e);
2286 }
2287 finally {
2288 if (list == null) {
2289 list = new ArrayList<WikiPage>();
2290 }
2291
2292 cacheResult(list);
2293
2294 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_R, finderArgs,
2295 list);
2296
2297 closeSession(session);
2298 }
2299 }
2300
2301 return list;
2302 }
2303
2304 public List<WikiPage> findByN_R(long nodeId, String redirectTitle,
2305 int start, int end) throws SystemException {
2306 return findByN_R(nodeId, redirectTitle, start, end, null);
2307 }
2308
2309 public List<WikiPage> findByN_R(long nodeId, String redirectTitle,
2310 int start, int end, OrderByComparator obc) throws SystemException {
2311 Object[] finderArgs = new Object[] {
2312 new Long(nodeId),
2313
2314 redirectTitle,
2315
2316 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2317 };
2318
2319 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_N_R,
2320 finderArgs, this);
2321
2322 if (list == null) {
2323 Session session = null;
2324
2325 try {
2326 session = openSession();
2327
2328 StringBuilder query = new StringBuilder();
2329
2330 query.append(
2331 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
2332
2333 query.append("nodeId = ?");
2334
2335 query.append(" AND ");
2336
2337 if (redirectTitle == null) {
2338 query.append("redirectTitle IS NULL");
2339 }
2340 else {
2341 query.append("redirectTitle = ?");
2342 }
2343
2344 query.append(" ");
2345
2346 if (obc != null) {
2347 query.append("ORDER BY ");
2348 query.append(obc.getOrderBy());
2349 }
2350
2351 else {
2352 query.append("ORDER BY ");
2353
2354 query.append("nodeId ASC, ");
2355 query.append("title ASC, ");
2356 query.append("version ASC");
2357 }
2358
2359 Query q = session.createQuery(query.toString());
2360
2361 QueryPos qPos = QueryPos.getInstance(q);
2362
2363 qPos.add(nodeId);
2364
2365 if (redirectTitle != null) {
2366 qPos.add(redirectTitle);
2367 }
2368
2369 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
2370 end);
2371 }
2372 catch (Exception e) {
2373 throw processException(e);
2374 }
2375 finally {
2376 if (list == null) {
2377 list = new ArrayList<WikiPage>();
2378 }
2379
2380 cacheResult(list);
2381
2382 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_N_R,
2383 finderArgs, list);
2384
2385 closeSession(session);
2386 }
2387 }
2388
2389 return list;
2390 }
2391
2392 public WikiPage findByN_R_First(long nodeId, String redirectTitle,
2393 OrderByComparator obc) throws NoSuchPageException, SystemException {
2394 List<WikiPage> list = findByN_R(nodeId, redirectTitle, 0, 1, obc);
2395
2396 if (list.isEmpty()) {
2397 StringBuilder msg = new StringBuilder();
2398
2399 msg.append("No WikiPage exists with the key {");
2400
2401 msg.append("nodeId=" + nodeId);
2402
2403 msg.append(", ");
2404 msg.append("redirectTitle=" + redirectTitle);
2405
2406 msg.append(StringPool.CLOSE_CURLY_BRACE);
2407
2408 throw new NoSuchPageException(msg.toString());
2409 }
2410 else {
2411 return list.get(0);
2412 }
2413 }
2414
2415 public WikiPage findByN_R_Last(long nodeId, String redirectTitle,
2416 OrderByComparator obc) throws NoSuchPageException, SystemException {
2417 int count = countByN_R(nodeId, redirectTitle);
2418
2419 List<WikiPage> list = findByN_R(nodeId, redirectTitle, count - 1,
2420 count, obc);
2421
2422 if (list.isEmpty()) {
2423 StringBuilder msg = new StringBuilder();
2424
2425 msg.append("No WikiPage exists with the key {");
2426
2427 msg.append("nodeId=" + nodeId);
2428
2429 msg.append(", ");
2430 msg.append("redirectTitle=" + redirectTitle);
2431
2432 msg.append(StringPool.CLOSE_CURLY_BRACE);
2433
2434 throw new NoSuchPageException(msg.toString());
2435 }
2436 else {
2437 return list.get(0);
2438 }
2439 }
2440
2441 public WikiPage[] findByN_R_PrevAndNext(long pageId, long nodeId,
2442 String redirectTitle, OrderByComparator obc)
2443 throws NoSuchPageException, SystemException {
2444 WikiPage wikiPage = findByPrimaryKey(pageId);
2445
2446 int count = countByN_R(nodeId, redirectTitle);
2447
2448 Session session = null;
2449
2450 try {
2451 session = openSession();
2452
2453 StringBuilder query = new StringBuilder();
2454
2455 query.append("FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
2456
2457 query.append("nodeId = ?");
2458
2459 query.append(" AND ");
2460
2461 if (redirectTitle == null) {
2462 query.append("redirectTitle IS NULL");
2463 }
2464 else {
2465 query.append("redirectTitle = ?");
2466 }
2467
2468 query.append(" ");
2469
2470 if (obc != null) {
2471 query.append("ORDER BY ");
2472 query.append(obc.getOrderBy());
2473 }
2474
2475 else {
2476 query.append("ORDER BY ");
2477
2478 query.append("nodeId ASC, ");
2479 query.append("title ASC, ");
2480 query.append("version ASC");
2481 }
2482
2483 Query q = session.createQuery(query.toString());
2484
2485 QueryPos qPos = QueryPos.getInstance(q);
2486
2487 qPos.add(nodeId);
2488
2489 if (redirectTitle != null) {
2490 qPos.add(redirectTitle);
2491 }
2492
2493 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiPage);
2494
2495 WikiPage[] array = new WikiPageImpl[3];
2496
2497 array[0] = (WikiPage)objArray[0];
2498 array[1] = (WikiPage)objArray[1];
2499 array[2] = (WikiPage)objArray[2];
2500
2501 return array;
2502 }
2503 catch (Exception e) {
2504 throw processException(e);
2505 }
2506 finally {
2507 closeSession(session);
2508 }
2509 }
2510
2511 public WikiPage findByN_T_V(long nodeId, String title, double version)
2512 throws NoSuchPageException, SystemException {
2513 WikiPage wikiPage = fetchByN_T_V(nodeId, title, version);
2514
2515 if (wikiPage == null) {
2516 StringBuilder msg = new StringBuilder();
2517
2518 msg.append("No WikiPage exists with the key {");
2519
2520 msg.append("nodeId=" + nodeId);
2521
2522 msg.append(", ");
2523 msg.append("title=" + title);
2524
2525 msg.append(", ");
2526 msg.append("version=" + version);
2527
2528 msg.append(StringPool.CLOSE_CURLY_BRACE);
2529
2530 if (_log.isWarnEnabled()) {
2531 _log.warn(msg.toString());
2532 }
2533
2534 throw new NoSuchPageException(msg.toString());
2535 }
2536
2537 return wikiPage;
2538 }
2539
2540 public WikiPage fetchByN_T_V(long nodeId, String title, double version)
2541 throws SystemException {
2542 return fetchByN_T_V(nodeId, title, version, true);
2543 }
2544
2545 public WikiPage fetchByN_T_V(long nodeId, String title, double version,
2546 boolean retrieveFromCache) throws SystemException {
2547 Object[] finderArgs = new Object[] {
2548 new Long(nodeId),
2549
2550 title, new Double(version)
2551 };
2552
2553 Object result = null;
2554
2555 if (retrieveFromCache) {
2556 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_N_T_V,
2557 finderArgs, this);
2558 }
2559
2560 if (result == null) {
2561 Session session = null;
2562
2563 try {
2564 session = openSession();
2565
2566 StringBuilder query = new StringBuilder();
2567
2568 query.append(
2569 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
2570
2571 query.append("nodeId = ?");
2572
2573 query.append(" AND ");
2574
2575 if (title == null) {
2576 query.append("title IS NULL");
2577 }
2578 else {
2579 query.append("title = ?");
2580 }
2581
2582 query.append(" AND ");
2583
2584 query.append("version = ?");
2585
2586 query.append(" ");
2587
2588 query.append("ORDER BY ");
2589
2590 query.append("nodeId ASC, ");
2591 query.append("title ASC, ");
2592 query.append("version ASC");
2593
2594 Query q = session.createQuery(query.toString());
2595
2596 QueryPos qPos = QueryPos.getInstance(q);
2597
2598 qPos.add(nodeId);
2599
2600 if (title != null) {
2601 qPos.add(title);
2602 }
2603
2604 qPos.add(version);
2605
2606 List<WikiPage> list = q.list();
2607
2608 result = list;
2609
2610 WikiPage wikiPage = null;
2611
2612 if (list.isEmpty()) {
2613 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T_V,
2614 finderArgs, list);
2615 }
2616 else {
2617 wikiPage = list.get(0);
2618
2619 cacheResult(wikiPage);
2620
2621 if ((wikiPage.getNodeId() != nodeId) ||
2622 (wikiPage.getTitle() == null) ||
2623 !wikiPage.getTitle().equals(title) ||
2624 (wikiPage.getVersion() != version)) {
2625 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T_V,
2626 finderArgs, wikiPage);
2627 }
2628 }
2629
2630 return wikiPage;
2631 }
2632 catch (Exception e) {
2633 throw processException(e);
2634 }
2635 finally {
2636 if (result == null) {
2637 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T_V,
2638 finderArgs, new ArrayList<WikiPage>());
2639 }
2640
2641 closeSession(session);
2642 }
2643 }
2644 else {
2645 if (result instanceof List) {
2646 return null;
2647 }
2648 else {
2649 return (WikiPage)result;
2650 }
2651 }
2652 }
2653
2654 public List<WikiPage> findByN_T_H(long nodeId, String title, boolean head)
2655 throws SystemException {
2656 Object[] finderArgs = new Object[] {
2657 new Long(nodeId),
2658
2659 title, Boolean.valueOf(head)
2660 };
2661
2662 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_T_H,
2663 finderArgs, this);
2664
2665 if (list == null) {
2666 Session session = null;
2667
2668 try {
2669 session = openSession();
2670
2671 StringBuilder query = new StringBuilder();
2672
2673 query.append(
2674 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
2675
2676 query.append("nodeId = ?");
2677
2678 query.append(" AND ");
2679
2680 if (title == null) {
2681 query.append("title IS NULL");
2682 }
2683 else {
2684 query.append("title = ?");
2685 }
2686
2687 query.append(" AND ");
2688
2689 query.append("head = ?");
2690
2691 query.append(" ");
2692
2693 query.append("ORDER BY ");
2694
2695 query.append("nodeId ASC, ");
2696 query.append("title ASC, ");
2697 query.append("version ASC");
2698
2699 Query q = session.createQuery(query.toString());
2700
2701 QueryPos qPos = QueryPos.getInstance(q);
2702
2703 qPos.add(nodeId);
2704
2705 if (title != null) {
2706 qPos.add(title);
2707 }
2708
2709 qPos.add(head);
2710
2711 list = q.list();
2712 }
2713 catch (Exception e) {
2714 throw processException(e);
2715 }
2716 finally {
2717 if (list == null) {
2718 list = new ArrayList<WikiPage>();
2719 }
2720
2721 cacheResult(list);
2722
2723 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_T_H,
2724 finderArgs, list);
2725
2726 closeSession(session);
2727 }
2728 }
2729
2730 return list;
2731 }
2732
2733 public List<WikiPage> findByN_T_H(long nodeId, String title, boolean head,
2734 int start, int end) throws SystemException {
2735 return findByN_T_H(nodeId, title, head, start, end, null);
2736 }
2737
2738 public List<WikiPage> findByN_T_H(long nodeId, String title, boolean head,
2739 int start, int end, OrderByComparator obc) throws SystemException {
2740 Object[] finderArgs = new Object[] {
2741 new Long(nodeId),
2742
2743 title, Boolean.valueOf(head),
2744
2745 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2746 };
2747
2748 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_N_T_H,
2749 finderArgs, this);
2750
2751 if (list == null) {
2752 Session session = null;
2753
2754 try {
2755 session = openSession();
2756
2757 StringBuilder query = new StringBuilder();
2758
2759 query.append(
2760 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
2761
2762 query.append("nodeId = ?");
2763
2764 query.append(" AND ");
2765
2766 if (title == null) {
2767 query.append("title IS NULL");
2768 }
2769 else {
2770 query.append("title = ?");
2771 }
2772
2773 query.append(" AND ");
2774
2775 query.append("head = ?");
2776
2777 query.append(" ");
2778
2779 if (obc != null) {
2780 query.append("ORDER BY ");
2781 query.append(obc.getOrderBy());
2782 }
2783
2784 else {
2785 query.append("ORDER BY ");
2786
2787 query.append("nodeId ASC, ");
2788 query.append("title ASC, ");
2789 query.append("version ASC");
2790 }
2791
2792 Query q = session.createQuery(query.toString());
2793
2794 QueryPos qPos = QueryPos.getInstance(q);
2795
2796 qPos.add(nodeId);
2797
2798 if (title != null) {
2799 qPos.add(title);
2800 }
2801
2802 qPos.add(head);
2803
2804 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
2805 end);
2806 }
2807 catch (Exception e) {
2808 throw processException(e);
2809 }
2810 finally {
2811 if (list == null) {
2812 list = new ArrayList<WikiPage>();
2813 }
2814
2815 cacheResult(list);
2816
2817 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_N_T_H,
2818 finderArgs, list);
2819
2820 closeSession(session);
2821 }
2822 }
2823
2824 return list;
2825 }
2826
2827 public WikiPage findByN_T_H_First(long nodeId, String title, boolean head,
2828 OrderByComparator obc) throws NoSuchPageException, SystemException {
2829 List<WikiPage> list = findByN_T_H(nodeId, title, head, 0, 1, obc);
2830
2831 if (list.isEmpty()) {
2832 StringBuilder msg = new StringBuilder();
2833
2834 msg.append("No WikiPage exists with the key {");
2835
2836 msg.append("nodeId=" + nodeId);
2837
2838 msg.append(", ");
2839 msg.append("title=" + title);
2840
2841 msg.append(", ");
2842 msg.append("head=" + head);
2843
2844 msg.append(StringPool.CLOSE_CURLY_BRACE);
2845
2846 throw new NoSuchPageException(msg.toString());
2847 }
2848 else {
2849 return list.get(0);
2850 }
2851 }
2852
2853 public WikiPage findByN_T_H_Last(long nodeId, String title, boolean head,
2854 OrderByComparator obc) throws NoSuchPageException, SystemException {
2855 int count = countByN_T_H(nodeId, title, head);
2856
2857 List<WikiPage> list = findByN_T_H(nodeId, title, head, count - 1,
2858 count, obc);
2859
2860 if (list.isEmpty()) {
2861 StringBuilder msg = new StringBuilder();
2862
2863 msg.append("No WikiPage exists with the key {");
2864
2865 msg.append("nodeId=" + nodeId);
2866
2867 msg.append(", ");
2868 msg.append("title=" + title);
2869
2870 msg.append(", ");
2871 msg.append("head=" + head);
2872
2873 msg.append(StringPool.CLOSE_CURLY_BRACE);
2874
2875 throw new NoSuchPageException(msg.toString());
2876 }
2877 else {
2878 return list.get(0);
2879 }
2880 }
2881
2882 public WikiPage[] findByN_T_H_PrevAndNext(long pageId, long nodeId,
2883 String title, boolean head, OrderByComparator obc)
2884 throws NoSuchPageException, SystemException {
2885 WikiPage wikiPage = findByPrimaryKey(pageId);
2886
2887 int count = countByN_T_H(nodeId, title, head);
2888
2889 Session session = null;
2890
2891 try {
2892 session = openSession();
2893
2894 StringBuilder query = new StringBuilder();
2895
2896 query.append("FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
2897
2898 query.append("nodeId = ?");
2899
2900 query.append(" AND ");
2901
2902 if (title == null) {
2903 query.append("title IS NULL");
2904 }
2905 else {
2906 query.append("title = ?");
2907 }
2908
2909 query.append(" AND ");
2910
2911 query.append("head = ?");
2912
2913 query.append(" ");
2914
2915 if (obc != null) {
2916 query.append("ORDER BY ");
2917 query.append(obc.getOrderBy());
2918 }
2919
2920 else {
2921 query.append("ORDER BY ");
2922
2923 query.append("nodeId ASC, ");
2924 query.append("title ASC, ");
2925 query.append("version ASC");
2926 }
2927
2928 Query q = session.createQuery(query.toString());
2929
2930 QueryPos qPos = QueryPos.getInstance(q);
2931
2932 qPos.add(nodeId);
2933
2934 if (title != null) {
2935 qPos.add(title);
2936 }
2937
2938 qPos.add(head);
2939
2940 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiPage);
2941
2942 WikiPage[] array = new WikiPageImpl[3];
2943
2944 array[0] = (WikiPage)objArray[0];
2945 array[1] = (WikiPage)objArray[1];
2946 array[2] = (WikiPage)objArray[2];
2947
2948 return array;
2949 }
2950 catch (Exception e) {
2951 throw processException(e);
2952 }
2953 finally {
2954 closeSession(session);
2955 }
2956 }
2957
2958 public List<WikiPage> findByN_H_P(long nodeId, boolean head,
2959 String parentTitle) throws SystemException {
2960 Object[] finderArgs = new Object[] {
2961 new Long(nodeId), Boolean.valueOf(head),
2962
2963 parentTitle
2964 };
2965
2966 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_H_P,
2967 finderArgs, this);
2968
2969 if (list == null) {
2970 Session session = null;
2971
2972 try {
2973 session = openSession();
2974
2975 StringBuilder query = new StringBuilder();
2976
2977 query.append(
2978 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
2979
2980 query.append("nodeId = ?");
2981
2982 query.append(" AND ");
2983
2984 query.append("head = ?");
2985
2986 query.append(" AND ");
2987
2988 if (parentTitle == null) {
2989 query.append("parentTitle IS NULL");
2990 }
2991 else {
2992 query.append("parentTitle = ?");
2993 }
2994
2995 query.append(" ");
2996
2997 query.append("ORDER BY ");
2998
2999 query.append("nodeId ASC, ");
3000 query.append("title ASC, ");
3001 query.append("version ASC");
3002
3003 Query q = session.createQuery(query.toString());
3004
3005 QueryPos qPos = QueryPos.getInstance(q);
3006
3007 qPos.add(nodeId);
3008
3009 qPos.add(head);
3010
3011 if (parentTitle != null) {
3012 qPos.add(parentTitle);
3013 }
3014
3015 list = q.list();
3016 }
3017 catch (Exception e) {
3018 throw processException(e);
3019 }
3020 finally {
3021 if (list == null) {
3022 list = new ArrayList<WikiPage>();
3023 }
3024
3025 cacheResult(list);
3026
3027 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_H_P,
3028 finderArgs, list);
3029
3030 closeSession(session);
3031 }
3032 }
3033
3034 return list;
3035 }
3036
3037 public List<WikiPage> findByN_H_P(long nodeId, boolean head,
3038 String parentTitle, int start, int end) throws SystemException {
3039 return findByN_H_P(nodeId, head, parentTitle, start, end, null);
3040 }
3041
3042 public List<WikiPage> findByN_H_P(long nodeId, boolean head,
3043 String parentTitle, int start, int end, OrderByComparator obc)
3044 throws SystemException {
3045 Object[] finderArgs = new Object[] {
3046 new Long(nodeId), Boolean.valueOf(head),
3047
3048 parentTitle,
3049
3050 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
3051 };
3052
3053 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_N_H_P,
3054 finderArgs, this);
3055
3056 if (list == null) {
3057 Session session = null;
3058
3059 try {
3060 session = openSession();
3061
3062 StringBuilder query = new StringBuilder();
3063
3064 query.append(
3065 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
3066
3067 query.append("nodeId = ?");
3068
3069 query.append(" AND ");
3070
3071 query.append("head = ?");
3072
3073 query.append(" AND ");
3074
3075 if (parentTitle == null) {
3076 query.append("parentTitle IS NULL");
3077 }
3078 else {
3079 query.append("parentTitle = ?");
3080 }
3081
3082 query.append(" ");
3083
3084 if (obc != null) {
3085 query.append("ORDER BY ");
3086 query.append(obc.getOrderBy());
3087 }
3088
3089 else {
3090 query.append("ORDER BY ");
3091
3092 query.append("nodeId ASC, ");
3093 query.append("title ASC, ");
3094 query.append("version ASC");
3095 }
3096
3097 Query q = session.createQuery(query.toString());
3098
3099 QueryPos qPos = QueryPos.getInstance(q);
3100
3101 qPos.add(nodeId);
3102
3103 qPos.add(head);
3104
3105 if (parentTitle != null) {
3106 qPos.add(parentTitle);
3107 }
3108
3109 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
3110 end);
3111 }
3112 catch (Exception e) {
3113 throw processException(e);
3114 }
3115 finally {
3116 if (list == null) {
3117 list = new ArrayList<WikiPage>();
3118 }
3119
3120 cacheResult(list);
3121
3122 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_N_H_P,
3123 finderArgs, list);
3124
3125 closeSession(session);
3126 }
3127 }
3128
3129 return list;
3130 }
3131
3132 public WikiPage findByN_H_P_First(long nodeId, boolean head,
3133 String parentTitle, OrderByComparator obc)
3134 throws NoSuchPageException, SystemException {
3135 List<WikiPage> list = findByN_H_P(nodeId, head, parentTitle, 0, 1, obc);
3136
3137 if (list.isEmpty()) {
3138 StringBuilder msg = new StringBuilder();
3139
3140 msg.append("No WikiPage exists with the key {");
3141
3142 msg.append("nodeId=" + nodeId);
3143
3144 msg.append(", ");
3145 msg.append("head=" + head);
3146
3147 msg.append(", ");
3148 msg.append("parentTitle=" + parentTitle);
3149
3150 msg.append(StringPool.CLOSE_CURLY_BRACE);
3151
3152 throw new NoSuchPageException(msg.toString());
3153 }
3154 else {
3155 return list.get(0);
3156 }
3157 }
3158
3159 public WikiPage findByN_H_P_Last(long nodeId, boolean head,
3160 String parentTitle, OrderByComparator obc)
3161 throws NoSuchPageException, SystemException {
3162 int count = countByN_H_P(nodeId, head, parentTitle);
3163
3164 List<WikiPage> list = findByN_H_P(nodeId, head, parentTitle, count - 1,
3165 count, obc);
3166
3167 if (list.isEmpty()) {
3168 StringBuilder msg = new StringBuilder();
3169
3170 msg.append("No WikiPage exists with the key {");
3171
3172 msg.append("nodeId=" + nodeId);
3173
3174 msg.append(", ");
3175 msg.append("head=" + head);
3176
3177 msg.append(", ");
3178 msg.append("parentTitle=" + parentTitle);
3179
3180 msg.append(StringPool.CLOSE_CURLY_BRACE);
3181
3182 throw new NoSuchPageException(msg.toString());
3183 }
3184 else {
3185 return list.get(0);
3186 }
3187 }
3188
3189 public WikiPage[] findByN_H_P_PrevAndNext(long pageId, long nodeId,
3190 boolean head, String parentTitle, OrderByComparator obc)
3191 throws NoSuchPageException, SystemException {
3192 WikiPage wikiPage = findByPrimaryKey(pageId);
3193
3194 int count = countByN_H_P(nodeId, head, parentTitle);
3195
3196 Session session = null;
3197
3198 try {
3199 session = openSession();
3200
3201 StringBuilder query = new StringBuilder();
3202
3203 query.append("FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
3204
3205 query.append("nodeId = ?");
3206
3207 query.append(" AND ");
3208
3209 query.append("head = ?");
3210
3211 query.append(" AND ");
3212
3213 if (parentTitle == null) {
3214 query.append("parentTitle IS NULL");
3215 }
3216 else {
3217 query.append("parentTitle = ?");
3218 }
3219
3220 query.append(" ");
3221
3222 if (obc != null) {
3223 query.append("ORDER BY ");
3224 query.append(obc.getOrderBy());
3225 }
3226
3227 else {
3228 query.append("ORDER BY ");
3229
3230 query.append("nodeId ASC, ");
3231 query.append("title ASC, ");
3232 query.append("version ASC");
3233 }
3234
3235 Query q = session.createQuery(query.toString());
3236
3237 QueryPos qPos = QueryPos.getInstance(q);
3238
3239 qPos.add(nodeId);
3240
3241 qPos.add(head);
3242
3243 if (parentTitle != null) {
3244 qPos.add(parentTitle);
3245 }
3246
3247 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, wikiPage);
3248
3249 WikiPage[] array = new WikiPageImpl[3];
3250
3251 array[0] = (WikiPage)objArray[0];
3252 array[1] = (WikiPage)objArray[1];
3253 array[2] = (WikiPage)objArray[2];
3254
3255 return array;
3256 }
3257 catch (Exception e) {
3258 throw processException(e);
3259 }
3260 finally {
3261 closeSession(session);
3262 }
3263 }
3264
3265 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
3266 throws SystemException {
3267 Session session = null;
3268
3269 try {
3270 session = openSession();
3271
3272 dynamicQuery.compile(session);
3273
3274 return dynamicQuery.list();
3275 }
3276 catch (Exception e) {
3277 throw processException(e);
3278 }
3279 finally {
3280 closeSession(session);
3281 }
3282 }
3283
3284 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
3285 int start, int end) throws SystemException {
3286 Session session = null;
3287
3288 try {
3289 session = openSession();
3290
3291 dynamicQuery.setLimit(start, end);
3292
3293 dynamicQuery.compile(session);
3294
3295 return dynamicQuery.list();
3296 }
3297 catch (Exception e) {
3298 throw processException(e);
3299 }
3300 finally {
3301 closeSession(session);
3302 }
3303 }
3304
3305 public List<WikiPage> findAll() throws SystemException {
3306 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3307 }
3308
3309 public List<WikiPage> findAll(int start, int end) throws SystemException {
3310 return findAll(start, end, null);
3311 }
3312
3313 public List<WikiPage> findAll(int start, int end, OrderByComparator obc)
3314 throws SystemException {
3315 Object[] finderArgs = new Object[] {
3316 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
3317 };
3318
3319 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
3320 finderArgs, this);
3321
3322 if (list == null) {
3323 Session session = null;
3324
3325 try {
3326 session = openSession();
3327
3328 StringBuilder query = new StringBuilder();
3329
3330 query.append("FROM com.liferay.portlet.wiki.model.WikiPage ");
3331
3332 if (obc != null) {
3333 query.append("ORDER BY ");
3334 query.append(obc.getOrderBy());
3335 }
3336
3337 else {
3338 query.append("ORDER BY ");
3339
3340 query.append("nodeId ASC, ");
3341 query.append("title ASC, ");
3342 query.append("version ASC");
3343 }
3344
3345 Query q = session.createQuery(query.toString());
3346
3347 if (obc == null) {
3348 list = (List<WikiPage>)QueryUtil.list(q, getDialect(),
3349 start, end, false);
3350
3351 Collections.sort(list);
3352 }
3353 else {
3354 list = (List<WikiPage>)QueryUtil.list(q, getDialect(),
3355 start, end);
3356 }
3357 }
3358 catch (Exception e) {
3359 throw processException(e);
3360 }
3361 finally {
3362 if (list == null) {
3363 list = new ArrayList<WikiPage>();
3364 }
3365
3366 cacheResult(list);
3367
3368 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
3369
3370 closeSession(session);
3371 }
3372 }
3373
3374 return list;
3375 }
3376
3377 public void removeByUuid(String uuid) throws SystemException {
3378 for (WikiPage wikiPage : findByUuid(uuid)) {
3379 remove(wikiPage);
3380 }
3381 }
3382
3383 public void removeByUUID_G(String uuid, long groupId)
3384 throws NoSuchPageException, SystemException {
3385 WikiPage wikiPage = findByUUID_G(uuid, groupId);
3386
3387 remove(wikiPage);
3388 }
3389
3390 public void removeByNodeId(long nodeId) throws SystemException {
3391 for (WikiPage wikiPage : findByNodeId(nodeId)) {
3392 remove(wikiPage);
3393 }
3394 }
3395
3396 public void removeByFormat(String format) throws SystemException {
3397 for (WikiPage wikiPage : findByFormat(format)) {
3398 remove(wikiPage);
3399 }
3400 }
3401
3402 public void removeByN_T(long nodeId, String title)
3403 throws SystemException {
3404 for (WikiPage wikiPage : findByN_T(nodeId, title)) {
3405 remove(wikiPage);
3406 }
3407 }
3408
3409 public void removeByN_H(long nodeId, boolean head)
3410 throws SystemException {
3411 for (WikiPage wikiPage : findByN_H(nodeId, head)) {
3412 remove(wikiPage);
3413 }
3414 }
3415
3416 public void removeByN_P(long nodeId, String parentTitle)
3417 throws SystemException {
3418 for (WikiPage wikiPage : findByN_P(nodeId, parentTitle)) {
3419 remove(wikiPage);
3420 }
3421 }
3422
3423 public void removeByN_R(long nodeId, String redirectTitle)
3424 throws SystemException {
3425 for (WikiPage wikiPage : findByN_R(nodeId, redirectTitle)) {
3426 remove(wikiPage);
3427 }
3428 }
3429
3430 public void removeByN_T_V(long nodeId, String title, double version)
3431 throws NoSuchPageException, SystemException {
3432 WikiPage wikiPage = findByN_T_V(nodeId, title, version);
3433
3434 remove(wikiPage);
3435 }
3436
3437 public void removeByN_T_H(long nodeId, String title, boolean head)
3438 throws SystemException {
3439 for (WikiPage wikiPage : findByN_T_H(nodeId, title, head)) {
3440 remove(wikiPage);
3441 }
3442 }
3443
3444 public void removeByN_H_P(long nodeId, boolean head, String parentTitle)
3445 throws SystemException {
3446 for (WikiPage wikiPage : findByN_H_P(nodeId, head, parentTitle)) {
3447 remove(wikiPage);
3448 }
3449 }
3450
3451 public void removeAll() throws SystemException {
3452 for (WikiPage wikiPage : findAll()) {
3453 remove(wikiPage);
3454 }
3455 }
3456
3457 public int countByUuid(String uuid) throws SystemException {
3458 Object[] finderArgs = new Object[] { uuid };
3459
3460 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
3461 finderArgs, this);
3462
3463 if (count == null) {
3464 Session session = null;
3465
3466 try {
3467 session = openSession();
3468
3469 StringBuilder query = new StringBuilder();
3470
3471 query.append("SELECT COUNT(*) ");
3472 query.append(
3473 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
3474
3475 if (uuid == null) {
3476 query.append("uuid_ IS NULL");
3477 }
3478 else {
3479 query.append("uuid_ = ?");
3480 }
3481
3482 query.append(" ");
3483
3484 Query q = session.createQuery(query.toString());
3485
3486 QueryPos qPos = QueryPos.getInstance(q);
3487
3488 if (uuid != null) {
3489 qPos.add(uuid);
3490 }
3491
3492 count = (Long)q.uniqueResult();
3493 }
3494 catch (Exception e) {
3495 throw processException(e);
3496 }
3497 finally {
3498 if (count == null) {
3499 count = Long.valueOf(0);
3500 }
3501
3502 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3503 finderArgs, count);
3504
3505 closeSession(session);
3506 }
3507 }
3508
3509 return count.intValue();
3510 }
3511
3512 public int countByUUID_G(String uuid, long groupId)
3513 throws SystemException {
3514 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
3515
3516 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
3517 finderArgs, this);
3518
3519 if (count == null) {
3520 Session session = null;
3521
3522 try {
3523 session = openSession();
3524
3525 StringBuilder query = new StringBuilder();
3526
3527 query.append("SELECT COUNT(*) ");
3528 query.append(
3529 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
3530
3531 if (uuid == null) {
3532 query.append("uuid_ IS NULL");
3533 }
3534 else {
3535 query.append("uuid_ = ?");
3536 }
3537
3538 query.append(" AND ");
3539
3540 query.append("groupId = ?");
3541
3542 query.append(" ");
3543
3544 Query q = session.createQuery(query.toString());
3545
3546 QueryPos qPos = QueryPos.getInstance(q);
3547
3548 if (uuid != null) {
3549 qPos.add(uuid);
3550 }
3551
3552 qPos.add(groupId);
3553
3554 count = (Long)q.uniqueResult();
3555 }
3556 catch (Exception e) {
3557 throw processException(e);
3558 }
3559 finally {
3560 if (count == null) {
3561 count = Long.valueOf(0);
3562 }
3563
3564 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
3565 finderArgs, count);
3566
3567 closeSession(session);
3568 }
3569 }
3570
3571 return count.intValue();
3572 }
3573
3574 public int countByNodeId(long nodeId) throws SystemException {
3575 Object[] finderArgs = new Object[] { new Long(nodeId) };
3576
3577 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_NODEID,
3578 finderArgs, this);
3579
3580 if (count == null) {
3581 Session session = null;
3582
3583 try {
3584 session = openSession();
3585
3586 StringBuilder query = new StringBuilder();
3587
3588 query.append("SELECT COUNT(*) ");
3589 query.append(
3590 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
3591
3592 query.append("nodeId = ?");
3593
3594 query.append(" ");
3595
3596 Query q = session.createQuery(query.toString());
3597
3598 QueryPos qPos = QueryPos.getInstance(q);
3599
3600 qPos.add(nodeId);
3601
3602 count = (Long)q.uniqueResult();
3603 }
3604 catch (Exception e) {
3605 throw processException(e);
3606 }
3607 finally {
3608 if (count == null) {
3609 count = Long.valueOf(0);
3610 }
3611
3612 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_NODEID,
3613 finderArgs, count);
3614
3615 closeSession(session);
3616 }
3617 }
3618
3619 return count.intValue();
3620 }
3621
3622 public int countByFormat(String format) throws SystemException {
3623 Object[] finderArgs = new Object[] { format };
3624
3625 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FORMAT,
3626 finderArgs, this);
3627
3628 if (count == null) {
3629 Session session = null;
3630
3631 try {
3632 session = openSession();
3633
3634 StringBuilder query = new StringBuilder();
3635
3636 query.append("SELECT COUNT(*) ");
3637 query.append(
3638 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
3639
3640 if (format == null) {
3641 query.append("format IS NULL");
3642 }
3643 else {
3644 query.append("format = ?");
3645 }
3646
3647 query.append(" ");
3648
3649 Query q = session.createQuery(query.toString());
3650
3651 QueryPos qPos = QueryPos.getInstance(q);
3652
3653 if (format != null) {
3654 qPos.add(format);
3655 }
3656
3657 count = (Long)q.uniqueResult();
3658 }
3659 catch (Exception e) {
3660 throw processException(e);
3661 }
3662 finally {
3663 if (count == null) {
3664 count = Long.valueOf(0);
3665 }
3666
3667 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FORMAT,
3668 finderArgs, count);
3669
3670 closeSession(session);
3671 }
3672 }
3673
3674 return count.intValue();
3675 }
3676
3677 public int countByN_T(long nodeId, String title) throws SystemException {
3678 Object[] finderArgs = new Object[] { new Long(nodeId), title };
3679
3680 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_T,
3681 finderArgs, this);
3682
3683 if (count == null) {
3684 Session session = null;
3685
3686 try {
3687 session = openSession();
3688
3689 StringBuilder query = new StringBuilder();
3690
3691 query.append("SELECT COUNT(*) ");
3692 query.append(
3693 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
3694
3695 query.append("nodeId = ?");
3696
3697 query.append(" AND ");
3698
3699 if (title == null) {
3700 query.append("title IS NULL");
3701 }
3702 else {
3703 query.append("title = ?");
3704 }
3705
3706 query.append(" ");
3707
3708 Query q = session.createQuery(query.toString());
3709
3710 QueryPos qPos = QueryPos.getInstance(q);
3711
3712 qPos.add(nodeId);
3713
3714 if (title != null) {
3715 qPos.add(title);
3716 }
3717
3718 count = (Long)q.uniqueResult();
3719 }
3720 catch (Exception e) {
3721 throw processException(e);
3722 }
3723 finally {
3724 if (count == null) {
3725 count = Long.valueOf(0);
3726 }
3727
3728 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T, finderArgs,
3729 count);
3730
3731 closeSession(session);
3732 }
3733 }
3734
3735 return count.intValue();
3736 }
3737
3738 public int countByN_H(long nodeId, boolean head) throws SystemException {
3739 Object[] finderArgs = new Object[] {
3740 new Long(nodeId), Boolean.valueOf(head)
3741 };
3742
3743 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_H,
3744 finderArgs, this);
3745
3746 if (count == null) {
3747 Session session = null;
3748
3749 try {
3750 session = openSession();
3751
3752 StringBuilder query = new StringBuilder();
3753
3754 query.append("SELECT COUNT(*) ");
3755 query.append(
3756 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
3757
3758 query.append("nodeId = ?");
3759
3760 query.append(" AND ");
3761
3762 query.append("head = ?");
3763
3764 query.append(" ");
3765
3766 Query q = session.createQuery(query.toString());
3767
3768 QueryPos qPos = QueryPos.getInstance(q);
3769
3770 qPos.add(nodeId);
3771
3772 qPos.add(head);
3773
3774 count = (Long)q.uniqueResult();
3775 }
3776 catch (Exception e) {
3777 throw processException(e);
3778 }
3779 finally {
3780 if (count == null) {
3781 count = Long.valueOf(0);
3782 }
3783
3784 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_H, finderArgs,
3785 count);
3786
3787 closeSession(session);
3788 }
3789 }
3790
3791 return count.intValue();
3792 }
3793
3794 public int countByN_P(long nodeId, String parentTitle)
3795 throws SystemException {
3796 Object[] finderArgs = new Object[] { new Long(nodeId), parentTitle };
3797
3798 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_P,
3799 finderArgs, this);
3800
3801 if (count == null) {
3802 Session session = null;
3803
3804 try {
3805 session = openSession();
3806
3807 StringBuilder query = new StringBuilder();
3808
3809 query.append("SELECT COUNT(*) ");
3810 query.append(
3811 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
3812
3813 query.append("nodeId = ?");
3814
3815 query.append(" AND ");
3816
3817 if (parentTitle == null) {
3818 query.append("parentTitle IS NULL");
3819 }
3820 else {
3821 query.append("parentTitle = ?");
3822 }
3823
3824 query.append(" ");
3825
3826 Query q = session.createQuery(query.toString());
3827
3828 QueryPos qPos = QueryPos.getInstance(q);
3829
3830 qPos.add(nodeId);
3831
3832 if (parentTitle != null) {
3833 qPos.add(parentTitle);
3834 }
3835
3836 count = (Long)q.uniqueResult();
3837 }
3838 catch (Exception e) {
3839 throw processException(e);
3840 }
3841 finally {
3842 if (count == null) {
3843 count = Long.valueOf(0);
3844 }
3845
3846 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_P, finderArgs,
3847 count);
3848
3849 closeSession(session);
3850 }
3851 }
3852
3853 return count.intValue();
3854 }
3855
3856 public int countByN_R(long nodeId, String redirectTitle)
3857 throws SystemException {
3858 Object[] finderArgs = new Object[] { new Long(nodeId), redirectTitle };
3859
3860 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_R,
3861 finderArgs, this);
3862
3863 if (count == null) {
3864 Session session = null;
3865
3866 try {
3867 session = openSession();
3868
3869 StringBuilder query = new StringBuilder();
3870
3871 query.append("SELECT COUNT(*) ");
3872 query.append(
3873 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
3874
3875 query.append("nodeId = ?");
3876
3877 query.append(" AND ");
3878
3879 if (redirectTitle == null) {
3880 query.append("redirectTitle IS NULL");
3881 }
3882 else {
3883 query.append("redirectTitle = ?");
3884 }
3885
3886 query.append(" ");
3887
3888 Query q = session.createQuery(query.toString());
3889
3890 QueryPos qPos = QueryPos.getInstance(q);
3891
3892 qPos.add(nodeId);
3893
3894 if (redirectTitle != null) {
3895 qPos.add(redirectTitle);
3896 }
3897
3898 count = (Long)q.uniqueResult();
3899 }
3900 catch (Exception e) {
3901 throw processException(e);
3902 }
3903 finally {
3904 if (count == null) {
3905 count = Long.valueOf(0);
3906 }
3907
3908 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_R, finderArgs,
3909 count);
3910
3911 closeSession(session);
3912 }
3913 }
3914
3915 return count.intValue();
3916 }
3917
3918 public int countByN_T_V(long nodeId, String title, double version)
3919 throws SystemException {
3920 Object[] finderArgs = new Object[] {
3921 new Long(nodeId),
3922
3923 title, new Double(version)
3924 };
3925
3926 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_T_V,
3927 finderArgs, this);
3928
3929 if (count == null) {
3930 Session session = null;
3931
3932 try {
3933 session = openSession();
3934
3935 StringBuilder query = new StringBuilder();
3936
3937 query.append("SELECT COUNT(*) ");
3938 query.append(
3939 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
3940
3941 query.append("nodeId = ?");
3942
3943 query.append(" AND ");
3944
3945 if (title == null) {
3946 query.append("title IS NULL");
3947 }
3948 else {
3949 query.append("title = ?");
3950 }
3951
3952 query.append(" AND ");
3953
3954 query.append("version = ?");
3955
3956 query.append(" ");
3957
3958 Query q = session.createQuery(query.toString());
3959
3960 QueryPos qPos = QueryPos.getInstance(q);
3961
3962 qPos.add(nodeId);
3963
3964 if (title != null) {
3965 qPos.add(title);
3966 }
3967
3968 qPos.add(version);
3969
3970 count = (Long)q.uniqueResult();
3971 }
3972 catch (Exception e) {
3973 throw processException(e);
3974 }
3975 finally {
3976 if (count == null) {
3977 count = Long.valueOf(0);
3978 }
3979
3980 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T_V,
3981 finderArgs, count);
3982
3983 closeSession(session);
3984 }
3985 }
3986
3987 return count.intValue();
3988 }
3989
3990 public int countByN_T_H(long nodeId, String title, boolean head)
3991 throws SystemException {
3992 Object[] finderArgs = new Object[] {
3993 new Long(nodeId),
3994
3995 title, Boolean.valueOf(head)
3996 };
3997
3998 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_T_H,
3999 finderArgs, this);
4000
4001 if (count == null) {
4002 Session session = null;
4003
4004 try {
4005 session = openSession();
4006
4007 StringBuilder query = new StringBuilder();
4008
4009 query.append("SELECT COUNT(*) ");
4010 query.append(
4011 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
4012
4013 query.append("nodeId = ?");
4014
4015 query.append(" AND ");
4016
4017 if (title == null) {
4018 query.append("title IS NULL");
4019 }
4020 else {
4021 query.append("title = ?");
4022 }
4023
4024 query.append(" AND ");
4025
4026 query.append("head = ?");
4027
4028 query.append(" ");
4029
4030 Query q = session.createQuery(query.toString());
4031
4032 QueryPos qPos = QueryPos.getInstance(q);
4033
4034 qPos.add(nodeId);
4035
4036 if (title != null) {
4037 qPos.add(title);
4038 }
4039
4040 qPos.add(head);
4041
4042 count = (Long)q.uniqueResult();
4043 }
4044 catch (Exception e) {
4045 throw processException(e);
4046 }
4047 finally {
4048 if (count == null) {
4049 count = Long.valueOf(0);
4050 }
4051
4052 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T_H,
4053 finderArgs, count);
4054
4055 closeSession(session);
4056 }
4057 }
4058
4059 return count.intValue();
4060 }
4061
4062 public int countByN_H_P(long nodeId, boolean head, String parentTitle)
4063 throws SystemException {
4064 Object[] finderArgs = new Object[] {
4065 new Long(nodeId), Boolean.valueOf(head),
4066
4067 parentTitle
4068 };
4069
4070 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_H_P,
4071 finderArgs, this);
4072
4073 if (count == null) {
4074 Session session = null;
4075
4076 try {
4077 session = openSession();
4078
4079 StringBuilder query = new StringBuilder();
4080
4081 query.append("SELECT COUNT(*) ");
4082 query.append(
4083 "FROM com.liferay.portlet.wiki.model.WikiPage WHERE ");
4084
4085 query.append("nodeId = ?");
4086
4087 query.append(" AND ");
4088
4089 query.append("head = ?");
4090
4091 query.append(" AND ");
4092
4093 if (parentTitle == null) {
4094 query.append("parentTitle IS NULL");
4095 }
4096 else {
4097 query.append("parentTitle = ?");
4098 }
4099
4100 query.append(" ");
4101
4102 Query q = session.createQuery(query.toString());
4103
4104 QueryPos qPos = QueryPos.getInstance(q);
4105
4106 qPos.add(nodeId);
4107
4108 qPos.add(head);
4109
4110 if (parentTitle != null) {
4111 qPos.add(parentTitle);
4112 }
4113
4114 count = (Long)q.uniqueResult();
4115 }
4116 catch (Exception e) {
4117 throw processException(e);
4118 }
4119 finally {
4120 if (count == null) {
4121 count = Long.valueOf(0);
4122 }
4123
4124 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_H_P,
4125 finderArgs, count);
4126
4127 closeSession(session);
4128 }
4129 }
4130
4131 return count.intValue();
4132 }
4133
4134 public int countAll() throws SystemException {
4135 Object[] finderArgs = new Object[0];
4136
4137 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
4138 finderArgs, this);
4139
4140 if (count == null) {
4141 Session session = null;
4142
4143 try {
4144 session = openSession();
4145
4146 Query q = session.createQuery(
4147 "SELECT COUNT(*) FROM com.liferay.portlet.wiki.model.WikiPage");
4148
4149 count = (Long)q.uniqueResult();
4150 }
4151 catch (Exception e) {
4152 throw processException(e);
4153 }
4154 finally {
4155 if (count == null) {
4156 count = Long.valueOf(0);
4157 }
4158
4159 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
4160 count);
4161
4162 closeSession(session);
4163 }
4164 }
4165
4166 return count.intValue();
4167 }
4168
4169 public void afterPropertiesSet() {
4170 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
4171 com.liferay.portal.util.PropsUtil.get(
4172 "value.object.listener.com.liferay.portlet.wiki.model.WikiPage")));
4173
4174 if (listenerClassNames.length > 0) {
4175 try {
4176 List<ModelListener<WikiPage>> listenersList = new ArrayList<ModelListener<WikiPage>>();
4177
4178 for (String listenerClassName : listenerClassNames) {
4179 listenersList.add((ModelListener<WikiPage>)Class.forName(
4180 listenerClassName).newInstance());
4181 }
4182
4183 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
4184 }
4185 catch (Exception e) {
4186 _log.error(e);
4187 }
4188 }
4189 }
4190
4191 @BeanReference(name = "com.liferay.portlet.wiki.service.persistence.WikiNodePersistence.impl")
4192 protected com.liferay.portlet.wiki.service.persistence.WikiNodePersistence wikiNodePersistence;
4193 @BeanReference(name = "com.liferay.portlet.wiki.service.persistence.WikiPagePersistence.impl")
4194 protected com.liferay.portlet.wiki.service.persistence.WikiPagePersistence wikiPagePersistence;
4195 @BeanReference(name = "com.liferay.portlet.wiki.service.persistence.WikiPageResourcePersistence.impl")
4196 protected com.liferay.portlet.wiki.service.persistence.WikiPageResourcePersistence wikiPageResourcePersistence;
4197 @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
4198 protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
4199 @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
4200 protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
4201 @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
4202 protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
4203 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
4204 protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
4205 @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence.impl")
4206 protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
4207 @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
4208 protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
4209 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence.impl")
4210 protected com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence mbMessagePersistence;
4211 @BeanReference(name = "com.liferay.portlet.social.service.persistence.SocialActivityPersistence.impl")
4212 protected com.liferay.portlet.social.service.persistence.SocialActivityPersistence socialActivityPersistence;
4213 @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsAssetPersistence.impl")
4214 protected com.liferay.portlet.tags.service.persistence.TagsAssetPersistence tagsAssetPersistence;
4215 @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsEntryPersistence.impl")
4216 protected com.liferay.portlet.tags.service.persistence.TagsEntryPersistence tagsEntryPersistence;
4217 private static Log _log = LogFactoryUtil.getLog(WikiPagePersistenceImpl.class);
4218}