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.NoSuchUserTrackerPathException;
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.UserTrackerPath;
45  import com.liferay.portal.model.impl.UserTrackerPathImpl;
46  import com.liferay.portal.model.impl.UserTrackerPathModelImpl;
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="UserTrackerPathPersistenceImpl.java.html"><b><i>View Source</i></b></a>
55   *
56   * @author Brian Wing Shun Chan
57   *
58   */
59  public class UserTrackerPathPersistenceImpl extends BasePersistenceImpl
60      implements UserTrackerPathPersistence {
61      public static final String FINDER_CLASS_NAME_ENTITY = UserTrackerPathImpl.class.getName();
62      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
63          ".List";
64      public static final FinderPath FINDER_PATH_FIND_BY_USERTRACKERID = new FinderPath(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
65              UserTrackerPathModelImpl.FINDER_CACHE_ENABLED,
66              FINDER_CLASS_NAME_LIST, "findByUserTrackerId",
67              new String[] { Long.class.getName() });
68      public static final FinderPath FINDER_PATH_FIND_BY_OBC_USERTRACKERID = new FinderPath(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
69              UserTrackerPathModelImpl.FINDER_CACHE_ENABLED,
70              FINDER_CLASS_NAME_LIST, "findByUserTrackerId",
71              new String[] {
72                  Long.class.getName(),
73                  
74              "java.lang.Integer", "java.lang.Integer",
75                  "com.liferay.portal.kernel.util.OrderByComparator"
76              });
77      public static final FinderPath FINDER_PATH_COUNT_BY_USERTRACKERID = new FinderPath(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
78              UserTrackerPathModelImpl.FINDER_CACHE_ENABLED,
79              FINDER_CLASS_NAME_LIST, "countByUserTrackerId",
80              new String[] { Long.class.getName() });
81      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
82              UserTrackerPathModelImpl.FINDER_CACHE_ENABLED,
83              FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
84      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
85              UserTrackerPathModelImpl.FINDER_CACHE_ENABLED,
86              FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
87  
88      public void cacheResult(UserTrackerPath userTrackerPath) {
89          EntityCacheUtil.putResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
90              UserTrackerPathImpl.class, userTrackerPath.getPrimaryKey(),
91              userTrackerPath);
92      }
93  
94      public void cacheResult(List<UserTrackerPath> userTrackerPaths) {
95          for (UserTrackerPath userTrackerPath : userTrackerPaths) {
96              if (EntityCacheUtil.getResult(
97                          UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
98                          UserTrackerPathImpl.class,
99                          userTrackerPath.getPrimaryKey(), this) == null) {
100                 cacheResult(userTrackerPath);
101             }
102         }
103     }
104 
105     public void clearCache() {
106         CacheRegistry.clear(UserTrackerPathImpl.class.getName());
107         EntityCacheUtil.clearCache(UserTrackerPathImpl.class.getName());
108         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
109         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
110     }
111 
112     public UserTrackerPath create(long userTrackerPathId) {
113         UserTrackerPath userTrackerPath = new UserTrackerPathImpl();
114 
115         userTrackerPath.setNew(true);
116         userTrackerPath.setPrimaryKey(userTrackerPathId);
117 
118         return userTrackerPath;
119     }
120 
121     public UserTrackerPath remove(long userTrackerPathId)
122         throws NoSuchUserTrackerPathException, SystemException {
123         Session session = null;
124 
125         try {
126             session = openSession();
127 
128             UserTrackerPath userTrackerPath = (UserTrackerPath)session.get(UserTrackerPathImpl.class,
129                     new Long(userTrackerPathId));
130 
131             if (userTrackerPath == null) {
132                 if (_log.isWarnEnabled()) {
133                     _log.warn("No UserTrackerPath exists with the primary key " +
134                         userTrackerPathId);
135                 }
136 
137                 throw new NoSuchUserTrackerPathException(
138                     "No UserTrackerPath exists with the primary key " +
139                     userTrackerPathId);
140             }
141 
142             return remove(userTrackerPath);
143         }
144         catch (NoSuchUserTrackerPathException nsee) {
145             throw nsee;
146         }
147         catch (Exception e) {
148             throw processException(e);
149         }
150         finally {
151             closeSession(session);
152         }
153     }
154 
155     public UserTrackerPath remove(UserTrackerPath userTrackerPath)
156         throws SystemException {
157         for (ModelListener<UserTrackerPath> listener : listeners) {
158             listener.onBeforeRemove(userTrackerPath);
159         }
160 
161         userTrackerPath = removeImpl(userTrackerPath);
162 
163         for (ModelListener<UserTrackerPath> listener : listeners) {
164             listener.onAfterRemove(userTrackerPath);
165         }
166 
167         return userTrackerPath;
168     }
169 
170     protected UserTrackerPath removeImpl(UserTrackerPath userTrackerPath)
171         throws SystemException {
172         Session session = null;
173 
174         try {
175             session = openSession();
176 
177             if (userTrackerPath.isCachedModel() ||
178                     BatchSessionUtil.isEnabled()) {
179                 Object staleObject = session.get(UserTrackerPathImpl.class,
180                         userTrackerPath.getPrimaryKeyObj());
181 
182                 if (staleObject != null) {
183                     session.evict(staleObject);
184                 }
185             }
186 
187             session.delete(userTrackerPath);
188 
189             session.flush();
190         }
191         catch (Exception e) {
192             throw processException(e);
193         }
194         finally {
195             closeSession(session);
196         }
197 
198         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
199 
200         EntityCacheUtil.removeResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
201             UserTrackerPathImpl.class, userTrackerPath.getPrimaryKey());
202 
203         return userTrackerPath;
204     }
205 
206     /**
207      * @deprecated Use <code>update(UserTrackerPath userTrackerPath, boolean merge)</code>.
208      */
209     public UserTrackerPath update(UserTrackerPath userTrackerPath)
210         throws SystemException {
211         if (_log.isWarnEnabled()) {
212             _log.warn(
213                 "Using the deprecated update(UserTrackerPath userTrackerPath) method. Use update(UserTrackerPath userTrackerPath, boolean merge) instead.");
214         }
215 
216         return update(userTrackerPath, false);
217     }
218 
219     /**
220      * Add, update, or merge, the entity. This method also calls the model
221      * listeners to trigger the proper events associated with adding, deleting,
222      * or updating an entity.
223      *
224      * @param        userTrackerPath the entity to add, update, or merge
225      * @param        merge boolean value for whether to merge the entity. The
226      *                default value is false. Setting merge to true is more
227      *                expensive and should only be true when userTrackerPath is
228      *                transient. See LEP-5473 for a detailed discussion of this
229      *                method.
230      * @return        true if the portlet can be displayed via Ajax
231      */
232     public UserTrackerPath update(UserTrackerPath userTrackerPath, boolean merge)
233         throws SystemException {
234         boolean isNew = userTrackerPath.isNew();
235 
236         for (ModelListener<UserTrackerPath> listener : listeners) {
237             if (isNew) {
238                 listener.onBeforeCreate(userTrackerPath);
239             }
240             else {
241                 listener.onBeforeUpdate(userTrackerPath);
242             }
243         }
244 
245         userTrackerPath = updateImpl(userTrackerPath, merge);
246 
247         for (ModelListener<UserTrackerPath> listener : listeners) {
248             if (isNew) {
249                 listener.onAfterCreate(userTrackerPath);
250             }
251             else {
252                 listener.onAfterUpdate(userTrackerPath);
253             }
254         }
255 
256         return userTrackerPath;
257     }
258 
259     public UserTrackerPath updateImpl(
260         com.liferay.portal.model.UserTrackerPath userTrackerPath, boolean merge)
261         throws SystemException {
262         Session session = null;
263 
264         try {
265             session = openSession();
266 
267             BatchSessionUtil.update(session, userTrackerPath, merge);
268 
269             userTrackerPath.setNew(false);
270         }
271         catch (Exception e) {
272             throw processException(e);
273         }
274         finally {
275             closeSession(session);
276         }
277 
278         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
279 
280         EntityCacheUtil.putResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
281             UserTrackerPathImpl.class, userTrackerPath.getPrimaryKey(),
282             userTrackerPath);
283 
284         return userTrackerPath;
285     }
286 
287     public UserTrackerPath findByPrimaryKey(long userTrackerPathId)
288         throws NoSuchUserTrackerPathException, SystemException {
289         UserTrackerPath userTrackerPath = fetchByPrimaryKey(userTrackerPathId);
290 
291         if (userTrackerPath == null) {
292             if (_log.isWarnEnabled()) {
293                 _log.warn("No UserTrackerPath exists with the primary key " +
294                     userTrackerPathId);
295             }
296 
297             throw new NoSuchUserTrackerPathException(
298                 "No UserTrackerPath exists with the primary key " +
299                 userTrackerPathId);
300         }
301 
302         return userTrackerPath;
303     }
304 
305     public UserTrackerPath fetchByPrimaryKey(long userTrackerPathId)
306         throws SystemException {
307         UserTrackerPath userTrackerPath = (UserTrackerPath)EntityCacheUtil.getResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
308                 UserTrackerPathImpl.class, userTrackerPathId, this);
309 
310         if (userTrackerPath == null) {
311             Session session = null;
312 
313             try {
314                 session = openSession();
315 
316                 userTrackerPath = (UserTrackerPath)session.get(UserTrackerPathImpl.class,
317                         new Long(userTrackerPathId));
318             }
319             catch (Exception e) {
320                 throw processException(e);
321             }
322             finally {
323                 if (userTrackerPath != null) {
324                     cacheResult(userTrackerPath);
325                 }
326 
327                 closeSession(session);
328             }
329         }
330 
331         return userTrackerPath;
332     }
333 
334     public List<UserTrackerPath> findByUserTrackerId(long userTrackerId)
335         throws SystemException {
336         Object[] finderArgs = new Object[] { new Long(userTrackerId) };
337 
338         List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERTRACKERID,
339                 finderArgs, this);
340 
341         if (list == null) {
342             Session session = null;
343 
344             try {
345                 session = openSession();
346 
347                 StringBuilder query = new StringBuilder();
348 
349                 query.append(
350                     "FROM com.liferay.portal.model.UserTrackerPath WHERE ");
351 
352                 query.append("userTrackerId = ?");
353 
354                 query.append(" ");
355 
356                 Query q = session.createQuery(query.toString());
357 
358                 QueryPos qPos = QueryPos.getInstance(q);
359 
360                 qPos.add(userTrackerId);
361 
362                 list = q.list();
363             }
364             catch (Exception e) {
365                 throw processException(e);
366             }
367             finally {
368                 if (list == null) {
369                     list = new ArrayList<UserTrackerPath>();
370                 }
371 
372                 cacheResult(list);
373 
374                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERTRACKERID,
375                     finderArgs, list);
376 
377                 closeSession(session);
378             }
379         }
380 
381         return list;
382     }
383 
384     public List<UserTrackerPath> findByUserTrackerId(long userTrackerId,
385         int start, int end) throws SystemException {
386         return findByUserTrackerId(userTrackerId, start, end, null);
387     }
388 
389     public List<UserTrackerPath> findByUserTrackerId(long userTrackerId,
390         int start, int end, OrderByComparator obc) throws SystemException {
391         Object[] finderArgs = new Object[] {
392                 new Long(userTrackerId),
393                 
394                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
395             };
396 
397         List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_USERTRACKERID,
398                 finderArgs, this);
399 
400         if (list == null) {
401             Session session = null;
402 
403             try {
404                 session = openSession();
405 
406                 StringBuilder query = new StringBuilder();
407 
408                 query.append(
409                     "FROM com.liferay.portal.model.UserTrackerPath WHERE ");
410 
411                 query.append("userTrackerId = ?");
412 
413                 query.append(" ");
414 
415                 if (obc != null) {
416                     query.append("ORDER BY ");
417                     query.append(obc.getOrderBy());
418                 }
419 
420                 Query q = session.createQuery(query.toString());
421 
422                 QueryPos qPos = QueryPos.getInstance(q);
423 
424                 qPos.add(userTrackerId);
425 
426                 list = (List<UserTrackerPath>)QueryUtil.list(q, getDialect(),
427                         start, end);
428             }
429             catch (Exception e) {
430                 throw processException(e);
431             }
432             finally {
433                 if (list == null) {
434                     list = new ArrayList<UserTrackerPath>();
435                 }
436 
437                 cacheResult(list);
438 
439                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_USERTRACKERID,
440                     finderArgs, list);
441 
442                 closeSession(session);
443             }
444         }
445 
446         return list;
447     }
448 
449     public UserTrackerPath findByUserTrackerId_First(long userTrackerId,
450         OrderByComparator obc)
451         throws NoSuchUserTrackerPathException, SystemException {
452         List<UserTrackerPath> list = findByUserTrackerId(userTrackerId, 0, 1,
453                 obc);
454 
455         if (list.isEmpty()) {
456             StringBuilder msg = new StringBuilder();
457 
458             msg.append("No UserTrackerPath exists with the key {");
459 
460             msg.append("userTrackerId=" + userTrackerId);
461 
462             msg.append(StringPool.CLOSE_CURLY_BRACE);
463 
464             throw new NoSuchUserTrackerPathException(msg.toString());
465         }
466         else {
467             return list.get(0);
468         }
469     }
470 
471     public UserTrackerPath findByUserTrackerId_Last(long userTrackerId,
472         OrderByComparator obc)
473         throws NoSuchUserTrackerPathException, SystemException {
474         int count = countByUserTrackerId(userTrackerId);
475 
476         List<UserTrackerPath> list = findByUserTrackerId(userTrackerId,
477                 count - 1, count, obc);
478 
479         if (list.isEmpty()) {
480             StringBuilder msg = new StringBuilder();
481 
482             msg.append("No UserTrackerPath exists with the key {");
483 
484             msg.append("userTrackerId=" + userTrackerId);
485 
486             msg.append(StringPool.CLOSE_CURLY_BRACE);
487 
488             throw new NoSuchUserTrackerPathException(msg.toString());
489         }
490         else {
491             return list.get(0);
492         }
493     }
494 
495     public UserTrackerPath[] findByUserTrackerId_PrevAndNext(
496         long userTrackerPathId, long userTrackerId, OrderByComparator obc)
497         throws NoSuchUserTrackerPathException, SystemException {
498         UserTrackerPath userTrackerPath = findByPrimaryKey(userTrackerPathId);
499 
500         int count = countByUserTrackerId(userTrackerId);
501 
502         Session session = null;
503 
504         try {
505             session = openSession();
506 
507             StringBuilder query = new StringBuilder();
508 
509             query.append("FROM com.liferay.portal.model.UserTrackerPath WHERE ");
510 
511             query.append("userTrackerId = ?");
512 
513             query.append(" ");
514 
515             if (obc != null) {
516                 query.append("ORDER BY ");
517                 query.append(obc.getOrderBy());
518             }
519 
520             Query q = session.createQuery(query.toString());
521 
522             QueryPos qPos = QueryPos.getInstance(q);
523 
524             qPos.add(userTrackerId);
525 
526             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
527                     userTrackerPath);
528 
529             UserTrackerPath[] array = new UserTrackerPathImpl[3];
530 
531             array[0] = (UserTrackerPath)objArray[0];
532             array[1] = (UserTrackerPath)objArray[1];
533             array[2] = (UserTrackerPath)objArray[2];
534 
535             return array;
536         }
537         catch (Exception e) {
538             throw processException(e);
539         }
540         finally {
541             closeSession(session);
542         }
543     }
544 
545     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
546         throws SystemException {
547         Session session = null;
548 
549         try {
550             session = openSession();
551 
552             dynamicQuery.compile(session);
553 
554             return dynamicQuery.list();
555         }
556         catch (Exception e) {
557             throw processException(e);
558         }
559         finally {
560             closeSession(session);
561         }
562     }
563 
564     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
565         int start, int end) throws SystemException {
566         Session session = null;
567 
568         try {
569             session = openSession();
570 
571             dynamicQuery.setLimit(start, end);
572 
573             dynamicQuery.compile(session);
574 
575             return dynamicQuery.list();
576         }
577         catch (Exception e) {
578             throw processException(e);
579         }
580         finally {
581             closeSession(session);
582         }
583     }
584 
585     public List<UserTrackerPath> findAll() throws SystemException {
586         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
587     }
588 
589     public List<UserTrackerPath> findAll(int start, int end)
590         throws SystemException {
591         return findAll(start, end, null);
592     }
593 
594     public List<UserTrackerPath> findAll(int start, int end,
595         OrderByComparator obc) throws SystemException {
596         Object[] finderArgs = new Object[] {
597                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
598             };
599 
600         List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
601                 finderArgs, this);
602 
603         if (list == null) {
604             Session session = null;
605 
606             try {
607                 session = openSession();
608 
609                 StringBuilder query = new StringBuilder();
610 
611                 query.append("FROM com.liferay.portal.model.UserTrackerPath ");
612 
613                 if (obc != null) {
614                     query.append("ORDER BY ");
615                     query.append(obc.getOrderBy());
616                 }
617 
618                 Query q = session.createQuery(query.toString());
619 
620                 if (obc == null) {
621                     list = (List<UserTrackerPath>)QueryUtil.list(q,
622                             getDialect(), start, end, false);
623 
624                     Collections.sort(list);
625                 }
626                 else {
627                     list = (List<UserTrackerPath>)QueryUtil.list(q,
628                             getDialect(), start, end);
629                 }
630             }
631             catch (Exception e) {
632                 throw processException(e);
633             }
634             finally {
635                 if (list == null) {
636                     list = new ArrayList<UserTrackerPath>();
637                 }
638 
639                 cacheResult(list);
640 
641                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
642 
643                 closeSession(session);
644             }
645         }
646 
647         return list;
648     }
649 
650     public void removeByUserTrackerId(long userTrackerId)
651         throws SystemException {
652         for (UserTrackerPath userTrackerPath : findByUserTrackerId(
653                 userTrackerId)) {
654             remove(userTrackerPath);
655         }
656     }
657 
658     public void removeAll() throws SystemException {
659         for (UserTrackerPath userTrackerPath : findAll()) {
660             remove(userTrackerPath);
661         }
662     }
663 
664     public int countByUserTrackerId(long userTrackerId)
665         throws SystemException {
666         Object[] finderArgs = new Object[] { new Long(userTrackerId) };
667 
668         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
669                 finderArgs, this);
670 
671         if (count == null) {
672             Session session = null;
673 
674             try {
675                 session = openSession();
676 
677                 StringBuilder query = new StringBuilder();
678 
679                 query.append("SELECT COUNT(*) ");
680                 query.append(
681                     "FROM com.liferay.portal.model.UserTrackerPath WHERE ");
682 
683                 query.append("userTrackerId = ?");
684 
685                 query.append(" ");
686 
687                 Query q = session.createQuery(query.toString());
688 
689                 QueryPos qPos = QueryPos.getInstance(q);
690 
691                 qPos.add(userTrackerId);
692 
693                 count = (Long)q.uniqueResult();
694             }
695             catch (Exception e) {
696                 throw processException(e);
697             }
698             finally {
699                 if (count == null) {
700                     count = Long.valueOf(0);
701                 }
702 
703                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
704                     finderArgs, count);
705 
706                 closeSession(session);
707             }
708         }
709 
710         return count.intValue();
711     }
712 
713     public int countAll() throws SystemException {
714         Object[] finderArgs = new Object[0];
715 
716         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
717                 finderArgs, this);
718 
719         if (count == null) {
720             Session session = null;
721 
722             try {
723                 session = openSession();
724 
725                 Query q = session.createQuery(
726                         "SELECT COUNT(*) FROM com.liferay.portal.model.UserTrackerPath");
727 
728                 count = (Long)q.uniqueResult();
729             }
730             catch (Exception e) {
731                 throw processException(e);
732             }
733             finally {
734                 if (count == null) {
735                     count = Long.valueOf(0);
736                 }
737 
738                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
739                     count);
740 
741                 closeSession(session);
742             }
743         }
744 
745         return count.intValue();
746     }
747 
748     public void afterPropertiesSet() {
749         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
750                     com.liferay.portal.util.PropsUtil.get(
751                         "value.object.listener.com.liferay.portal.model.UserTrackerPath")));
752 
753         if (listenerClassNames.length > 0) {
754             try {
755                 List<ModelListener<UserTrackerPath>> listenersList = new ArrayList<ModelListener<UserTrackerPath>>();
756 
757                 for (String listenerClassName : listenerClassNames) {
758                     listenersList.add((ModelListener<UserTrackerPath>)Class.forName(
759                             listenerClassName).newInstance());
760                 }
761 
762                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
763             }
764             catch (Exception e) {
765                 _log.error(e);
766             }
767         }
768     }
769 
770     @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence.impl")
771     protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
772     @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence.impl")
773     protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
774     @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence.impl")
775     protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
776     @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence.impl")
777     protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
778     @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
779     protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
780     @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence.impl")
781     protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
782     @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence.impl")
783     protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
784     @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence.impl")
785     protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
786     @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
787     protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
788     @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
789     protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
790     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence.impl")
791     protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
792     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence.impl")
793     protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
794     @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence.impl")
795     protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
796     @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence.impl")
797     protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
798     @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence.impl")
799     protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
800     @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence.impl")
801     protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
802     @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence.impl")
803     protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
804     @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence.impl")
805     protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
806     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence.impl")
807     protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
808     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence.impl")
809     protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
810     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence.impl")
811     protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
812     @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence.impl")
813     protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
814     @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence.impl")
815     protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
816     @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence.impl")
817     protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
818     @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence.impl")
819     protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
820     @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence.impl")
821     protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
822     @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
823     protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
824     @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence.impl")
825     protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
826     @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence.impl")
827     protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
828     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
829     protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
830     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence.impl")
831     protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
832     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence.impl")
833     protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
834     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence.impl")
835     protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
836     @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence.impl")
837     protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
838     @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence.impl")
839     protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
840     @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence.impl")
841     protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
842     @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence.impl")
843     protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
844     @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
845     protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
846     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence.impl")
847     protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
848     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence.impl")
849     protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
850     @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence.impl")
851     protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
852     @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence.impl")
853     protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
854     @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence.impl")
855     protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
856     @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence.impl")
857     protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
858     @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence.impl")
859     protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
860     private static Log _log = LogFactoryUtil.getLog(UserTrackerPathPersistenceImpl.class);
861 }