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.SQLQuery;
27  import com.liferay.portal.kernel.dao.orm.Session;
28  import com.liferay.portal.kernel.dao.orm.Type;
29  import com.liferay.portal.kernel.exception.SystemException;
30  import com.liferay.portal.kernel.log.Log;
31  import com.liferay.portal.kernel.log.LogFactoryUtil;
32  import com.liferay.portal.kernel.util.GetterUtil;
33  import com.liferay.portal.kernel.util.InstanceFactory;
34  import com.liferay.portal.kernel.util.OrderByComparator;
35  import com.liferay.portal.kernel.util.StringBundler;
36  import com.liferay.portal.kernel.util.StringPool;
37  import com.liferay.portal.kernel.util.StringUtil;
38  import com.liferay.portal.kernel.util.Validator;
39  import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
40  import com.liferay.portal.model.ModelListener;
41  import com.liferay.portal.security.permission.InlineSQLHelperUtil;
42  import com.liferay.portal.service.persistence.BatchSessionUtil;
43  import com.liferay.portal.service.persistence.GroupPersistence;
44  import com.liferay.portal.service.persistence.ResourcePersistence;
45  import com.liferay.portal.service.persistence.SubscriptionPersistence;
46  import com.liferay.portal.service.persistence.UserPersistence;
47  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
48  
49  import com.liferay.portlet.wiki.NoSuchNodeException;
50  import com.liferay.portlet.wiki.model.WikiNode;
51  import com.liferay.portlet.wiki.model.impl.WikiNodeImpl;
52  import com.liferay.portlet.wiki.model.impl.WikiNodeModelImpl;
53  
54  import java.io.Serializable;
55  
56  import java.util.ArrayList;
57  import java.util.Collections;
58  import java.util.List;
59  
60  /**
61   * <a href="WikiNodePersistenceImpl.java.html"><b><i>View Source</i></b></a>
62   *
63   * <p>
64   * ServiceBuilder generated this class. Modifications in this class will be
65   * overwritten the next time is generated.
66   * </p>
67   *
68   * @author    Brian Wing Shun Chan
69   * @see       WikiNodePersistence
70   * @see       WikiNodeUtil
71   * @generated
72   */
73  public class WikiNodePersistenceImpl extends BasePersistenceImpl<WikiNode>
74      implements WikiNodePersistence {
75      public static final String FINDER_CLASS_NAME_ENTITY = WikiNodeImpl.class.getName();
76      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
77          ".List";
78      public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
79              WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
80              "findByUuid",
81              new String[] {
82                  String.class.getName(),
83                  
84              "java.lang.Integer", "java.lang.Integer",
85                  "com.liferay.portal.kernel.util.OrderByComparator"
86              });
87      public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
88              WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
89              "countByUuid", new String[] { String.class.getName() });
90      public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
91              WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
92              "fetchByUUID_G",
93              new String[] { String.class.getName(), Long.class.getName() });
94      public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
95              WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
96              "countByUUID_G",
97              new String[] { String.class.getName(), Long.class.getName() });
98      public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
99              WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
100             "findByGroupId",
101             new String[] {
102                 Long.class.getName(),
103                 
104             "java.lang.Integer", "java.lang.Integer",
105                 "com.liferay.portal.kernel.util.OrderByComparator"
106             });
107     public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
108             WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
109             "countByGroupId", new String[] { Long.class.getName() });
110     public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
111             WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
112             "findByCompanyId",
113             new String[] {
114                 Long.class.getName(),
115                 
116             "java.lang.Integer", "java.lang.Integer",
117                 "com.liferay.portal.kernel.util.OrderByComparator"
118             });
119     public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
120             WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
121             "countByCompanyId", new String[] { Long.class.getName() });
122     public static final FinderPath FINDER_PATH_FETCH_BY_G_N = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
123             WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
124             "fetchByG_N",
125             new String[] { Long.class.getName(), String.class.getName() });
126     public static final FinderPath FINDER_PATH_COUNT_BY_G_N = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
127             WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
128             "countByG_N",
129             new String[] { Long.class.getName(), String.class.getName() });
130     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
131             WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
132             "findAll", new String[0]);
133     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
134             WikiNodeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
135             "countAll", new String[0]);
136 
137     public void cacheResult(WikiNode wikiNode) {
138         EntityCacheUtil.putResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
139             WikiNodeImpl.class, wikiNode.getPrimaryKey(), wikiNode);
140 
141         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
142             new Object[] { wikiNode.getUuid(), new Long(wikiNode.getGroupId()) },
143             wikiNode);
144 
145         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
146             new Object[] { new Long(wikiNode.getGroupId()), wikiNode.getName() },
147             wikiNode);
148     }
149 
150     public void cacheResult(List<WikiNode> wikiNodes) {
151         for (WikiNode wikiNode : wikiNodes) {
152             if (EntityCacheUtil.getResult(
153                         WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
154                         WikiNodeImpl.class, wikiNode.getPrimaryKey(), this) == null) {
155                 cacheResult(wikiNode);
156             }
157         }
158     }
159 
160     public void clearCache() {
161         CacheRegistry.clear(WikiNodeImpl.class.getName());
162         EntityCacheUtil.clearCache(WikiNodeImpl.class.getName());
163         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
164         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
165     }
166 
167     public void clearCache(WikiNode wikiNode) {
168         EntityCacheUtil.removeResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
169             WikiNodeImpl.class, wikiNode.getPrimaryKey());
170 
171         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
172             new Object[] { wikiNode.getUuid(), new Long(wikiNode.getGroupId()) });
173 
174         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
175             new Object[] { new Long(wikiNode.getGroupId()), wikiNode.getName() });
176     }
177 
178     public WikiNode create(long nodeId) {
179         WikiNode wikiNode = new WikiNodeImpl();
180 
181         wikiNode.setNew(true);
182         wikiNode.setPrimaryKey(nodeId);
183 
184         String uuid = PortalUUIDUtil.generate();
185 
186         wikiNode.setUuid(uuid);
187 
188         return wikiNode;
189     }
190 
191     public WikiNode remove(Serializable primaryKey)
192         throws NoSuchModelException, SystemException {
193         return remove(((Long)primaryKey).longValue());
194     }
195 
196     public WikiNode remove(long nodeId)
197         throws NoSuchNodeException, SystemException {
198         Session session = null;
199 
200         try {
201             session = openSession();
202 
203             WikiNode wikiNode = (WikiNode)session.get(WikiNodeImpl.class,
204                     new Long(nodeId));
205 
206             if (wikiNode == null) {
207                 if (_log.isWarnEnabled()) {
208                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + nodeId);
209                 }
210 
211                 throw new NoSuchNodeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
212                     nodeId);
213             }
214 
215             return remove(wikiNode);
216         }
217         catch (NoSuchNodeException nsee) {
218             throw nsee;
219         }
220         catch (Exception e) {
221             throw processException(e);
222         }
223         finally {
224             closeSession(session);
225         }
226     }
227 
228     public WikiNode remove(WikiNode wikiNode) throws SystemException {
229         for (ModelListener<WikiNode> listener : listeners) {
230             listener.onBeforeRemove(wikiNode);
231         }
232 
233         wikiNode = removeImpl(wikiNode);
234 
235         for (ModelListener<WikiNode> listener : listeners) {
236             listener.onAfterRemove(wikiNode);
237         }
238 
239         return wikiNode;
240     }
241 
242     protected WikiNode removeImpl(WikiNode wikiNode) throws SystemException {
243         wikiNode = toUnwrappedModel(wikiNode);
244 
245         Session session = null;
246 
247         try {
248             session = openSession();
249 
250             if (wikiNode.isCachedModel() || BatchSessionUtil.isEnabled()) {
251                 Object staleObject = session.get(WikiNodeImpl.class,
252                         wikiNode.getPrimaryKeyObj());
253 
254                 if (staleObject != null) {
255                     session.evict(staleObject);
256                 }
257             }
258 
259             session.delete(wikiNode);
260 
261             session.flush();
262         }
263         catch (Exception e) {
264             throw processException(e);
265         }
266         finally {
267             closeSession(session);
268         }
269 
270         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
271 
272         WikiNodeModelImpl wikiNodeModelImpl = (WikiNodeModelImpl)wikiNode;
273 
274         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
275             new Object[] {
276                 wikiNodeModelImpl.getOriginalUuid(),
277                 new Long(wikiNodeModelImpl.getOriginalGroupId())
278             });
279 
280         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
281             new Object[] {
282                 new Long(wikiNodeModelImpl.getOriginalGroupId()),
283                 
284             wikiNodeModelImpl.getOriginalName()
285             });
286 
287         EntityCacheUtil.removeResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
288             WikiNodeImpl.class, wikiNode.getPrimaryKey());
289 
290         return wikiNode;
291     }
292 
293     public WikiNode updateImpl(
294         com.liferay.portlet.wiki.model.WikiNode wikiNode, boolean merge)
295         throws SystemException {
296         wikiNode = toUnwrappedModel(wikiNode);
297 
298         boolean isNew = wikiNode.isNew();
299 
300         WikiNodeModelImpl wikiNodeModelImpl = (WikiNodeModelImpl)wikiNode;
301 
302         if (Validator.isNull(wikiNode.getUuid())) {
303             String uuid = PortalUUIDUtil.generate();
304 
305             wikiNode.setUuid(uuid);
306         }
307 
308         Session session = null;
309 
310         try {
311             session = openSession();
312 
313             BatchSessionUtil.update(session, wikiNode, merge);
314 
315             wikiNode.setNew(false);
316         }
317         catch (Exception e) {
318             throw processException(e);
319         }
320         finally {
321             closeSession(session);
322         }
323 
324         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
325 
326         EntityCacheUtil.putResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
327             WikiNodeImpl.class, wikiNode.getPrimaryKey(), wikiNode);
328 
329         if (!isNew &&
330                 (!Validator.equals(wikiNode.getUuid(),
331                     wikiNodeModelImpl.getOriginalUuid()) ||
332                 (wikiNode.getGroupId() != wikiNodeModelImpl.getOriginalGroupId()))) {
333             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
334                 new Object[] {
335                     wikiNodeModelImpl.getOriginalUuid(),
336                     new Long(wikiNodeModelImpl.getOriginalGroupId())
337                 });
338         }
339 
340         if (isNew ||
341                 (!Validator.equals(wikiNode.getUuid(),
342                     wikiNodeModelImpl.getOriginalUuid()) ||
343                 (wikiNode.getGroupId() != wikiNodeModelImpl.getOriginalGroupId()))) {
344             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
345                 new Object[] { wikiNode.getUuid(), new Long(
346                         wikiNode.getGroupId()) }, wikiNode);
347         }
348 
349         if (!isNew &&
350                 ((wikiNode.getGroupId() != wikiNodeModelImpl.getOriginalGroupId()) ||
351                 !Validator.equals(wikiNode.getName(),
352                     wikiNodeModelImpl.getOriginalName()))) {
353             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
354                 new Object[] {
355                     new Long(wikiNodeModelImpl.getOriginalGroupId()),
356                     
357                 wikiNodeModelImpl.getOriginalName()
358                 });
359         }
360 
361         if (isNew ||
362                 ((wikiNode.getGroupId() != wikiNodeModelImpl.getOriginalGroupId()) ||
363                 !Validator.equals(wikiNode.getName(),
364                     wikiNodeModelImpl.getOriginalName()))) {
365             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
366                 new Object[] { new Long(wikiNode.getGroupId()), wikiNode.getName() },
367                 wikiNode);
368         }
369 
370         return wikiNode;
371     }
372 
373     protected WikiNode toUnwrappedModel(WikiNode wikiNode) {
374         if (wikiNode instanceof WikiNodeImpl) {
375             return wikiNode;
376         }
377 
378         WikiNodeImpl wikiNodeImpl = new WikiNodeImpl();
379 
380         wikiNodeImpl.setNew(wikiNode.isNew());
381         wikiNodeImpl.setPrimaryKey(wikiNode.getPrimaryKey());
382 
383         wikiNodeImpl.setUuid(wikiNode.getUuid());
384         wikiNodeImpl.setNodeId(wikiNode.getNodeId());
385         wikiNodeImpl.setGroupId(wikiNode.getGroupId());
386         wikiNodeImpl.setCompanyId(wikiNode.getCompanyId());
387         wikiNodeImpl.setUserId(wikiNode.getUserId());
388         wikiNodeImpl.setUserName(wikiNode.getUserName());
389         wikiNodeImpl.setCreateDate(wikiNode.getCreateDate());
390         wikiNodeImpl.setModifiedDate(wikiNode.getModifiedDate());
391         wikiNodeImpl.setName(wikiNode.getName());
392         wikiNodeImpl.setDescription(wikiNode.getDescription());
393         wikiNodeImpl.setLastPostDate(wikiNode.getLastPostDate());
394 
395         return wikiNodeImpl;
396     }
397 
398     public WikiNode findByPrimaryKey(Serializable primaryKey)
399         throws NoSuchModelException, SystemException {
400         return findByPrimaryKey(((Long)primaryKey).longValue());
401     }
402 
403     public WikiNode findByPrimaryKey(long nodeId)
404         throws NoSuchNodeException, SystemException {
405         WikiNode wikiNode = fetchByPrimaryKey(nodeId);
406 
407         if (wikiNode == null) {
408             if (_log.isWarnEnabled()) {
409                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + nodeId);
410             }
411 
412             throw new NoSuchNodeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
413                 nodeId);
414         }
415 
416         return wikiNode;
417     }
418 
419     public WikiNode fetchByPrimaryKey(Serializable primaryKey)
420         throws SystemException {
421         return fetchByPrimaryKey(((Long)primaryKey).longValue());
422     }
423 
424     public WikiNode fetchByPrimaryKey(long nodeId) throws SystemException {
425         WikiNode wikiNode = (WikiNode)EntityCacheUtil.getResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
426                 WikiNodeImpl.class, nodeId, this);
427 
428         if (wikiNode == null) {
429             Session session = null;
430 
431             try {
432                 session = openSession();
433 
434                 wikiNode = (WikiNode)session.get(WikiNodeImpl.class,
435                         new Long(nodeId));
436             }
437             catch (Exception e) {
438                 throw processException(e);
439             }
440             finally {
441                 if (wikiNode != null) {
442                     cacheResult(wikiNode);
443                 }
444 
445                 closeSession(session);
446             }
447         }
448 
449         return wikiNode;
450     }
451 
452     public List<WikiNode> findByUuid(String uuid) throws SystemException {
453         return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
454     }
455 
456     public List<WikiNode> findByUuid(String uuid, int start, int end)
457         throws SystemException {
458         return findByUuid(uuid, start, end, null);
459     }
460 
461     public List<WikiNode> findByUuid(String uuid, int start, int end,
462         OrderByComparator orderByComparator) throws SystemException {
463         Object[] finderArgs = new Object[] {
464                 uuid,
465                 
466                 String.valueOf(start), String.valueOf(end),
467                 String.valueOf(orderByComparator)
468             };
469 
470         List<WikiNode> list = (List<WikiNode>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
471                 finderArgs, this);
472 
473         if (list == null) {
474             Session session = null;
475 
476             try {
477                 session = openSession();
478 
479                 StringBundler query = null;
480 
481                 if (orderByComparator != null) {
482                     query = new StringBundler(3 +
483                             (orderByComparator.getOrderByFields().length * 3));
484                 }
485                 else {
486                     query = new StringBundler(3);
487                 }
488 
489                 query.append(_SQL_SELECT_WIKINODE_WHERE);
490 
491                 if (uuid == null) {
492                     query.append(_FINDER_COLUMN_UUID_UUID_1);
493                 }
494                 else {
495                     if (uuid.equals(StringPool.BLANK)) {
496                         query.append(_FINDER_COLUMN_UUID_UUID_3);
497                     }
498                     else {
499                         query.append(_FINDER_COLUMN_UUID_UUID_2);
500                     }
501                 }
502 
503                 if (orderByComparator != null) {
504                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
505                         orderByComparator);
506                 }
507 
508                 else {
509                     query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
510                 }
511 
512                 String sql = query.toString();
513 
514                 Query q = session.createQuery(sql);
515 
516                 QueryPos qPos = QueryPos.getInstance(q);
517 
518                 if (uuid != null) {
519                     qPos.add(uuid);
520                 }
521 
522                 list = (List<WikiNode>)QueryUtil.list(q, getDialect(), start,
523                         end);
524             }
525             catch (Exception e) {
526                 throw processException(e);
527             }
528             finally {
529                 if (list == null) {
530                     list = new ArrayList<WikiNode>();
531                 }
532 
533                 cacheResult(list);
534 
535                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
536                     list);
537 
538                 closeSession(session);
539             }
540         }
541 
542         return list;
543     }
544 
545     public WikiNode findByUuid_First(String uuid,
546         OrderByComparator orderByComparator)
547         throws NoSuchNodeException, SystemException {
548         List<WikiNode> list = findByUuid(uuid, 0, 1, orderByComparator);
549 
550         if (list.isEmpty()) {
551             StringBundler msg = new StringBundler(4);
552 
553             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
554 
555             msg.append("uuid=");
556             msg.append(uuid);
557 
558             msg.append(StringPool.CLOSE_CURLY_BRACE);
559 
560             throw new NoSuchNodeException(msg.toString());
561         }
562         else {
563             return list.get(0);
564         }
565     }
566 
567     public WikiNode findByUuid_Last(String uuid,
568         OrderByComparator orderByComparator)
569         throws NoSuchNodeException, SystemException {
570         int count = countByUuid(uuid);
571 
572         List<WikiNode> list = findByUuid(uuid, count - 1, count,
573                 orderByComparator);
574 
575         if (list.isEmpty()) {
576             StringBundler msg = new StringBundler(4);
577 
578             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
579 
580             msg.append("uuid=");
581             msg.append(uuid);
582 
583             msg.append(StringPool.CLOSE_CURLY_BRACE);
584 
585             throw new NoSuchNodeException(msg.toString());
586         }
587         else {
588             return list.get(0);
589         }
590     }
591 
592     public WikiNode[] findByUuid_PrevAndNext(long nodeId, String uuid,
593         OrderByComparator orderByComparator)
594         throws NoSuchNodeException, SystemException {
595         WikiNode wikiNode = findByPrimaryKey(nodeId);
596 
597         Session session = null;
598 
599         try {
600             session = openSession();
601 
602             WikiNode[] array = new WikiNodeImpl[3];
603 
604             array[0] = getByUuid_PrevAndNext(session, wikiNode, uuid,
605                     orderByComparator, true);
606 
607             array[1] = wikiNode;
608 
609             array[2] = getByUuid_PrevAndNext(session, wikiNode, uuid,
610                     orderByComparator, false);
611 
612             return array;
613         }
614         catch (Exception e) {
615             throw processException(e);
616         }
617         finally {
618             closeSession(session);
619         }
620     }
621 
622     protected WikiNode getByUuid_PrevAndNext(Session session,
623         WikiNode wikiNode, String uuid, OrderByComparator orderByComparator,
624         boolean previous) {
625         StringBundler query = null;
626 
627         if (orderByComparator != null) {
628             query = new StringBundler(6 +
629                     (orderByComparator.getOrderByFields().length * 6));
630         }
631         else {
632             query = new StringBundler(3);
633         }
634 
635         query.append(_SQL_SELECT_WIKINODE_WHERE);
636 
637         if (uuid == null) {
638             query.append(_FINDER_COLUMN_UUID_UUID_1);
639         }
640         else {
641             if (uuid.equals(StringPool.BLANK)) {
642                 query.append(_FINDER_COLUMN_UUID_UUID_3);
643             }
644             else {
645                 query.append(_FINDER_COLUMN_UUID_UUID_2);
646             }
647         }
648 
649         if (orderByComparator != null) {
650             String[] orderByFields = orderByComparator.getOrderByFields();
651 
652             if (orderByFields.length > 0) {
653                 query.append(WHERE_AND);
654             }
655 
656             for (int i = 0; i < orderByFields.length; i++) {
657                 query.append(_ORDER_BY_ENTITY_ALIAS);
658                 query.append(orderByFields[i]);
659 
660                 if ((i + 1) < orderByFields.length) {
661                     if (orderByComparator.isAscending() ^ previous) {
662                         query.append(WHERE_GREATER_THAN_HAS_NEXT);
663                     }
664                     else {
665                         query.append(WHERE_LESSER_THAN_HAS_NEXT);
666                     }
667                 }
668                 else {
669                     if (orderByComparator.isAscending() ^ previous) {
670                         query.append(WHERE_GREATER_THAN);
671                     }
672                     else {
673                         query.append(WHERE_LESSER_THAN);
674                     }
675                 }
676             }
677 
678             query.append(ORDER_BY_CLAUSE);
679 
680             for (int i = 0; i < orderByFields.length; i++) {
681                 query.append(_ORDER_BY_ENTITY_ALIAS);
682                 query.append(orderByFields[i]);
683 
684                 if ((i + 1) < orderByFields.length) {
685                     if (orderByComparator.isAscending() ^ previous) {
686                         query.append(ORDER_BY_ASC_HAS_NEXT);
687                     }
688                     else {
689                         query.append(ORDER_BY_DESC_HAS_NEXT);
690                     }
691                 }
692                 else {
693                     if (orderByComparator.isAscending() ^ previous) {
694                         query.append(ORDER_BY_ASC);
695                     }
696                     else {
697                         query.append(ORDER_BY_DESC);
698                     }
699                 }
700             }
701         }
702 
703         else {
704             query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
705         }
706 
707         String sql = query.toString();
708 
709         Query q = session.createQuery(sql);
710 
711         q.setFirstResult(0);
712         q.setMaxResults(2);
713 
714         QueryPos qPos = QueryPos.getInstance(q);
715 
716         if (uuid != null) {
717             qPos.add(uuid);
718         }
719 
720         if (orderByComparator != null) {
721             Object[] values = orderByComparator.getOrderByValues(wikiNode);
722 
723             for (Object value : values) {
724                 qPos.add(value);
725             }
726         }
727 
728         List<WikiNode> list = q.list();
729 
730         if (list.size() == 2) {
731             return list.get(1);
732         }
733         else {
734             return null;
735         }
736     }
737 
738     public WikiNode findByUUID_G(String uuid, long groupId)
739         throws NoSuchNodeException, SystemException {
740         WikiNode wikiNode = fetchByUUID_G(uuid, groupId);
741 
742         if (wikiNode == null) {
743             StringBundler msg = new StringBundler(6);
744 
745             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
746 
747             msg.append("uuid=");
748             msg.append(uuid);
749 
750             msg.append(", groupId=");
751             msg.append(groupId);
752 
753             msg.append(StringPool.CLOSE_CURLY_BRACE);
754 
755             if (_log.isWarnEnabled()) {
756                 _log.warn(msg.toString());
757             }
758 
759             throw new NoSuchNodeException(msg.toString());
760         }
761 
762         return wikiNode;
763     }
764 
765     public WikiNode fetchByUUID_G(String uuid, long groupId)
766         throws SystemException {
767         return fetchByUUID_G(uuid, groupId, true);
768     }
769 
770     public WikiNode fetchByUUID_G(String uuid, long groupId,
771         boolean retrieveFromCache) throws SystemException {
772         Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
773 
774         Object result = null;
775 
776         if (retrieveFromCache) {
777             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
778                     finderArgs, this);
779         }
780 
781         if (result == null) {
782             Session session = null;
783 
784             try {
785                 session = openSession();
786 
787                 StringBundler query = new StringBundler(4);
788 
789                 query.append(_SQL_SELECT_WIKINODE_WHERE);
790 
791                 if (uuid == null) {
792                     query.append(_FINDER_COLUMN_UUID_G_UUID_1);
793                 }
794                 else {
795                     if (uuid.equals(StringPool.BLANK)) {
796                         query.append(_FINDER_COLUMN_UUID_G_UUID_3);
797                     }
798                     else {
799                         query.append(_FINDER_COLUMN_UUID_G_UUID_2);
800                     }
801                 }
802 
803                 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
804 
805                 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
806 
807                 String sql = query.toString();
808 
809                 Query q = session.createQuery(sql);
810 
811                 QueryPos qPos = QueryPos.getInstance(q);
812 
813                 if (uuid != null) {
814                     qPos.add(uuid);
815                 }
816 
817                 qPos.add(groupId);
818 
819                 List<WikiNode> list = q.list();
820 
821                 result = list;
822 
823                 WikiNode wikiNode = null;
824 
825                 if (list.isEmpty()) {
826                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
827                         finderArgs, list);
828                 }
829                 else {
830                     wikiNode = list.get(0);
831 
832                     cacheResult(wikiNode);
833 
834                     if ((wikiNode.getUuid() == null) ||
835                             !wikiNode.getUuid().equals(uuid) ||
836                             (wikiNode.getGroupId() != groupId)) {
837                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
838                             finderArgs, wikiNode);
839                     }
840                 }
841 
842                 return wikiNode;
843             }
844             catch (Exception e) {
845                 throw processException(e);
846             }
847             finally {
848                 if (result == null) {
849                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
850                         finderArgs, new ArrayList<WikiNode>());
851                 }
852 
853                 closeSession(session);
854             }
855         }
856         else {
857             if (result instanceof List<?>) {
858                 return null;
859             }
860             else {
861                 return (WikiNode)result;
862             }
863         }
864     }
865 
866     public List<WikiNode> findByGroupId(long groupId) throws SystemException {
867         return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
868     }
869 
870     public List<WikiNode> findByGroupId(long groupId, int start, int end)
871         throws SystemException {
872         return findByGroupId(groupId, start, end, null);
873     }
874 
875     public List<WikiNode> findByGroupId(long groupId, int start, int end,
876         OrderByComparator orderByComparator) throws SystemException {
877         Object[] finderArgs = new Object[] {
878                 new Long(groupId),
879                 
880                 String.valueOf(start), String.valueOf(end),
881                 String.valueOf(orderByComparator)
882             };
883 
884         List<WikiNode> list = (List<WikiNode>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
885                 finderArgs, this);
886 
887         if (list == null) {
888             Session session = null;
889 
890             try {
891                 session = openSession();
892 
893                 StringBundler query = null;
894 
895                 if (orderByComparator != null) {
896                     query = new StringBundler(3 +
897                             (orderByComparator.getOrderByFields().length * 3));
898                 }
899                 else {
900                     query = new StringBundler(3);
901                 }
902 
903                 query.append(_SQL_SELECT_WIKINODE_WHERE);
904 
905                 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
906 
907                 if (orderByComparator != null) {
908                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
909                         orderByComparator);
910                 }
911 
912                 else {
913                     query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
914                 }
915 
916                 String sql = query.toString();
917 
918                 Query q = session.createQuery(sql);
919 
920                 QueryPos qPos = QueryPos.getInstance(q);
921 
922                 qPos.add(groupId);
923 
924                 list = (List<WikiNode>)QueryUtil.list(q, getDialect(), start,
925                         end);
926             }
927             catch (Exception e) {
928                 throw processException(e);
929             }
930             finally {
931                 if (list == null) {
932                     list = new ArrayList<WikiNode>();
933                 }
934 
935                 cacheResult(list);
936 
937                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
938                     finderArgs, list);
939 
940                 closeSession(session);
941             }
942         }
943 
944         return list;
945     }
946 
947     public WikiNode findByGroupId_First(long groupId,
948         OrderByComparator orderByComparator)
949         throws NoSuchNodeException, SystemException {
950         List<WikiNode> list = findByGroupId(groupId, 0, 1, orderByComparator);
951 
952         if (list.isEmpty()) {
953             StringBundler msg = new StringBundler(4);
954 
955             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
956 
957             msg.append("groupId=");
958             msg.append(groupId);
959 
960             msg.append(StringPool.CLOSE_CURLY_BRACE);
961 
962             throw new NoSuchNodeException(msg.toString());
963         }
964         else {
965             return list.get(0);
966         }
967     }
968 
969     public WikiNode findByGroupId_Last(long groupId,
970         OrderByComparator orderByComparator)
971         throws NoSuchNodeException, SystemException {
972         int count = countByGroupId(groupId);
973 
974         List<WikiNode> list = findByGroupId(groupId, count - 1, count,
975                 orderByComparator);
976 
977         if (list.isEmpty()) {
978             StringBundler msg = new StringBundler(4);
979 
980             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
981 
982             msg.append("groupId=");
983             msg.append(groupId);
984 
985             msg.append(StringPool.CLOSE_CURLY_BRACE);
986 
987             throw new NoSuchNodeException(msg.toString());
988         }
989         else {
990             return list.get(0);
991         }
992     }
993 
994     public WikiNode[] findByGroupId_PrevAndNext(long nodeId, long groupId,
995         OrderByComparator orderByComparator)
996         throws NoSuchNodeException, SystemException {
997         WikiNode wikiNode = findByPrimaryKey(nodeId);
998 
999         Session session = null;
1000
1001        try {
1002            session = openSession();
1003
1004            WikiNode[] array = new WikiNodeImpl[3];
1005
1006            array[0] = getByGroupId_PrevAndNext(session, wikiNode, groupId,
1007                    orderByComparator, true);
1008
1009            array[1] = wikiNode;
1010
1011            array[2] = getByGroupId_PrevAndNext(session, wikiNode, groupId,
1012                    orderByComparator, false);
1013
1014            return array;
1015        }
1016        catch (Exception e) {
1017            throw processException(e);
1018        }
1019        finally {
1020            closeSession(session);
1021        }
1022    }
1023
1024    protected WikiNode getByGroupId_PrevAndNext(Session session,
1025        WikiNode wikiNode, long groupId, OrderByComparator orderByComparator,
1026        boolean previous) {
1027        StringBundler query = null;
1028
1029        if (orderByComparator != null) {
1030            query = new StringBundler(6 +
1031                    (orderByComparator.getOrderByFields().length * 6));
1032        }
1033        else {
1034            query = new StringBundler(3);
1035        }
1036
1037        query.append(_SQL_SELECT_WIKINODE_WHERE);
1038
1039        query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1040
1041        if (orderByComparator != null) {
1042            String[] orderByFields = orderByComparator.getOrderByFields();
1043
1044            if (orderByFields.length > 0) {
1045                query.append(WHERE_AND);
1046            }
1047
1048            for (int i = 0; i < orderByFields.length; i++) {
1049                query.append(_ORDER_BY_ENTITY_ALIAS);
1050                query.append(orderByFields[i]);
1051
1052                if ((i + 1) < orderByFields.length) {
1053                    if (orderByComparator.isAscending() ^ previous) {
1054                        query.append(WHERE_GREATER_THAN_HAS_NEXT);
1055                    }
1056                    else {
1057                        query.append(WHERE_LESSER_THAN_HAS_NEXT);
1058                    }
1059                }
1060                else {
1061                    if (orderByComparator.isAscending() ^ previous) {
1062                        query.append(WHERE_GREATER_THAN);
1063                    }
1064                    else {
1065                        query.append(WHERE_LESSER_THAN);
1066                    }
1067                }
1068            }
1069
1070            query.append(ORDER_BY_CLAUSE);
1071
1072            for (int i = 0; i < orderByFields.length; i++) {
1073                query.append(_ORDER_BY_ENTITY_ALIAS);
1074                query.append(orderByFields[i]);
1075
1076                if ((i + 1) < orderByFields.length) {
1077                    if (orderByComparator.isAscending() ^ previous) {
1078                        query.append(ORDER_BY_ASC_HAS_NEXT);
1079                    }
1080                    else {
1081                        query.append(ORDER_BY_DESC_HAS_NEXT);
1082                    }
1083                }
1084                else {
1085                    if (orderByComparator.isAscending() ^ previous) {
1086                        query.append(ORDER_BY_ASC);
1087                    }
1088                    else {
1089                        query.append(ORDER_BY_DESC);
1090                    }
1091                }
1092            }
1093        }
1094
1095        else {
1096            query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
1097        }
1098
1099        String sql = query.toString();
1100
1101        Query q = session.createQuery(sql);
1102
1103        q.setFirstResult(0);
1104        q.setMaxResults(2);
1105
1106        QueryPos qPos = QueryPos.getInstance(q);
1107
1108        qPos.add(groupId);
1109
1110        if (orderByComparator != null) {
1111            Object[] values = orderByComparator.getOrderByValues(wikiNode);
1112
1113            for (Object value : values) {
1114                qPos.add(value);
1115            }
1116        }
1117
1118        List<WikiNode> list = q.list();
1119
1120        if (list.size() == 2) {
1121            return list.get(1);
1122        }
1123        else {
1124            return null;
1125        }
1126    }
1127
1128    public List<WikiNode> filterFindByGroupId(long groupId)
1129        throws SystemException {
1130        return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1131            QueryUtil.ALL_POS, null);
1132    }
1133
1134    public List<WikiNode> filterFindByGroupId(long groupId, int start, int end)
1135        throws SystemException {
1136        return filterFindByGroupId(groupId, start, end, null);
1137    }
1138
1139    public List<WikiNode> filterFindByGroupId(long groupId, int start, int end,
1140        OrderByComparator orderByComparator) throws SystemException {
1141        if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1142            return findByGroupId(groupId, start, end, orderByComparator);
1143        }
1144
1145        Session session = null;
1146
1147        try {
1148            session = openSession();
1149
1150            StringBundler query = null;
1151
1152            if (orderByComparator != null) {
1153                query = new StringBundler(3 +
1154                        (orderByComparator.getOrderByFields().length * 3));
1155            }
1156            else {
1157                query = new StringBundler(3);
1158            }
1159
1160            query.append(_FILTER_SQL_SELECT_WIKINODE_WHERE);
1161
1162            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1163
1164            if (orderByComparator != null) {
1165                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1166                    orderByComparator);
1167            }
1168
1169            else {
1170                query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
1171            }
1172
1173            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1174                    WikiNode.class.getName(), _FILTER_COLUMN_NODEID,
1175                    _FILTER_COLUMN_USERID, groupId);
1176
1177            SQLQuery q = session.createSQLQuery(sql);
1178
1179            q.addEntity(_FILTER_ENTITY_ALIAS, WikiNodeImpl.class);
1180
1181            QueryPos qPos = QueryPos.getInstance(q);
1182
1183            qPos.add(groupId);
1184
1185            return (List<WikiNode>)QueryUtil.list(q, getDialect(), start, end);
1186        }
1187        catch (Exception e) {
1188            throw processException(e);
1189        }
1190        finally {
1191            closeSession(session);
1192        }
1193    }
1194
1195    public List<WikiNode> findByCompanyId(long companyId)
1196        throws SystemException {
1197        return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1198            null);
1199    }
1200
1201    public List<WikiNode> findByCompanyId(long companyId, int start, int end)
1202        throws SystemException {
1203        return findByCompanyId(companyId, start, end, null);
1204    }
1205
1206    public List<WikiNode> findByCompanyId(long companyId, int start, int end,
1207        OrderByComparator orderByComparator) throws SystemException {
1208        Object[] finderArgs = new Object[] {
1209                new Long(companyId),
1210                
1211                String.valueOf(start), String.valueOf(end),
1212                String.valueOf(orderByComparator)
1213            };
1214
1215        List<WikiNode> list = (List<WikiNode>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1216                finderArgs, this);
1217
1218        if (list == null) {
1219            Session session = null;
1220
1221            try {
1222                session = openSession();
1223
1224                StringBundler query = null;
1225
1226                if (orderByComparator != null) {
1227                    query = new StringBundler(3 +
1228                            (orderByComparator.getOrderByFields().length * 3));
1229                }
1230                else {
1231                    query = new StringBundler(3);
1232                }
1233
1234                query.append(_SQL_SELECT_WIKINODE_WHERE);
1235
1236                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1237
1238                if (orderByComparator != null) {
1239                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1240                        orderByComparator);
1241                }
1242
1243                else {
1244                    query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
1245                }
1246
1247                String sql = query.toString();
1248
1249                Query q = session.createQuery(sql);
1250
1251                QueryPos qPos = QueryPos.getInstance(q);
1252
1253                qPos.add(companyId);
1254
1255                list = (List<WikiNode>)QueryUtil.list(q, getDialect(), start,
1256                        end);
1257            }
1258            catch (Exception e) {
1259                throw processException(e);
1260            }
1261            finally {
1262                if (list == null) {
1263                    list = new ArrayList<WikiNode>();
1264                }
1265
1266                cacheResult(list);
1267
1268                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1269                    finderArgs, list);
1270
1271                closeSession(session);
1272            }
1273        }
1274
1275        return list;
1276    }
1277
1278    public WikiNode findByCompanyId_First(long companyId,
1279        OrderByComparator orderByComparator)
1280        throws NoSuchNodeException, SystemException {
1281        List<WikiNode> list = findByCompanyId(companyId, 0, 1, orderByComparator);
1282
1283        if (list.isEmpty()) {
1284            StringBundler msg = new StringBundler(4);
1285
1286            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1287
1288            msg.append("companyId=");
1289            msg.append(companyId);
1290
1291            msg.append(StringPool.CLOSE_CURLY_BRACE);
1292
1293            throw new NoSuchNodeException(msg.toString());
1294        }
1295        else {
1296            return list.get(0);
1297        }
1298    }
1299
1300    public WikiNode findByCompanyId_Last(long companyId,
1301        OrderByComparator orderByComparator)
1302        throws NoSuchNodeException, SystemException {
1303        int count = countByCompanyId(companyId);
1304
1305        List<WikiNode> list = findByCompanyId(companyId, count - 1, count,
1306                orderByComparator);
1307
1308        if (list.isEmpty()) {
1309            StringBundler msg = new StringBundler(4);
1310
1311            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1312
1313            msg.append("companyId=");
1314            msg.append(companyId);
1315
1316            msg.append(StringPool.CLOSE_CURLY_BRACE);
1317
1318            throw new NoSuchNodeException(msg.toString());
1319        }
1320        else {
1321            return list.get(0);
1322        }
1323    }
1324
1325    public WikiNode[] findByCompanyId_PrevAndNext(long nodeId, long companyId,
1326        OrderByComparator orderByComparator)
1327        throws NoSuchNodeException, SystemException {
1328        WikiNode wikiNode = findByPrimaryKey(nodeId);
1329
1330        Session session = null;
1331
1332        try {
1333            session = openSession();
1334
1335            WikiNode[] array = new WikiNodeImpl[3];
1336
1337            array[0] = getByCompanyId_PrevAndNext(session, wikiNode, companyId,
1338                    orderByComparator, true);
1339
1340            array[1] = wikiNode;
1341
1342            array[2] = getByCompanyId_PrevAndNext(session, wikiNode, companyId,
1343                    orderByComparator, false);
1344
1345            return array;
1346        }
1347        catch (Exception e) {
1348            throw processException(e);
1349        }
1350        finally {
1351            closeSession(session);
1352        }
1353    }
1354
1355    protected WikiNode getByCompanyId_PrevAndNext(Session session,
1356        WikiNode wikiNode, long companyId, OrderByComparator orderByComparator,
1357        boolean previous) {
1358        StringBundler query = null;
1359
1360        if (orderByComparator != null) {
1361            query = new StringBundler(6 +
1362                    (orderByComparator.getOrderByFields().length * 6));
1363        }
1364        else {
1365            query = new StringBundler(3);
1366        }
1367
1368        query.append(_SQL_SELECT_WIKINODE_WHERE);
1369
1370        query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1371
1372        if (orderByComparator != null) {
1373            String[] orderByFields = orderByComparator.getOrderByFields();
1374
1375            if (orderByFields.length > 0) {
1376                query.append(WHERE_AND);
1377            }
1378
1379            for (int i = 0; i < orderByFields.length; i++) {
1380                query.append(_ORDER_BY_ENTITY_ALIAS);
1381                query.append(orderByFields[i]);
1382
1383                if ((i + 1) < orderByFields.length) {
1384                    if (orderByComparator.isAscending() ^ previous) {
1385                        query.append(WHERE_GREATER_THAN_HAS_NEXT);
1386                    }
1387                    else {
1388                        query.append(WHERE_LESSER_THAN_HAS_NEXT);
1389                    }
1390                }
1391                else {
1392                    if (orderByComparator.isAscending() ^ previous) {
1393                        query.append(WHERE_GREATER_THAN);
1394                    }
1395                    else {
1396                        query.append(WHERE_LESSER_THAN);
1397                    }
1398                }
1399            }
1400
1401            query.append(ORDER_BY_CLAUSE);
1402
1403            for (int i = 0; i < orderByFields.length; i++) {
1404                query.append(_ORDER_BY_ENTITY_ALIAS);
1405                query.append(orderByFields[i]);
1406
1407                if ((i + 1) < orderByFields.length) {
1408                    if (orderByComparator.isAscending() ^ previous) {
1409                        query.append(ORDER_BY_ASC_HAS_NEXT);
1410                    }
1411                    else {
1412                        query.append(ORDER_BY_DESC_HAS_NEXT);
1413                    }
1414                }
1415                else {
1416                    if (orderByComparator.isAscending() ^ previous) {
1417                        query.append(ORDER_BY_ASC);
1418                    }
1419                    else {
1420                        query.append(ORDER_BY_DESC);
1421                    }
1422                }
1423            }
1424        }
1425
1426        else {
1427            query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
1428        }
1429
1430        String sql = query.toString();
1431
1432        Query q = session.createQuery(sql);
1433
1434        q.setFirstResult(0);
1435        q.setMaxResults(2);
1436
1437        QueryPos qPos = QueryPos.getInstance(q);
1438
1439        qPos.add(companyId);
1440
1441        if (orderByComparator != null) {
1442            Object[] values = orderByComparator.getOrderByValues(wikiNode);
1443
1444            for (Object value : values) {
1445                qPos.add(value);
1446            }
1447        }
1448
1449        List<WikiNode> list = q.list();
1450
1451        if (list.size() == 2) {
1452            return list.get(1);
1453        }
1454        else {
1455            return null;
1456        }
1457    }
1458
1459    public WikiNode findByG_N(long groupId, String name)
1460        throws NoSuchNodeException, SystemException {
1461        WikiNode wikiNode = fetchByG_N(groupId, name);
1462
1463        if (wikiNode == null) {
1464            StringBundler msg = new StringBundler(6);
1465
1466            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1467
1468            msg.append("groupId=");
1469            msg.append(groupId);
1470
1471            msg.append(", name=");
1472            msg.append(name);
1473
1474            msg.append(StringPool.CLOSE_CURLY_BRACE);
1475
1476            if (_log.isWarnEnabled()) {
1477                _log.warn(msg.toString());
1478            }
1479
1480            throw new NoSuchNodeException(msg.toString());
1481        }
1482
1483        return wikiNode;
1484    }
1485
1486    public WikiNode fetchByG_N(long groupId, String name)
1487        throws SystemException {
1488        return fetchByG_N(groupId, name, true);
1489    }
1490
1491    public WikiNode fetchByG_N(long groupId, String name,
1492        boolean retrieveFromCache) throws SystemException {
1493        Object[] finderArgs = new Object[] { new Long(groupId), name };
1494
1495        Object result = null;
1496
1497        if (retrieveFromCache) {
1498            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_N,
1499                    finderArgs, this);
1500        }
1501
1502        if (result == null) {
1503            Session session = null;
1504
1505            try {
1506                session = openSession();
1507
1508                StringBundler query = new StringBundler(4);
1509
1510                query.append(_SQL_SELECT_WIKINODE_WHERE);
1511
1512                query.append(_FINDER_COLUMN_G_N_GROUPID_2);
1513
1514                if (name == null) {
1515                    query.append(_FINDER_COLUMN_G_N_NAME_1);
1516                }
1517                else {
1518                    if (name.equals(StringPool.BLANK)) {
1519                        query.append(_FINDER_COLUMN_G_N_NAME_3);
1520                    }
1521                    else {
1522                        query.append(_FINDER_COLUMN_G_N_NAME_2);
1523                    }
1524                }
1525
1526                query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
1527
1528                String sql = query.toString();
1529
1530                Query q = session.createQuery(sql);
1531
1532                QueryPos qPos = QueryPos.getInstance(q);
1533
1534                qPos.add(groupId);
1535
1536                if (name != null) {
1537                    qPos.add(name);
1538                }
1539
1540                List<WikiNode> list = q.list();
1541
1542                result = list;
1543
1544                WikiNode wikiNode = null;
1545
1546                if (list.isEmpty()) {
1547                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
1548                        finderArgs, list);
1549                }
1550                else {
1551                    wikiNode = list.get(0);
1552
1553                    cacheResult(wikiNode);
1554
1555                    if ((wikiNode.getGroupId() != groupId) ||
1556                            (wikiNode.getName() == null) ||
1557                            !wikiNode.getName().equals(name)) {
1558                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
1559                            finderArgs, wikiNode);
1560                    }
1561                }
1562
1563                return wikiNode;
1564            }
1565            catch (Exception e) {
1566                throw processException(e);
1567            }
1568            finally {
1569                if (result == null) {
1570                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
1571                        finderArgs, new ArrayList<WikiNode>());
1572                }
1573
1574                closeSession(session);
1575            }
1576        }
1577        else {
1578            if (result instanceof List<?>) {
1579                return null;
1580            }
1581            else {
1582                return (WikiNode)result;
1583            }
1584        }
1585    }
1586
1587    public List<WikiNode> findAll() throws SystemException {
1588        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1589    }
1590
1591    public List<WikiNode> findAll(int start, int end) throws SystemException {
1592        return findAll(start, end, null);
1593    }
1594
1595    public List<WikiNode> findAll(int start, int end,
1596        OrderByComparator orderByComparator) throws SystemException {
1597        Object[] finderArgs = new Object[] {
1598                String.valueOf(start), String.valueOf(end),
1599                String.valueOf(orderByComparator)
1600            };
1601
1602        List<WikiNode> list = (List<WikiNode>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1603                finderArgs, this);
1604
1605        if (list == null) {
1606            Session session = null;
1607
1608            try {
1609                session = openSession();
1610
1611                StringBundler query = null;
1612                String sql = null;
1613
1614                if (orderByComparator != null) {
1615                    query = new StringBundler(2 +
1616                            (orderByComparator.getOrderByFields().length * 3));
1617
1618                    query.append(_SQL_SELECT_WIKINODE);
1619
1620                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1621                        orderByComparator);
1622
1623                    sql = query.toString();
1624                }
1625
1626                else {
1627                    sql = _SQL_SELECT_WIKINODE.concat(WikiNodeModelImpl.ORDER_BY_JPQL);
1628                }
1629
1630                Query q = session.createQuery(sql);
1631
1632                if (orderByComparator == null) {
1633                    list = (List<WikiNode>)QueryUtil.list(q, getDialect(),
1634                            start, end, false);
1635
1636                    Collections.sort(list);
1637                }
1638                else {
1639                    list = (List<WikiNode>)QueryUtil.list(q, getDialect(),
1640                            start, end);
1641                }
1642            }
1643            catch (Exception e) {
1644                throw processException(e);
1645            }
1646            finally {
1647                if (list == null) {
1648                    list = new ArrayList<WikiNode>();
1649                }
1650
1651                cacheResult(list);
1652
1653                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1654
1655                closeSession(session);
1656            }
1657        }
1658
1659        return list;
1660    }
1661
1662    public void removeByUuid(String uuid) throws SystemException {
1663        for (WikiNode wikiNode : findByUuid(uuid)) {
1664            remove(wikiNode);
1665        }
1666    }
1667
1668    public void removeByUUID_G(String uuid, long groupId)
1669        throws NoSuchNodeException, SystemException {
1670        WikiNode wikiNode = findByUUID_G(uuid, groupId);
1671
1672        remove(wikiNode);
1673    }
1674
1675    public void removeByGroupId(long groupId) throws SystemException {
1676        for (WikiNode wikiNode : findByGroupId(groupId)) {
1677            remove(wikiNode);
1678        }
1679    }
1680
1681    public void removeByCompanyId(long companyId) throws SystemException {
1682        for (WikiNode wikiNode : findByCompanyId(companyId)) {
1683            remove(wikiNode);
1684        }
1685    }
1686
1687    public void removeByG_N(long groupId, String name)
1688        throws NoSuchNodeException, SystemException {
1689        WikiNode wikiNode = findByG_N(groupId, name);
1690
1691        remove(wikiNode);
1692    }
1693
1694    public void removeAll() throws SystemException {
1695        for (WikiNode wikiNode : findAll()) {
1696            remove(wikiNode);
1697        }
1698    }
1699
1700    public int countByUuid(String uuid) throws SystemException {
1701        Object[] finderArgs = new Object[] { uuid };
1702
1703        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
1704                finderArgs, this);
1705
1706        if (count == null) {
1707            Session session = null;
1708
1709            try {
1710                session = openSession();
1711
1712                StringBundler query = new StringBundler(2);
1713
1714                query.append(_SQL_COUNT_WIKINODE_WHERE);
1715
1716                if (uuid == null) {
1717                    query.append(_FINDER_COLUMN_UUID_UUID_1);
1718                }
1719                else {
1720                    if (uuid.equals(StringPool.BLANK)) {
1721                        query.append(_FINDER_COLUMN_UUID_UUID_3);
1722                    }
1723                    else {
1724                        query.append(_FINDER_COLUMN_UUID_UUID_2);
1725                    }
1726                }
1727
1728                String sql = query.toString();
1729
1730                Query q = session.createQuery(sql);
1731
1732                QueryPos qPos = QueryPos.getInstance(q);
1733
1734                if (uuid != null) {
1735                    qPos.add(uuid);
1736                }
1737
1738                count = (Long)q.uniqueResult();
1739            }
1740            catch (Exception e) {
1741                throw processException(e);
1742            }
1743            finally {
1744                if (count == null) {
1745                    count = Long.valueOf(0);
1746                }
1747
1748                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
1749                    finderArgs, count);
1750
1751                closeSession(session);
1752            }
1753        }
1754
1755        return count.intValue();
1756    }
1757
1758    public int countByUUID_G(String uuid, long groupId)
1759        throws SystemException {
1760        Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
1761
1762        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
1763                finderArgs, this);
1764
1765        if (count == null) {
1766            Session session = null;
1767
1768            try {
1769                session = openSession();
1770
1771                StringBundler query = new StringBundler(3);
1772
1773                query.append(_SQL_COUNT_WIKINODE_WHERE);
1774
1775                if (uuid == null) {
1776                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1777                }
1778                else {
1779                    if (uuid.equals(StringPool.BLANK)) {
1780                        query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1781                    }
1782                    else {
1783                        query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1784                    }
1785                }
1786
1787                query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1788
1789                String sql = query.toString();
1790
1791                Query q = session.createQuery(sql);
1792
1793                QueryPos qPos = QueryPos.getInstance(q);
1794
1795                if (uuid != null) {
1796                    qPos.add(uuid);
1797                }
1798
1799                qPos.add(groupId);
1800
1801                count = (Long)q.uniqueResult();
1802            }
1803            catch (Exception e) {
1804                throw processException(e);
1805            }
1806            finally {
1807                if (count == null) {
1808                    count = Long.valueOf(0);
1809                }
1810
1811                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
1812                    finderArgs, count);
1813
1814                closeSession(session);
1815            }
1816        }
1817
1818        return count.intValue();
1819    }
1820
1821    public int countByGroupId(long groupId) throws SystemException {
1822        Object[] finderArgs = new Object[] { new Long(groupId) };
1823
1824        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1825                finderArgs, this);
1826
1827        if (count == null) {
1828            Session session = null;
1829
1830            try {
1831                session = openSession();
1832
1833                StringBundler query = new StringBundler(2);
1834
1835                query.append(_SQL_COUNT_WIKINODE_WHERE);
1836
1837                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1838
1839                String sql = query.toString();
1840
1841                Query q = session.createQuery(sql);
1842
1843                QueryPos qPos = QueryPos.getInstance(q);
1844
1845                qPos.add(groupId);
1846
1847                count = (Long)q.uniqueResult();
1848            }
1849            catch (Exception e) {
1850                throw processException(e);
1851            }
1852            finally {
1853                if (count == null) {
1854                    count = Long.valueOf(0);
1855                }
1856
1857                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1858                    finderArgs, count);
1859
1860                closeSession(session);
1861            }
1862        }
1863
1864        return count.intValue();
1865    }
1866
1867    public int filterCountByGroupId(long groupId) throws SystemException {
1868        if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1869            return countByGroupId(groupId);
1870        }
1871
1872        Session session = null;
1873
1874        try {
1875            session = openSession();
1876
1877            StringBundler query = new StringBundler(2);
1878
1879            query.append(_FILTER_SQL_COUNT_WIKINODE_WHERE);
1880
1881            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1882
1883            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1884                    WikiNode.class.getName(), _FILTER_COLUMN_NODEID,
1885                    _FILTER_COLUMN_USERID, groupId);
1886
1887            SQLQuery q = session.createSQLQuery(sql);
1888
1889            q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
1890
1891            QueryPos qPos = QueryPos.getInstance(q);
1892
1893            qPos.add(groupId);
1894
1895            Long count = (Long)q.uniqueResult();
1896
1897            return count.intValue();
1898        }
1899        catch (Exception e) {
1900            throw processException(e);
1901        }
1902        finally {
1903            closeSession(session);
1904        }
1905    }
1906
1907    public int countByCompanyId(long companyId) throws SystemException {
1908        Object[] finderArgs = new Object[] { new Long(companyId) };
1909
1910        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1911                finderArgs, this);
1912
1913        if (count == null) {
1914            Session session = null;
1915
1916            try {
1917                session = openSession();
1918
1919                StringBundler query = new StringBundler(2);
1920
1921                query.append(_SQL_COUNT_WIKINODE_WHERE);
1922
1923                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1924
1925                String sql = query.toString();
1926
1927                Query q = session.createQuery(sql);
1928
1929                QueryPos qPos = QueryPos.getInstance(q);
1930
1931                qPos.add(companyId);
1932
1933                count = (Long)q.uniqueResult();
1934            }
1935            catch (Exception e) {
1936                throw processException(e);
1937            }
1938            finally {
1939                if (count == null) {
1940                    count = Long.valueOf(0);
1941                }
1942
1943                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1944                    finderArgs, count);
1945
1946                closeSession(session);
1947            }
1948        }
1949
1950        return count.intValue();
1951    }
1952
1953    public int countByG_N(long groupId, String name) throws SystemException {
1954        Object[] finderArgs = new Object[] { new Long(groupId), name };
1955
1956        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_N,
1957                finderArgs, this);
1958
1959        if (count == null) {
1960            Session session = null;
1961
1962            try {
1963                session = openSession();
1964
1965                StringBundler query = new StringBundler(3);
1966
1967                query.append(_SQL_COUNT_WIKINODE_WHERE);
1968
1969                query.append(_FINDER_COLUMN_G_N_GROUPID_2);
1970
1971                if (name == null) {
1972                    query.append(_FINDER_COLUMN_G_N_NAME_1);
1973                }
1974                else {
1975                    if (name.equals(StringPool.BLANK)) {
1976                        query.append(_FINDER_COLUMN_G_N_NAME_3);
1977                    }
1978                    else {
1979                        query.append(_FINDER_COLUMN_G_N_NAME_2);
1980                    }
1981                }
1982
1983                String sql = query.toString();
1984
1985                Query q = session.createQuery(sql);
1986
1987                QueryPos qPos = QueryPos.getInstance(q);
1988
1989                qPos.add(groupId);
1990
1991                if (name != null) {
1992                    qPos.add(name);
1993                }
1994
1995                count = (Long)q.uniqueResult();
1996            }
1997            catch (Exception e) {
1998                throw processException(e);
1999            }
2000            finally {
2001                if (count == null) {
2002                    count = Long.valueOf(0);
2003                }
2004
2005                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N, finderArgs,
2006                    count);
2007
2008                closeSession(session);
2009            }
2010        }
2011
2012        return count.intValue();
2013    }
2014
2015    public int filterCountByG_N(long groupId, String name)
2016        throws SystemException {
2017        if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2018            return countByG_N(groupId, name);
2019        }
2020
2021        Session session = null;
2022
2023        try {
2024            session = openSession();
2025
2026            StringBundler query = new StringBundler(3);
2027
2028            query.append(_FILTER_SQL_COUNT_WIKINODE_WHERE);
2029
2030            query.append(_FINDER_COLUMN_G_N_GROUPID_2);
2031
2032            if (name == null) {
2033                query.append(_FINDER_COLUMN_G_N_NAME_1);
2034            }
2035            else {
2036                if (name.equals(StringPool.BLANK)) {
2037                    query.append(_FINDER_COLUMN_G_N_NAME_3);
2038                }
2039                else {
2040                    query.append(_FINDER_COLUMN_G_N_NAME_2);
2041                }
2042            }
2043
2044            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2045                    WikiNode.class.getName(), _FILTER_COLUMN_NODEID,
2046                    _FILTER_COLUMN_USERID, groupId);
2047
2048            SQLQuery q = session.createSQLQuery(sql);
2049
2050            q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
2051
2052            QueryPos qPos = QueryPos.getInstance(q);
2053
2054            qPos.add(groupId);
2055
2056            if (name != null) {
2057                qPos.add(name);
2058            }
2059
2060            Long count = (Long)q.uniqueResult();
2061
2062            return count.intValue();
2063        }
2064        catch (Exception e) {
2065            throw processException(e);
2066        }
2067        finally {
2068            closeSession(session);
2069        }
2070    }
2071
2072    public int countAll() throws SystemException {
2073        Object[] finderArgs = new Object[0];
2074
2075        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2076                finderArgs, this);
2077
2078        if (count == null) {
2079            Session session = null;
2080
2081            try {
2082                session = openSession();
2083
2084                Query q = session.createQuery(_SQL_COUNT_WIKINODE);
2085
2086                count = (Long)q.uniqueResult();
2087            }
2088            catch (Exception e) {
2089                throw processException(e);
2090            }
2091            finally {
2092                if (count == null) {
2093                    count = Long.valueOf(0);
2094                }
2095
2096                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2097                    count);
2098
2099                closeSession(session);
2100            }
2101        }
2102
2103        return count.intValue();
2104    }
2105
2106    public void afterPropertiesSet() {
2107        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2108                    com.liferay.portal.util.PropsUtil.get(
2109                        "value.object.listener.com.liferay.portlet.wiki.model.WikiNode")));
2110
2111        if (listenerClassNames.length > 0) {
2112            try {
2113                List<ModelListener<WikiNode>> listenersList = new ArrayList<ModelListener<WikiNode>>();
2114
2115                for (String listenerClassName : listenerClassNames) {
2116                    listenersList.add((ModelListener<WikiNode>)InstanceFactory.newInstance(
2117                            listenerClassName));
2118                }
2119
2120                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2121            }
2122            catch (Exception e) {
2123                _log.error(e);
2124            }
2125        }
2126    }
2127
2128    @BeanReference(type = WikiNodePersistence.class)
2129    protected WikiNodePersistence wikiNodePersistence;
2130    @BeanReference(type = WikiPagePersistence.class)
2131    protected WikiPagePersistence wikiPagePersistence;
2132    @BeanReference(type = WikiPageResourcePersistence.class)
2133    protected WikiPageResourcePersistence wikiPageResourcePersistence;
2134    @BeanReference(type = GroupPersistence.class)
2135    protected GroupPersistence groupPersistence;
2136    @BeanReference(type = ResourcePersistence.class)
2137    protected ResourcePersistence resourcePersistence;
2138    @BeanReference(type = SubscriptionPersistence.class)
2139    protected SubscriptionPersistence subscriptionPersistence;
2140    @BeanReference(type = UserPersistence.class)
2141    protected UserPersistence userPersistence;
2142    private static final String _SQL_SELECT_WIKINODE = "SELECT wikiNode FROM WikiNode wikiNode";
2143    private static final String _SQL_SELECT_WIKINODE_WHERE = "SELECT wikiNode FROM WikiNode wikiNode WHERE ";
2144    private static final String _SQL_COUNT_WIKINODE = "SELECT COUNT(wikiNode) FROM WikiNode wikiNode";
2145    private static final String _SQL_COUNT_WIKINODE_WHERE = "SELECT COUNT(wikiNode) FROM WikiNode wikiNode WHERE ";
2146    private static final String _FINDER_COLUMN_UUID_UUID_1 = "wikiNode.uuid IS NULL";
2147    private static final String _FINDER_COLUMN_UUID_UUID_2 = "wikiNode.uuid = ?";
2148    private static final String _FINDER_COLUMN_UUID_UUID_3 = "(wikiNode.uuid IS NULL OR wikiNode.uuid = ?)";
2149    private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "wikiNode.uuid IS NULL AND ";
2150    private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "wikiNode.uuid = ? AND ";
2151    private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(wikiNode.uuid IS NULL OR wikiNode.uuid = ?) AND ";
2152    private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "wikiNode.groupId = ?";
2153    private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "wikiNode.groupId = ?";
2154    private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "wikiNode.companyId = ?";
2155    private static final String _FINDER_COLUMN_G_N_GROUPID_2 = "wikiNode.groupId = ? AND ";
2156    private static final String _FINDER_COLUMN_G_N_NAME_1 = "wikiNode.name IS NULL";
2157    private static final String _FINDER_COLUMN_G_N_NAME_2 = "wikiNode.name = ?";
2158    private static final String _FINDER_COLUMN_G_N_NAME_3 = "(wikiNode.name IS NULL OR wikiNode.name = ?)";
2159    private static final String _FILTER_SQL_SELECT_WIKINODE_WHERE = "SELECT DISTINCT {wikiNode.*} FROM WikiNode wikiNode WHERE ";
2160    private static final String _FILTER_SQL_COUNT_WIKINODE_WHERE = "SELECT COUNT(DISTINCT wikiNode.nodeId) AS COUNT_VALUE FROM WikiNode wikiNode WHERE ";
2161    private static final String _FILTER_COLUMN_NODEID = "wikiNode.nodeId";
2162    private static final String _FILTER_COLUMN_USERID = "wikiNode.userId";
2163    private static final String _FILTER_ENTITY_ALIAS = "wikiNode";
2164    private static final String _ORDER_BY_ENTITY_ALIAS = "wikiNode.";
2165    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No WikiNode exists with the primary key ";
2166    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No WikiNode exists with the key {";
2167    private static Log _log = LogFactoryUtil.getLog(WikiNodePersistenceImpl.class);
2168}