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