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