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