1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.persistence;
24  
25  import com.liferay.portal.NoSuchWebDAVPropsException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.annotation.BeanReference;
28  import com.liferay.portal.kernel.cache.CacheRegistry;
29  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
30  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
31  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
32  import com.liferay.portal.kernel.dao.orm.FinderPath;
33  import com.liferay.portal.kernel.dao.orm.Query;
34  import com.liferay.portal.kernel.dao.orm.QueryPos;
35  import com.liferay.portal.kernel.dao.orm.QueryUtil;
36  import com.liferay.portal.kernel.dao.orm.Session;
37  import com.liferay.portal.kernel.log.Log;
38  import com.liferay.portal.kernel.log.LogFactoryUtil;
39  import com.liferay.portal.kernel.util.GetterUtil;
40  import com.liferay.portal.kernel.util.OrderByComparator;
41  import com.liferay.portal.kernel.util.StringPool;
42  import com.liferay.portal.kernel.util.StringUtil;
43  import com.liferay.portal.model.ModelListener;
44  import com.liferay.portal.model.WebDAVProps;
45  import com.liferay.portal.model.impl.WebDAVPropsImpl;
46  import com.liferay.portal.model.impl.WebDAVPropsModelImpl;
47  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
48  
49  import java.util.ArrayList;
50  import java.util.Collections;
51  import java.util.List;
52  
53  /**
54   * <a href="WebDAVPropsPersistenceImpl.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       WebDAVPropsPersistence
63   * @see       WebDAVPropsUtil
64   * @generated
65   */
66  public class WebDAVPropsPersistenceImpl extends BasePersistenceImpl
67      implements WebDAVPropsPersistence {
68      public static final String FINDER_CLASS_NAME_ENTITY = WebDAVPropsImpl.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_C_C = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
72              WebDAVPropsModelImpl.FINDER_CACHE_ENABLED,
73              FINDER_CLASS_NAME_ENTITY, "fetchByC_C",
74              new String[] { Long.class.getName(), Long.class.getName() });
75      public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
76              WebDAVPropsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
77              "countByC_C",
78              new String[] { Long.class.getName(), Long.class.getName() });
79      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
80              WebDAVPropsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
81              "findAll", new String[0]);
82      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
83              WebDAVPropsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
84              "countAll", new String[0]);
85  
86      public void cacheResult(WebDAVProps webDAVProps) {
87          EntityCacheUtil.putResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
88              WebDAVPropsImpl.class, webDAVProps.getPrimaryKey(), webDAVProps);
89  
90          FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
91              new Object[] {
92                  new Long(webDAVProps.getClassNameId()),
93                  new Long(webDAVProps.getClassPK())
94              }, webDAVProps);
95      }
96  
97      public void cacheResult(List<WebDAVProps> webDAVPropses) {
98          for (WebDAVProps webDAVProps : webDAVPropses) {
99              if (EntityCacheUtil.getResult(
100                         WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
101                         WebDAVPropsImpl.class, webDAVProps.getPrimaryKey(), this) == null) {
102                 cacheResult(webDAVProps);
103             }
104         }
105     }
106 
107     public void clearCache() {
108         CacheRegistry.clear(WebDAVPropsImpl.class.getName());
109         EntityCacheUtil.clearCache(WebDAVPropsImpl.class.getName());
110         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
111         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
112     }
113 
114     public WebDAVProps create(long webDavPropsId) {
115         WebDAVProps webDAVProps = new WebDAVPropsImpl();
116 
117         webDAVProps.setNew(true);
118         webDAVProps.setPrimaryKey(webDavPropsId);
119 
120         return webDAVProps;
121     }
122 
123     public WebDAVProps remove(long webDavPropsId)
124         throws NoSuchWebDAVPropsException, SystemException {
125         Session session = null;
126 
127         try {
128             session = openSession();
129 
130             WebDAVProps webDAVProps = (WebDAVProps)session.get(WebDAVPropsImpl.class,
131                     new Long(webDavPropsId));
132 
133             if (webDAVProps == null) {
134                 if (_log.isWarnEnabled()) {
135                     _log.warn("No WebDAVProps exists with the primary key " +
136                         webDavPropsId);
137                 }
138 
139                 throw new NoSuchWebDAVPropsException(
140                     "No WebDAVProps exists with the primary key " +
141                     webDavPropsId);
142             }
143 
144             return remove(webDAVProps);
145         }
146         catch (NoSuchWebDAVPropsException nsee) {
147             throw nsee;
148         }
149         catch (Exception e) {
150             throw processException(e);
151         }
152         finally {
153             closeSession(session);
154         }
155     }
156 
157     public WebDAVProps remove(WebDAVProps webDAVProps)
158         throws SystemException {
159         for (ModelListener<WebDAVProps> listener : listeners) {
160             listener.onBeforeRemove(webDAVProps);
161         }
162 
163         webDAVProps = removeImpl(webDAVProps);
164 
165         for (ModelListener<WebDAVProps> listener : listeners) {
166             listener.onAfterRemove(webDAVProps);
167         }
168 
169         return webDAVProps;
170     }
171 
172     protected WebDAVProps removeImpl(WebDAVProps webDAVProps)
173         throws SystemException {
174         webDAVProps = toUnwrappedModel(webDAVProps);
175 
176         Session session = null;
177 
178         try {
179             session = openSession();
180 
181             if (webDAVProps.isCachedModel() || BatchSessionUtil.isEnabled()) {
182                 Object staleObject = session.get(WebDAVPropsImpl.class,
183                         webDAVProps.getPrimaryKeyObj());
184 
185                 if (staleObject != null) {
186                     session.evict(staleObject);
187                 }
188             }
189 
190             session.delete(webDAVProps);
191 
192             session.flush();
193         }
194         catch (Exception e) {
195             throw processException(e);
196         }
197         finally {
198             closeSession(session);
199         }
200 
201         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
202 
203         WebDAVPropsModelImpl webDAVPropsModelImpl = (WebDAVPropsModelImpl)webDAVProps;
204 
205         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
206             new Object[] {
207                 new Long(webDAVPropsModelImpl.getOriginalClassNameId()),
208                 new Long(webDAVPropsModelImpl.getOriginalClassPK())
209             });
210 
211         EntityCacheUtil.removeResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
212             WebDAVPropsImpl.class, webDAVProps.getPrimaryKey());
213 
214         return webDAVProps;
215     }
216 
217     /**
218      * @deprecated Use {@link #update(WebDAVProps, boolean merge)}.
219      */
220     public WebDAVProps update(WebDAVProps webDAVProps)
221         throws SystemException {
222         if (_log.isWarnEnabled()) {
223             _log.warn(
224                 "Using the deprecated update(WebDAVProps webDAVProps) method. Use update(WebDAVProps webDAVProps, boolean merge) instead.");
225         }
226 
227         return update(webDAVProps, false);
228     }
229 
230     /**
231      * Add, update, or merge, the entity. This method also calls the model
232      * listeners to trigger the proper events associated with adding, deleting,
233      * or updating an entity.
234      *
235      * @param  webDAVProps the entity to add, update, or merge
236      * @param  merge boolean value for whether to merge the entity. The default
237      *         value is false. Setting merge to true is more expensive and
238      *         should only be true when webDAVProps is transient. See
239      *         LEP-5473 for a detailed discussion of this method.
240      * @return the entity that was added, updated, or merged
241      */
242     public WebDAVProps update(WebDAVProps webDAVProps, boolean merge)
243         throws SystemException {
244         boolean isNew = webDAVProps.isNew();
245 
246         for (ModelListener<WebDAVProps> listener : listeners) {
247             if (isNew) {
248                 listener.onBeforeCreate(webDAVProps);
249             }
250             else {
251                 listener.onBeforeUpdate(webDAVProps);
252             }
253         }
254 
255         webDAVProps = updateImpl(webDAVProps, merge);
256 
257         for (ModelListener<WebDAVProps> listener : listeners) {
258             if (isNew) {
259                 listener.onAfterCreate(webDAVProps);
260             }
261             else {
262                 listener.onAfterUpdate(webDAVProps);
263             }
264         }
265 
266         return webDAVProps;
267     }
268 
269     public WebDAVProps updateImpl(
270         com.liferay.portal.model.WebDAVProps webDAVProps, boolean merge)
271         throws SystemException {
272         webDAVProps = toUnwrappedModel(webDAVProps);
273 
274         boolean isNew = webDAVProps.isNew();
275 
276         WebDAVPropsModelImpl webDAVPropsModelImpl = (WebDAVPropsModelImpl)webDAVProps;
277 
278         Session session = null;
279 
280         try {
281             session = openSession();
282 
283             BatchSessionUtil.update(session, webDAVProps, merge);
284 
285             webDAVProps.setNew(false);
286         }
287         catch (Exception e) {
288             throw processException(e);
289         }
290         finally {
291             closeSession(session);
292         }
293 
294         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
295 
296         EntityCacheUtil.putResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
297             WebDAVPropsImpl.class, webDAVProps.getPrimaryKey(), webDAVProps);
298 
299         if (!isNew &&
300                 ((webDAVProps.getClassNameId() != webDAVPropsModelImpl.getOriginalClassNameId()) ||
301                 (webDAVProps.getClassPK() != webDAVPropsModelImpl.getOriginalClassPK()))) {
302             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
303                 new Object[] {
304                     new Long(webDAVPropsModelImpl.getOriginalClassNameId()),
305                     new Long(webDAVPropsModelImpl.getOriginalClassPK())
306                 });
307         }
308 
309         if (isNew ||
310                 ((webDAVProps.getClassNameId() != webDAVPropsModelImpl.getOriginalClassNameId()) ||
311                 (webDAVProps.getClassPK() != webDAVPropsModelImpl.getOriginalClassPK()))) {
312             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
313                 new Object[] {
314                     new Long(webDAVProps.getClassNameId()),
315                     new Long(webDAVProps.getClassPK())
316                 }, webDAVProps);
317         }
318 
319         return webDAVProps;
320     }
321 
322     protected WebDAVProps toUnwrappedModel(WebDAVProps webDAVProps) {
323         if (webDAVProps instanceof WebDAVPropsImpl) {
324             return webDAVProps;
325         }
326 
327         WebDAVPropsImpl webDAVPropsImpl = new WebDAVPropsImpl();
328 
329         webDAVPropsImpl.setNew(webDAVProps.isNew());
330         webDAVPropsImpl.setPrimaryKey(webDAVProps.getPrimaryKey());
331 
332         webDAVPropsImpl.setWebDavPropsId(webDAVProps.getWebDavPropsId());
333         webDAVPropsImpl.setCompanyId(webDAVProps.getCompanyId());
334         webDAVPropsImpl.setCreateDate(webDAVProps.getCreateDate());
335         webDAVPropsImpl.setModifiedDate(webDAVProps.getModifiedDate());
336         webDAVPropsImpl.setClassNameId(webDAVProps.getClassNameId());
337         webDAVPropsImpl.setClassPK(webDAVProps.getClassPK());
338         webDAVPropsImpl.setProps(webDAVProps.getProps());
339 
340         return webDAVPropsImpl;
341     }
342 
343     public WebDAVProps findByPrimaryKey(long webDavPropsId)
344         throws NoSuchWebDAVPropsException, SystemException {
345         WebDAVProps webDAVProps = fetchByPrimaryKey(webDavPropsId);
346 
347         if (webDAVProps == null) {
348             if (_log.isWarnEnabled()) {
349                 _log.warn("No WebDAVProps exists with the primary key " +
350                     webDavPropsId);
351             }
352 
353             throw new NoSuchWebDAVPropsException(
354                 "No WebDAVProps exists with the primary key " + webDavPropsId);
355         }
356 
357         return webDAVProps;
358     }
359 
360     public WebDAVProps fetchByPrimaryKey(long webDavPropsId)
361         throws SystemException {
362         WebDAVProps webDAVProps = (WebDAVProps)EntityCacheUtil.getResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
363                 WebDAVPropsImpl.class, webDavPropsId, this);
364 
365         if (webDAVProps == null) {
366             Session session = null;
367 
368             try {
369                 session = openSession();
370 
371                 webDAVProps = (WebDAVProps)session.get(WebDAVPropsImpl.class,
372                         new Long(webDavPropsId));
373             }
374             catch (Exception e) {
375                 throw processException(e);
376             }
377             finally {
378                 if (webDAVProps != null) {
379                     cacheResult(webDAVProps);
380                 }
381 
382                 closeSession(session);
383             }
384         }
385 
386         return webDAVProps;
387     }
388 
389     public WebDAVProps findByC_C(long classNameId, long classPK)
390         throws NoSuchWebDAVPropsException, SystemException {
391         WebDAVProps webDAVProps = fetchByC_C(classNameId, classPK);
392 
393         if (webDAVProps == null) {
394             StringBuilder msg = new StringBuilder();
395 
396             msg.append("No WebDAVProps exists with the key {");
397 
398             msg.append("classNameId=" + classNameId);
399 
400             msg.append(", ");
401             msg.append("classPK=" + classPK);
402 
403             msg.append(StringPool.CLOSE_CURLY_BRACE);
404 
405             if (_log.isWarnEnabled()) {
406                 _log.warn(msg.toString());
407             }
408 
409             throw new NoSuchWebDAVPropsException(msg.toString());
410         }
411 
412         return webDAVProps;
413     }
414 
415     public WebDAVProps fetchByC_C(long classNameId, long classPK)
416         throws SystemException {
417         return fetchByC_C(classNameId, classPK, true);
418     }
419 
420     public WebDAVProps fetchByC_C(long classNameId, long classPK,
421         boolean retrieveFromCache) throws SystemException {
422         Object[] finderArgs = new Object[] {
423                 new Long(classNameId), new Long(classPK)
424             };
425 
426         Object result = null;
427 
428         if (retrieveFromCache) {
429             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
430                     finderArgs, this);
431         }
432 
433         if (result == null) {
434             Session session = null;
435 
436             try {
437                 session = openSession();
438 
439                 StringBuilder query = new StringBuilder();
440 
441                 query.append(
442                     "SELECT webDAVProps FROM WebDAVProps webDAVProps WHERE ");
443 
444                 query.append("webDAVProps.classNameId = ?");
445 
446                 query.append(" AND ");
447 
448                 query.append("webDAVProps.classPK = ?");
449 
450                 query.append(" ");
451 
452                 Query q = session.createQuery(query.toString());
453 
454                 QueryPos qPos = QueryPos.getInstance(q);
455 
456                 qPos.add(classNameId);
457 
458                 qPos.add(classPK);
459 
460                 List<WebDAVProps> list = q.list();
461 
462                 result = list;
463 
464                 WebDAVProps webDAVProps = null;
465 
466                 if (list.isEmpty()) {
467                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
468                         finderArgs, list);
469                 }
470                 else {
471                     webDAVProps = list.get(0);
472 
473                     cacheResult(webDAVProps);
474 
475                     if ((webDAVProps.getClassNameId() != classNameId) ||
476                             (webDAVProps.getClassPK() != classPK)) {
477                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
478                             finderArgs, webDAVProps);
479                     }
480                 }
481 
482                 return webDAVProps;
483             }
484             catch (Exception e) {
485                 throw processException(e);
486             }
487             finally {
488                 if (result == null) {
489                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
490                         finderArgs, new ArrayList<WebDAVProps>());
491                 }
492 
493                 closeSession(session);
494             }
495         }
496         else {
497             if (result instanceof List<?>) {
498                 return null;
499             }
500             else {
501                 return (WebDAVProps)result;
502             }
503         }
504     }
505 
506     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
507         throws SystemException {
508         Session session = null;
509 
510         try {
511             session = openSession();
512 
513             dynamicQuery.compile(session);
514 
515             return dynamicQuery.list();
516         }
517         catch (Exception e) {
518             throw processException(e);
519         }
520         finally {
521             closeSession(session);
522         }
523     }
524 
525     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
526         int start, int end) throws SystemException {
527         Session session = null;
528 
529         try {
530             session = openSession();
531 
532             dynamicQuery.setLimit(start, end);
533 
534             dynamicQuery.compile(session);
535 
536             return dynamicQuery.list();
537         }
538         catch (Exception e) {
539             throw processException(e);
540         }
541         finally {
542             closeSession(session);
543         }
544     }
545 
546     public List<WebDAVProps> findAll() throws SystemException {
547         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
548     }
549 
550     public List<WebDAVProps> findAll(int start, int end)
551         throws SystemException {
552         return findAll(start, end, null);
553     }
554 
555     public List<WebDAVProps> findAll(int start, int end, OrderByComparator obc)
556         throws SystemException {
557         Object[] finderArgs = new Object[] {
558                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
559             };
560 
561         List<WebDAVProps> list = (List<WebDAVProps>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
562                 finderArgs, this);
563 
564         if (list == null) {
565             Session session = null;
566 
567             try {
568                 session = openSession();
569 
570                 StringBuilder query = new StringBuilder();
571 
572                 query.append("SELECT webDAVProps FROM WebDAVProps webDAVProps ");
573 
574                 if (obc != null) {
575                     query.append("ORDER BY ");
576 
577                     String[] orderByFields = obc.getOrderByFields();
578 
579                     for (int i = 0; i < orderByFields.length; i++) {
580                         query.append("webDAVProps.");
581                         query.append(orderByFields[i]);
582 
583                         if (obc.isAscending()) {
584                             query.append(" ASC");
585                         }
586                         else {
587                             query.append(" DESC");
588                         }
589 
590                         if ((i + 1) < orderByFields.length) {
591                             query.append(", ");
592                         }
593                     }
594                 }
595 
596                 Query q = session.createQuery(query.toString());
597 
598                 if (obc == null) {
599                     list = (List<WebDAVProps>)QueryUtil.list(q, getDialect(),
600                             start, end, false);
601 
602                     Collections.sort(list);
603                 }
604                 else {
605                     list = (List<WebDAVProps>)QueryUtil.list(q, getDialect(),
606                             start, end);
607                 }
608             }
609             catch (Exception e) {
610                 throw processException(e);
611             }
612             finally {
613                 if (list == null) {
614                     list = new ArrayList<WebDAVProps>();
615                 }
616 
617                 cacheResult(list);
618 
619                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
620 
621                 closeSession(session);
622             }
623         }
624 
625         return list;
626     }
627 
628     public void removeByC_C(long classNameId, long classPK)
629         throws NoSuchWebDAVPropsException, SystemException {
630         WebDAVProps webDAVProps = findByC_C(classNameId, classPK);
631 
632         remove(webDAVProps);
633     }
634 
635     public void removeAll() throws SystemException {
636         for (WebDAVProps webDAVProps : findAll()) {
637             remove(webDAVProps);
638         }
639     }
640 
641     public int countByC_C(long classNameId, long classPK)
642         throws SystemException {
643         Object[] finderArgs = new Object[] {
644                 new Long(classNameId), new Long(classPK)
645             };
646 
647         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
648                 finderArgs, this);
649 
650         if (count == null) {
651             Session session = null;
652 
653             try {
654                 session = openSession();
655 
656                 StringBuilder query = new StringBuilder();
657 
658                 query.append("SELECT COUNT(webDAVProps) ");
659                 query.append("FROM WebDAVProps webDAVProps WHERE ");
660 
661                 query.append("webDAVProps.classNameId = ?");
662 
663                 query.append(" AND ");
664 
665                 query.append("webDAVProps.classPK = ?");
666 
667                 query.append(" ");
668 
669                 Query q = session.createQuery(query.toString());
670 
671                 QueryPos qPos = QueryPos.getInstance(q);
672 
673                 qPos.add(classNameId);
674 
675                 qPos.add(classPK);
676 
677                 count = (Long)q.uniqueResult();
678             }
679             catch (Exception e) {
680                 throw processException(e);
681             }
682             finally {
683                 if (count == null) {
684                     count = Long.valueOf(0);
685                 }
686 
687                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
688                     count);
689 
690                 closeSession(session);
691             }
692         }
693 
694         return count.intValue();
695     }
696 
697     public int countAll() throws SystemException {
698         Object[] finderArgs = new Object[0];
699 
700         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
701                 finderArgs, this);
702 
703         if (count == null) {
704             Session session = null;
705 
706             try {
707                 session = openSession();
708 
709                 Query q = session.createQuery(
710                         "SELECT COUNT(webDAVProps) FROM WebDAVProps webDAVProps");
711 
712                 count = (Long)q.uniqueResult();
713             }
714             catch (Exception e) {
715                 throw processException(e);
716             }
717             finally {
718                 if (count == null) {
719                     count = Long.valueOf(0);
720                 }
721 
722                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
723                     count);
724 
725                 closeSession(session);
726             }
727         }
728 
729         return count.intValue();
730     }
731 
732     public void afterPropertiesSet() {
733         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
734                     com.liferay.portal.util.PropsUtil.get(
735                         "value.object.listener.com.liferay.portal.model.WebDAVProps")));
736 
737         if (listenerClassNames.length > 0) {
738             try {
739                 List<ModelListener<WebDAVProps>> listenersList = new ArrayList<ModelListener<WebDAVProps>>();
740 
741                 for (String listenerClassName : listenerClassNames) {
742                     listenersList.add((ModelListener<WebDAVProps>)Class.forName(
743                             listenerClassName).newInstance());
744                 }
745 
746                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
747             }
748             catch (Exception e) {
749                 _log.error(e);
750             }
751         }
752     }
753 
754     @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence.impl")
755     protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
756     @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence.impl")
757     protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
758     @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence.impl")
759     protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
760     @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence.impl")
761     protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
762     @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
763     protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
764     @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence.impl")
765     protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
766     @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence.impl")
767     protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
768     @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence.impl")
769     protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
770     @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
771     protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
772     @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
773     protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
774     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence.impl")
775     protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
776     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence.impl")
777     protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
778     @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence.impl")
779     protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
780     @BeanReference(name = "com.liferay.portal.service.persistence.LockPersistence.impl")
781     protected com.liferay.portal.service.persistence.LockPersistence lockPersistence;
782     @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence.impl")
783     protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
784     @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence.impl")
785     protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
786     @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence.impl")
787     protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
788     @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence.impl")
789     protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
790     @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence.impl")
791     protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
792     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence.impl")
793     protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
794     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence.impl")
795     protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
796     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence.impl")
797     protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
798     @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence.impl")
799     protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
800     @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence.impl")
801     protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
802     @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence.impl")
803     protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
804     @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence.impl")
805     protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
806     @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence.impl")
807     protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
808     @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
809     protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
810     @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence.impl")
811     protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
812     @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence.impl")
813     protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
814     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
815     protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
816     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence.impl")
817     protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
818     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence.impl")
819     protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
820     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence.impl")
821     protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
822     @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence.impl")
823     protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
824     @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence.impl")
825     protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
826     @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence.impl")
827     protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
828     @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence.impl")
829     protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
830     @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
831     protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
832     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence.impl")
833     protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
834     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupGroupRolePersistence.impl")
835     protected com.liferay.portal.service.persistence.UserGroupGroupRolePersistence userGroupGroupRolePersistence;
836     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence.impl")
837     protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
838     @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence.impl")
839     protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
840     @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence.impl")
841     protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
842     @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence.impl")
843     protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
844     @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence.impl")
845     protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
846     @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence.impl")
847     protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
848     private static Log _log = LogFactoryUtil.getLog(WebDAVPropsPersistenceImpl.class);
849 }