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