1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.NoSuchUserTrackerException;
19  import com.liferay.portal.kernel.annotation.BeanReference;
20  import com.liferay.portal.kernel.cache.CacheRegistry;
21  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderPath;
24  import com.liferay.portal.kernel.dao.orm.Query;
25  import com.liferay.portal.kernel.dao.orm.QueryPos;
26  import com.liferay.portal.kernel.dao.orm.QueryUtil;
27  import com.liferay.portal.kernel.dao.orm.Session;
28  import com.liferay.portal.kernel.exception.SystemException;
29  import com.liferay.portal.kernel.log.Log;
30  import com.liferay.portal.kernel.log.LogFactoryUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.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.UserTracker;
39  import com.liferay.portal.model.impl.UserTrackerImpl;
40  import com.liferay.portal.model.impl.UserTrackerModelImpl;
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="UserTrackerPersistenceImpl.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       UserTrackerPersistence
59   * @see       UserTrackerUtil
60   * @generated
61   */
62  public class UserTrackerPersistenceImpl extends BasePersistenceImpl<UserTracker>
63      implements UserTrackerPersistence {
64      public static final String FINDER_CLASS_NAME_ENTITY = UserTrackerImpl.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_COMPANYID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
68              UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
69              "findByCompanyId",
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_COMPANYID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
77              UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
78              "countByCompanyId", new String[] { Long.class.getName() });
79      public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
80              UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
81              "findByUserId",
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_USERID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
89              UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
90              "countByUserId", new String[] { Long.class.getName() });
91      public static final FinderPath FINDER_PATH_FIND_BY_SESSIONID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
92              UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
93              "findBySessionId",
94              new String[] {
95                  String.class.getName(),
96                  
97              "java.lang.Integer", "java.lang.Integer",
98                  "com.liferay.portal.kernel.util.OrderByComparator"
99              });
100     public static final FinderPath FINDER_PATH_COUNT_BY_SESSIONID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
101             UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
102             "countBySessionId", new String[] { String.class.getName() });
103     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
104             UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
105             "findAll", new String[0]);
106     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
107             UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
108             "countAll", new String[0]);
109 
110     public void cacheResult(UserTracker userTracker) {
111         EntityCacheUtil.putResult(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
112             UserTrackerImpl.class, userTracker.getPrimaryKey(), userTracker);
113     }
114 
115     public void cacheResult(List<UserTracker> userTrackers) {
116         for (UserTracker userTracker : userTrackers) {
117             if (EntityCacheUtil.getResult(
118                         UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
119                         UserTrackerImpl.class, userTracker.getPrimaryKey(), this) == null) {
120                 cacheResult(userTracker);
121             }
122         }
123     }
124 
125     public void clearCache() {
126         CacheRegistry.clear(UserTrackerImpl.class.getName());
127         EntityCacheUtil.clearCache(UserTrackerImpl.class.getName());
128         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
129         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
130     }
131 
132     public void clearCache(UserTracker userTracker) {
133         EntityCacheUtil.removeResult(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
134             UserTrackerImpl.class, userTracker.getPrimaryKey());
135     }
136 
137     public UserTracker create(long userTrackerId) {
138         UserTracker userTracker = new UserTrackerImpl();
139 
140         userTracker.setNew(true);
141         userTracker.setPrimaryKey(userTrackerId);
142 
143         return userTracker;
144     }
145 
146     public UserTracker remove(Serializable primaryKey)
147         throws NoSuchModelException, SystemException {
148         return remove(((Long)primaryKey).longValue());
149     }
150 
151     public UserTracker remove(long userTrackerId)
152         throws NoSuchUserTrackerException, SystemException {
153         Session session = null;
154 
155         try {
156             session = openSession();
157 
158             UserTracker userTracker = (UserTracker)session.get(UserTrackerImpl.class,
159                     new Long(userTrackerId));
160 
161             if (userTracker == null) {
162                 if (_log.isWarnEnabled()) {
163                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userTrackerId);
164                 }
165 
166                 throw new NoSuchUserTrackerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
167                     userTrackerId);
168             }
169 
170             return remove(userTracker);
171         }
172         catch (NoSuchUserTrackerException nsee) {
173             throw nsee;
174         }
175         catch (Exception e) {
176             throw processException(e);
177         }
178         finally {
179             closeSession(session);
180         }
181     }
182 
183     public UserTracker remove(UserTracker userTracker)
184         throws SystemException {
185         for (ModelListener<UserTracker> listener : listeners) {
186             listener.onBeforeRemove(userTracker);
187         }
188 
189         userTracker = removeImpl(userTracker);
190 
191         for (ModelListener<UserTracker> listener : listeners) {
192             listener.onAfterRemove(userTracker);
193         }
194 
195         return userTracker;
196     }
197 
198     protected UserTracker removeImpl(UserTracker userTracker)
199         throws SystemException {
200         userTracker = toUnwrappedModel(userTracker);
201 
202         Session session = null;
203 
204         try {
205             session = openSession();
206 
207             if (userTracker.isCachedModel() || BatchSessionUtil.isEnabled()) {
208                 Object staleObject = session.get(UserTrackerImpl.class,
209                         userTracker.getPrimaryKeyObj());
210 
211                 if (staleObject != null) {
212                     session.evict(staleObject);
213                 }
214             }
215 
216             session.delete(userTracker);
217 
218             session.flush();
219         }
220         catch (Exception e) {
221             throw processException(e);
222         }
223         finally {
224             closeSession(session);
225         }
226 
227         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
228 
229         EntityCacheUtil.removeResult(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
230             UserTrackerImpl.class, userTracker.getPrimaryKey());
231 
232         return userTracker;
233     }
234 
235     public UserTracker updateImpl(
236         com.liferay.portal.model.UserTracker userTracker, boolean merge)
237         throws SystemException {
238         userTracker = toUnwrappedModel(userTracker);
239 
240         Session session = null;
241 
242         try {
243             session = openSession();
244 
245             BatchSessionUtil.update(session, userTracker, merge);
246 
247             userTracker.setNew(false);
248         }
249         catch (Exception e) {
250             throw processException(e);
251         }
252         finally {
253             closeSession(session);
254         }
255 
256         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
257 
258         EntityCacheUtil.putResult(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
259             UserTrackerImpl.class, userTracker.getPrimaryKey(), userTracker);
260 
261         return userTracker;
262     }
263 
264     protected UserTracker toUnwrappedModel(UserTracker userTracker) {
265         if (userTracker instanceof UserTrackerImpl) {
266             return userTracker;
267         }
268 
269         UserTrackerImpl userTrackerImpl = new UserTrackerImpl();
270 
271         userTrackerImpl.setNew(userTracker.isNew());
272         userTrackerImpl.setPrimaryKey(userTracker.getPrimaryKey());
273 
274         userTrackerImpl.setUserTrackerId(userTracker.getUserTrackerId());
275         userTrackerImpl.setCompanyId(userTracker.getCompanyId());
276         userTrackerImpl.setUserId(userTracker.getUserId());
277         userTrackerImpl.setModifiedDate(userTracker.getModifiedDate());
278         userTrackerImpl.setSessionId(userTracker.getSessionId());
279         userTrackerImpl.setRemoteAddr(userTracker.getRemoteAddr());
280         userTrackerImpl.setRemoteHost(userTracker.getRemoteHost());
281         userTrackerImpl.setUserAgent(userTracker.getUserAgent());
282 
283         return userTrackerImpl;
284     }
285 
286     public UserTracker findByPrimaryKey(Serializable primaryKey)
287         throws NoSuchModelException, SystemException {
288         return findByPrimaryKey(((Long)primaryKey).longValue());
289     }
290 
291     public UserTracker findByPrimaryKey(long userTrackerId)
292         throws NoSuchUserTrackerException, SystemException {
293         UserTracker userTracker = fetchByPrimaryKey(userTrackerId);
294 
295         if (userTracker == null) {
296             if (_log.isWarnEnabled()) {
297                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userTrackerId);
298             }
299 
300             throw new NoSuchUserTrackerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
301                 userTrackerId);
302         }
303 
304         return userTracker;
305     }
306 
307     public UserTracker fetchByPrimaryKey(Serializable primaryKey)
308         throws SystemException {
309         return fetchByPrimaryKey(((Long)primaryKey).longValue());
310     }
311 
312     public UserTracker fetchByPrimaryKey(long userTrackerId)
313         throws SystemException {
314         UserTracker userTracker = (UserTracker)EntityCacheUtil.getResult(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
315                 UserTrackerImpl.class, userTrackerId, this);
316 
317         if (userTracker == null) {
318             Session session = null;
319 
320             try {
321                 session = openSession();
322 
323                 userTracker = (UserTracker)session.get(UserTrackerImpl.class,
324                         new Long(userTrackerId));
325             }
326             catch (Exception e) {
327                 throw processException(e);
328             }
329             finally {
330                 if (userTracker != null) {
331                     cacheResult(userTracker);
332                 }
333 
334                 closeSession(session);
335             }
336         }
337 
338         return userTracker;
339     }
340 
341     public List<UserTracker> findByCompanyId(long companyId)
342         throws SystemException {
343         return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
344             null);
345     }
346 
347     public List<UserTracker> findByCompanyId(long companyId, int start, int end)
348         throws SystemException {
349         return findByCompanyId(companyId, start, end, null);
350     }
351 
352     public List<UserTracker> findByCompanyId(long companyId, int start,
353         int end, OrderByComparator orderByComparator) throws SystemException {
354         Object[] finderArgs = new Object[] {
355                 new Long(companyId),
356                 
357                 String.valueOf(start), String.valueOf(end),
358                 String.valueOf(orderByComparator)
359             };
360 
361         List<UserTracker> list = (List<UserTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
362                 finderArgs, this);
363 
364         if (list == null) {
365             Session session = null;
366 
367             try {
368                 session = openSession();
369 
370                 StringBundler query = null;
371 
372                 if (orderByComparator != null) {
373                     query = new StringBundler(3 +
374                             (orderByComparator.getOrderByFields().length * 3));
375                 }
376                 else {
377                     query = new StringBundler(2);
378                 }
379 
380                 query.append(_SQL_SELECT_USERTRACKER_WHERE);
381 
382                 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
383 
384                 if (orderByComparator != null) {
385                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
386                         orderByComparator);
387                 }
388 
389                 String sql = query.toString();
390 
391                 Query q = session.createQuery(sql);
392 
393                 QueryPos qPos = QueryPos.getInstance(q);
394 
395                 qPos.add(companyId);
396 
397                 list = (List<UserTracker>)QueryUtil.list(q, getDialect(),
398                         start, end);
399             }
400             catch (Exception e) {
401                 throw processException(e);
402             }
403             finally {
404                 if (list == null) {
405                     list = new ArrayList<UserTracker>();
406                 }
407 
408                 cacheResult(list);
409 
410                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
411                     finderArgs, list);
412 
413                 closeSession(session);
414             }
415         }
416 
417         return list;
418     }
419 
420     public UserTracker findByCompanyId_First(long companyId,
421         OrderByComparator orderByComparator)
422         throws NoSuchUserTrackerException, SystemException {
423         List<UserTracker> list = findByCompanyId(companyId, 0, 1,
424                 orderByComparator);
425 
426         if (list.isEmpty()) {
427             StringBundler msg = new StringBundler(4);
428 
429             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
430 
431             msg.append("companyId=");
432             msg.append(companyId);
433 
434             msg.append(StringPool.CLOSE_CURLY_BRACE);
435 
436             throw new NoSuchUserTrackerException(msg.toString());
437         }
438         else {
439             return list.get(0);
440         }
441     }
442 
443     public UserTracker findByCompanyId_Last(long companyId,
444         OrderByComparator orderByComparator)
445         throws NoSuchUserTrackerException, SystemException {
446         int count = countByCompanyId(companyId);
447 
448         List<UserTracker> list = findByCompanyId(companyId, count - 1, count,
449                 orderByComparator);
450 
451         if (list.isEmpty()) {
452             StringBundler msg = new StringBundler(4);
453 
454             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
455 
456             msg.append("companyId=");
457             msg.append(companyId);
458 
459             msg.append(StringPool.CLOSE_CURLY_BRACE);
460 
461             throw new NoSuchUserTrackerException(msg.toString());
462         }
463         else {
464             return list.get(0);
465         }
466     }
467 
468     public UserTracker[] findByCompanyId_PrevAndNext(long userTrackerId,
469         long companyId, OrderByComparator orderByComparator)
470         throws NoSuchUserTrackerException, SystemException {
471         UserTracker userTracker = findByPrimaryKey(userTrackerId);
472 
473         Session session = null;
474 
475         try {
476             session = openSession();
477 
478             UserTracker[] array = new UserTrackerImpl[3];
479 
480             array[0] = getByCompanyId_PrevAndNext(session, userTracker,
481                     companyId, orderByComparator, true);
482 
483             array[1] = userTracker;
484 
485             array[2] = getByCompanyId_PrevAndNext(session, userTracker,
486                     companyId, orderByComparator, false);
487 
488             return array;
489         }
490         catch (Exception e) {
491             throw processException(e);
492         }
493         finally {
494             closeSession(session);
495         }
496     }
497 
498     protected UserTracker getByCompanyId_PrevAndNext(Session session,
499         UserTracker userTracker, long companyId,
500         OrderByComparator orderByComparator, boolean previous) {
501         StringBundler query = null;
502 
503         if (orderByComparator != null) {
504             query = new StringBundler(6 +
505                     (orderByComparator.getOrderByFields().length * 6));
506         }
507         else {
508             query = new StringBundler(3);
509         }
510 
511         query.append(_SQL_SELECT_USERTRACKER_WHERE);
512 
513         query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
514 
515         if (orderByComparator != null) {
516             String[] orderByFields = orderByComparator.getOrderByFields();
517 
518             if (orderByFields.length > 0) {
519                 query.append(WHERE_AND);
520             }
521 
522             for (int i = 0; i < orderByFields.length; i++) {
523                 query.append(_ORDER_BY_ENTITY_ALIAS);
524                 query.append(orderByFields[i]);
525 
526                 if ((i + 1) < orderByFields.length) {
527                     if (orderByComparator.isAscending() ^ previous) {
528                         query.append(WHERE_GREATER_THAN_HAS_NEXT);
529                     }
530                     else {
531                         query.append(WHERE_LESSER_THAN_HAS_NEXT);
532                     }
533                 }
534                 else {
535                     if (orderByComparator.isAscending() ^ previous) {
536                         query.append(WHERE_GREATER_THAN);
537                     }
538                     else {
539                         query.append(WHERE_LESSER_THAN);
540                     }
541                 }
542             }
543 
544             query.append(ORDER_BY_CLAUSE);
545 
546             for (int i = 0; i < orderByFields.length; i++) {
547                 query.append(_ORDER_BY_ENTITY_ALIAS);
548                 query.append(orderByFields[i]);
549 
550                 if ((i + 1) < orderByFields.length) {
551                     if (orderByComparator.isAscending() ^ previous) {
552                         query.append(ORDER_BY_ASC_HAS_NEXT);
553                     }
554                     else {
555                         query.append(ORDER_BY_DESC_HAS_NEXT);
556                     }
557                 }
558                 else {
559                     if (orderByComparator.isAscending() ^ previous) {
560                         query.append(ORDER_BY_ASC);
561                     }
562                     else {
563                         query.append(ORDER_BY_DESC);
564                     }
565                 }
566             }
567         }
568 
569         String sql = query.toString();
570 
571         Query q = session.createQuery(sql);
572 
573         q.setFirstResult(0);
574         q.setMaxResults(2);
575 
576         QueryPos qPos = QueryPos.getInstance(q);
577 
578         qPos.add(companyId);
579 
580         if (orderByComparator != null) {
581             Object[] values = orderByComparator.getOrderByValues(userTracker);
582 
583             for (Object value : values) {
584                 qPos.add(value);
585             }
586         }
587 
588         List<UserTracker> list = q.list();
589 
590         if (list.size() == 2) {
591             return list.get(1);
592         }
593         else {
594             return null;
595         }
596     }
597 
598     public List<UserTracker> findByUserId(long userId)
599         throws SystemException {
600         return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
601     }
602 
603     public List<UserTracker> findByUserId(long userId, int start, int end)
604         throws SystemException {
605         return findByUserId(userId, start, end, null);
606     }
607 
608     public List<UserTracker> findByUserId(long userId, int start, int end,
609         OrderByComparator orderByComparator) throws SystemException {
610         Object[] finderArgs = new Object[] {
611                 new Long(userId),
612                 
613                 String.valueOf(start), String.valueOf(end),
614                 String.valueOf(orderByComparator)
615             };
616 
617         List<UserTracker> list = (List<UserTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
618                 finderArgs, this);
619 
620         if (list == null) {
621             Session session = null;
622 
623             try {
624                 session = openSession();
625 
626                 StringBundler query = null;
627 
628                 if (orderByComparator != null) {
629                     query = new StringBundler(3 +
630                             (orderByComparator.getOrderByFields().length * 3));
631                 }
632                 else {
633                     query = new StringBundler(2);
634                 }
635 
636                 query.append(_SQL_SELECT_USERTRACKER_WHERE);
637 
638                 query.append(_FINDER_COLUMN_USERID_USERID_2);
639 
640                 if (orderByComparator != null) {
641                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
642                         orderByComparator);
643                 }
644 
645                 String sql = query.toString();
646 
647                 Query q = session.createQuery(sql);
648 
649                 QueryPos qPos = QueryPos.getInstance(q);
650 
651                 qPos.add(userId);
652 
653                 list = (List<UserTracker>)QueryUtil.list(q, getDialect(),
654                         start, end);
655             }
656             catch (Exception e) {
657                 throw processException(e);
658             }
659             finally {
660                 if (list == null) {
661                     list = new ArrayList<UserTracker>();
662                 }
663 
664                 cacheResult(list);
665 
666                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
667                     finderArgs, list);
668 
669                 closeSession(session);
670             }
671         }
672 
673         return list;
674     }
675 
676     public UserTracker findByUserId_First(long userId,
677         OrderByComparator orderByComparator)
678         throws NoSuchUserTrackerException, SystemException {
679         List<UserTracker> list = findByUserId(userId, 0, 1, orderByComparator);
680 
681         if (list.isEmpty()) {
682             StringBundler msg = new StringBundler(4);
683 
684             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
685 
686             msg.append("userId=");
687             msg.append(userId);
688 
689             msg.append(StringPool.CLOSE_CURLY_BRACE);
690 
691             throw new NoSuchUserTrackerException(msg.toString());
692         }
693         else {
694             return list.get(0);
695         }
696     }
697 
698     public UserTracker findByUserId_Last(long userId,
699         OrderByComparator orderByComparator)
700         throws NoSuchUserTrackerException, SystemException {
701         int count = countByUserId(userId);
702 
703         List<UserTracker> list = findByUserId(userId, count - 1, count,
704                 orderByComparator);
705 
706         if (list.isEmpty()) {
707             StringBundler msg = new StringBundler(4);
708 
709             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
710 
711             msg.append("userId=");
712             msg.append(userId);
713 
714             msg.append(StringPool.CLOSE_CURLY_BRACE);
715 
716             throw new NoSuchUserTrackerException(msg.toString());
717         }
718         else {
719             return list.get(0);
720         }
721     }
722 
723     public UserTracker[] findByUserId_PrevAndNext(long userTrackerId,
724         long userId, OrderByComparator orderByComparator)
725         throws NoSuchUserTrackerException, SystemException {
726         UserTracker userTracker = findByPrimaryKey(userTrackerId);
727 
728         Session session = null;
729 
730         try {
731             session = openSession();
732 
733             UserTracker[] array = new UserTrackerImpl[3];
734 
735             array[0] = getByUserId_PrevAndNext(session, userTracker, userId,
736                     orderByComparator, true);
737 
738             array[1] = userTracker;
739 
740             array[2] = getByUserId_PrevAndNext(session, userTracker, userId,
741                     orderByComparator, false);
742 
743             return array;
744         }
745         catch (Exception e) {
746             throw processException(e);
747         }
748         finally {
749             closeSession(session);
750         }
751     }
752 
753     protected UserTracker getByUserId_PrevAndNext(Session session,
754         UserTracker userTracker, long userId,
755         OrderByComparator orderByComparator, boolean previous) {
756         StringBundler query = null;
757 
758         if (orderByComparator != null) {
759             query = new StringBundler(6 +
760                     (orderByComparator.getOrderByFields().length * 6));
761         }
762         else {
763             query = new StringBundler(3);
764         }
765 
766         query.append(_SQL_SELECT_USERTRACKER_WHERE);
767 
768         query.append(_FINDER_COLUMN_USERID_USERID_2);
769 
770         if (orderByComparator != null) {
771             String[] orderByFields = orderByComparator.getOrderByFields();
772 
773             if (orderByFields.length > 0) {
774                 query.append(WHERE_AND);
775             }
776 
777             for (int i = 0; i < orderByFields.length; i++) {
778                 query.append(_ORDER_BY_ENTITY_ALIAS);
779                 query.append(orderByFields[i]);
780 
781                 if ((i + 1) < orderByFields.length) {
782                     if (orderByComparator.isAscending() ^ previous) {
783                         query.append(WHERE_GREATER_THAN_HAS_NEXT);
784                     }
785                     else {
786                         query.append(WHERE_LESSER_THAN_HAS_NEXT);
787                     }
788                 }
789                 else {
790                     if (orderByComparator.isAscending() ^ previous) {
791                         query.append(WHERE_GREATER_THAN);
792                     }
793                     else {
794                         query.append(WHERE_LESSER_THAN);
795                     }
796                 }
797             }
798 
799             query.append(ORDER_BY_CLAUSE);
800 
801             for (int i = 0; i < orderByFields.length; i++) {
802                 query.append(_ORDER_BY_ENTITY_ALIAS);
803                 query.append(orderByFields[i]);
804 
805                 if ((i + 1) < orderByFields.length) {
806                     if (orderByComparator.isAscending() ^ previous) {
807                         query.append(ORDER_BY_ASC_HAS_NEXT);
808                     }
809                     else {
810                         query.append(ORDER_BY_DESC_HAS_NEXT);
811                     }
812                 }
813                 else {
814                     if (orderByComparator.isAscending() ^ previous) {
815                         query.append(ORDER_BY_ASC);
816                     }
817                     else {
818                         query.append(ORDER_BY_DESC);
819                     }
820                 }
821             }
822         }
823 
824         String sql = query.toString();
825 
826         Query q = session.createQuery(sql);
827 
828         q.setFirstResult(0);
829         q.setMaxResults(2);
830 
831         QueryPos qPos = QueryPos.getInstance(q);
832 
833         qPos.add(userId);
834 
835         if (orderByComparator != null) {
836             Object[] values = orderByComparator.getOrderByValues(userTracker);
837 
838             for (Object value : values) {
839                 qPos.add(value);
840             }
841         }
842 
843         List<UserTracker> list = q.list();
844 
845         if (list.size() == 2) {
846             return list.get(1);
847         }
848         else {
849             return null;
850         }
851     }
852 
853     public List<UserTracker> findBySessionId(String sessionId)
854         throws SystemException {
855         return findBySessionId(sessionId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
856             null);
857     }
858 
859     public List<UserTracker> findBySessionId(String sessionId, int start,
860         int end) throws SystemException {
861         return findBySessionId(sessionId, start, end, null);
862     }
863 
864     public List<UserTracker> findBySessionId(String sessionId, int start,
865         int end, OrderByComparator orderByComparator) throws SystemException {
866         Object[] finderArgs = new Object[] {
867                 sessionId,
868                 
869                 String.valueOf(start), String.valueOf(end),
870                 String.valueOf(orderByComparator)
871             };
872 
873         List<UserTracker> list = (List<UserTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_SESSIONID,
874                 finderArgs, this);
875 
876         if (list == null) {
877             Session session = null;
878 
879             try {
880                 session = openSession();
881 
882                 StringBundler query = null;
883 
884                 if (orderByComparator != null) {
885                     query = new StringBundler(3 +
886                             (orderByComparator.getOrderByFields().length * 3));
887                 }
888                 else {
889                     query = new StringBundler(2);
890                 }
891 
892                 query.append(_SQL_SELECT_USERTRACKER_WHERE);
893 
894                 if (sessionId == null) {
895                     query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_1);
896                 }
897                 else {
898                     if (sessionId.equals(StringPool.BLANK)) {
899                         query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_3);
900                     }
901                     else {
902                         query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_2);
903                     }
904                 }
905 
906                 if (orderByComparator != null) {
907                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
908                         orderByComparator);
909                 }
910 
911                 String sql = query.toString();
912 
913                 Query q = session.createQuery(sql);
914 
915                 QueryPos qPos = QueryPos.getInstance(q);
916 
917                 if (sessionId != null) {
918                     qPos.add(sessionId);
919                 }
920 
921                 list = (List<UserTracker>)QueryUtil.list(q, getDialect(),
922                         start, end);
923             }
924             catch (Exception e) {
925                 throw processException(e);
926             }
927             finally {
928                 if (list == null) {
929                     list = new ArrayList<UserTracker>();
930                 }
931 
932                 cacheResult(list);
933 
934                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_SESSIONID,
935                     finderArgs, list);
936 
937                 closeSession(session);
938             }
939         }
940 
941         return list;
942     }
943 
944     public UserTracker findBySessionId_First(String sessionId,
945         OrderByComparator orderByComparator)
946         throws NoSuchUserTrackerException, SystemException {
947         List<UserTracker> list = findBySessionId(sessionId, 0, 1,
948                 orderByComparator);
949 
950         if (list.isEmpty()) {
951             StringBundler msg = new StringBundler(4);
952 
953             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
954 
955             msg.append("sessionId=");
956             msg.append(sessionId);
957 
958             msg.append(StringPool.CLOSE_CURLY_BRACE);
959 
960             throw new NoSuchUserTrackerException(msg.toString());
961         }
962         else {
963             return list.get(0);
964         }
965     }
966 
967     public UserTracker findBySessionId_Last(String sessionId,
968         OrderByComparator orderByComparator)
969         throws NoSuchUserTrackerException, SystemException {
970         int count = countBySessionId(sessionId);
971 
972         List<UserTracker> list = findBySessionId(sessionId, count - 1, count,
973                 orderByComparator);
974 
975         if (list.isEmpty()) {
976             StringBundler msg = new StringBundler(4);
977 
978             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
979 
980             msg.append("sessionId=");
981             msg.append(sessionId);
982 
983             msg.append(StringPool.CLOSE_CURLY_BRACE);
984 
985             throw new NoSuchUserTrackerException(msg.toString());
986         }
987         else {
988             return list.get(0);
989         }
990     }
991 
992     public UserTracker[] findBySessionId_PrevAndNext(long userTrackerId,
993         String sessionId, OrderByComparator orderByComparator)
994         throws NoSuchUserTrackerException, SystemException {
995         UserTracker userTracker = findByPrimaryKey(userTrackerId);
996 
997         Session session = null;
998 
999         try {
1000            session = openSession();
1001
1002            UserTracker[] array = new UserTrackerImpl[3];
1003
1004            array[0] = getBySessionId_PrevAndNext(session, userTracker,
1005                    sessionId, orderByComparator, true);
1006
1007            array[1] = userTracker;
1008
1009            array[2] = getBySessionId_PrevAndNext(session, userTracker,
1010                    sessionId, orderByComparator, false);
1011
1012            return array;
1013        }
1014        catch (Exception e) {
1015            throw processException(e);
1016        }
1017        finally {
1018            closeSession(session);
1019        }
1020    }
1021
1022    protected UserTracker getBySessionId_PrevAndNext(Session session,
1023        UserTracker userTracker, String sessionId,
1024        OrderByComparator orderByComparator, boolean previous) {
1025        StringBundler query = null;
1026
1027        if (orderByComparator != null) {
1028            query = new StringBundler(6 +
1029                    (orderByComparator.getOrderByFields().length * 6));
1030        }
1031        else {
1032            query = new StringBundler(3);
1033        }
1034
1035        query.append(_SQL_SELECT_USERTRACKER_WHERE);
1036
1037        if (sessionId == null) {
1038            query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_1);
1039        }
1040        else {
1041            if (sessionId.equals(StringPool.BLANK)) {
1042                query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_3);
1043            }
1044            else {
1045                query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_2);
1046            }
1047        }
1048
1049        if (orderByComparator != null) {
1050            String[] orderByFields = orderByComparator.getOrderByFields();
1051
1052            if (orderByFields.length > 0) {
1053                query.append(WHERE_AND);
1054            }
1055
1056            for (int i = 0; i < orderByFields.length; i++) {
1057                query.append(_ORDER_BY_ENTITY_ALIAS);
1058                query.append(orderByFields[i]);
1059
1060                if ((i + 1) < orderByFields.length) {
1061                    if (orderByComparator.isAscending() ^ previous) {
1062                        query.append(WHERE_GREATER_THAN_HAS_NEXT);
1063                    }
1064                    else {
1065                        query.append(WHERE_LESSER_THAN_HAS_NEXT);
1066                    }
1067                }
1068                else {
1069                    if (orderByComparator.isAscending() ^ previous) {
1070                        query.append(WHERE_GREATER_THAN);
1071                    }
1072                    else {
1073                        query.append(WHERE_LESSER_THAN);
1074                    }
1075                }
1076            }
1077
1078            query.append(ORDER_BY_CLAUSE);
1079
1080            for (int i = 0; i < orderByFields.length; i++) {
1081                query.append(_ORDER_BY_ENTITY_ALIAS);
1082                query.append(orderByFields[i]);
1083
1084                if ((i + 1) < orderByFields.length) {
1085                    if (orderByComparator.isAscending() ^ previous) {
1086                        query.append(ORDER_BY_ASC_HAS_NEXT);
1087                    }
1088                    else {
1089                        query.append(ORDER_BY_DESC_HAS_NEXT);
1090                    }
1091                }
1092                else {
1093                    if (orderByComparator.isAscending() ^ previous) {
1094                        query.append(ORDER_BY_ASC);
1095                    }
1096                    else {
1097                        query.append(ORDER_BY_DESC);
1098                    }
1099                }
1100            }
1101        }
1102
1103        String sql = query.toString();
1104
1105        Query q = session.createQuery(sql);
1106
1107        q.setFirstResult(0);
1108        q.setMaxResults(2);
1109
1110        QueryPos qPos = QueryPos.getInstance(q);
1111
1112        if (sessionId != null) {
1113            qPos.add(sessionId);
1114        }
1115
1116        if (orderByComparator != null) {
1117            Object[] values = orderByComparator.getOrderByValues(userTracker);
1118
1119            for (Object value : values) {
1120                qPos.add(value);
1121            }
1122        }
1123
1124        List<UserTracker> list = q.list();
1125
1126        if (list.size() == 2) {
1127            return list.get(1);
1128        }
1129        else {
1130            return null;
1131        }
1132    }
1133
1134    public List<UserTracker> findAll() throws SystemException {
1135        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1136    }
1137
1138    public List<UserTracker> findAll(int start, int end)
1139        throws SystemException {
1140        return findAll(start, end, null);
1141    }
1142
1143    public List<UserTracker> findAll(int start, int end,
1144        OrderByComparator orderByComparator) throws SystemException {
1145        Object[] finderArgs = new Object[] {
1146                String.valueOf(start), String.valueOf(end),
1147                String.valueOf(orderByComparator)
1148            };
1149
1150        List<UserTracker> list = (List<UserTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1151                finderArgs, this);
1152
1153        if (list == null) {
1154            Session session = null;
1155
1156            try {
1157                session = openSession();
1158
1159                StringBundler query = null;
1160                String sql = null;
1161
1162                if (orderByComparator != null) {
1163                    query = new StringBundler(2 +
1164                            (orderByComparator.getOrderByFields().length * 3));
1165
1166                    query.append(_SQL_SELECT_USERTRACKER);
1167
1168                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1169                        orderByComparator);
1170
1171                    sql = query.toString();
1172                }
1173
1174                sql = _SQL_SELECT_USERTRACKER;
1175
1176                Query q = session.createQuery(sql);
1177
1178                if (orderByComparator == null) {
1179                    list = (List<UserTracker>)QueryUtil.list(q, getDialect(),
1180                            start, end, false);
1181
1182                    Collections.sort(list);
1183                }
1184                else {
1185                    list = (List<UserTracker>)QueryUtil.list(q, getDialect(),
1186                            start, end);
1187                }
1188            }
1189            catch (Exception e) {
1190                throw processException(e);
1191            }
1192            finally {
1193                if (list == null) {
1194                    list = new ArrayList<UserTracker>();
1195                }
1196
1197                cacheResult(list);
1198
1199                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1200
1201                closeSession(session);
1202            }
1203        }
1204
1205        return list;
1206    }
1207
1208    public void removeByCompanyId(long companyId) throws SystemException {
1209        for (UserTracker userTracker : findByCompanyId(companyId)) {
1210            remove(userTracker);
1211        }
1212    }
1213
1214    public void removeByUserId(long userId) throws SystemException {
1215        for (UserTracker userTracker : findByUserId(userId)) {
1216            remove(userTracker);
1217        }
1218    }
1219
1220    public void removeBySessionId(String sessionId) throws SystemException {
1221        for (UserTracker userTracker : findBySessionId(sessionId)) {
1222            remove(userTracker);
1223        }
1224    }
1225
1226    public void removeAll() throws SystemException {
1227        for (UserTracker userTracker : findAll()) {
1228            remove(userTracker);
1229        }
1230    }
1231
1232    public int countByCompanyId(long companyId) throws SystemException {
1233        Object[] finderArgs = new Object[] { new Long(companyId) };
1234
1235        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1236                finderArgs, this);
1237
1238        if (count == null) {
1239            Session session = null;
1240
1241            try {
1242                session = openSession();
1243
1244                StringBundler query = new StringBundler(2);
1245
1246                query.append(_SQL_COUNT_USERTRACKER_WHERE);
1247
1248                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1249
1250                String sql = query.toString();
1251
1252                Query q = session.createQuery(sql);
1253
1254                QueryPos qPos = QueryPos.getInstance(q);
1255
1256                qPos.add(companyId);
1257
1258                count = (Long)q.uniqueResult();
1259            }
1260            catch (Exception e) {
1261                throw processException(e);
1262            }
1263            finally {
1264                if (count == null) {
1265                    count = Long.valueOf(0);
1266                }
1267
1268                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1269                    finderArgs, count);
1270
1271                closeSession(session);
1272            }
1273        }
1274
1275        return count.intValue();
1276    }
1277
1278    public int countByUserId(long userId) throws SystemException {
1279        Object[] finderArgs = new Object[] { new Long(userId) };
1280
1281        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
1282                finderArgs, this);
1283
1284        if (count == null) {
1285            Session session = null;
1286
1287            try {
1288                session = openSession();
1289
1290                StringBundler query = new StringBundler(2);
1291
1292                query.append(_SQL_COUNT_USERTRACKER_WHERE);
1293
1294                query.append(_FINDER_COLUMN_USERID_USERID_2);
1295
1296                String sql = query.toString();
1297
1298                Query q = session.createQuery(sql);
1299
1300                QueryPos qPos = QueryPos.getInstance(q);
1301
1302                qPos.add(userId);
1303
1304                count = (Long)q.uniqueResult();
1305            }
1306            catch (Exception e) {
1307                throw processException(e);
1308            }
1309            finally {
1310                if (count == null) {
1311                    count = Long.valueOf(0);
1312                }
1313
1314                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
1315                    finderArgs, count);
1316
1317                closeSession(session);
1318            }
1319        }
1320
1321        return count.intValue();
1322    }
1323
1324    public int countBySessionId(String sessionId) throws SystemException {
1325        Object[] finderArgs = new Object[] { sessionId };
1326
1327        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SESSIONID,
1328                finderArgs, this);
1329
1330        if (count == null) {
1331            Session session = null;
1332
1333            try {
1334                session = openSession();
1335
1336                StringBundler query = new StringBundler(2);
1337
1338                query.append(_SQL_COUNT_USERTRACKER_WHERE);
1339
1340                if (sessionId == null) {
1341                    query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_1);
1342                }
1343                else {
1344                    if (sessionId.equals(StringPool.BLANK)) {
1345                        query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_3);
1346                    }
1347                    else {
1348                        query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_2);
1349                    }
1350                }
1351
1352                String sql = query.toString();
1353
1354                Query q = session.createQuery(sql);
1355
1356                QueryPos qPos = QueryPos.getInstance(q);
1357
1358                if (sessionId != null) {
1359                    qPos.add(sessionId);
1360                }
1361
1362                count = (Long)q.uniqueResult();
1363            }
1364            catch (Exception e) {
1365                throw processException(e);
1366            }
1367            finally {
1368                if (count == null) {
1369                    count = Long.valueOf(0);
1370                }
1371
1372                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SESSIONID,
1373                    finderArgs, count);
1374
1375                closeSession(session);
1376            }
1377        }
1378
1379        return count.intValue();
1380    }
1381
1382    public int countAll() throws SystemException {
1383        Object[] finderArgs = new Object[0];
1384
1385        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1386                finderArgs, this);
1387
1388        if (count == null) {
1389            Session session = null;
1390
1391            try {
1392                session = openSession();
1393
1394                Query q = session.createQuery(_SQL_COUNT_USERTRACKER);
1395
1396                count = (Long)q.uniqueResult();
1397            }
1398            catch (Exception e) {
1399                throw processException(e);
1400            }
1401            finally {
1402                if (count == null) {
1403                    count = Long.valueOf(0);
1404                }
1405
1406                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1407                    count);
1408
1409                closeSession(session);
1410            }
1411        }
1412
1413        return count.intValue();
1414    }
1415
1416    public void afterPropertiesSet() {
1417        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1418                    com.liferay.portal.util.PropsUtil.get(
1419                        "value.object.listener.com.liferay.portal.model.UserTracker")));
1420
1421        if (listenerClassNames.length > 0) {
1422            try {
1423                List<ModelListener<UserTracker>> listenersList = new ArrayList<ModelListener<UserTracker>>();
1424
1425                for (String listenerClassName : listenerClassNames) {
1426                    listenersList.add((ModelListener<UserTracker>)InstanceFactory.newInstance(
1427                            listenerClassName));
1428                }
1429
1430                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1431            }
1432            catch (Exception e) {
1433                _log.error(e);
1434            }
1435        }
1436    }
1437
1438    @BeanReference(type = AccountPersistence.class)
1439    protected AccountPersistence accountPersistence;
1440    @BeanReference(type = AddressPersistence.class)
1441    protected AddressPersistence addressPersistence;
1442    @BeanReference(type = BrowserTrackerPersistence.class)
1443    protected BrowserTrackerPersistence browserTrackerPersistence;
1444    @BeanReference(type = ClassNamePersistence.class)
1445    protected ClassNamePersistence classNamePersistence;
1446    @BeanReference(type = CompanyPersistence.class)
1447    protected CompanyPersistence companyPersistence;
1448    @BeanReference(type = ContactPersistence.class)
1449    protected ContactPersistence contactPersistence;
1450    @BeanReference(type = CountryPersistence.class)
1451    protected CountryPersistence countryPersistence;
1452    @BeanReference(type = EmailAddressPersistence.class)
1453    protected EmailAddressPersistence emailAddressPersistence;
1454    @BeanReference(type = GroupPersistence.class)
1455    protected GroupPersistence groupPersistence;
1456    @BeanReference(type = ImagePersistence.class)
1457    protected ImagePersistence imagePersistence;
1458    @BeanReference(type = LayoutPersistence.class)
1459    protected LayoutPersistence layoutPersistence;
1460    @BeanReference(type = LayoutPrototypePersistence.class)
1461    protected LayoutPrototypePersistence layoutPrototypePersistence;
1462    @BeanReference(type = LayoutSetPersistence.class)
1463    protected LayoutSetPersistence layoutSetPersistence;
1464    @BeanReference(type = LayoutSetPrototypePersistence.class)
1465    protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1466    @BeanReference(type = ListTypePersistence.class)
1467    protected ListTypePersistence listTypePersistence;
1468    @BeanReference(type = LockPersistence.class)
1469    protected LockPersistence lockPersistence;
1470    @BeanReference(type = MembershipRequestPersistence.class)
1471    protected MembershipRequestPersistence membershipRequestPersistence;
1472    @BeanReference(type = OrganizationPersistence.class)
1473    protected OrganizationPersistence organizationPersistence;
1474    @BeanReference(type = OrgGroupPermissionPersistence.class)
1475    protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1476    @BeanReference(type = OrgGroupRolePersistence.class)
1477    protected OrgGroupRolePersistence orgGroupRolePersistence;
1478    @BeanReference(type = OrgLaborPersistence.class)
1479    protected OrgLaborPersistence orgLaborPersistence;
1480    @BeanReference(type = PasswordPolicyPersistence.class)
1481    protected PasswordPolicyPersistence passwordPolicyPersistence;
1482    @BeanReference(type = PasswordPolicyRelPersistence.class)
1483    protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1484    @BeanReference(type = PasswordTrackerPersistence.class)
1485    protected PasswordTrackerPersistence passwordTrackerPersistence;
1486    @BeanReference(type = PermissionPersistence.class)
1487    protected PermissionPersistence permissionPersistence;
1488    @BeanReference(type = PhonePersistence.class)
1489    protected PhonePersistence phonePersistence;
1490    @BeanReference(type = PluginSettingPersistence.class)
1491    protected PluginSettingPersistence pluginSettingPersistence;
1492    @BeanReference(type = PortletPersistence.class)
1493    protected PortletPersistence portletPersistence;
1494    @BeanReference(type = PortletItemPersistence.class)
1495    protected PortletItemPersistence portletItemPersistence;
1496    @BeanReference(type = PortletPreferencesPersistence.class)
1497    protected PortletPreferencesPersistence portletPreferencesPersistence;
1498    @BeanReference(type = RegionPersistence.class)
1499    protected RegionPersistence regionPersistence;
1500    @BeanReference(type = ReleasePersistence.class)
1501    protected ReleasePersistence releasePersistence;
1502    @BeanReference(type = ResourcePersistence.class)
1503    protected ResourcePersistence resourcePersistence;
1504    @BeanReference(type = ResourceActionPersistence.class)
1505    protected ResourceActionPersistence resourceActionPersistence;
1506    @BeanReference(type = ResourceCodePersistence.class)
1507    protected ResourceCodePersistence resourceCodePersistence;
1508    @BeanReference(type = ResourcePermissionPersistence.class)
1509    protected ResourcePermissionPersistence resourcePermissionPersistence;
1510    @BeanReference(type = RolePersistence.class)
1511    protected RolePersistence rolePersistence;
1512    @BeanReference(type = ServiceComponentPersistence.class)
1513    protected ServiceComponentPersistence serviceComponentPersistence;
1514    @BeanReference(type = ShardPersistence.class)
1515    protected ShardPersistence shardPersistence;
1516    @BeanReference(type = SubscriptionPersistence.class)
1517    protected SubscriptionPersistence subscriptionPersistence;
1518    @BeanReference(type = TicketPersistence.class)
1519    protected TicketPersistence ticketPersistence;
1520    @BeanReference(type = TeamPersistence.class)
1521    protected TeamPersistence teamPersistence;
1522    @BeanReference(type = UserPersistence.class)
1523    protected UserPersistence userPersistence;
1524    @BeanReference(type = UserGroupPersistence.class)
1525    protected UserGroupPersistence userGroupPersistence;
1526    @BeanReference(type = UserGroupGroupRolePersistence.class)
1527    protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1528    @BeanReference(type = UserGroupRolePersistence.class)
1529    protected UserGroupRolePersistence userGroupRolePersistence;
1530    @BeanReference(type = UserIdMapperPersistence.class)
1531    protected UserIdMapperPersistence userIdMapperPersistence;
1532    @BeanReference(type = UserTrackerPersistence.class)
1533    protected UserTrackerPersistence userTrackerPersistence;
1534    @BeanReference(type = UserTrackerPathPersistence.class)
1535    protected UserTrackerPathPersistence userTrackerPathPersistence;
1536    @BeanReference(type = WebDAVPropsPersistence.class)
1537    protected WebDAVPropsPersistence webDAVPropsPersistence;
1538    @BeanReference(type = WebsitePersistence.class)
1539    protected WebsitePersistence websitePersistence;
1540    @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1541    protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1542    @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1543    protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1544    private static final String _SQL_SELECT_USERTRACKER = "SELECT userTracker FROM UserTracker userTracker";
1545    private static final String _SQL_SELECT_USERTRACKER_WHERE = "SELECT userTracker FROM UserTracker userTracker WHERE ";
1546    private static final String _SQL_COUNT_USERTRACKER = "SELECT COUNT(userTracker) FROM UserTracker userTracker";
1547    private static final String _SQL_COUNT_USERTRACKER_WHERE = "SELECT COUNT(userTracker) FROM UserTracker userTracker WHERE ";
1548    private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "userTracker.companyId = ?";
1549    private static final String _FINDER_COLUMN_USERID_USERID_2 = "userTracker.userId = ?";
1550    private static final String _FINDER_COLUMN_SESSIONID_SESSIONID_1 = "userTracker.sessionId IS NULL";
1551    private static final String _FINDER_COLUMN_SESSIONID_SESSIONID_2 = "userTracker.sessionId = ?";
1552    private static final String _FINDER_COLUMN_SESSIONID_SESSIONID_3 = "(userTracker.sessionId IS NULL OR userTracker.sessionId = ?)";
1553    private static final String _ORDER_BY_ENTITY_ALIAS = "userTracker.";
1554    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserTracker exists with the primary key ";
1555    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserTracker exists with the key {";
1556    private static Log _log = LogFactoryUtil.getLog(UserTrackerPersistenceImpl.class);
1557}