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.DynamicQuery;
21  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderPath;
24  import com.liferay.portal.kernel.dao.orm.Query;
25  import com.liferay.portal.kernel.dao.orm.QueryPos;
26  import com.liferay.portal.kernel.dao.orm.QueryUtil;
27  import com.liferay.portal.kernel.dao.orm.Session;
28  import com.liferay.portal.kernel.exception.SystemException;
29  import com.liferay.portal.kernel.log.Log;
30  import com.liferay.portal.kernel.log.LogFactoryUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.OrderByComparator;
33  import com.liferay.portal.kernel.util.StringBundler;
34  import com.liferay.portal.kernel.util.StringPool;
35  import com.liferay.portal.kernel.util.StringUtil;
36  import com.liferay.portal.kernel.util.Validator;
37  import com.liferay.portal.model.ModelListener;
38  import com.liferay.portal.service.persistence.BatchSessionUtil;
39  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
40  
41  import com.liferay.portlet.wiki.NoSuchPageResourceException;
42  import com.liferay.portlet.wiki.model.WikiPageResource;
43  import com.liferay.portlet.wiki.model.impl.WikiPageResourceImpl;
44  import com.liferay.portlet.wiki.model.impl.WikiPageResourceModelImpl;
45  
46  import java.io.Serializable;
47  
48  import java.util.ArrayList;
49  import java.util.Collections;
50  import java.util.List;
51  
52  /**
53   * <a href="WikiPageResourcePersistenceImpl.java.html"><b><i>View Source</i></b></a>
54   *
55   * <p>
56   * ServiceBuilder generated this class. Modifications in this class will be
57   * overwritten the next time is generated.
58   * </p>
59   *
60   * @author    Brian Wing Shun Chan
61   * @see       WikiPageResourcePersistence
62   * @see       WikiPageResourceUtil
63   * @generated
64   */
65  public class WikiPageResourcePersistenceImpl extends BasePersistenceImpl<WikiPageResource>
66      implements WikiPageResourcePersistence {
67      public static final String FINDER_CLASS_NAME_ENTITY = WikiPageResourceImpl.class.getName();
68      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
69          ".List";
70      public static final FinderPath FINDER_PATH_FETCH_BY_N_T = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
71              WikiPageResourceModelImpl.FINDER_CACHE_ENABLED,
72              FINDER_CLASS_NAME_ENTITY, "fetchByN_T",
73              new String[] { Long.class.getName(), String.class.getName() });
74      public static final FinderPath FINDER_PATH_COUNT_BY_N_T = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
75              WikiPageResourceModelImpl.FINDER_CACHE_ENABLED,
76              FINDER_CLASS_NAME_LIST, "countByN_T",
77              new String[] { Long.class.getName(), String.class.getName() });
78      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
79              WikiPageResourceModelImpl.FINDER_CACHE_ENABLED,
80              FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
81      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
82              WikiPageResourceModelImpl.FINDER_CACHE_ENABLED,
83              FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
84  
85      public void cacheResult(WikiPageResource wikiPageResource) {
86          EntityCacheUtil.putResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
87              WikiPageResourceImpl.class, wikiPageResource.getPrimaryKey(),
88              wikiPageResource);
89  
90          FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T,
91              new Object[] {
92                  new Long(wikiPageResource.getNodeId()),
93                  
94              wikiPageResource.getTitle()
95              }, wikiPageResource);
96      }
97  
98      public void cacheResult(List<WikiPageResource> wikiPageResources) {
99          for (WikiPageResource wikiPageResource : wikiPageResources) {
100             if (EntityCacheUtil.getResult(
101                         WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
102                         WikiPageResourceImpl.class,
103                         wikiPageResource.getPrimaryKey(), this) == null) {
104                 cacheResult(wikiPageResource);
105             }
106         }
107     }
108 
109     public void clearCache() {
110         CacheRegistry.clear(WikiPageResourceImpl.class.getName());
111         EntityCacheUtil.clearCache(WikiPageResourceImpl.class.getName());
112         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
113         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
114     }
115 
116     public WikiPageResource create(long resourcePrimKey) {
117         WikiPageResource wikiPageResource = new WikiPageResourceImpl();
118 
119         wikiPageResource.setNew(true);
120         wikiPageResource.setPrimaryKey(resourcePrimKey);
121 
122         return wikiPageResource;
123     }
124 
125     public WikiPageResource remove(Serializable primaryKey)
126         throws NoSuchModelException, SystemException {
127         return remove(((Long)primaryKey).longValue());
128     }
129 
130     public WikiPageResource remove(long resourcePrimKey)
131         throws NoSuchPageResourceException, SystemException {
132         Session session = null;
133 
134         try {
135             session = openSession();
136 
137             WikiPageResource wikiPageResource = (WikiPageResource)session.get(WikiPageResourceImpl.class,
138                     new Long(resourcePrimKey));
139 
140             if (wikiPageResource == null) {
141                 if (_log.isWarnEnabled()) {
142                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
143                         resourcePrimKey);
144                 }
145 
146                 throw new NoSuchPageResourceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
147                     resourcePrimKey);
148             }
149 
150             return remove(wikiPageResource);
151         }
152         catch (NoSuchPageResourceException nsee) {
153             throw nsee;
154         }
155         catch (Exception e) {
156             throw processException(e);
157         }
158         finally {
159             closeSession(session);
160         }
161     }
162 
163     public WikiPageResource remove(WikiPageResource wikiPageResource)
164         throws SystemException {
165         for (ModelListener<WikiPageResource> listener : listeners) {
166             listener.onBeforeRemove(wikiPageResource);
167         }
168 
169         wikiPageResource = removeImpl(wikiPageResource);
170 
171         for (ModelListener<WikiPageResource> listener : listeners) {
172             listener.onAfterRemove(wikiPageResource);
173         }
174 
175         return wikiPageResource;
176     }
177 
178     protected WikiPageResource removeImpl(WikiPageResource wikiPageResource)
179         throws SystemException {
180         wikiPageResource = toUnwrappedModel(wikiPageResource);
181 
182         Session session = null;
183 
184         try {
185             session = openSession();
186 
187             if (wikiPageResource.isCachedModel() ||
188                     BatchSessionUtil.isEnabled()) {
189                 Object staleObject = session.get(WikiPageResourceImpl.class,
190                         wikiPageResource.getPrimaryKeyObj());
191 
192                 if (staleObject != null) {
193                     session.evict(staleObject);
194                 }
195             }
196 
197             session.delete(wikiPageResource);
198 
199             session.flush();
200         }
201         catch (Exception e) {
202             throw processException(e);
203         }
204         finally {
205             closeSession(session);
206         }
207 
208         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
209 
210         WikiPageResourceModelImpl wikiPageResourceModelImpl = (WikiPageResourceModelImpl)wikiPageResource;
211 
212         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T,
213             new Object[] {
214                 new Long(wikiPageResourceModelImpl.getOriginalNodeId()),
215                 
216             wikiPageResourceModelImpl.getOriginalTitle()
217             });
218 
219         EntityCacheUtil.removeResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
220             WikiPageResourceImpl.class, wikiPageResource.getPrimaryKey());
221 
222         return wikiPageResource;
223     }
224 
225     public WikiPageResource updateImpl(
226         com.liferay.portlet.wiki.model.WikiPageResource wikiPageResource,
227         boolean merge) throws SystemException {
228         wikiPageResource = toUnwrappedModel(wikiPageResource);
229 
230         boolean isNew = wikiPageResource.isNew();
231 
232         WikiPageResourceModelImpl wikiPageResourceModelImpl = (WikiPageResourceModelImpl)wikiPageResource;
233 
234         Session session = null;
235 
236         try {
237             session = openSession();
238 
239             BatchSessionUtil.update(session, wikiPageResource, merge);
240 
241             wikiPageResource.setNew(false);
242         }
243         catch (Exception e) {
244             throw processException(e);
245         }
246         finally {
247             closeSession(session);
248         }
249 
250         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
251 
252         EntityCacheUtil.putResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
253             WikiPageResourceImpl.class, wikiPageResource.getPrimaryKey(),
254             wikiPageResource);
255 
256         if (!isNew &&
257                 ((wikiPageResource.getNodeId() != wikiPageResourceModelImpl.getOriginalNodeId()) ||
258                 !Validator.equals(wikiPageResource.getTitle(),
259                     wikiPageResourceModelImpl.getOriginalTitle()))) {
260             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T,
261                 new Object[] {
262                     new Long(wikiPageResourceModelImpl.getOriginalNodeId()),
263                     
264                 wikiPageResourceModelImpl.getOriginalTitle()
265                 });
266         }
267 
268         if (isNew ||
269                 ((wikiPageResource.getNodeId() != wikiPageResourceModelImpl.getOriginalNodeId()) ||
270                 !Validator.equals(wikiPageResource.getTitle(),
271                     wikiPageResourceModelImpl.getOriginalTitle()))) {
272             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T,
273                 new Object[] {
274                     new Long(wikiPageResource.getNodeId()),
275                     
276                 wikiPageResource.getTitle()
277                 }, wikiPageResource);
278         }
279 
280         return wikiPageResource;
281     }
282 
283     protected WikiPageResource toUnwrappedModel(
284         WikiPageResource wikiPageResource) {
285         if (wikiPageResource instanceof WikiPageResourceImpl) {
286             return wikiPageResource;
287         }
288 
289         WikiPageResourceImpl wikiPageResourceImpl = new WikiPageResourceImpl();
290 
291         wikiPageResourceImpl.setNew(wikiPageResource.isNew());
292         wikiPageResourceImpl.setPrimaryKey(wikiPageResource.getPrimaryKey());
293 
294         wikiPageResourceImpl.setResourcePrimKey(wikiPageResource.getResourcePrimKey());
295         wikiPageResourceImpl.setNodeId(wikiPageResource.getNodeId());
296         wikiPageResourceImpl.setTitle(wikiPageResource.getTitle());
297 
298         return wikiPageResourceImpl;
299     }
300 
301     public WikiPageResource findByPrimaryKey(Serializable primaryKey)
302         throws NoSuchModelException, SystemException {
303         return findByPrimaryKey(((Long)primaryKey).longValue());
304     }
305 
306     public WikiPageResource findByPrimaryKey(long resourcePrimKey)
307         throws NoSuchPageResourceException, SystemException {
308         WikiPageResource wikiPageResource = fetchByPrimaryKey(resourcePrimKey);
309 
310         if (wikiPageResource == null) {
311             if (_log.isWarnEnabled()) {
312                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + resourcePrimKey);
313             }
314 
315             throw new NoSuchPageResourceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
316                 resourcePrimKey);
317         }
318 
319         return wikiPageResource;
320     }
321 
322     public WikiPageResource fetchByPrimaryKey(Serializable primaryKey)
323         throws SystemException {
324         return fetchByPrimaryKey(((Long)primaryKey).longValue());
325     }
326 
327     public WikiPageResource fetchByPrimaryKey(long resourcePrimKey)
328         throws SystemException {
329         WikiPageResource wikiPageResource = (WikiPageResource)EntityCacheUtil.getResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
330                 WikiPageResourceImpl.class, resourcePrimKey, this);
331 
332         if (wikiPageResource == null) {
333             Session session = null;
334 
335             try {
336                 session = openSession();
337 
338                 wikiPageResource = (WikiPageResource)session.get(WikiPageResourceImpl.class,
339                         new Long(resourcePrimKey));
340             }
341             catch (Exception e) {
342                 throw processException(e);
343             }
344             finally {
345                 if (wikiPageResource != null) {
346                     cacheResult(wikiPageResource);
347                 }
348 
349                 closeSession(session);
350             }
351         }
352 
353         return wikiPageResource;
354     }
355 
356     public WikiPageResource findByN_T(long nodeId, String title)
357         throws NoSuchPageResourceException, SystemException {
358         WikiPageResource wikiPageResource = fetchByN_T(nodeId, title);
359 
360         if (wikiPageResource == null) {
361             StringBundler msg = new StringBundler(6);
362 
363             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
364 
365             msg.append("nodeId=");
366             msg.append(nodeId);
367 
368             msg.append(", title=");
369             msg.append(title);
370 
371             msg.append(StringPool.CLOSE_CURLY_BRACE);
372 
373             if (_log.isWarnEnabled()) {
374                 _log.warn(msg.toString());
375             }
376 
377             throw new NoSuchPageResourceException(msg.toString());
378         }
379 
380         return wikiPageResource;
381     }
382 
383     public WikiPageResource fetchByN_T(long nodeId, String title)
384         throws SystemException {
385         return fetchByN_T(nodeId, title, true);
386     }
387 
388     public WikiPageResource fetchByN_T(long nodeId, String title,
389         boolean retrieveFromCache) throws SystemException {
390         Object[] finderArgs = new Object[] { new Long(nodeId), title };
391 
392         Object result = null;
393 
394         if (retrieveFromCache) {
395             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_N_T,
396                     finderArgs, this);
397         }
398 
399         if (result == null) {
400             Session session = null;
401 
402             try {
403                 session = openSession();
404 
405                 StringBundler query = new StringBundler(3);
406 
407                 query.append(_SQL_SELECT_WIKIPAGERESOURCE_WHERE);
408 
409                 query.append(_FINDER_COLUMN_N_T_NODEID_2);
410 
411                 if (title == null) {
412                     query.append(_FINDER_COLUMN_N_T_TITLE_1);
413                 }
414                 else {
415                     if (title.equals(StringPool.BLANK)) {
416                         query.append(_FINDER_COLUMN_N_T_TITLE_3);
417                     }
418                     else {
419                         query.append(_FINDER_COLUMN_N_T_TITLE_2);
420                     }
421                 }
422 
423                 String sql = query.toString();
424 
425                 Query q = session.createQuery(sql);
426 
427                 QueryPos qPos = QueryPos.getInstance(q);
428 
429                 qPos.add(nodeId);
430 
431                 if (title != null) {
432                     qPos.add(title);
433                 }
434 
435                 List<WikiPageResource> list = q.list();
436 
437                 result = list;
438 
439                 WikiPageResource wikiPageResource = null;
440 
441                 if (list.isEmpty()) {
442                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T,
443                         finderArgs, list);
444                 }
445                 else {
446                     wikiPageResource = list.get(0);
447 
448                     cacheResult(wikiPageResource);
449 
450                     if ((wikiPageResource.getNodeId() != nodeId) ||
451                             (wikiPageResource.getTitle() == null) ||
452                             !wikiPageResource.getTitle().equals(title)) {
453                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T,
454                             finderArgs, wikiPageResource);
455                     }
456                 }
457 
458                 return wikiPageResource;
459             }
460             catch (Exception e) {
461                 throw processException(e);
462             }
463             finally {
464                 if (result == null) {
465                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T,
466                         finderArgs, new ArrayList<WikiPageResource>());
467                 }
468 
469                 closeSession(session);
470             }
471         }
472         else {
473             if (result instanceof List<?>) {
474                 return null;
475             }
476             else {
477                 return (WikiPageResource)result;
478             }
479         }
480     }
481 
482     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
483         throws SystemException {
484         Session session = null;
485 
486         try {
487             session = openSession();
488 
489             dynamicQuery.compile(session);
490 
491             return dynamicQuery.list();
492         }
493         catch (Exception e) {
494             throw processException(e);
495         }
496         finally {
497             closeSession(session);
498         }
499     }
500 
501     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
502         int start, int end) throws SystemException {
503         Session session = null;
504 
505         try {
506             session = openSession();
507 
508             dynamicQuery.setLimit(start, end);
509 
510             dynamicQuery.compile(session);
511 
512             return dynamicQuery.list();
513         }
514         catch (Exception e) {
515             throw processException(e);
516         }
517         finally {
518             closeSession(session);
519         }
520     }
521 
522     public List<WikiPageResource> findAll() throws SystemException {
523         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
524     }
525 
526     public List<WikiPageResource> findAll(int start, int end)
527         throws SystemException {
528         return findAll(start, end, null);
529     }
530 
531     public List<WikiPageResource> findAll(int start, int end,
532         OrderByComparator obc) throws SystemException {
533         Object[] finderArgs = new Object[] {
534                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
535             };
536 
537         List<WikiPageResource> list = (List<WikiPageResource>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
538                 finderArgs, this);
539 
540         if (list == null) {
541             Session session = null;
542 
543             try {
544                 session = openSession();
545 
546                 StringBundler query = null;
547                 String sql = null;
548 
549                 if (obc != null) {
550                     query = new StringBundler(2 +
551                             (obc.getOrderByFields().length * 3));
552 
553                     query.append(_SQL_SELECT_WIKIPAGERESOURCE);
554 
555                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
556 
557                     sql = query.toString();
558                 }
559 
560                 sql = _SQL_SELECT_WIKIPAGERESOURCE;
561 
562                 Query q = session.createQuery(sql);
563 
564                 if (obc == null) {
565                     list = (List<WikiPageResource>)QueryUtil.list(q,
566                             getDialect(), start, end, false);
567 
568                     Collections.sort(list);
569                 }
570                 else {
571                     list = (List<WikiPageResource>)QueryUtil.list(q,
572                             getDialect(), start, end);
573                 }
574             }
575             catch (Exception e) {
576                 throw processException(e);
577             }
578             finally {
579                 if (list == null) {
580                     list = new ArrayList<WikiPageResource>();
581                 }
582 
583                 cacheResult(list);
584 
585                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
586 
587                 closeSession(session);
588             }
589         }
590 
591         return list;
592     }
593 
594     public void removeByN_T(long nodeId, String title)
595         throws NoSuchPageResourceException, SystemException {
596         WikiPageResource wikiPageResource = findByN_T(nodeId, title);
597 
598         remove(wikiPageResource);
599     }
600 
601     public void removeAll() throws SystemException {
602         for (WikiPageResource wikiPageResource : findAll()) {
603             remove(wikiPageResource);
604         }
605     }
606 
607     public int countByN_T(long nodeId, String title) throws SystemException {
608         Object[] finderArgs = new Object[] { new Long(nodeId), title };
609 
610         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_T,
611                 finderArgs, this);
612 
613         if (count == null) {
614             Session session = null;
615 
616             try {
617                 session = openSession();
618 
619                 StringBundler query = new StringBundler(3);
620 
621                 query.append(_SQL_COUNT_WIKIPAGERESOURCE_WHERE);
622 
623                 query.append(_FINDER_COLUMN_N_T_NODEID_2);
624 
625                 if (title == null) {
626                     query.append(_FINDER_COLUMN_N_T_TITLE_1);
627                 }
628                 else {
629                     if (title.equals(StringPool.BLANK)) {
630                         query.append(_FINDER_COLUMN_N_T_TITLE_3);
631                     }
632                     else {
633                         query.append(_FINDER_COLUMN_N_T_TITLE_2);
634                     }
635                 }
636 
637                 String sql = query.toString();
638 
639                 Query q = session.createQuery(sql);
640 
641                 QueryPos qPos = QueryPos.getInstance(q);
642 
643                 qPos.add(nodeId);
644 
645                 if (title != null) {
646                     qPos.add(title);
647                 }
648 
649                 count = (Long)q.uniqueResult();
650             }
651             catch (Exception e) {
652                 throw processException(e);
653             }
654             finally {
655                 if (count == null) {
656                     count = Long.valueOf(0);
657                 }
658 
659                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T, finderArgs,
660                     count);
661 
662                 closeSession(session);
663             }
664         }
665 
666         return count.intValue();
667     }
668 
669     public int countAll() throws SystemException {
670         Object[] finderArgs = new Object[0];
671 
672         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
673                 finderArgs, this);
674 
675         if (count == null) {
676             Session session = null;
677 
678             try {
679                 session = openSession();
680 
681                 Query q = session.createQuery(_SQL_COUNT_WIKIPAGERESOURCE);
682 
683                 count = (Long)q.uniqueResult();
684             }
685             catch (Exception e) {
686                 throw processException(e);
687             }
688             finally {
689                 if (count == null) {
690                     count = Long.valueOf(0);
691                 }
692 
693                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
694                     count);
695 
696                 closeSession(session);
697             }
698         }
699 
700         return count.intValue();
701     }
702 
703     public void afterPropertiesSet() {
704         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
705                     com.liferay.portal.util.PropsUtil.get(
706                         "value.object.listener.com.liferay.portlet.wiki.model.WikiPageResource")));
707 
708         if (listenerClassNames.length > 0) {
709             try {
710                 List<ModelListener<WikiPageResource>> listenersList = new ArrayList<ModelListener<WikiPageResource>>();
711 
712                 for (String listenerClassName : listenerClassNames) {
713                     listenersList.add((ModelListener<WikiPageResource>)Class.forName(
714                             listenerClassName).newInstance());
715                 }
716 
717                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
718             }
719             catch (Exception e) {
720                 _log.error(e);
721             }
722         }
723     }
724 
725     @BeanReference(name = "com.liferay.portlet.wiki.service.persistence.WikiNodePersistence")
726     protected com.liferay.portlet.wiki.service.persistence.WikiNodePersistence wikiNodePersistence;
727     @BeanReference(name = "com.liferay.portlet.wiki.service.persistence.WikiPagePersistence")
728     protected com.liferay.portlet.wiki.service.persistence.WikiPagePersistence wikiPagePersistence;
729     @BeanReference(name = "com.liferay.portlet.wiki.service.persistence.WikiPageResourcePersistence")
730     protected com.liferay.portlet.wiki.service.persistence.WikiPageResourcePersistence wikiPageResourcePersistence;
731     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
732     protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
733     @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
734     protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
735     private static final String _SQL_SELECT_WIKIPAGERESOURCE = "SELECT wikiPageResource FROM WikiPageResource wikiPageResource";
736     private static final String _SQL_SELECT_WIKIPAGERESOURCE_WHERE = "SELECT wikiPageResource FROM WikiPageResource wikiPageResource WHERE ";
737     private static final String _SQL_COUNT_WIKIPAGERESOURCE = "SELECT COUNT(wikiPageResource) FROM WikiPageResource wikiPageResource";
738     private static final String _SQL_COUNT_WIKIPAGERESOURCE_WHERE = "SELECT COUNT(wikiPageResource) FROM WikiPageResource wikiPageResource WHERE ";
739     private static final String _FINDER_COLUMN_N_T_NODEID_2 = "wikiPageResource.nodeId = ? AND ";
740     private static final String _FINDER_COLUMN_N_T_TITLE_1 = "wikiPageResource.title IS NULL";
741     private static final String _FINDER_COLUMN_N_T_TITLE_2 = "wikiPageResource.title = ?";
742     private static final String _FINDER_COLUMN_N_T_TITLE_3 = "(wikiPageResource.title IS NULL OR wikiPageResource.title = ?)";
743     private static final String _ORDER_BY_ENTITY_ALIAS = "wikiPageResource.";
744     private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No WikiPageResource exists with the primary key ";
745     private static final String _NO_SUCH_ENTITY_WITH_KEY = "No WikiPageResource exists with the key {";
746     private static Log _log = LogFactoryUtil.getLog(WikiPageResourcePersistenceImpl.class);
747 }