1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.NoSuchUserTrackerPathException;
19  import com.liferay.portal.kernel.annotation.BeanReference;
20  import com.liferay.portal.kernel.cache.CacheRegistry;
21  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderPath;
24  import com.liferay.portal.kernel.dao.orm.Query;
25  import com.liferay.portal.kernel.dao.orm.QueryPos;
26  import com.liferay.portal.kernel.dao.orm.QueryUtil;
27  import com.liferay.portal.kernel.dao.orm.Session;
28  import com.liferay.portal.kernel.exception.SystemException;
29  import com.liferay.portal.kernel.log.Log;
30  import com.liferay.portal.kernel.log.LogFactoryUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.OrderByComparator;
33  import com.liferay.portal.kernel.util.StringBundler;
34  import com.liferay.portal.kernel.util.StringPool;
35  import com.liferay.portal.kernel.util.StringUtil;
36  import com.liferay.portal.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     public UserTrackerPath updateImpl(
215         com.liferay.portal.model.UserTrackerPath userTrackerPath, boolean merge)
216         throws SystemException {
217         userTrackerPath = toUnwrappedModel(userTrackerPath);
218 
219         Session session = null;
220 
221         try {
222             session = openSession();
223 
224             BatchSessionUtil.update(session, userTrackerPath, merge);
225 
226             userTrackerPath.setNew(false);
227         }
228         catch (Exception e) {
229             throw processException(e);
230         }
231         finally {
232             closeSession(session);
233         }
234 
235         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
236 
237         EntityCacheUtil.putResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
238             UserTrackerPathImpl.class, userTrackerPath.getPrimaryKey(),
239             userTrackerPath);
240 
241         return userTrackerPath;
242     }
243 
244     protected UserTrackerPath toUnwrappedModel(UserTrackerPath userTrackerPath) {
245         if (userTrackerPath instanceof UserTrackerPathImpl) {
246             return userTrackerPath;
247         }
248 
249         UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
250 
251         userTrackerPathImpl.setNew(userTrackerPath.isNew());
252         userTrackerPathImpl.setPrimaryKey(userTrackerPath.getPrimaryKey());
253 
254         userTrackerPathImpl.setUserTrackerPathId(userTrackerPath.getUserTrackerPathId());
255         userTrackerPathImpl.setUserTrackerId(userTrackerPath.getUserTrackerId());
256         userTrackerPathImpl.setPath(userTrackerPath.getPath());
257         userTrackerPathImpl.setPathDate(userTrackerPath.getPathDate());
258 
259         return userTrackerPathImpl;
260     }
261 
262     public UserTrackerPath findByPrimaryKey(Serializable primaryKey)
263         throws NoSuchModelException, SystemException {
264         return findByPrimaryKey(((Long)primaryKey).longValue());
265     }
266 
267     public UserTrackerPath findByPrimaryKey(long userTrackerPathId)
268         throws NoSuchUserTrackerPathException, SystemException {
269         UserTrackerPath userTrackerPath = fetchByPrimaryKey(userTrackerPathId);
270 
271         if (userTrackerPath == null) {
272             if (_log.isWarnEnabled()) {
273                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userTrackerPathId);
274             }
275 
276             throw new NoSuchUserTrackerPathException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
277                 userTrackerPathId);
278         }
279 
280         return userTrackerPath;
281     }
282 
283     public UserTrackerPath fetchByPrimaryKey(Serializable primaryKey)
284         throws SystemException {
285         return fetchByPrimaryKey(((Long)primaryKey).longValue());
286     }
287 
288     public UserTrackerPath fetchByPrimaryKey(long userTrackerPathId)
289         throws SystemException {
290         UserTrackerPath userTrackerPath = (UserTrackerPath)EntityCacheUtil.getResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
291                 UserTrackerPathImpl.class, userTrackerPathId, this);
292 
293         if (userTrackerPath == null) {
294             Session session = null;
295 
296             try {
297                 session = openSession();
298 
299                 userTrackerPath = (UserTrackerPath)session.get(UserTrackerPathImpl.class,
300                         new Long(userTrackerPathId));
301             }
302             catch (Exception e) {
303                 throw processException(e);
304             }
305             finally {
306                 if (userTrackerPath != null) {
307                     cacheResult(userTrackerPath);
308                 }
309 
310                 closeSession(session);
311             }
312         }
313 
314         return userTrackerPath;
315     }
316 
317     public List<UserTrackerPath> findByUserTrackerId(long userTrackerId)
318         throws SystemException {
319         Object[] finderArgs = new Object[] { new Long(userTrackerId) };
320 
321         List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERTRACKERID,
322                 finderArgs, this);
323 
324         if (list == null) {
325             Session session = null;
326 
327             try {
328                 session = openSession();
329 
330                 StringBundler query = new StringBundler(2);
331 
332                 query.append(_SQL_SELECT_USERTRACKERPATH_WHERE);
333 
334                 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
335 
336                 String sql = query.toString();
337 
338                 Query q = session.createQuery(sql);
339 
340                 QueryPos qPos = QueryPos.getInstance(q);
341 
342                 qPos.add(userTrackerId);
343 
344                 list = q.list();
345             }
346             catch (Exception e) {
347                 throw processException(e);
348             }
349             finally {
350                 if (list == null) {
351                     list = new ArrayList<UserTrackerPath>();
352                 }
353 
354                 cacheResult(list);
355 
356                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERTRACKERID,
357                     finderArgs, list);
358 
359                 closeSession(session);
360             }
361         }
362 
363         return list;
364     }
365 
366     public List<UserTrackerPath> findByUserTrackerId(long userTrackerId,
367         int start, int end) throws SystemException {
368         return findByUserTrackerId(userTrackerId, start, end, null);
369     }
370 
371     public List<UserTrackerPath> findByUserTrackerId(long userTrackerId,
372         int start, int end, OrderByComparator orderByComparator)
373         throws SystemException {
374         Object[] finderArgs = new Object[] {
375                 new Long(userTrackerId),
376                 
377                 String.valueOf(start), String.valueOf(end),
378                 String.valueOf(orderByComparator)
379             };
380 
381         List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_USERTRACKERID,
382                 finderArgs, this);
383 
384         if (list == null) {
385             Session session = null;
386 
387             try {
388                 session = openSession();
389 
390                 StringBundler query = null;
391 
392                 if (orderByComparator != null) {
393                     query = new StringBundler(3 +
394                             (orderByComparator.getOrderByFields().length * 3));
395                 }
396                 else {
397                     query = new StringBundler(2);
398                 }
399 
400                 query.append(_SQL_SELECT_USERTRACKERPATH_WHERE);
401 
402                 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
403 
404                 if (orderByComparator != null) {
405                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
406                         orderByComparator);
407                 }
408 
409                 String sql = query.toString();
410 
411                 Query q = session.createQuery(sql);
412 
413                 QueryPos qPos = QueryPos.getInstance(q);
414 
415                 qPos.add(userTrackerId);
416 
417                 list = (List<UserTrackerPath>)QueryUtil.list(q, getDialect(),
418                         start, end);
419             }
420             catch (Exception e) {
421                 throw processException(e);
422             }
423             finally {
424                 if (list == null) {
425                     list = new ArrayList<UserTrackerPath>();
426                 }
427 
428                 cacheResult(list);
429 
430                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_USERTRACKERID,
431                     finderArgs, list);
432 
433                 closeSession(session);
434             }
435         }
436 
437         return list;
438     }
439 
440     public UserTrackerPath findByUserTrackerId_First(long userTrackerId,
441         OrderByComparator orderByComparator)
442         throws NoSuchUserTrackerPathException, SystemException {
443         List<UserTrackerPath> list = findByUserTrackerId(userTrackerId, 0, 1,
444                 orderByComparator);
445 
446         if (list.isEmpty()) {
447             StringBundler msg = new StringBundler(4);
448 
449             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
450 
451             msg.append("userTrackerId=");
452             msg.append(userTrackerId);
453 
454             msg.append(StringPool.CLOSE_CURLY_BRACE);
455 
456             throw new NoSuchUserTrackerPathException(msg.toString());
457         }
458         else {
459             return list.get(0);
460         }
461     }
462 
463     public UserTrackerPath findByUserTrackerId_Last(long userTrackerId,
464         OrderByComparator orderByComparator)
465         throws NoSuchUserTrackerPathException, SystemException {
466         int count = countByUserTrackerId(userTrackerId);
467 
468         List<UserTrackerPath> list = findByUserTrackerId(userTrackerId,
469                 count - 1, count, orderByComparator);
470 
471         if (list.isEmpty()) {
472             StringBundler msg = new StringBundler(4);
473 
474             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
475 
476             msg.append("userTrackerId=");
477             msg.append(userTrackerId);
478 
479             msg.append(StringPool.CLOSE_CURLY_BRACE);
480 
481             throw new NoSuchUserTrackerPathException(msg.toString());
482         }
483         else {
484             return list.get(0);
485         }
486     }
487 
488     public UserTrackerPath[] findByUserTrackerId_PrevAndNext(
489         long userTrackerPathId, long userTrackerId,
490         OrderByComparator orderByComparator)
491         throws NoSuchUserTrackerPathException, SystemException {
492         UserTrackerPath userTrackerPath = findByPrimaryKey(userTrackerPathId);
493 
494         int count = countByUserTrackerId(userTrackerId);
495 
496         Session session = null;
497 
498         try {
499             session = openSession();
500 
501             StringBundler query = null;
502 
503             if (orderByComparator != null) {
504                 query = new StringBundler(3 +
505                         (orderByComparator.getOrderByFields().length * 3));
506             }
507             else {
508                 query = new StringBundler(2);
509             }
510 
511             query.append(_SQL_SELECT_USERTRACKERPATH_WHERE);
512 
513             query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
514 
515             if (orderByComparator != null) {
516                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
517                     orderByComparator);
518             }
519 
520             String sql = query.toString();
521 
522             Query q = session.createQuery(sql);
523 
524             QueryPos qPos = QueryPos.getInstance(q);
525 
526             qPos.add(userTrackerId);
527 
528             Object[] objArray = QueryUtil.getPrevAndNext(q, count,
529                     orderByComparator, userTrackerPath);
530 
531             UserTrackerPath[] array = new UserTrackerPathImpl[3];
532 
533             array[0] = (UserTrackerPath)objArray[0];
534             array[1] = (UserTrackerPath)objArray[1];
535             array[2] = (UserTrackerPath)objArray[2];
536 
537             return array;
538         }
539         catch (Exception e) {
540             throw processException(e);
541         }
542         finally {
543             closeSession(session);
544         }
545     }
546 
547     public List<UserTrackerPath> findAll() throws SystemException {
548         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
549     }
550 
551     public List<UserTrackerPath> findAll(int start, int end)
552         throws SystemException {
553         return findAll(start, end, null);
554     }
555 
556     public List<UserTrackerPath> findAll(int start, int end,
557         OrderByComparator orderByComparator) throws SystemException {
558         Object[] finderArgs = new Object[] {
559                 String.valueOf(start), String.valueOf(end),
560                 String.valueOf(orderByComparator)
561             };
562 
563         List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
564                 finderArgs, this);
565 
566         if (list == null) {
567             Session session = null;
568 
569             try {
570                 session = openSession();
571 
572                 StringBundler query = null;
573                 String sql = null;
574 
575                 if (orderByComparator != null) {
576                     query = new StringBundler(2 +
577                             (orderByComparator.getOrderByFields().length * 3));
578 
579                     query.append(_SQL_SELECT_USERTRACKERPATH);
580 
581                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
582                         orderByComparator);
583 
584                     sql = query.toString();
585                 }
586 
587                 sql = _SQL_SELECT_USERTRACKERPATH;
588 
589                 Query q = session.createQuery(sql);
590 
591                 if (orderByComparator == null) {
592                     list = (List<UserTrackerPath>)QueryUtil.list(q,
593                             getDialect(), start, end, false);
594 
595                     Collections.sort(list);
596                 }
597                 else {
598                     list = (List<UserTrackerPath>)QueryUtil.list(q,
599                             getDialect(), start, end);
600                 }
601             }
602             catch (Exception e) {
603                 throw processException(e);
604             }
605             finally {
606                 if (list == null) {
607                     list = new ArrayList<UserTrackerPath>();
608                 }
609 
610                 cacheResult(list);
611 
612                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
613 
614                 closeSession(session);
615             }
616         }
617 
618         return list;
619     }
620 
621     public void removeByUserTrackerId(long userTrackerId)
622         throws SystemException {
623         for (UserTrackerPath userTrackerPath : findByUserTrackerId(
624                 userTrackerId)) {
625             remove(userTrackerPath);
626         }
627     }
628 
629     public void removeAll() throws SystemException {
630         for (UserTrackerPath userTrackerPath : findAll()) {
631             remove(userTrackerPath);
632         }
633     }
634 
635     public int countByUserTrackerId(long userTrackerId)
636         throws SystemException {
637         Object[] finderArgs = new Object[] { new Long(userTrackerId) };
638 
639         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
640                 finderArgs, this);
641 
642         if (count == null) {
643             Session session = null;
644 
645             try {
646                 session = openSession();
647 
648                 StringBundler query = new StringBundler(2);
649 
650                 query.append(_SQL_COUNT_USERTRACKERPATH_WHERE);
651 
652                 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
653 
654                 String sql = query.toString();
655 
656                 Query q = session.createQuery(sql);
657 
658                 QueryPos qPos = QueryPos.getInstance(q);
659 
660                 qPos.add(userTrackerId);
661 
662                 count = (Long)q.uniqueResult();
663             }
664             catch (Exception e) {
665                 throw processException(e);
666             }
667             finally {
668                 if (count == null) {
669                     count = Long.valueOf(0);
670                 }
671 
672                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
673                     finderArgs, count);
674 
675                 closeSession(session);
676             }
677         }
678 
679         return count.intValue();
680     }
681 
682     public int countAll() throws SystemException {
683         Object[] finderArgs = new Object[0];
684 
685         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
686                 finderArgs, this);
687 
688         if (count == null) {
689             Session session = null;
690 
691             try {
692                 session = openSession();
693 
694                 Query q = session.createQuery(_SQL_COUNT_USERTRACKERPATH);
695 
696                 count = (Long)q.uniqueResult();
697             }
698             catch (Exception e) {
699                 throw processException(e);
700             }
701             finally {
702                 if (count == null) {
703                     count = Long.valueOf(0);
704                 }
705 
706                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
707                     count);
708 
709                 closeSession(session);
710             }
711         }
712 
713         return count.intValue();
714     }
715 
716     public void afterPropertiesSet() {
717         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
718                     com.liferay.portal.util.PropsUtil.get(
719                         "value.object.listener.com.liferay.portal.model.UserTrackerPath")));
720 
721         if (listenerClassNames.length > 0) {
722             try {
723                 List<ModelListener<UserTrackerPath>> listenersList = new ArrayList<ModelListener<UserTrackerPath>>();
724 
725                 for (String listenerClassName : listenerClassNames) {
726                     listenersList.add((ModelListener<UserTrackerPath>)Class.forName(
727                             listenerClassName).newInstance());
728                 }
729 
730                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
731             }
732             catch (Exception e) {
733                 _log.error(e);
734             }
735         }
736     }
737 
738     @BeanReference(type = AccountPersistence.class)
739     protected AccountPersistence accountPersistence;
740     @BeanReference(type = AddressPersistence.class)
741     protected AddressPersistence addressPersistence;
742     @BeanReference(type = BrowserTrackerPersistence.class)
743     protected BrowserTrackerPersistence browserTrackerPersistence;
744     @BeanReference(type = ClassNamePersistence.class)
745     protected ClassNamePersistence classNamePersistence;
746     @BeanReference(type = CompanyPersistence.class)
747     protected CompanyPersistence companyPersistence;
748     @BeanReference(type = ContactPersistence.class)
749     protected ContactPersistence contactPersistence;
750     @BeanReference(type = CountryPersistence.class)
751     protected CountryPersistence countryPersistence;
752     @BeanReference(type = EmailAddressPersistence.class)
753     protected EmailAddressPersistence emailAddressPersistence;
754     @BeanReference(type = GroupPersistence.class)
755     protected GroupPersistence groupPersistence;
756     @BeanReference(type = ImagePersistence.class)
757     protected ImagePersistence imagePersistence;
758     @BeanReference(type = LayoutPersistence.class)
759     protected LayoutPersistence layoutPersistence;
760     @BeanReference(type = LayoutPrototypePersistence.class)
761     protected LayoutPrototypePersistence layoutPrototypePersistence;
762     @BeanReference(type = LayoutSetPersistence.class)
763     protected LayoutSetPersistence layoutSetPersistence;
764     @BeanReference(type = LayoutSetPrototypePersistence.class)
765     protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
766     @BeanReference(type = ListTypePersistence.class)
767     protected ListTypePersistence listTypePersistence;
768     @BeanReference(type = LockPersistence.class)
769     protected LockPersistence lockPersistence;
770     @BeanReference(type = MembershipRequestPersistence.class)
771     protected MembershipRequestPersistence membershipRequestPersistence;
772     @BeanReference(type = OrganizationPersistence.class)
773     protected OrganizationPersistence organizationPersistence;
774     @BeanReference(type = OrgGroupPermissionPersistence.class)
775     protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
776     @BeanReference(type = OrgGroupRolePersistence.class)
777     protected OrgGroupRolePersistence orgGroupRolePersistence;
778     @BeanReference(type = OrgLaborPersistence.class)
779     protected OrgLaborPersistence orgLaborPersistence;
780     @BeanReference(type = PasswordPolicyPersistence.class)
781     protected PasswordPolicyPersistence passwordPolicyPersistence;
782     @BeanReference(type = PasswordPolicyRelPersistence.class)
783     protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
784     @BeanReference(type = PasswordTrackerPersistence.class)
785     protected PasswordTrackerPersistence passwordTrackerPersistence;
786     @BeanReference(type = PermissionPersistence.class)
787     protected PermissionPersistence permissionPersistence;
788     @BeanReference(type = PhonePersistence.class)
789     protected PhonePersistence phonePersistence;
790     @BeanReference(type = PluginSettingPersistence.class)
791     protected PluginSettingPersistence pluginSettingPersistence;
792     @BeanReference(type = PortletPersistence.class)
793     protected PortletPersistence portletPersistence;
794     @BeanReference(type = PortletItemPersistence.class)
795     protected PortletItemPersistence portletItemPersistence;
796     @BeanReference(type = PortletPreferencesPersistence.class)
797     protected PortletPreferencesPersistence portletPreferencesPersistence;
798     @BeanReference(type = RegionPersistence.class)
799     protected RegionPersistence regionPersistence;
800     @BeanReference(type = ReleasePersistence.class)
801     protected ReleasePersistence releasePersistence;
802     @BeanReference(type = ResourcePersistence.class)
803     protected ResourcePersistence resourcePersistence;
804     @BeanReference(type = ResourceActionPersistence.class)
805     protected ResourceActionPersistence resourceActionPersistence;
806     @BeanReference(type = ResourceCodePersistence.class)
807     protected ResourceCodePersistence resourceCodePersistence;
808     @BeanReference(type = ResourcePermissionPersistence.class)
809     protected ResourcePermissionPersistence resourcePermissionPersistence;
810     @BeanReference(type = RolePersistence.class)
811     protected RolePersistence rolePersistence;
812     @BeanReference(type = ServiceComponentPersistence.class)
813     protected ServiceComponentPersistence serviceComponentPersistence;
814     @BeanReference(type = ShardPersistence.class)
815     protected ShardPersistence shardPersistence;
816     @BeanReference(type = SubscriptionPersistence.class)
817     protected SubscriptionPersistence subscriptionPersistence;
818     @BeanReference(type = TeamPersistence.class)
819     protected TeamPersistence teamPersistence;
820     @BeanReference(type = UserPersistence.class)
821     protected UserPersistence userPersistence;
822     @BeanReference(type = UserGroupPersistence.class)
823     protected UserGroupPersistence userGroupPersistence;
824     @BeanReference(type = UserGroupGroupRolePersistence.class)
825     protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
826     @BeanReference(type = UserGroupRolePersistence.class)
827     protected UserGroupRolePersistence userGroupRolePersistence;
828     @BeanReference(type = UserIdMapperPersistence.class)
829     protected UserIdMapperPersistence userIdMapperPersistence;
830     @BeanReference(type = UserTrackerPersistence.class)
831     protected UserTrackerPersistence userTrackerPersistence;
832     @BeanReference(type = UserTrackerPathPersistence.class)
833     protected UserTrackerPathPersistence userTrackerPathPersistence;
834     @BeanReference(type = WebDAVPropsPersistence.class)
835     protected WebDAVPropsPersistence webDAVPropsPersistence;
836     @BeanReference(type = WebsitePersistence.class)
837     protected WebsitePersistence websitePersistence;
838     @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
839     protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
840     @BeanReference(type = WorkflowInstanceLinkPersistence.class)
841     protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
842     private static final String _SQL_SELECT_USERTRACKERPATH = "SELECT userTrackerPath FROM UserTrackerPath userTrackerPath";
843     private static final String _SQL_SELECT_USERTRACKERPATH_WHERE = "SELECT userTrackerPath FROM UserTrackerPath userTrackerPath WHERE ";
844     private static final String _SQL_COUNT_USERTRACKERPATH = "SELECT COUNT(userTrackerPath) FROM UserTrackerPath userTrackerPath";
845     private static final String _SQL_COUNT_USERTRACKERPATH_WHERE = "SELECT COUNT(userTrackerPath) FROM UserTrackerPath userTrackerPath WHERE ";
846     private static final String _FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2 = "userTrackerPath.userTrackerId = ?";
847     private static final String _ORDER_BY_ENTITY_ALIAS = "userTrackerPath.";
848     private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserTrackerPath exists with the primary key ";
849     private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserTrackerPath exists with the key {";
850     private static Log _log = LogFactoryUtil.getLog(UserTrackerPathPersistenceImpl.class);
851 }