001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.NoSuchUserTrackerException;
019    import com.liferay.portal.kernel.annotation.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.model.ModelListener;
038    import com.liferay.portal.model.UserTracker;
039    import com.liferay.portal.model.impl.UserTrackerImpl;
040    import com.liferay.portal.model.impl.UserTrackerModelImpl;
041    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
042    
043    import java.io.Serializable;
044    
045    import java.util.ArrayList;
046    import java.util.Collections;
047    import java.util.List;
048    
049    /**
050     * The persistence implementation for the user tracker service.
051     *
052     * <p>
053     * Never modify or reference this class directly. Always use {@link UserTrackerUtil} to access the user tracker persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
054     * </p>
055     *
056     * <p>
057     * Caching information and settings can be found in <code>portal.properties</code>
058     * </p>
059     *
060     * @author Brian Wing Shun Chan
061     * @see UserTrackerPersistence
062     * @see UserTrackerUtil
063     * @generated
064     */
065    public class UserTrackerPersistenceImpl extends BasePersistenceImpl<UserTracker>
066            implements UserTrackerPersistence {
067            public static final String FINDER_CLASS_NAME_ENTITY = UserTrackerImpl.class.getName();
068            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
069                    ".List";
070            public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
071                            UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
072                            "findByCompanyId",
073                            new String[] {
074                                    Long.class.getName(),
075                                    
076                            "java.lang.Integer", "java.lang.Integer",
077                                    "com.liferay.portal.kernel.util.OrderByComparator"
078                            });
079            public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
080                            UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
081                            "countByCompanyId", new String[] { Long.class.getName() });
082            public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
083                            UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
084                            "findByUserId",
085                            new String[] {
086                                    Long.class.getName(),
087                                    
088                            "java.lang.Integer", "java.lang.Integer",
089                                    "com.liferay.portal.kernel.util.OrderByComparator"
090                            });
091            public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
092                            UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
093                            "countByUserId", new String[] { Long.class.getName() });
094            public static final FinderPath FINDER_PATH_FIND_BY_SESSIONID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
095                            UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
096                            "findBySessionId",
097                            new String[] {
098                                    String.class.getName(),
099                                    
100                            "java.lang.Integer", "java.lang.Integer",
101                                    "com.liferay.portal.kernel.util.OrderByComparator"
102                            });
103            public static final FinderPath FINDER_PATH_COUNT_BY_SESSIONID = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
104                            UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
105                            "countBySessionId", new String[] { String.class.getName() });
106            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
107                            UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
108                            "findAll", new String[0]);
109            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
110                            UserTrackerModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
111                            "countAll", new String[0]);
112    
113            /**
114             * Caches the user tracker in the entity cache if it is enabled.
115             *
116             * @param userTracker the user tracker to cache
117             */
118            public void cacheResult(UserTracker userTracker) {
119                    EntityCacheUtil.putResult(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
120                            UserTrackerImpl.class, userTracker.getPrimaryKey(), userTracker);
121            }
122    
123            /**
124             * Caches the user trackers in the entity cache if it is enabled.
125             *
126             * @param userTrackers the user trackers to cache
127             */
128            public void cacheResult(List<UserTracker> userTrackers) {
129                    for (UserTracker userTracker : userTrackers) {
130                            if (EntityCacheUtil.getResult(
131                                                    UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
132                                                    UserTrackerImpl.class, userTracker.getPrimaryKey(), this) == null) {
133                                    cacheResult(userTracker);
134                            }
135                    }
136            }
137    
138            /**
139             * Clears the cache for all user trackers.
140             *
141             * <p>
142             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
143             * </p>
144             */
145            public void clearCache() {
146                    CacheRegistryUtil.clear(UserTrackerImpl.class.getName());
147                    EntityCacheUtil.clearCache(UserTrackerImpl.class.getName());
148                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
149                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
150            }
151    
152            /**
153             * Clears the cache for the user tracker.
154             *
155             * <p>
156             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
157             * </p>
158             */
159            public void clearCache(UserTracker userTracker) {
160                    EntityCacheUtil.removeResult(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
161                            UserTrackerImpl.class, userTracker.getPrimaryKey());
162            }
163    
164            /**
165             * Creates a new user tracker with the primary key. Does not add the user tracker to the database.
166             *
167             * @param userTrackerId the primary key for the new user tracker
168             * @return the new user tracker
169             */
170            public UserTracker create(long userTrackerId) {
171                    UserTracker userTracker = new UserTrackerImpl();
172    
173                    userTracker.setNew(true);
174                    userTracker.setPrimaryKey(userTrackerId);
175    
176                    return userTracker;
177            }
178    
179            /**
180             * Removes the user tracker with the primary key from the database. Also notifies the appropriate model listeners.
181             *
182             * @param primaryKey the primary key of the user tracker to remove
183             * @return the user tracker that was removed
184             * @throws com.liferay.portal.NoSuchModelException if a user tracker with the primary key could not be found
185             * @throws SystemException if a system exception occurred
186             */
187            public UserTracker remove(Serializable primaryKey)
188                    throws NoSuchModelException, SystemException {
189                    return remove(((Long)primaryKey).longValue());
190            }
191    
192            /**
193             * Removes the user tracker with the primary key from the database. Also notifies the appropriate model listeners.
194             *
195             * @param userTrackerId the primary key of the user tracker to remove
196             * @return the user tracker that was removed
197             * @throws com.liferay.portal.NoSuchUserTrackerException if a user tracker with the primary key could not be found
198             * @throws SystemException if a system exception occurred
199             */
200            public UserTracker remove(long userTrackerId)
201                    throws NoSuchUserTrackerException, SystemException {
202                    Session session = null;
203    
204                    try {
205                            session = openSession();
206    
207                            UserTracker userTracker = (UserTracker)session.get(UserTrackerImpl.class,
208                                            new Long(userTrackerId));
209    
210                            if (userTracker == null) {
211                                    if (_log.isWarnEnabled()) {
212                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userTrackerId);
213                                    }
214    
215                                    throw new NoSuchUserTrackerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
216                                            userTrackerId);
217                            }
218    
219                            return remove(userTracker);
220                    }
221                    catch (NoSuchUserTrackerException nsee) {
222                            throw nsee;
223                    }
224                    catch (Exception e) {
225                            throw processException(e);
226                    }
227                    finally {
228                            closeSession(session);
229                    }
230            }
231    
232            protected UserTracker removeImpl(UserTracker userTracker)
233                    throws SystemException {
234                    userTracker = toUnwrappedModel(userTracker);
235    
236                    Session session = null;
237    
238                    try {
239                            session = openSession();
240    
241                            BatchSessionUtil.delete(session, userTracker);
242                    }
243                    catch (Exception e) {
244                            throw processException(e);
245                    }
246                    finally {
247                            closeSession(session);
248                    }
249    
250                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
251    
252                    EntityCacheUtil.removeResult(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
253                            UserTrackerImpl.class, userTracker.getPrimaryKey());
254    
255                    return userTracker;
256            }
257    
258            public UserTracker updateImpl(
259                    com.liferay.portal.model.UserTracker userTracker, boolean merge)
260                    throws SystemException {
261                    userTracker = toUnwrappedModel(userTracker);
262    
263                    Session session = null;
264    
265                    try {
266                            session = openSession();
267    
268                            BatchSessionUtil.update(session, userTracker, merge);
269    
270                            userTracker.setNew(false);
271                    }
272                    catch (Exception e) {
273                            throw processException(e);
274                    }
275                    finally {
276                            closeSession(session);
277                    }
278    
279                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
280    
281                    EntityCacheUtil.putResult(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
282                            UserTrackerImpl.class, userTracker.getPrimaryKey(), userTracker);
283    
284                    return userTracker;
285            }
286    
287            protected UserTracker toUnwrappedModel(UserTracker userTracker) {
288                    if (userTracker instanceof UserTrackerImpl) {
289                            return userTracker;
290                    }
291    
292                    UserTrackerImpl userTrackerImpl = new UserTrackerImpl();
293    
294                    userTrackerImpl.setNew(userTracker.isNew());
295                    userTrackerImpl.setPrimaryKey(userTracker.getPrimaryKey());
296    
297                    userTrackerImpl.setUserTrackerId(userTracker.getUserTrackerId());
298                    userTrackerImpl.setCompanyId(userTracker.getCompanyId());
299                    userTrackerImpl.setUserId(userTracker.getUserId());
300                    userTrackerImpl.setModifiedDate(userTracker.getModifiedDate());
301                    userTrackerImpl.setSessionId(userTracker.getSessionId());
302                    userTrackerImpl.setRemoteAddr(userTracker.getRemoteAddr());
303                    userTrackerImpl.setRemoteHost(userTracker.getRemoteHost());
304                    userTrackerImpl.setUserAgent(userTracker.getUserAgent());
305    
306                    return userTrackerImpl;
307            }
308    
309            /**
310             * Finds the user tracker with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
311             *
312             * @param primaryKey the primary key of the user tracker to find
313             * @return the user tracker
314             * @throws com.liferay.portal.NoSuchModelException if a user tracker with the primary key could not be found
315             * @throws SystemException if a system exception occurred
316             */
317            public UserTracker findByPrimaryKey(Serializable primaryKey)
318                    throws NoSuchModelException, SystemException {
319                    return findByPrimaryKey(((Long)primaryKey).longValue());
320            }
321    
322            /**
323             * Finds the user tracker with the primary key or throws a {@link com.liferay.portal.NoSuchUserTrackerException} if it could not be found.
324             *
325             * @param userTrackerId the primary key of the user tracker to find
326             * @return the user tracker
327             * @throws com.liferay.portal.NoSuchUserTrackerException if a user tracker with the primary key could not be found
328             * @throws SystemException if a system exception occurred
329             */
330            public UserTracker findByPrimaryKey(long userTrackerId)
331                    throws NoSuchUserTrackerException, SystemException {
332                    UserTracker userTracker = fetchByPrimaryKey(userTrackerId);
333    
334                    if (userTracker == null) {
335                            if (_log.isWarnEnabled()) {
336                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userTrackerId);
337                            }
338    
339                            throw new NoSuchUserTrackerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
340                                    userTrackerId);
341                    }
342    
343                    return userTracker;
344            }
345    
346            /**
347             * Finds the user tracker with the primary key or returns <code>null</code> if it could not be found.
348             *
349             * @param primaryKey the primary key of the user tracker to find
350             * @return the user tracker, or <code>null</code> if a user tracker with the primary key could not be found
351             * @throws SystemException if a system exception occurred
352             */
353            public UserTracker fetchByPrimaryKey(Serializable primaryKey)
354                    throws SystemException {
355                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
356            }
357    
358            /**
359             * Finds the user tracker with the primary key or returns <code>null</code> if it could not be found.
360             *
361             * @param userTrackerId the primary key of the user tracker to find
362             * @return the user tracker, or <code>null</code> if a user tracker with the primary key could not be found
363             * @throws SystemException if a system exception occurred
364             */
365            public UserTracker fetchByPrimaryKey(long userTrackerId)
366                    throws SystemException {
367                    UserTracker userTracker = (UserTracker)EntityCacheUtil.getResult(UserTrackerModelImpl.ENTITY_CACHE_ENABLED,
368                                    UserTrackerImpl.class, userTrackerId, this);
369    
370                    if (userTracker == null) {
371                            Session session = null;
372    
373                            try {
374                                    session = openSession();
375    
376                                    userTracker = (UserTracker)session.get(UserTrackerImpl.class,
377                                                    new Long(userTrackerId));
378                            }
379                            catch (Exception e) {
380                                    throw processException(e);
381                            }
382                            finally {
383                                    if (userTracker != null) {
384                                            cacheResult(userTracker);
385                                    }
386    
387                                    closeSession(session);
388                            }
389                    }
390    
391                    return userTracker;
392            }
393    
394            /**
395             * Finds all the user trackers where companyId = &#63;.
396             *
397             * @param companyId the company id to search with
398             * @return the matching user trackers
399             * @throws SystemException if a system exception occurred
400             */
401            public List<UserTracker> findByCompanyId(long companyId)
402                    throws SystemException {
403                    return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
404                            null);
405            }
406    
407            /**
408             * Finds a range of all the user trackers where companyId = &#63;.
409             *
410             * <p>
411             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
412             * </p>
413             *
414             * @param companyId the company id to search with
415             * @param start the lower bound of the range of user trackers to return
416             * @param end the upper bound of the range of user trackers to return (not inclusive)
417             * @return the range of matching user trackers
418             * @throws SystemException if a system exception occurred
419             */
420            public List<UserTracker> findByCompanyId(long companyId, int start, int end)
421                    throws SystemException {
422                    return findByCompanyId(companyId, start, end, null);
423            }
424    
425            /**
426             * Finds an ordered range of all the user trackers where companyId = &#63;.
427             *
428             * <p>
429             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
430             * </p>
431             *
432             * @param companyId the company id to search with
433             * @param start the lower bound of the range of user trackers to return
434             * @param end the upper bound of the range of user trackers to return (not inclusive)
435             * @param orderByComparator the comparator to order the results by
436             * @return the ordered range of matching user trackers
437             * @throws SystemException if a system exception occurred
438             */
439            public List<UserTracker> findByCompanyId(long companyId, int start,
440                    int end, OrderByComparator orderByComparator) throws SystemException {
441                    Object[] finderArgs = new Object[] {
442                                    companyId,
443                                    
444                                    String.valueOf(start), String.valueOf(end),
445                                    String.valueOf(orderByComparator)
446                            };
447    
448                    List<UserTracker> list = (List<UserTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
449                                    finderArgs, this);
450    
451                    if (list == null) {
452                            StringBundler query = null;
453    
454                            if (orderByComparator != null) {
455                                    query = new StringBundler(3 +
456                                                    (orderByComparator.getOrderByFields().length * 3));
457                            }
458                            else {
459                                    query = new StringBundler(2);
460                            }
461    
462                            query.append(_SQL_SELECT_USERTRACKER_WHERE);
463    
464                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
465    
466                            if (orderByComparator != null) {
467                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
468                                            orderByComparator);
469                            }
470    
471                            String sql = query.toString();
472    
473                            Session session = null;
474    
475                            try {
476                                    session = openSession();
477    
478                                    Query q = session.createQuery(sql);
479    
480                                    QueryPos qPos = QueryPos.getInstance(q);
481    
482                                    qPos.add(companyId);
483    
484                                    list = (List<UserTracker>)QueryUtil.list(q, getDialect(),
485                                                    start, end);
486                            }
487                            catch (Exception e) {
488                                    throw processException(e);
489                            }
490                            finally {
491                                    if (list == null) {
492                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_COMPANYID,
493                                                    finderArgs);
494                                    }
495                                    else {
496                                            cacheResult(list);
497    
498                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
499                                                    finderArgs, list);
500                                    }
501    
502                                    closeSession(session);
503                            }
504                    }
505    
506                    return list;
507            }
508    
509            /**
510             * Finds the first user tracker in the ordered set where companyId = &#63;.
511             *
512             * <p>
513             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
514             * </p>
515             *
516             * @param companyId the company id to search with
517             * @param orderByComparator the comparator to order the set by
518             * @return the first matching user tracker
519             * @throws com.liferay.portal.NoSuchUserTrackerException if a matching user tracker could not be found
520             * @throws SystemException if a system exception occurred
521             */
522            public UserTracker findByCompanyId_First(long companyId,
523                    OrderByComparator orderByComparator)
524                    throws NoSuchUserTrackerException, SystemException {
525                    List<UserTracker> list = findByCompanyId(companyId, 0, 1,
526                                    orderByComparator);
527    
528                    if (list.isEmpty()) {
529                            StringBundler msg = new StringBundler(4);
530    
531                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
532    
533                            msg.append("companyId=");
534                            msg.append(companyId);
535    
536                            msg.append(StringPool.CLOSE_CURLY_BRACE);
537    
538                            throw new NoSuchUserTrackerException(msg.toString());
539                    }
540                    else {
541                            return list.get(0);
542                    }
543            }
544    
545            /**
546             * Finds the last user tracker in the ordered set where companyId = &#63;.
547             *
548             * <p>
549             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
550             * </p>
551             *
552             * @param companyId the company id to search with
553             * @param orderByComparator the comparator to order the set by
554             * @return the last matching user tracker
555             * @throws com.liferay.portal.NoSuchUserTrackerException if a matching user tracker could not be found
556             * @throws SystemException if a system exception occurred
557             */
558            public UserTracker findByCompanyId_Last(long companyId,
559                    OrderByComparator orderByComparator)
560                    throws NoSuchUserTrackerException, SystemException {
561                    int count = countByCompanyId(companyId);
562    
563                    List<UserTracker> list = findByCompanyId(companyId, count - 1, count,
564                                    orderByComparator);
565    
566                    if (list.isEmpty()) {
567                            StringBundler msg = new StringBundler(4);
568    
569                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
570    
571                            msg.append("companyId=");
572                            msg.append(companyId);
573    
574                            msg.append(StringPool.CLOSE_CURLY_BRACE);
575    
576                            throw new NoSuchUserTrackerException(msg.toString());
577                    }
578                    else {
579                            return list.get(0);
580                    }
581            }
582    
583            /**
584             * Finds the user trackers before and after the current user tracker in the ordered set where companyId = &#63;.
585             *
586             * <p>
587             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
588             * </p>
589             *
590             * @param userTrackerId the primary key of the current user tracker
591             * @param companyId the company id to search with
592             * @param orderByComparator the comparator to order the set by
593             * @return the previous, current, and next user tracker
594             * @throws com.liferay.portal.NoSuchUserTrackerException if a user tracker with the primary key could not be found
595             * @throws SystemException if a system exception occurred
596             */
597            public UserTracker[] findByCompanyId_PrevAndNext(long userTrackerId,
598                    long companyId, OrderByComparator orderByComparator)
599                    throws NoSuchUserTrackerException, SystemException {
600                    UserTracker userTracker = findByPrimaryKey(userTrackerId);
601    
602                    Session session = null;
603    
604                    try {
605                            session = openSession();
606    
607                            UserTracker[] array = new UserTrackerImpl[3];
608    
609                            array[0] = getByCompanyId_PrevAndNext(session, userTracker,
610                                            companyId, orderByComparator, true);
611    
612                            array[1] = userTracker;
613    
614                            array[2] = getByCompanyId_PrevAndNext(session, userTracker,
615                                            companyId, orderByComparator, false);
616    
617                            return array;
618                    }
619                    catch (Exception e) {
620                            throw processException(e);
621                    }
622                    finally {
623                            closeSession(session);
624                    }
625            }
626    
627            protected UserTracker getByCompanyId_PrevAndNext(Session session,
628                    UserTracker userTracker, long companyId,
629                    OrderByComparator orderByComparator, boolean previous) {
630                    StringBundler query = null;
631    
632                    if (orderByComparator != null) {
633                            query = new StringBundler(6 +
634                                            (orderByComparator.getOrderByFields().length * 6));
635                    }
636                    else {
637                            query = new StringBundler(3);
638                    }
639    
640                    query.append(_SQL_SELECT_USERTRACKER_WHERE);
641    
642                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
643    
644                    if (orderByComparator != null) {
645                            String[] orderByFields = orderByComparator.getOrderByFields();
646    
647                            if (orderByFields.length > 0) {
648                                    query.append(WHERE_AND);
649                            }
650    
651                            for (int i = 0; i < orderByFields.length; i++) {
652                                    query.append(_ORDER_BY_ENTITY_ALIAS);
653                                    query.append(orderByFields[i]);
654    
655                                    if ((i + 1) < orderByFields.length) {
656                                            if (orderByComparator.isAscending() ^ previous) {
657                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
658                                            }
659                                            else {
660                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
661                                            }
662                                    }
663                                    else {
664                                            if (orderByComparator.isAscending() ^ previous) {
665                                                    query.append(WHERE_GREATER_THAN);
666                                            }
667                                            else {
668                                                    query.append(WHERE_LESSER_THAN);
669                                            }
670                                    }
671                            }
672    
673                            query.append(ORDER_BY_CLAUSE);
674    
675                            for (int i = 0; i < orderByFields.length; i++) {
676                                    query.append(_ORDER_BY_ENTITY_ALIAS);
677                                    query.append(orderByFields[i]);
678    
679                                    if ((i + 1) < orderByFields.length) {
680                                            if (orderByComparator.isAscending() ^ previous) {
681                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
682                                            }
683                                            else {
684                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
685                                            }
686                                    }
687                                    else {
688                                            if (orderByComparator.isAscending() ^ previous) {
689                                                    query.append(ORDER_BY_ASC);
690                                            }
691                                            else {
692                                                    query.append(ORDER_BY_DESC);
693                                            }
694                                    }
695                            }
696                    }
697    
698                    String sql = query.toString();
699    
700                    Query q = session.createQuery(sql);
701    
702                    q.setFirstResult(0);
703                    q.setMaxResults(2);
704    
705                    QueryPos qPos = QueryPos.getInstance(q);
706    
707                    qPos.add(companyId);
708    
709                    if (orderByComparator != null) {
710                            Object[] values = orderByComparator.getOrderByValues(userTracker);
711    
712                            for (Object value : values) {
713                                    qPos.add(value);
714                            }
715                    }
716    
717                    List<UserTracker> list = q.list();
718    
719                    if (list.size() == 2) {
720                            return list.get(1);
721                    }
722                    else {
723                            return null;
724                    }
725            }
726    
727            /**
728             * Finds all the user trackers where userId = &#63;.
729             *
730             * @param userId the user id to search with
731             * @return the matching user trackers
732             * @throws SystemException if a system exception occurred
733             */
734            public List<UserTracker> findByUserId(long userId)
735                    throws SystemException {
736                    return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
737            }
738    
739            /**
740             * Finds a range of all the user trackers where userId = &#63;.
741             *
742             * <p>
743             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
744             * </p>
745             *
746             * @param userId the user id to search with
747             * @param start the lower bound of the range of user trackers to return
748             * @param end the upper bound of the range of user trackers to return (not inclusive)
749             * @return the range of matching user trackers
750             * @throws SystemException if a system exception occurred
751             */
752            public List<UserTracker> findByUserId(long userId, int start, int end)
753                    throws SystemException {
754                    return findByUserId(userId, start, end, null);
755            }
756    
757            /**
758             * Finds an ordered range of all the user trackers where userId = &#63;.
759             *
760             * <p>
761             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
762             * </p>
763             *
764             * @param userId the user id to search with
765             * @param start the lower bound of the range of user trackers to return
766             * @param end the upper bound of the range of user trackers to return (not inclusive)
767             * @param orderByComparator the comparator to order the results by
768             * @return the ordered range of matching user trackers
769             * @throws SystemException if a system exception occurred
770             */
771            public List<UserTracker> findByUserId(long userId, int start, int end,
772                    OrderByComparator orderByComparator) throws SystemException {
773                    Object[] finderArgs = new Object[] {
774                                    userId,
775                                    
776                                    String.valueOf(start), String.valueOf(end),
777                                    String.valueOf(orderByComparator)
778                            };
779    
780                    List<UserTracker> list = (List<UserTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
781                                    finderArgs, this);
782    
783                    if (list == null) {
784                            StringBundler query = null;
785    
786                            if (orderByComparator != null) {
787                                    query = new StringBundler(3 +
788                                                    (orderByComparator.getOrderByFields().length * 3));
789                            }
790                            else {
791                                    query = new StringBundler(2);
792                            }
793    
794                            query.append(_SQL_SELECT_USERTRACKER_WHERE);
795    
796                            query.append(_FINDER_COLUMN_USERID_USERID_2);
797    
798                            if (orderByComparator != null) {
799                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
800                                            orderByComparator);
801                            }
802    
803                            String sql = query.toString();
804    
805                            Session session = null;
806    
807                            try {
808                                    session = openSession();
809    
810                                    Query q = session.createQuery(sql);
811    
812                                    QueryPos qPos = QueryPos.getInstance(q);
813    
814                                    qPos.add(userId);
815    
816                                    list = (List<UserTracker>)QueryUtil.list(q, getDialect(),
817                                                    start, end);
818                            }
819                            catch (Exception e) {
820                                    throw processException(e);
821                            }
822                            finally {
823                                    if (list == null) {
824                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_USERID,
825                                                    finderArgs);
826                                    }
827                                    else {
828                                            cacheResult(list);
829    
830                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
831                                                    finderArgs, list);
832                                    }
833    
834                                    closeSession(session);
835                            }
836                    }
837    
838                    return list;
839            }
840    
841            /**
842             * Finds the first user tracker in the ordered set where userId = &#63;.
843             *
844             * <p>
845             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
846             * </p>
847             *
848             * @param userId the user id to search with
849             * @param orderByComparator the comparator to order the set by
850             * @return the first matching user tracker
851             * @throws com.liferay.portal.NoSuchUserTrackerException if a matching user tracker could not be found
852             * @throws SystemException if a system exception occurred
853             */
854            public UserTracker findByUserId_First(long userId,
855                    OrderByComparator orderByComparator)
856                    throws NoSuchUserTrackerException, SystemException {
857                    List<UserTracker> list = findByUserId(userId, 0, 1, orderByComparator);
858    
859                    if (list.isEmpty()) {
860                            StringBundler msg = new StringBundler(4);
861    
862                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
863    
864                            msg.append("userId=");
865                            msg.append(userId);
866    
867                            msg.append(StringPool.CLOSE_CURLY_BRACE);
868    
869                            throw new NoSuchUserTrackerException(msg.toString());
870                    }
871                    else {
872                            return list.get(0);
873                    }
874            }
875    
876            /**
877             * Finds the last user tracker in the ordered set where userId = &#63;.
878             *
879             * <p>
880             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
881             * </p>
882             *
883             * @param userId the user id to search with
884             * @param orderByComparator the comparator to order the set by
885             * @return the last matching user tracker
886             * @throws com.liferay.portal.NoSuchUserTrackerException if a matching user tracker could not be found
887             * @throws SystemException if a system exception occurred
888             */
889            public UserTracker findByUserId_Last(long userId,
890                    OrderByComparator orderByComparator)
891                    throws NoSuchUserTrackerException, SystemException {
892                    int count = countByUserId(userId);
893    
894                    List<UserTracker> list = findByUserId(userId, count - 1, count,
895                                    orderByComparator);
896    
897                    if (list.isEmpty()) {
898                            StringBundler msg = new StringBundler(4);
899    
900                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
901    
902                            msg.append("userId=");
903                            msg.append(userId);
904    
905                            msg.append(StringPool.CLOSE_CURLY_BRACE);
906    
907                            throw new NoSuchUserTrackerException(msg.toString());
908                    }
909                    else {
910                            return list.get(0);
911                    }
912            }
913    
914            /**
915             * Finds the user trackers before and after the current user tracker in the ordered set where userId = &#63;.
916             *
917             * <p>
918             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
919             * </p>
920             *
921             * @param userTrackerId the primary key of the current user tracker
922             * @param userId the user id to search with
923             * @param orderByComparator the comparator to order the set by
924             * @return the previous, current, and next user tracker
925             * @throws com.liferay.portal.NoSuchUserTrackerException if a user tracker with the primary key could not be found
926             * @throws SystemException if a system exception occurred
927             */
928            public UserTracker[] findByUserId_PrevAndNext(long userTrackerId,
929                    long userId, OrderByComparator orderByComparator)
930                    throws NoSuchUserTrackerException, SystemException {
931                    UserTracker userTracker = findByPrimaryKey(userTrackerId);
932    
933                    Session session = null;
934    
935                    try {
936                            session = openSession();
937    
938                            UserTracker[] array = new UserTrackerImpl[3];
939    
940                            array[0] = getByUserId_PrevAndNext(session, userTracker, userId,
941                                            orderByComparator, true);
942    
943                            array[1] = userTracker;
944    
945                            array[2] = getByUserId_PrevAndNext(session, userTracker, userId,
946                                            orderByComparator, false);
947    
948                            return array;
949                    }
950                    catch (Exception e) {
951                            throw processException(e);
952                    }
953                    finally {
954                            closeSession(session);
955                    }
956            }
957    
958            protected UserTracker getByUserId_PrevAndNext(Session session,
959                    UserTracker userTracker, long userId,
960                    OrderByComparator orderByComparator, boolean previous) {
961                    StringBundler query = null;
962    
963                    if (orderByComparator != null) {
964                            query = new StringBundler(6 +
965                                            (orderByComparator.getOrderByFields().length * 6));
966                    }
967                    else {
968                            query = new StringBundler(3);
969                    }
970    
971                    query.append(_SQL_SELECT_USERTRACKER_WHERE);
972    
973                    query.append(_FINDER_COLUMN_USERID_USERID_2);
974    
975                    if (orderByComparator != null) {
976                            String[] orderByFields = orderByComparator.getOrderByFields();
977    
978                            if (orderByFields.length > 0) {
979                                    query.append(WHERE_AND);
980                            }
981    
982                            for (int i = 0; i < orderByFields.length; i++) {
983                                    query.append(_ORDER_BY_ENTITY_ALIAS);
984                                    query.append(orderByFields[i]);
985    
986                                    if ((i + 1) < orderByFields.length) {
987                                            if (orderByComparator.isAscending() ^ previous) {
988                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
989                                            }
990                                            else {
991                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
992                                            }
993                                    }
994                                    else {
995                                            if (orderByComparator.isAscending() ^ previous) {
996                                                    query.append(WHERE_GREATER_THAN);
997                                            }
998                                            else {
999                                                    query.append(WHERE_LESSER_THAN);
1000                                            }
1001                                    }
1002                            }
1003    
1004                            query.append(ORDER_BY_CLAUSE);
1005    
1006                            for (int i = 0; i < orderByFields.length; i++) {
1007                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1008                                    query.append(orderByFields[i]);
1009    
1010                                    if ((i + 1) < orderByFields.length) {
1011                                            if (orderByComparator.isAscending() ^ previous) {
1012                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1013                                            }
1014                                            else {
1015                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1016                                            }
1017                                    }
1018                                    else {
1019                                            if (orderByComparator.isAscending() ^ previous) {
1020                                                    query.append(ORDER_BY_ASC);
1021                                            }
1022                                            else {
1023                                                    query.append(ORDER_BY_DESC);
1024                                            }
1025                                    }
1026                            }
1027                    }
1028    
1029                    String sql = query.toString();
1030    
1031                    Query q = session.createQuery(sql);
1032    
1033                    q.setFirstResult(0);
1034                    q.setMaxResults(2);
1035    
1036                    QueryPos qPos = QueryPos.getInstance(q);
1037    
1038                    qPos.add(userId);
1039    
1040                    if (orderByComparator != null) {
1041                            Object[] values = orderByComparator.getOrderByValues(userTracker);
1042    
1043                            for (Object value : values) {
1044                                    qPos.add(value);
1045                            }
1046                    }
1047    
1048                    List<UserTracker> list = q.list();
1049    
1050                    if (list.size() == 2) {
1051                            return list.get(1);
1052                    }
1053                    else {
1054                            return null;
1055                    }
1056            }
1057    
1058            /**
1059             * Finds all the user trackers where sessionId = &#63;.
1060             *
1061             * @param sessionId the session id to search with
1062             * @return the matching user trackers
1063             * @throws SystemException if a system exception occurred
1064             */
1065            public List<UserTracker> findBySessionId(String sessionId)
1066                    throws SystemException {
1067                    return findBySessionId(sessionId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1068                            null);
1069            }
1070    
1071            /**
1072             * Finds a range of all the user trackers where sessionId = &#63;.
1073             *
1074             * <p>
1075             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1076             * </p>
1077             *
1078             * @param sessionId the session id to search with
1079             * @param start the lower bound of the range of user trackers to return
1080             * @param end the upper bound of the range of user trackers to return (not inclusive)
1081             * @return the range of matching user trackers
1082             * @throws SystemException if a system exception occurred
1083             */
1084            public List<UserTracker> findBySessionId(String sessionId, int start,
1085                    int end) throws SystemException {
1086                    return findBySessionId(sessionId, start, end, null);
1087            }
1088    
1089            /**
1090             * Finds an ordered range of all the user trackers where sessionId = &#63;.
1091             *
1092             * <p>
1093             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1094             * </p>
1095             *
1096             * @param sessionId the session id to search with
1097             * @param start the lower bound of the range of user trackers to return
1098             * @param end the upper bound of the range of user trackers to return (not inclusive)
1099             * @param orderByComparator the comparator to order the results by
1100             * @return the ordered range of matching user trackers
1101             * @throws SystemException if a system exception occurred
1102             */
1103            public List<UserTracker> findBySessionId(String sessionId, int start,
1104                    int end, OrderByComparator orderByComparator) throws SystemException {
1105                    Object[] finderArgs = new Object[] {
1106                                    sessionId,
1107                                    
1108                                    String.valueOf(start), String.valueOf(end),
1109                                    String.valueOf(orderByComparator)
1110                            };
1111    
1112                    List<UserTracker> list = (List<UserTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_SESSIONID,
1113                                    finderArgs, this);
1114    
1115                    if (list == null) {
1116                            StringBundler query = null;
1117    
1118                            if (orderByComparator != null) {
1119                                    query = new StringBundler(3 +
1120                                                    (orderByComparator.getOrderByFields().length * 3));
1121                            }
1122                            else {
1123                                    query = new StringBundler(2);
1124                            }
1125    
1126                            query.append(_SQL_SELECT_USERTRACKER_WHERE);
1127    
1128                            if (sessionId == null) {
1129                                    query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_1);
1130                            }
1131                            else {
1132                                    if (sessionId.equals(StringPool.BLANK)) {
1133                                            query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_3);
1134                                    }
1135                                    else {
1136                                            query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_2);
1137                                    }
1138                            }
1139    
1140                            if (orderByComparator != null) {
1141                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1142                                            orderByComparator);
1143                            }
1144    
1145                            String sql = query.toString();
1146    
1147                            Session session = null;
1148    
1149                            try {
1150                                    session = openSession();
1151    
1152                                    Query q = session.createQuery(sql);
1153    
1154                                    QueryPos qPos = QueryPos.getInstance(q);
1155    
1156                                    if (sessionId != null) {
1157                                            qPos.add(sessionId);
1158                                    }
1159    
1160                                    list = (List<UserTracker>)QueryUtil.list(q, getDialect(),
1161                                                    start, end);
1162                            }
1163                            catch (Exception e) {
1164                                    throw processException(e);
1165                            }
1166                            finally {
1167                                    if (list == null) {
1168                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_SESSIONID,
1169                                                    finderArgs);
1170                                    }
1171                                    else {
1172                                            cacheResult(list);
1173    
1174                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_SESSIONID,
1175                                                    finderArgs, list);
1176                                    }
1177    
1178                                    closeSession(session);
1179                            }
1180                    }
1181    
1182                    return list;
1183            }
1184    
1185            /**
1186             * Finds the first user tracker in the ordered set where sessionId = &#63;.
1187             *
1188             * <p>
1189             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1190             * </p>
1191             *
1192             * @param sessionId the session id to search with
1193             * @param orderByComparator the comparator to order the set by
1194             * @return the first matching user tracker
1195             * @throws com.liferay.portal.NoSuchUserTrackerException if a matching user tracker could not be found
1196             * @throws SystemException if a system exception occurred
1197             */
1198            public UserTracker findBySessionId_First(String sessionId,
1199                    OrderByComparator orderByComparator)
1200                    throws NoSuchUserTrackerException, SystemException {
1201                    List<UserTracker> list = findBySessionId(sessionId, 0, 1,
1202                                    orderByComparator);
1203    
1204                    if (list.isEmpty()) {
1205                            StringBundler msg = new StringBundler(4);
1206    
1207                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1208    
1209                            msg.append("sessionId=");
1210                            msg.append(sessionId);
1211    
1212                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1213    
1214                            throw new NoSuchUserTrackerException(msg.toString());
1215                    }
1216                    else {
1217                            return list.get(0);
1218                    }
1219            }
1220    
1221            /**
1222             * Finds the last user tracker in the ordered set where sessionId = &#63;.
1223             *
1224             * <p>
1225             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1226             * </p>
1227             *
1228             * @param sessionId the session id to search with
1229             * @param orderByComparator the comparator to order the set by
1230             * @return the last matching user tracker
1231             * @throws com.liferay.portal.NoSuchUserTrackerException if a matching user tracker could not be found
1232             * @throws SystemException if a system exception occurred
1233             */
1234            public UserTracker findBySessionId_Last(String sessionId,
1235                    OrderByComparator orderByComparator)
1236                    throws NoSuchUserTrackerException, SystemException {
1237                    int count = countBySessionId(sessionId);
1238    
1239                    List<UserTracker> list = findBySessionId(sessionId, count - 1, count,
1240                                    orderByComparator);
1241    
1242                    if (list.isEmpty()) {
1243                            StringBundler msg = new StringBundler(4);
1244    
1245                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1246    
1247                            msg.append("sessionId=");
1248                            msg.append(sessionId);
1249    
1250                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1251    
1252                            throw new NoSuchUserTrackerException(msg.toString());
1253                    }
1254                    else {
1255                            return list.get(0);
1256                    }
1257            }
1258    
1259            /**
1260             * Finds the user trackers before and after the current user tracker in the ordered set where sessionId = &#63;.
1261             *
1262             * <p>
1263             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1264             * </p>
1265             *
1266             * @param userTrackerId the primary key of the current user tracker
1267             * @param sessionId the session id to search with
1268             * @param orderByComparator the comparator to order the set by
1269             * @return the previous, current, and next user tracker
1270             * @throws com.liferay.portal.NoSuchUserTrackerException if a user tracker with the primary key could not be found
1271             * @throws SystemException if a system exception occurred
1272             */
1273            public UserTracker[] findBySessionId_PrevAndNext(long userTrackerId,
1274                    String sessionId, OrderByComparator orderByComparator)
1275                    throws NoSuchUserTrackerException, SystemException {
1276                    UserTracker userTracker = findByPrimaryKey(userTrackerId);
1277    
1278                    Session session = null;
1279    
1280                    try {
1281                            session = openSession();
1282    
1283                            UserTracker[] array = new UserTrackerImpl[3];
1284    
1285                            array[0] = getBySessionId_PrevAndNext(session, userTracker,
1286                                            sessionId, orderByComparator, true);
1287    
1288                            array[1] = userTracker;
1289    
1290                            array[2] = getBySessionId_PrevAndNext(session, userTracker,
1291                                            sessionId, orderByComparator, false);
1292    
1293                            return array;
1294                    }
1295                    catch (Exception e) {
1296                            throw processException(e);
1297                    }
1298                    finally {
1299                            closeSession(session);
1300                    }
1301            }
1302    
1303            protected UserTracker getBySessionId_PrevAndNext(Session session,
1304                    UserTracker userTracker, String sessionId,
1305                    OrderByComparator orderByComparator, boolean previous) {
1306                    StringBundler query = null;
1307    
1308                    if (orderByComparator != null) {
1309                            query = new StringBundler(6 +
1310                                            (orderByComparator.getOrderByFields().length * 6));
1311                    }
1312                    else {
1313                            query = new StringBundler(3);
1314                    }
1315    
1316                    query.append(_SQL_SELECT_USERTRACKER_WHERE);
1317    
1318                    if (sessionId == null) {
1319                            query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_1);
1320                    }
1321                    else {
1322                            if (sessionId.equals(StringPool.BLANK)) {
1323                                    query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_3);
1324                            }
1325                            else {
1326                                    query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_2);
1327                            }
1328                    }
1329    
1330                    if (orderByComparator != null) {
1331                            String[] orderByFields = orderByComparator.getOrderByFields();
1332    
1333                            if (orderByFields.length > 0) {
1334                                    query.append(WHERE_AND);
1335                            }
1336    
1337                            for (int i = 0; i < orderByFields.length; i++) {
1338                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1339                                    query.append(orderByFields[i]);
1340    
1341                                    if ((i + 1) < orderByFields.length) {
1342                                            if (orderByComparator.isAscending() ^ previous) {
1343                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1344                                            }
1345                                            else {
1346                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1347                                            }
1348                                    }
1349                                    else {
1350                                            if (orderByComparator.isAscending() ^ previous) {
1351                                                    query.append(WHERE_GREATER_THAN);
1352                                            }
1353                                            else {
1354                                                    query.append(WHERE_LESSER_THAN);
1355                                            }
1356                                    }
1357                            }
1358    
1359                            query.append(ORDER_BY_CLAUSE);
1360    
1361                            for (int i = 0; i < orderByFields.length; i++) {
1362                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1363                                    query.append(orderByFields[i]);
1364    
1365                                    if ((i + 1) < orderByFields.length) {
1366                                            if (orderByComparator.isAscending() ^ previous) {
1367                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1368                                            }
1369                                            else {
1370                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1371                                            }
1372                                    }
1373                                    else {
1374                                            if (orderByComparator.isAscending() ^ previous) {
1375                                                    query.append(ORDER_BY_ASC);
1376                                            }
1377                                            else {
1378                                                    query.append(ORDER_BY_DESC);
1379                                            }
1380                                    }
1381                            }
1382                    }
1383    
1384                    String sql = query.toString();
1385    
1386                    Query q = session.createQuery(sql);
1387    
1388                    q.setFirstResult(0);
1389                    q.setMaxResults(2);
1390    
1391                    QueryPos qPos = QueryPos.getInstance(q);
1392    
1393                    if (sessionId != null) {
1394                            qPos.add(sessionId);
1395                    }
1396    
1397                    if (orderByComparator != null) {
1398                            Object[] values = orderByComparator.getOrderByValues(userTracker);
1399    
1400                            for (Object value : values) {
1401                                    qPos.add(value);
1402                            }
1403                    }
1404    
1405                    List<UserTracker> list = q.list();
1406    
1407                    if (list.size() == 2) {
1408                            return list.get(1);
1409                    }
1410                    else {
1411                            return null;
1412                    }
1413            }
1414    
1415            /**
1416             * Finds all the user trackers.
1417             *
1418             * @return the user trackers
1419             * @throws SystemException if a system exception occurred
1420             */
1421            public List<UserTracker> findAll() throws SystemException {
1422                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1423            }
1424    
1425            /**
1426             * Finds a range of all the user trackers.
1427             *
1428             * <p>
1429             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1430             * </p>
1431             *
1432             * @param start the lower bound of the range of user trackers to return
1433             * @param end the upper bound of the range of user trackers to return (not inclusive)
1434             * @return the range of user trackers
1435             * @throws SystemException if a system exception occurred
1436             */
1437            public List<UserTracker> findAll(int start, int end)
1438                    throws SystemException {
1439                    return findAll(start, end, null);
1440            }
1441    
1442            /**
1443             * Finds an ordered range of all the user trackers.
1444             *
1445             * <p>
1446             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1447             * </p>
1448             *
1449             * @param start the lower bound of the range of user trackers to return
1450             * @param end the upper bound of the range of user trackers to return (not inclusive)
1451             * @param orderByComparator the comparator to order the results by
1452             * @return the ordered range of user trackers
1453             * @throws SystemException if a system exception occurred
1454             */
1455            public List<UserTracker> findAll(int start, int end,
1456                    OrderByComparator orderByComparator) throws SystemException {
1457                    Object[] finderArgs = new Object[] {
1458                                    String.valueOf(start), String.valueOf(end),
1459                                    String.valueOf(orderByComparator)
1460                            };
1461    
1462                    List<UserTracker> list = (List<UserTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1463                                    finderArgs, this);
1464    
1465                    if (list == null) {
1466                            StringBundler query = null;
1467                            String sql = null;
1468    
1469                            if (orderByComparator != null) {
1470                                    query = new StringBundler(2 +
1471                                                    (orderByComparator.getOrderByFields().length * 3));
1472    
1473                                    query.append(_SQL_SELECT_USERTRACKER);
1474    
1475                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1476                                            orderByComparator);
1477    
1478                                    sql = query.toString();
1479                            }
1480                            else {
1481                                    sql = _SQL_SELECT_USERTRACKER;
1482                            }
1483    
1484                            Session session = null;
1485    
1486                            try {
1487                                    session = openSession();
1488    
1489                                    Query q = session.createQuery(sql);
1490    
1491                                    if (orderByComparator == null) {
1492                                            list = (List<UserTracker>)QueryUtil.list(q, getDialect(),
1493                                                            start, end, false);
1494    
1495                                            Collections.sort(list);
1496                                    }
1497                                    else {
1498                                            list = (List<UserTracker>)QueryUtil.list(q, getDialect(),
1499                                                            start, end);
1500                                    }
1501                            }
1502                            catch (Exception e) {
1503                                    throw processException(e);
1504                            }
1505                            finally {
1506                                    if (list == null) {
1507                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
1508                                                    finderArgs);
1509                                    }
1510                                    else {
1511                                            cacheResult(list);
1512    
1513                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
1514                                                    list);
1515                                    }
1516    
1517                                    closeSession(session);
1518                            }
1519                    }
1520    
1521                    return list;
1522            }
1523    
1524            /**
1525             * Removes all the user trackers where companyId = &#63; from the database.
1526             *
1527             * @param companyId the company id to search with
1528             * @throws SystemException if a system exception occurred
1529             */
1530            public void removeByCompanyId(long companyId) throws SystemException {
1531                    for (UserTracker userTracker : findByCompanyId(companyId)) {
1532                            remove(userTracker);
1533                    }
1534            }
1535    
1536            /**
1537             * Removes all the user trackers where userId = &#63; from the database.
1538             *
1539             * @param userId the user id to search with
1540             * @throws SystemException if a system exception occurred
1541             */
1542            public void removeByUserId(long userId) throws SystemException {
1543                    for (UserTracker userTracker : findByUserId(userId)) {
1544                            remove(userTracker);
1545                    }
1546            }
1547    
1548            /**
1549             * Removes all the user trackers where sessionId = &#63; from the database.
1550             *
1551             * @param sessionId the session id to search with
1552             * @throws SystemException if a system exception occurred
1553             */
1554            public void removeBySessionId(String sessionId) throws SystemException {
1555                    for (UserTracker userTracker : findBySessionId(sessionId)) {
1556                            remove(userTracker);
1557                    }
1558            }
1559    
1560            /**
1561             * Removes all the user trackers from the database.
1562             *
1563             * @throws SystemException if a system exception occurred
1564             */
1565            public void removeAll() throws SystemException {
1566                    for (UserTracker userTracker : findAll()) {
1567                            remove(userTracker);
1568                    }
1569            }
1570    
1571            /**
1572             * Counts all the user trackers where companyId = &#63;.
1573             *
1574             * @param companyId the company id to search with
1575             * @return the number of matching user trackers
1576             * @throws SystemException if a system exception occurred
1577             */
1578            public int countByCompanyId(long companyId) throws SystemException {
1579                    Object[] finderArgs = new Object[] { companyId };
1580    
1581                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1582                                    finderArgs, this);
1583    
1584                    if (count == null) {
1585                            StringBundler query = new StringBundler(2);
1586    
1587                            query.append(_SQL_COUNT_USERTRACKER_WHERE);
1588    
1589                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1590    
1591                            String sql = query.toString();
1592    
1593                            Session session = null;
1594    
1595                            try {
1596                                    session = openSession();
1597    
1598                                    Query q = session.createQuery(sql);
1599    
1600                                    QueryPos qPos = QueryPos.getInstance(q);
1601    
1602                                    qPos.add(companyId);
1603    
1604                                    count = (Long)q.uniqueResult();
1605                            }
1606                            catch (Exception e) {
1607                                    throw processException(e);
1608                            }
1609                            finally {
1610                                    if (count == null) {
1611                                            count = Long.valueOf(0);
1612                                    }
1613    
1614                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1615                                            finderArgs, count);
1616    
1617                                    closeSession(session);
1618                            }
1619                    }
1620    
1621                    return count.intValue();
1622            }
1623    
1624            /**
1625             * Counts all the user trackers where userId = &#63;.
1626             *
1627             * @param userId the user id to search with
1628             * @return the number of matching user trackers
1629             * @throws SystemException if a system exception occurred
1630             */
1631            public int countByUserId(long userId) throws SystemException {
1632                    Object[] finderArgs = new Object[] { userId };
1633    
1634                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
1635                                    finderArgs, this);
1636    
1637                    if (count == null) {
1638                            StringBundler query = new StringBundler(2);
1639    
1640                            query.append(_SQL_COUNT_USERTRACKER_WHERE);
1641    
1642                            query.append(_FINDER_COLUMN_USERID_USERID_2);
1643    
1644                            String sql = query.toString();
1645    
1646                            Session session = null;
1647    
1648                            try {
1649                                    session = openSession();
1650    
1651                                    Query q = session.createQuery(sql);
1652    
1653                                    QueryPos qPos = QueryPos.getInstance(q);
1654    
1655                                    qPos.add(userId);
1656    
1657                                    count = (Long)q.uniqueResult();
1658                            }
1659                            catch (Exception e) {
1660                                    throw processException(e);
1661                            }
1662                            finally {
1663                                    if (count == null) {
1664                                            count = Long.valueOf(0);
1665                                    }
1666    
1667                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
1668                                            finderArgs, count);
1669    
1670                                    closeSession(session);
1671                            }
1672                    }
1673    
1674                    return count.intValue();
1675            }
1676    
1677            /**
1678             * Counts all the user trackers where sessionId = &#63;.
1679             *
1680             * @param sessionId the session id to search with
1681             * @return the number of matching user trackers
1682             * @throws SystemException if a system exception occurred
1683             */
1684            public int countBySessionId(String sessionId) throws SystemException {
1685                    Object[] finderArgs = new Object[] { sessionId };
1686    
1687                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SESSIONID,
1688                                    finderArgs, this);
1689    
1690                    if (count == null) {
1691                            StringBundler query = new StringBundler(2);
1692    
1693                            query.append(_SQL_COUNT_USERTRACKER_WHERE);
1694    
1695                            if (sessionId == null) {
1696                                    query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_1);
1697                            }
1698                            else {
1699                                    if (sessionId.equals(StringPool.BLANK)) {
1700                                            query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_3);
1701                                    }
1702                                    else {
1703                                            query.append(_FINDER_COLUMN_SESSIONID_SESSIONID_2);
1704                                    }
1705                            }
1706    
1707                            String sql = query.toString();
1708    
1709                            Session session = null;
1710    
1711                            try {
1712                                    session = openSession();
1713    
1714                                    Query q = session.createQuery(sql);
1715    
1716                                    QueryPos qPos = QueryPos.getInstance(q);
1717    
1718                                    if (sessionId != null) {
1719                                            qPos.add(sessionId);
1720                                    }
1721    
1722                                    count = (Long)q.uniqueResult();
1723                            }
1724                            catch (Exception e) {
1725                                    throw processException(e);
1726                            }
1727                            finally {
1728                                    if (count == null) {
1729                                            count = Long.valueOf(0);
1730                                    }
1731    
1732                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SESSIONID,
1733                                            finderArgs, count);
1734    
1735                                    closeSession(session);
1736                            }
1737                    }
1738    
1739                    return count.intValue();
1740            }
1741    
1742            /**
1743             * Counts all the user trackers.
1744             *
1745             * @return the number of user trackers
1746             * @throws SystemException if a system exception occurred
1747             */
1748            public int countAll() throws SystemException {
1749                    Object[] finderArgs = new Object[0];
1750    
1751                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1752                                    finderArgs, this);
1753    
1754                    if (count == null) {
1755                            Session session = null;
1756    
1757                            try {
1758                                    session = openSession();
1759    
1760                                    Query q = session.createQuery(_SQL_COUNT_USERTRACKER);
1761    
1762                                    count = (Long)q.uniqueResult();
1763                            }
1764                            catch (Exception e) {
1765                                    throw processException(e);
1766                            }
1767                            finally {
1768                                    if (count == null) {
1769                                            count = Long.valueOf(0);
1770                                    }
1771    
1772                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1773                                            count);
1774    
1775                                    closeSession(session);
1776                            }
1777                    }
1778    
1779                    return count.intValue();
1780            }
1781    
1782            /**
1783             * Initializes the user tracker persistence.
1784             */
1785            public void afterPropertiesSet() {
1786                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1787                                            com.liferay.portal.util.PropsUtil.get(
1788                                                    "value.object.listener.com.liferay.portal.model.UserTracker")));
1789    
1790                    if (listenerClassNames.length > 0) {
1791                            try {
1792                                    List<ModelListener<UserTracker>> listenersList = new ArrayList<ModelListener<UserTracker>>();
1793    
1794                                    for (String listenerClassName : listenerClassNames) {
1795                                            listenersList.add((ModelListener<UserTracker>)InstanceFactory.newInstance(
1796                                                            listenerClassName));
1797                                    }
1798    
1799                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1800                            }
1801                            catch (Exception e) {
1802                                    _log.error(e);
1803                            }
1804                    }
1805            }
1806    
1807            public void destroy() {
1808                    EntityCacheUtil.removeCache(UserTrackerImpl.class.getName());
1809                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1810                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
1811            }
1812    
1813            @BeanReference(type = AccountPersistence.class)
1814            protected AccountPersistence accountPersistence;
1815            @BeanReference(type = AddressPersistence.class)
1816            protected AddressPersistence addressPersistence;
1817            @BeanReference(type = BrowserTrackerPersistence.class)
1818            protected BrowserTrackerPersistence browserTrackerPersistence;
1819            @BeanReference(type = ClassNamePersistence.class)
1820            protected ClassNamePersistence classNamePersistence;
1821            @BeanReference(type = ClusterGroupPersistence.class)
1822            protected ClusterGroupPersistence clusterGroupPersistence;
1823            @BeanReference(type = CompanyPersistence.class)
1824            protected CompanyPersistence companyPersistence;
1825            @BeanReference(type = ContactPersistence.class)
1826            protected ContactPersistence contactPersistence;
1827            @BeanReference(type = CountryPersistence.class)
1828            protected CountryPersistence countryPersistence;
1829            @BeanReference(type = EmailAddressPersistence.class)
1830            protected EmailAddressPersistence emailAddressPersistence;
1831            @BeanReference(type = GroupPersistence.class)
1832            protected GroupPersistence groupPersistence;
1833            @BeanReference(type = ImagePersistence.class)
1834            protected ImagePersistence imagePersistence;
1835            @BeanReference(type = LayoutPersistence.class)
1836            protected LayoutPersistence layoutPersistence;
1837            @BeanReference(type = LayoutPrototypePersistence.class)
1838            protected LayoutPrototypePersistence layoutPrototypePersistence;
1839            @BeanReference(type = LayoutSetPersistence.class)
1840            protected LayoutSetPersistence layoutSetPersistence;
1841            @BeanReference(type = LayoutSetPrototypePersistence.class)
1842            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1843            @BeanReference(type = ListTypePersistence.class)
1844            protected ListTypePersistence listTypePersistence;
1845            @BeanReference(type = LockPersistence.class)
1846            protected LockPersistence lockPersistence;
1847            @BeanReference(type = MembershipRequestPersistence.class)
1848            protected MembershipRequestPersistence membershipRequestPersistence;
1849            @BeanReference(type = OrganizationPersistence.class)
1850            protected OrganizationPersistence organizationPersistence;
1851            @BeanReference(type = OrgGroupPermissionPersistence.class)
1852            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1853            @BeanReference(type = OrgGroupRolePersistence.class)
1854            protected OrgGroupRolePersistence orgGroupRolePersistence;
1855            @BeanReference(type = OrgLaborPersistence.class)
1856            protected OrgLaborPersistence orgLaborPersistence;
1857            @BeanReference(type = PasswordPolicyPersistence.class)
1858            protected PasswordPolicyPersistence passwordPolicyPersistence;
1859            @BeanReference(type = PasswordPolicyRelPersistence.class)
1860            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1861            @BeanReference(type = PasswordTrackerPersistence.class)
1862            protected PasswordTrackerPersistence passwordTrackerPersistence;
1863            @BeanReference(type = PermissionPersistence.class)
1864            protected PermissionPersistence permissionPersistence;
1865            @BeanReference(type = PhonePersistence.class)
1866            protected PhonePersistence phonePersistence;
1867            @BeanReference(type = PluginSettingPersistence.class)
1868            protected PluginSettingPersistence pluginSettingPersistence;
1869            @BeanReference(type = PortletPersistence.class)
1870            protected PortletPersistence portletPersistence;
1871            @BeanReference(type = PortletItemPersistence.class)
1872            protected PortletItemPersistence portletItemPersistence;
1873            @BeanReference(type = PortletPreferencesPersistence.class)
1874            protected PortletPreferencesPersistence portletPreferencesPersistence;
1875            @BeanReference(type = RegionPersistence.class)
1876            protected RegionPersistence regionPersistence;
1877            @BeanReference(type = ReleasePersistence.class)
1878            protected ReleasePersistence releasePersistence;
1879            @BeanReference(type = ResourcePersistence.class)
1880            protected ResourcePersistence resourcePersistence;
1881            @BeanReference(type = ResourceActionPersistence.class)
1882            protected ResourceActionPersistence resourceActionPersistence;
1883            @BeanReference(type = ResourceCodePersistence.class)
1884            protected ResourceCodePersistence resourceCodePersistence;
1885            @BeanReference(type = ResourcePermissionPersistence.class)
1886            protected ResourcePermissionPersistence resourcePermissionPersistence;
1887            @BeanReference(type = RolePersistence.class)
1888            protected RolePersistence rolePersistence;
1889            @BeanReference(type = ServiceComponentPersistence.class)
1890            protected ServiceComponentPersistence serviceComponentPersistence;
1891            @BeanReference(type = ShardPersistence.class)
1892            protected ShardPersistence shardPersistence;
1893            @BeanReference(type = SubscriptionPersistence.class)
1894            protected SubscriptionPersistence subscriptionPersistence;
1895            @BeanReference(type = TicketPersistence.class)
1896            protected TicketPersistence ticketPersistence;
1897            @BeanReference(type = TeamPersistence.class)
1898            protected TeamPersistence teamPersistence;
1899            @BeanReference(type = UserPersistence.class)
1900            protected UserPersistence userPersistence;
1901            @BeanReference(type = UserGroupPersistence.class)
1902            protected UserGroupPersistence userGroupPersistence;
1903            @BeanReference(type = UserGroupGroupRolePersistence.class)
1904            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1905            @BeanReference(type = UserGroupRolePersistence.class)
1906            protected UserGroupRolePersistence userGroupRolePersistence;
1907            @BeanReference(type = UserIdMapperPersistence.class)
1908            protected UserIdMapperPersistence userIdMapperPersistence;
1909            @BeanReference(type = UserTrackerPersistence.class)
1910            protected UserTrackerPersistence userTrackerPersistence;
1911            @BeanReference(type = UserTrackerPathPersistence.class)
1912            protected UserTrackerPathPersistence userTrackerPathPersistence;
1913            @BeanReference(type = WebDAVPropsPersistence.class)
1914            protected WebDAVPropsPersistence webDAVPropsPersistence;
1915            @BeanReference(type = WebsitePersistence.class)
1916            protected WebsitePersistence websitePersistence;
1917            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1918            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1919            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1920            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1921            private static final String _SQL_SELECT_USERTRACKER = "SELECT userTracker FROM UserTracker userTracker";
1922            private static final String _SQL_SELECT_USERTRACKER_WHERE = "SELECT userTracker FROM UserTracker userTracker WHERE ";
1923            private static final String _SQL_COUNT_USERTRACKER = "SELECT COUNT(userTracker) FROM UserTracker userTracker";
1924            private static final String _SQL_COUNT_USERTRACKER_WHERE = "SELECT COUNT(userTracker) FROM UserTracker userTracker WHERE ";
1925            private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "userTracker.companyId = ?";
1926            private static final String _FINDER_COLUMN_USERID_USERID_2 = "userTracker.userId = ?";
1927            private static final String _FINDER_COLUMN_SESSIONID_SESSIONID_1 = "userTracker.sessionId IS NULL";
1928            private static final String _FINDER_COLUMN_SESSIONID_SESSIONID_2 = "userTracker.sessionId = ?";
1929            private static final String _FINDER_COLUMN_SESSIONID_SESSIONID_3 = "(userTracker.sessionId IS NULL OR userTracker.sessionId = ?)";
1930            private static final String _ORDER_BY_ENTITY_ALIAS = "userTracker.";
1931            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserTracker exists with the primary key ";
1932            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserTracker exists with the key {";
1933            private static Log _log = LogFactoryUtil.getLog(UserTrackerPersistenceImpl.class);
1934    }