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