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