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