001    /**
002     * Copyright (c) 2000-present 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.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.NoSuchPasswordTrackerException;
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.log.Log;
029    import com.liferay.portal.kernel.log.LogFactoryUtil;
030    import com.liferay.portal.kernel.util.OrderByComparator;
031    import com.liferay.portal.kernel.util.SetUtil;
032    import com.liferay.portal.kernel.util.StringBundler;
033    import com.liferay.portal.kernel.util.StringPool;
034    import com.liferay.portal.model.CacheModel;
035    import com.liferay.portal.model.MVCCModel;
036    import com.liferay.portal.model.PasswordTracker;
037    import com.liferay.portal.model.impl.PasswordTrackerImpl;
038    import com.liferay.portal.model.impl.PasswordTrackerModelImpl;
039    import com.liferay.portal.service.persistence.PasswordTrackerPersistence;
040    
041    import java.io.Serializable;
042    
043    import java.util.Collections;
044    import java.util.HashMap;
045    import java.util.HashSet;
046    import java.util.Iterator;
047    import java.util.List;
048    import java.util.Map;
049    import java.util.Set;
050    
051    /**
052     * The persistence implementation for the password tracker service.
053     *
054     * <p>
055     * Caching information and settings can be found in <code>portal.properties</code>
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see PasswordTrackerPersistence
060     * @see PasswordTrackerUtil
061     * @generated
062     */
063    @ProviderType
064    public class PasswordTrackerPersistenceImpl extends BasePersistenceImpl<PasswordTracker>
065            implements PasswordTrackerPersistence {
066            /*
067             * NOTE FOR DEVELOPERS:
068             *
069             * Never modify or reference this class directly. Always use {@link PasswordTrackerUtil} to access the password tracker persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
070             */
071            public static final String FINDER_CLASS_NAME_ENTITY = PasswordTrackerImpl.class.getName();
072            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073                    ".List1";
074            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
075                    ".List2";
076            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
077                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED,
078                            PasswordTrackerImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
079                            "findAll", new String[0]);
080            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
081                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED,
082                            PasswordTrackerImpl.class,
083                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
084            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
085                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED, Long.class,
086                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
087            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
088                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED,
089                            PasswordTrackerImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
090                            "findByUserId",
091                            new String[] {
092                                    Long.class.getName(),
093                                    
094                            Integer.class.getName(), Integer.class.getName(),
095                                    OrderByComparator.class.getName()
096                            });
097            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID =
098                    new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
099                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED,
100                            PasswordTrackerImpl.class,
101                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserId",
102                            new String[] { Long.class.getName() },
103                            PasswordTrackerModelImpl.USERID_COLUMN_BITMASK |
104                            PasswordTrackerModelImpl.CREATEDATE_COLUMN_BITMASK);
105            public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
106                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED, Long.class,
107                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserId",
108                            new String[] { Long.class.getName() });
109    
110            /**
111             * Returns all the password trackers where userId = &#63;.
112             *
113             * @param userId the user ID
114             * @return the matching password trackers
115             */
116            @Override
117            public List<PasswordTracker> findByUserId(long userId) {
118                    return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
119            }
120    
121            /**
122             * Returns a range of all the password trackers where userId = &#63;.
123             *
124             * <p>
125             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.PasswordTrackerModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
126             * </p>
127             *
128             * @param userId the user ID
129             * @param start the lower bound of the range of password trackers
130             * @param end the upper bound of the range of password trackers (not inclusive)
131             * @return the range of matching password trackers
132             */
133            @Override
134            public List<PasswordTracker> findByUserId(long userId, int start, int end) {
135                    return findByUserId(userId, start, end, null);
136            }
137    
138            /**
139             * Returns an ordered range of all the password trackers where userId = &#63;.
140             *
141             * <p>
142             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.PasswordTrackerModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
143             * </p>
144             *
145             * @param userId the user ID
146             * @param start the lower bound of the range of password trackers
147             * @param end the upper bound of the range of password trackers (not inclusive)
148             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
149             * @return the ordered range of matching password trackers
150             */
151            @Override
152            public List<PasswordTracker> findByUserId(long userId, int start, int end,
153                    OrderByComparator<PasswordTracker> orderByComparator) {
154                    boolean pagination = true;
155                    FinderPath finderPath = null;
156                    Object[] finderArgs = null;
157    
158                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
159                                    (orderByComparator == null)) {
160                            pagination = false;
161                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
162                            finderArgs = new Object[] { userId };
163                    }
164                    else {
165                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
166                            finderArgs = new Object[] { userId, start, end, orderByComparator };
167                    }
168    
169                    List<PasswordTracker> list = (List<PasswordTracker>)FinderCacheUtil.getResult(finderPath,
170                                    finderArgs, this);
171    
172                    if ((list != null) && !list.isEmpty()) {
173                            for (PasswordTracker passwordTracker : list) {
174                                    if ((userId != passwordTracker.getUserId())) {
175                                            list = null;
176    
177                                            break;
178                                    }
179                            }
180                    }
181    
182                    if (list == null) {
183                            StringBundler query = null;
184    
185                            if (orderByComparator != null) {
186                                    query = new StringBundler(3 +
187                                                    (orderByComparator.getOrderByFields().length * 3));
188                            }
189                            else {
190                                    query = new StringBundler(3);
191                            }
192    
193                            query.append(_SQL_SELECT_PASSWORDTRACKER_WHERE);
194    
195                            query.append(_FINDER_COLUMN_USERID_USERID_2);
196    
197                            if (orderByComparator != null) {
198                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
199                                            orderByComparator);
200                            }
201                            else
202                             if (pagination) {
203                                    query.append(PasswordTrackerModelImpl.ORDER_BY_JPQL);
204                            }
205    
206                            String sql = query.toString();
207    
208                            Session session = null;
209    
210                            try {
211                                    session = openSession();
212    
213                                    Query q = session.createQuery(sql);
214    
215                                    QueryPos qPos = QueryPos.getInstance(q);
216    
217                                    qPos.add(userId);
218    
219                                    if (!pagination) {
220                                            list = (List<PasswordTracker>)QueryUtil.list(q,
221                                                            getDialect(), start, end, false);
222    
223                                            Collections.sort(list);
224    
225                                            list = Collections.unmodifiableList(list);
226                                    }
227                                    else {
228                                            list = (List<PasswordTracker>)QueryUtil.list(q,
229                                                            getDialect(), start, end);
230                                    }
231    
232                                    cacheResult(list);
233    
234                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
235                            }
236                            catch (Exception e) {
237                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
238    
239                                    throw processException(e);
240                            }
241                            finally {
242                                    closeSession(session);
243                            }
244                    }
245    
246                    return list;
247            }
248    
249            /**
250             * Returns the first password tracker in the ordered set where userId = &#63;.
251             *
252             * @param userId the user ID
253             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
254             * @return the first matching password tracker
255             * @throws com.liferay.portal.NoSuchPasswordTrackerException if a matching password tracker could not be found
256             */
257            @Override
258            public PasswordTracker findByUserId_First(long userId,
259                    OrderByComparator<PasswordTracker> orderByComparator)
260                    throws NoSuchPasswordTrackerException {
261                    PasswordTracker passwordTracker = fetchByUserId_First(userId,
262                                    orderByComparator);
263    
264                    if (passwordTracker != null) {
265                            return passwordTracker;
266                    }
267    
268                    StringBundler msg = new StringBundler(4);
269    
270                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
271    
272                    msg.append("userId=");
273                    msg.append(userId);
274    
275                    msg.append(StringPool.CLOSE_CURLY_BRACE);
276    
277                    throw new NoSuchPasswordTrackerException(msg.toString());
278            }
279    
280            /**
281             * Returns the first password tracker in the ordered set where userId = &#63;.
282             *
283             * @param userId the user ID
284             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
285             * @return the first matching password tracker, or <code>null</code> if a matching password tracker could not be found
286             */
287            @Override
288            public PasswordTracker fetchByUserId_First(long userId,
289                    OrderByComparator<PasswordTracker> orderByComparator) {
290                    List<PasswordTracker> list = findByUserId(userId, 0, 1,
291                                    orderByComparator);
292    
293                    if (!list.isEmpty()) {
294                            return list.get(0);
295                    }
296    
297                    return null;
298            }
299    
300            /**
301             * Returns the last password tracker in the ordered set where userId = &#63;.
302             *
303             * @param userId the user ID
304             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
305             * @return the last matching password tracker
306             * @throws com.liferay.portal.NoSuchPasswordTrackerException if a matching password tracker could not be found
307             */
308            @Override
309            public PasswordTracker findByUserId_Last(long userId,
310                    OrderByComparator<PasswordTracker> orderByComparator)
311                    throws NoSuchPasswordTrackerException {
312                    PasswordTracker passwordTracker = fetchByUserId_Last(userId,
313                                    orderByComparator);
314    
315                    if (passwordTracker != null) {
316                            return passwordTracker;
317                    }
318    
319                    StringBundler msg = new StringBundler(4);
320    
321                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
322    
323                    msg.append("userId=");
324                    msg.append(userId);
325    
326                    msg.append(StringPool.CLOSE_CURLY_BRACE);
327    
328                    throw new NoSuchPasswordTrackerException(msg.toString());
329            }
330    
331            /**
332             * Returns the last password tracker in the ordered set where userId = &#63;.
333             *
334             * @param userId the user ID
335             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
336             * @return the last matching password tracker, or <code>null</code> if a matching password tracker could not be found
337             */
338            @Override
339            public PasswordTracker fetchByUserId_Last(long userId,
340                    OrderByComparator<PasswordTracker> orderByComparator) {
341                    int count = countByUserId(userId);
342    
343                    if (count == 0) {
344                            return null;
345                    }
346    
347                    List<PasswordTracker> list = findByUserId(userId, count - 1, count,
348                                    orderByComparator);
349    
350                    if (!list.isEmpty()) {
351                            return list.get(0);
352                    }
353    
354                    return null;
355            }
356    
357            /**
358             * Returns the password trackers before and after the current password tracker in the ordered set where userId = &#63;.
359             *
360             * @param passwordTrackerId the primary key of the current password tracker
361             * @param userId the user ID
362             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
363             * @return the previous, current, and next password tracker
364             * @throws com.liferay.portal.NoSuchPasswordTrackerException if a password tracker with the primary key could not be found
365             */
366            @Override
367            public PasswordTracker[] findByUserId_PrevAndNext(long passwordTrackerId,
368                    long userId, OrderByComparator<PasswordTracker> orderByComparator)
369                    throws NoSuchPasswordTrackerException {
370                    PasswordTracker passwordTracker = findByPrimaryKey(passwordTrackerId);
371    
372                    Session session = null;
373    
374                    try {
375                            session = openSession();
376    
377                            PasswordTracker[] array = new PasswordTrackerImpl[3];
378    
379                            array[0] = getByUserId_PrevAndNext(session, passwordTracker,
380                                            userId, orderByComparator, true);
381    
382                            array[1] = passwordTracker;
383    
384                            array[2] = getByUserId_PrevAndNext(session, passwordTracker,
385                                            userId, orderByComparator, false);
386    
387                            return array;
388                    }
389                    catch (Exception e) {
390                            throw processException(e);
391                    }
392                    finally {
393                            closeSession(session);
394                    }
395            }
396    
397            protected PasswordTracker getByUserId_PrevAndNext(Session session,
398                    PasswordTracker passwordTracker, long userId,
399                    OrderByComparator<PasswordTracker> orderByComparator, boolean previous) {
400                    StringBundler query = null;
401    
402                    if (orderByComparator != null) {
403                            query = new StringBundler(6 +
404                                            (orderByComparator.getOrderByFields().length * 6));
405                    }
406                    else {
407                            query = new StringBundler(3);
408                    }
409    
410                    query.append(_SQL_SELECT_PASSWORDTRACKER_WHERE);
411    
412                    query.append(_FINDER_COLUMN_USERID_USERID_2);
413    
414                    if (orderByComparator != null) {
415                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
416    
417                            if (orderByConditionFields.length > 0) {
418                                    query.append(WHERE_AND);
419                            }
420    
421                            for (int i = 0; i < orderByConditionFields.length; i++) {
422                                    query.append(_ORDER_BY_ENTITY_ALIAS);
423                                    query.append(orderByConditionFields[i]);
424    
425                                    if ((i + 1) < orderByConditionFields.length) {
426                                            if (orderByComparator.isAscending() ^ previous) {
427                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
428                                            }
429                                            else {
430                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
431                                            }
432                                    }
433                                    else {
434                                            if (orderByComparator.isAscending() ^ previous) {
435                                                    query.append(WHERE_GREATER_THAN);
436                                            }
437                                            else {
438                                                    query.append(WHERE_LESSER_THAN);
439                                            }
440                                    }
441                            }
442    
443                            query.append(ORDER_BY_CLAUSE);
444    
445                            String[] orderByFields = orderByComparator.getOrderByFields();
446    
447                            for (int i = 0; i < orderByFields.length; i++) {
448                                    query.append(_ORDER_BY_ENTITY_ALIAS);
449                                    query.append(orderByFields[i]);
450    
451                                    if ((i + 1) < orderByFields.length) {
452                                            if (orderByComparator.isAscending() ^ previous) {
453                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
454                                            }
455                                            else {
456                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
457                                            }
458                                    }
459                                    else {
460                                            if (orderByComparator.isAscending() ^ previous) {
461                                                    query.append(ORDER_BY_ASC);
462                                            }
463                                            else {
464                                                    query.append(ORDER_BY_DESC);
465                                            }
466                                    }
467                            }
468                    }
469                    else {
470                            query.append(PasswordTrackerModelImpl.ORDER_BY_JPQL);
471                    }
472    
473                    String sql = query.toString();
474    
475                    Query q = session.createQuery(sql);
476    
477                    q.setFirstResult(0);
478                    q.setMaxResults(2);
479    
480                    QueryPos qPos = QueryPos.getInstance(q);
481    
482                    qPos.add(userId);
483    
484                    if (orderByComparator != null) {
485                            Object[] values = orderByComparator.getOrderByConditionValues(passwordTracker);
486    
487                            for (Object value : values) {
488                                    qPos.add(value);
489                            }
490                    }
491    
492                    List<PasswordTracker> list = q.list();
493    
494                    if (list.size() == 2) {
495                            return list.get(1);
496                    }
497                    else {
498                            return null;
499                    }
500            }
501    
502            /**
503             * Removes all the password trackers where userId = &#63; from the database.
504             *
505             * @param userId the user ID
506             */
507            @Override
508            public void removeByUserId(long userId) {
509                    for (PasswordTracker passwordTracker : findByUserId(userId,
510                                    QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
511                            remove(passwordTracker);
512                    }
513            }
514    
515            /**
516             * Returns the number of password trackers where userId = &#63;.
517             *
518             * @param userId the user ID
519             * @return the number of matching password trackers
520             */
521            @Override
522            public int countByUserId(long userId) {
523                    FinderPath finderPath = FINDER_PATH_COUNT_BY_USERID;
524    
525                    Object[] finderArgs = new Object[] { userId };
526    
527                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
528                                    this);
529    
530                    if (count == null) {
531                            StringBundler query = new StringBundler(2);
532    
533                            query.append(_SQL_COUNT_PASSWORDTRACKER_WHERE);
534    
535                            query.append(_FINDER_COLUMN_USERID_USERID_2);
536    
537                            String sql = query.toString();
538    
539                            Session session = null;
540    
541                            try {
542                                    session = openSession();
543    
544                                    Query q = session.createQuery(sql);
545    
546                                    QueryPos qPos = QueryPos.getInstance(q);
547    
548                                    qPos.add(userId);
549    
550                                    count = (Long)q.uniqueResult();
551    
552                                    FinderCacheUtil.putResult(finderPath, finderArgs, count);
553                            }
554                            catch (Exception e) {
555                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
556    
557                                    throw processException(e);
558                            }
559                            finally {
560                                    closeSession(session);
561                            }
562                    }
563    
564                    return count.intValue();
565            }
566    
567            private static final String _FINDER_COLUMN_USERID_USERID_2 = "passwordTracker.userId = ?";
568    
569            public PasswordTrackerPersistenceImpl() {
570                    setModelClass(PasswordTracker.class);
571            }
572    
573            /**
574             * Caches the password tracker in the entity cache if it is enabled.
575             *
576             * @param passwordTracker the password tracker
577             */
578            @Override
579            public void cacheResult(PasswordTracker passwordTracker) {
580                    EntityCacheUtil.putResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
581                            PasswordTrackerImpl.class, passwordTracker.getPrimaryKey(),
582                            passwordTracker);
583    
584                    passwordTracker.resetOriginalValues();
585            }
586    
587            /**
588             * Caches the password trackers in the entity cache if it is enabled.
589             *
590             * @param passwordTrackers the password trackers
591             */
592            @Override
593            public void cacheResult(List<PasswordTracker> passwordTrackers) {
594                    for (PasswordTracker passwordTracker : passwordTrackers) {
595                            if (EntityCacheUtil.getResult(
596                                                    PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
597                                                    PasswordTrackerImpl.class,
598                                                    passwordTracker.getPrimaryKey()) == null) {
599                                    cacheResult(passwordTracker);
600                            }
601                            else {
602                                    passwordTracker.resetOriginalValues();
603                            }
604                    }
605            }
606    
607            /**
608             * Clears the cache for all password trackers.
609             *
610             * <p>
611             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
612             * </p>
613             */
614            @Override
615            public void clearCache() {
616                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
617                            CacheRegistryUtil.clear(PasswordTrackerImpl.class.getName());
618                    }
619    
620                    EntityCacheUtil.clearCache(PasswordTrackerImpl.class);
621    
622                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
623                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
624                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
625            }
626    
627            /**
628             * Clears the cache for the password tracker.
629             *
630             * <p>
631             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
632             * </p>
633             */
634            @Override
635            public void clearCache(PasswordTracker passwordTracker) {
636                    EntityCacheUtil.removeResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
637                            PasswordTrackerImpl.class, passwordTracker.getPrimaryKey());
638    
639                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
640                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
641            }
642    
643            @Override
644            public void clearCache(List<PasswordTracker> passwordTrackers) {
645                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
646                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
647    
648                    for (PasswordTracker passwordTracker : passwordTrackers) {
649                            EntityCacheUtil.removeResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
650                                    PasswordTrackerImpl.class, passwordTracker.getPrimaryKey());
651                    }
652            }
653    
654            /**
655             * Creates a new password tracker with the primary key. Does not add the password tracker to the database.
656             *
657             * @param passwordTrackerId the primary key for the new password tracker
658             * @return the new password tracker
659             */
660            @Override
661            public PasswordTracker create(long passwordTrackerId) {
662                    PasswordTracker passwordTracker = new PasswordTrackerImpl();
663    
664                    passwordTracker.setNew(true);
665                    passwordTracker.setPrimaryKey(passwordTrackerId);
666    
667                    return passwordTracker;
668            }
669    
670            /**
671             * Removes the password tracker with the primary key from the database. Also notifies the appropriate model listeners.
672             *
673             * @param passwordTrackerId the primary key of the password tracker
674             * @return the password tracker that was removed
675             * @throws com.liferay.portal.NoSuchPasswordTrackerException if a password tracker with the primary key could not be found
676             */
677            @Override
678            public PasswordTracker remove(long passwordTrackerId)
679                    throws NoSuchPasswordTrackerException {
680                    return remove((Serializable)passwordTrackerId);
681            }
682    
683            /**
684             * Removes the password tracker with the primary key from the database. Also notifies the appropriate model listeners.
685             *
686             * @param primaryKey the primary key of the password tracker
687             * @return the password tracker that was removed
688             * @throws com.liferay.portal.NoSuchPasswordTrackerException if a password tracker with the primary key could not be found
689             */
690            @Override
691            public PasswordTracker remove(Serializable primaryKey)
692                    throws NoSuchPasswordTrackerException {
693                    Session session = null;
694    
695                    try {
696                            session = openSession();
697    
698                            PasswordTracker passwordTracker = (PasswordTracker)session.get(PasswordTrackerImpl.class,
699                                            primaryKey);
700    
701                            if (passwordTracker == null) {
702                                    if (_log.isWarnEnabled()) {
703                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
704                                    }
705    
706                                    throw new NoSuchPasswordTrackerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
707                                            primaryKey);
708                            }
709    
710                            return remove(passwordTracker);
711                    }
712                    catch (NoSuchPasswordTrackerException nsee) {
713                            throw nsee;
714                    }
715                    catch (Exception e) {
716                            throw processException(e);
717                    }
718                    finally {
719                            closeSession(session);
720                    }
721            }
722    
723            @Override
724            protected PasswordTracker removeImpl(PasswordTracker passwordTracker) {
725                    passwordTracker = toUnwrappedModel(passwordTracker);
726    
727                    Session session = null;
728    
729                    try {
730                            session = openSession();
731    
732                            if (!session.contains(passwordTracker)) {
733                                    passwordTracker = (PasswordTracker)session.get(PasswordTrackerImpl.class,
734                                                    passwordTracker.getPrimaryKeyObj());
735                            }
736    
737                            if (passwordTracker != null) {
738                                    session.delete(passwordTracker);
739                            }
740                    }
741                    catch (Exception e) {
742                            throw processException(e);
743                    }
744                    finally {
745                            closeSession(session);
746                    }
747    
748                    if (passwordTracker != null) {
749                            clearCache(passwordTracker);
750                    }
751    
752                    return passwordTracker;
753            }
754    
755            @Override
756            public PasswordTracker updateImpl(
757                    com.liferay.portal.model.PasswordTracker passwordTracker) {
758                    passwordTracker = toUnwrappedModel(passwordTracker);
759    
760                    boolean isNew = passwordTracker.isNew();
761    
762                    PasswordTrackerModelImpl passwordTrackerModelImpl = (PasswordTrackerModelImpl)passwordTracker;
763    
764                    Session session = null;
765    
766                    try {
767                            session = openSession();
768    
769                            if (passwordTracker.isNew()) {
770                                    session.save(passwordTracker);
771    
772                                    passwordTracker.setNew(false);
773                            }
774                            else {
775                                    session.merge(passwordTracker);
776                            }
777                    }
778                    catch (Exception e) {
779                            throw processException(e);
780                    }
781                    finally {
782                            closeSession(session);
783                    }
784    
785                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
786    
787                    if (isNew || !PasswordTrackerModelImpl.COLUMN_BITMASK_ENABLED) {
788                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
789                    }
790    
791                    else {
792                            if ((passwordTrackerModelImpl.getColumnBitmask() &
793                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
794                                    Object[] args = new Object[] {
795                                                    passwordTrackerModelImpl.getOriginalUserId()
796                                            };
797    
798                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
799                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
800                                            args);
801    
802                                    args = new Object[] { passwordTrackerModelImpl.getUserId() };
803    
804                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
805                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
806                                            args);
807                            }
808                    }
809    
810                    EntityCacheUtil.putResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
811                            PasswordTrackerImpl.class, passwordTracker.getPrimaryKey(),
812                            passwordTracker, false);
813    
814                    passwordTracker.resetOriginalValues();
815    
816                    return passwordTracker;
817            }
818    
819            protected PasswordTracker toUnwrappedModel(PasswordTracker passwordTracker) {
820                    if (passwordTracker instanceof PasswordTrackerImpl) {
821                            return passwordTracker;
822                    }
823    
824                    PasswordTrackerImpl passwordTrackerImpl = new PasswordTrackerImpl();
825    
826                    passwordTrackerImpl.setNew(passwordTracker.isNew());
827                    passwordTrackerImpl.setPrimaryKey(passwordTracker.getPrimaryKey());
828    
829                    passwordTrackerImpl.setMvccVersion(passwordTracker.getMvccVersion());
830                    passwordTrackerImpl.setPasswordTrackerId(passwordTracker.getPasswordTrackerId());
831                    passwordTrackerImpl.setUserId(passwordTracker.getUserId());
832                    passwordTrackerImpl.setCreateDate(passwordTracker.getCreateDate());
833                    passwordTrackerImpl.setPassword(passwordTracker.getPassword());
834    
835                    return passwordTrackerImpl;
836            }
837    
838            /**
839             * Returns the password tracker with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
840             *
841             * @param primaryKey the primary key of the password tracker
842             * @return the password tracker
843             * @throws com.liferay.portal.NoSuchPasswordTrackerException if a password tracker with the primary key could not be found
844             */
845            @Override
846            public PasswordTracker findByPrimaryKey(Serializable primaryKey)
847                    throws NoSuchPasswordTrackerException {
848                    PasswordTracker passwordTracker = fetchByPrimaryKey(primaryKey);
849    
850                    if (passwordTracker == null) {
851                            if (_log.isWarnEnabled()) {
852                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
853                            }
854    
855                            throw new NoSuchPasswordTrackerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
856                                    primaryKey);
857                    }
858    
859                    return passwordTracker;
860            }
861    
862            /**
863             * Returns the password tracker with the primary key or throws a {@link com.liferay.portal.NoSuchPasswordTrackerException} if it could not be found.
864             *
865             * @param passwordTrackerId the primary key of the password tracker
866             * @return the password tracker
867             * @throws com.liferay.portal.NoSuchPasswordTrackerException if a password tracker with the primary key could not be found
868             */
869            @Override
870            public PasswordTracker findByPrimaryKey(long passwordTrackerId)
871                    throws NoSuchPasswordTrackerException {
872                    return findByPrimaryKey((Serializable)passwordTrackerId);
873            }
874    
875            /**
876             * Returns the password tracker with the primary key or returns <code>null</code> if it could not be found.
877             *
878             * @param primaryKey the primary key of the password tracker
879             * @return the password tracker, or <code>null</code> if a password tracker with the primary key could not be found
880             */
881            @Override
882            public PasswordTracker fetchByPrimaryKey(Serializable primaryKey) {
883                    PasswordTracker passwordTracker = (PasswordTracker)EntityCacheUtil.getResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
884                                    PasswordTrackerImpl.class, primaryKey);
885    
886                    if (passwordTracker == _nullPasswordTracker) {
887                            return null;
888                    }
889    
890                    if (passwordTracker == null) {
891                            Session session = null;
892    
893                            try {
894                                    session = openSession();
895    
896                                    passwordTracker = (PasswordTracker)session.get(PasswordTrackerImpl.class,
897                                                    primaryKey);
898    
899                                    if (passwordTracker != null) {
900                                            cacheResult(passwordTracker);
901                                    }
902                                    else {
903                                            EntityCacheUtil.putResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
904                                                    PasswordTrackerImpl.class, primaryKey,
905                                                    _nullPasswordTracker);
906                                    }
907                            }
908                            catch (Exception e) {
909                                    EntityCacheUtil.removeResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
910                                            PasswordTrackerImpl.class, primaryKey);
911    
912                                    throw processException(e);
913                            }
914                            finally {
915                                    closeSession(session);
916                            }
917                    }
918    
919                    return passwordTracker;
920            }
921    
922            /**
923             * Returns the password tracker with the primary key or returns <code>null</code> if it could not be found.
924             *
925             * @param passwordTrackerId the primary key of the password tracker
926             * @return the password tracker, or <code>null</code> if a password tracker with the primary key could not be found
927             */
928            @Override
929            public PasswordTracker fetchByPrimaryKey(long passwordTrackerId) {
930                    return fetchByPrimaryKey((Serializable)passwordTrackerId);
931            }
932    
933            @Override
934            public Map<Serializable, PasswordTracker> fetchByPrimaryKeys(
935                    Set<Serializable> primaryKeys) {
936                    if (primaryKeys.isEmpty()) {
937                            return Collections.emptyMap();
938                    }
939    
940                    Map<Serializable, PasswordTracker> map = new HashMap<Serializable, PasswordTracker>();
941    
942                    if (primaryKeys.size() == 1) {
943                            Iterator<Serializable> iterator = primaryKeys.iterator();
944    
945                            Serializable primaryKey = iterator.next();
946    
947                            PasswordTracker passwordTracker = fetchByPrimaryKey(primaryKey);
948    
949                            if (passwordTracker != null) {
950                                    map.put(primaryKey, passwordTracker);
951                            }
952    
953                            return map;
954                    }
955    
956                    Set<Serializable> uncachedPrimaryKeys = null;
957    
958                    for (Serializable primaryKey : primaryKeys) {
959                            PasswordTracker passwordTracker = (PasswordTracker)EntityCacheUtil.getResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
960                                            PasswordTrackerImpl.class, primaryKey);
961    
962                            if (passwordTracker == null) {
963                                    if (uncachedPrimaryKeys == null) {
964                                            uncachedPrimaryKeys = new HashSet<Serializable>();
965                                    }
966    
967                                    uncachedPrimaryKeys.add(primaryKey);
968                            }
969                            else {
970                                    map.put(primaryKey, passwordTracker);
971                            }
972                    }
973    
974                    if (uncachedPrimaryKeys == null) {
975                            return map;
976                    }
977    
978                    StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) +
979                                    1);
980    
981                    query.append(_SQL_SELECT_PASSWORDTRACKER_WHERE_PKS_IN);
982    
983                    for (Serializable primaryKey : uncachedPrimaryKeys) {
984                            query.append(String.valueOf(primaryKey));
985    
986                            query.append(StringPool.COMMA);
987                    }
988    
989                    query.setIndex(query.index() - 1);
990    
991                    query.append(StringPool.CLOSE_PARENTHESIS);
992    
993                    String sql = query.toString();
994    
995                    Session session = null;
996    
997                    try {
998                            session = openSession();
999    
1000                            Query q = session.createQuery(sql);
1001    
1002                            for (PasswordTracker passwordTracker : (List<PasswordTracker>)q.list()) {
1003                                    map.put(passwordTracker.getPrimaryKeyObj(), passwordTracker);
1004    
1005                                    cacheResult(passwordTracker);
1006    
1007                                    uncachedPrimaryKeys.remove(passwordTracker.getPrimaryKeyObj());
1008                            }
1009    
1010                            for (Serializable primaryKey : uncachedPrimaryKeys) {
1011                                    EntityCacheUtil.putResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
1012                                            PasswordTrackerImpl.class, primaryKey, _nullPasswordTracker);
1013                            }
1014                    }
1015                    catch (Exception e) {
1016                            throw processException(e);
1017                    }
1018                    finally {
1019                            closeSession(session);
1020                    }
1021    
1022                    return map;
1023            }
1024    
1025            /**
1026             * Returns all the password trackers.
1027             *
1028             * @return the password trackers
1029             */
1030            @Override
1031            public List<PasswordTracker> findAll() {
1032                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1033            }
1034    
1035            /**
1036             * Returns a range of all the password trackers.
1037             *
1038             * <p>
1039             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.PasswordTrackerModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1040             * </p>
1041             *
1042             * @param start the lower bound of the range of password trackers
1043             * @param end the upper bound of the range of password trackers (not inclusive)
1044             * @return the range of password trackers
1045             */
1046            @Override
1047            public List<PasswordTracker> findAll(int start, int end) {
1048                    return findAll(start, end, null);
1049            }
1050    
1051            /**
1052             * Returns an ordered range of all the password trackers.
1053             *
1054             * <p>
1055             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.PasswordTrackerModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1056             * </p>
1057             *
1058             * @param start the lower bound of the range of password trackers
1059             * @param end the upper bound of the range of password trackers (not inclusive)
1060             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1061             * @return the ordered range of password trackers
1062             */
1063            @Override
1064            public List<PasswordTracker> findAll(int start, int end,
1065                    OrderByComparator<PasswordTracker> orderByComparator) {
1066                    boolean pagination = true;
1067                    FinderPath finderPath = null;
1068                    Object[] finderArgs = null;
1069    
1070                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1071                                    (orderByComparator == null)) {
1072                            pagination = false;
1073                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1074                            finderArgs = FINDER_ARGS_EMPTY;
1075                    }
1076                    else {
1077                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1078                            finderArgs = new Object[] { start, end, orderByComparator };
1079                    }
1080    
1081                    List<PasswordTracker> list = (List<PasswordTracker>)FinderCacheUtil.getResult(finderPath,
1082                                    finderArgs, this);
1083    
1084                    if (list == null) {
1085                            StringBundler query = null;
1086                            String sql = null;
1087    
1088                            if (orderByComparator != null) {
1089                                    query = new StringBundler(2 +
1090                                                    (orderByComparator.getOrderByFields().length * 3));
1091    
1092                                    query.append(_SQL_SELECT_PASSWORDTRACKER);
1093    
1094                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1095                                            orderByComparator);
1096    
1097                                    sql = query.toString();
1098                            }
1099                            else {
1100                                    sql = _SQL_SELECT_PASSWORDTRACKER;
1101    
1102                                    if (pagination) {
1103                                            sql = sql.concat(PasswordTrackerModelImpl.ORDER_BY_JPQL);
1104                                    }
1105                            }
1106    
1107                            Session session = null;
1108    
1109                            try {
1110                                    session = openSession();
1111    
1112                                    Query q = session.createQuery(sql);
1113    
1114                                    if (!pagination) {
1115                                            list = (List<PasswordTracker>)QueryUtil.list(q,
1116                                                            getDialect(), start, end, false);
1117    
1118                                            Collections.sort(list);
1119    
1120                                            list = Collections.unmodifiableList(list);
1121                                    }
1122                                    else {
1123                                            list = (List<PasswordTracker>)QueryUtil.list(q,
1124                                                            getDialect(), start, end);
1125                                    }
1126    
1127                                    cacheResult(list);
1128    
1129                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
1130                            }
1131                            catch (Exception e) {
1132                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
1133    
1134                                    throw processException(e);
1135                            }
1136                            finally {
1137                                    closeSession(session);
1138                            }
1139                    }
1140    
1141                    return list;
1142            }
1143    
1144            /**
1145             * Removes all the password trackers from the database.
1146             *
1147             */
1148            @Override
1149            public void removeAll() {
1150                    for (PasswordTracker passwordTracker : findAll()) {
1151                            remove(passwordTracker);
1152                    }
1153            }
1154    
1155            /**
1156             * Returns the number of password trackers.
1157             *
1158             * @return the number of password trackers
1159             */
1160            @Override
1161            public int countAll() {
1162                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1163                                    FINDER_ARGS_EMPTY, this);
1164    
1165                    if (count == null) {
1166                            Session session = null;
1167    
1168                            try {
1169                                    session = openSession();
1170    
1171                                    Query q = session.createQuery(_SQL_COUNT_PASSWORDTRACKER);
1172    
1173                                    count = (Long)q.uniqueResult();
1174    
1175                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1176                                            FINDER_ARGS_EMPTY, count);
1177                            }
1178                            catch (Exception e) {
1179                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
1180                                            FINDER_ARGS_EMPTY);
1181    
1182                                    throw processException(e);
1183                            }
1184                            finally {
1185                                    closeSession(session);
1186                            }
1187                    }
1188    
1189                    return count.intValue();
1190            }
1191    
1192            @Override
1193            protected Set<String> getBadColumnNames() {
1194                    return _badColumnNames;
1195            }
1196    
1197            /**
1198             * Initializes the password tracker persistence.
1199             */
1200            public void afterPropertiesSet() {
1201            }
1202    
1203            public void destroy() {
1204                    EntityCacheUtil.removeCache(PasswordTrackerImpl.class.getName());
1205                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1206                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1207                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1208            }
1209    
1210            private static final String _SQL_SELECT_PASSWORDTRACKER = "SELECT passwordTracker FROM PasswordTracker passwordTracker";
1211            private static final String _SQL_SELECT_PASSWORDTRACKER_WHERE_PKS_IN = "SELECT passwordTracker FROM PasswordTracker passwordTracker WHERE passwordTrackerId IN (";
1212            private static final String _SQL_SELECT_PASSWORDTRACKER_WHERE = "SELECT passwordTracker FROM PasswordTracker passwordTracker WHERE ";
1213            private static final String _SQL_COUNT_PASSWORDTRACKER = "SELECT COUNT(passwordTracker) FROM PasswordTracker passwordTracker";
1214            private static final String _SQL_COUNT_PASSWORDTRACKER_WHERE = "SELECT COUNT(passwordTracker) FROM PasswordTracker passwordTracker WHERE ";
1215            private static final String _ORDER_BY_ENTITY_ALIAS = "passwordTracker.";
1216            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PasswordTracker exists with the primary key ";
1217            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PasswordTracker exists with the key {";
1218            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1219            private static final Log _log = LogFactoryUtil.getLog(PasswordTrackerPersistenceImpl.class);
1220            private static final Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
1221                                    "password"
1222                            });
1223            private static final PasswordTracker _nullPasswordTracker = new PasswordTrackerImpl() {
1224                            @Override
1225                            public Object clone() {
1226                                    return this;
1227                            }
1228    
1229                            @Override
1230                            public CacheModel<PasswordTracker> toCacheModel() {
1231                                    return _nullPasswordTrackerCacheModel;
1232                            }
1233                    };
1234    
1235            private static final CacheModel<PasswordTracker> _nullPasswordTrackerCacheModel =
1236                    new NullCacheModel();
1237    
1238            private static class NullCacheModel implements CacheModel<PasswordTracker>,
1239                    MVCCModel {
1240                    @Override
1241                    public long getMvccVersion() {
1242                            return -1;
1243                    }
1244    
1245                    @Override
1246                    public void setMvccVersion(long mvccVersion) {
1247                    }
1248    
1249                    @Override
1250                    public PasswordTracker toEntityModel() {
1251                            return _nullPasswordTracker;
1252                    }
1253            }
1254    }