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