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