1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
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.SystemException;
20  import com.liferay.portal.kernel.annotation.BeanReference;
21  import com.liferay.portal.kernel.cache.CacheRegistry;
22  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
23  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
24  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
25  import com.liferay.portal.kernel.dao.orm.FinderPath;
26  import com.liferay.portal.kernel.dao.orm.Query;
27  import com.liferay.portal.kernel.dao.orm.QueryPos;
28  import com.liferay.portal.kernel.dao.orm.QueryUtil;
29  import com.liferay.portal.kernel.dao.orm.Session;
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     /**
216      * @deprecated Use {@link BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)}.
217      */
218     public PasswordTracker update(PasswordTracker passwordTracker)
219         throws SystemException {
220         if (_log.isWarnEnabled()) {
221             _log.warn(
222                 "Using the deprecated update(PasswordTracker passwordTracker) method. Use update(PasswordTracker passwordTracker, boolean merge) instead.");
223         }
224 
225         return update(passwordTracker, false);
226     }
227 
228     public PasswordTracker updateImpl(
229         com.liferay.portal.model.PasswordTracker passwordTracker, boolean merge)
230         throws SystemException {
231         passwordTracker = toUnwrappedModel(passwordTracker);
232 
233         Session session = null;
234 
235         try {
236             session = openSession();
237 
238             BatchSessionUtil.update(session, passwordTracker, merge);
239 
240             passwordTracker.setNew(false);
241         }
242         catch (Exception e) {
243             throw processException(e);
244         }
245         finally {
246             closeSession(session);
247         }
248 
249         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
250 
251         EntityCacheUtil.putResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
252             PasswordTrackerImpl.class, passwordTracker.getPrimaryKey(),
253             passwordTracker);
254 
255         return passwordTracker;
256     }
257 
258     protected PasswordTracker toUnwrappedModel(PasswordTracker passwordTracker) {
259         if (passwordTracker instanceof PasswordTrackerImpl) {
260             return passwordTracker;
261         }
262 
263         PasswordTrackerImpl passwordTrackerImpl = new PasswordTrackerImpl();
264 
265         passwordTrackerImpl.setNew(passwordTracker.isNew());
266         passwordTrackerImpl.setPrimaryKey(passwordTracker.getPrimaryKey());
267 
268         passwordTrackerImpl.setPasswordTrackerId(passwordTracker.getPasswordTrackerId());
269         passwordTrackerImpl.setUserId(passwordTracker.getUserId());
270         passwordTrackerImpl.setCreateDate(passwordTracker.getCreateDate());
271         passwordTrackerImpl.setPassword(passwordTracker.getPassword());
272 
273         return passwordTrackerImpl;
274     }
275 
276     public PasswordTracker findByPrimaryKey(Serializable primaryKey)
277         throws NoSuchModelException, SystemException {
278         return findByPrimaryKey(((Long)primaryKey).longValue());
279     }
280 
281     public PasswordTracker findByPrimaryKey(long passwordTrackerId)
282         throws NoSuchPasswordTrackerException, SystemException {
283         PasswordTracker passwordTracker = fetchByPrimaryKey(passwordTrackerId);
284 
285         if (passwordTracker == null) {
286             if (_log.isWarnEnabled()) {
287                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + passwordTrackerId);
288             }
289 
290             throw new NoSuchPasswordTrackerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
291                 passwordTrackerId);
292         }
293 
294         return passwordTracker;
295     }
296 
297     public PasswordTracker fetchByPrimaryKey(Serializable primaryKey)
298         throws SystemException {
299         return fetchByPrimaryKey(((Long)primaryKey).longValue());
300     }
301 
302     public PasswordTracker fetchByPrimaryKey(long passwordTrackerId)
303         throws SystemException {
304         PasswordTracker passwordTracker = (PasswordTracker)EntityCacheUtil.getResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
305                 PasswordTrackerImpl.class, passwordTrackerId, this);
306 
307         if (passwordTracker == null) {
308             Session session = null;
309 
310             try {
311                 session = openSession();
312 
313                 passwordTracker = (PasswordTracker)session.get(PasswordTrackerImpl.class,
314                         new Long(passwordTrackerId));
315             }
316             catch (Exception e) {
317                 throw processException(e);
318             }
319             finally {
320                 if (passwordTracker != null) {
321                     cacheResult(passwordTracker);
322                 }
323 
324                 closeSession(session);
325             }
326         }
327 
328         return passwordTracker;
329     }
330 
331     public List<PasswordTracker> findByUserId(long userId)
332         throws SystemException {
333         Object[] finderArgs = new Object[] { new Long(userId) };
334 
335         List<PasswordTracker> list = (List<PasswordTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
336                 finderArgs, this);
337 
338         if (list == null) {
339             Session session = null;
340 
341             try {
342                 session = openSession();
343 
344                 StringBundler query = new StringBundler(3);
345 
346                 query.append(_SQL_SELECT_PASSWORDTRACKER_WHERE);
347 
348                 query.append(_FINDER_COLUMN_USERID_USERID_2);
349 
350                 query.append(PasswordTrackerModelImpl.ORDER_BY_JPQL);
351 
352                 String sql = query.toString();
353 
354                 Query q = session.createQuery(sql);
355 
356                 QueryPos qPos = QueryPos.getInstance(q);
357 
358                 qPos.add(userId);
359 
360                 list = q.list();
361             }
362             catch (Exception e) {
363                 throw processException(e);
364             }
365             finally {
366                 if (list == null) {
367                     list = new ArrayList<PasswordTracker>();
368                 }
369 
370                 cacheResult(list);
371 
372                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
373                     finderArgs, list);
374 
375                 closeSession(session);
376             }
377         }
378 
379         return list;
380     }
381 
382     public List<PasswordTracker> findByUserId(long userId, int start, int end)
383         throws SystemException {
384         return findByUserId(userId, start, end, null);
385     }
386 
387     public List<PasswordTracker> findByUserId(long userId, int start, int end,
388         OrderByComparator obc) throws SystemException {
389         Object[] finderArgs = new Object[] {
390                 new Long(userId),
391                 
392                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
393             };
394 
395         List<PasswordTracker> list = (List<PasswordTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_USERID,
396                 finderArgs, this);
397 
398         if (list == null) {
399             Session session = null;
400 
401             try {
402                 session = openSession();
403 
404                 StringBundler query = null;
405 
406                 if (obc != null) {
407                     query = new StringBundler(3 +
408                             (obc.getOrderByFields().length * 3));
409                 }
410                 else {
411                     query = new StringBundler(3);
412                 }
413 
414                 query.append(_SQL_SELECT_PASSWORDTRACKER_WHERE);
415 
416                 query.append(_FINDER_COLUMN_USERID_USERID_2);
417 
418                 if (obc != null) {
419                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
420                 }
421 
422                 else {
423                     query.append(PasswordTrackerModelImpl.ORDER_BY_JPQL);
424                 }
425 
426                 String sql = query.toString();
427 
428                 Query q = session.createQuery(sql);
429 
430                 QueryPos qPos = QueryPos.getInstance(q);
431 
432                 qPos.add(userId);
433 
434                 list = (List<PasswordTracker>)QueryUtil.list(q, getDialect(),
435                         start, end);
436             }
437             catch (Exception e) {
438                 throw processException(e);
439             }
440             finally {
441                 if (list == null) {
442                     list = new ArrayList<PasswordTracker>();
443                 }
444 
445                 cacheResult(list);
446 
447                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_USERID,
448                     finderArgs, list);
449 
450                 closeSession(session);
451             }
452         }
453 
454         return list;
455     }
456 
457     public PasswordTracker findByUserId_First(long userId, OrderByComparator obc)
458         throws NoSuchPasswordTrackerException, SystemException {
459         List<PasswordTracker> list = findByUserId(userId, 0, 1, obc);
460 
461         if (list.isEmpty()) {
462             StringBundler msg = new StringBundler(4);
463 
464             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
465 
466             msg.append("userId=");
467             msg.append(userId);
468 
469             msg.append(StringPool.CLOSE_CURLY_BRACE);
470 
471             throw new NoSuchPasswordTrackerException(msg.toString());
472         }
473         else {
474             return list.get(0);
475         }
476     }
477 
478     public PasswordTracker findByUserId_Last(long userId, OrderByComparator obc)
479         throws NoSuchPasswordTrackerException, SystemException {
480         int count = countByUserId(userId);
481 
482         List<PasswordTracker> list = findByUserId(userId, count - 1, count, obc);
483 
484         if (list.isEmpty()) {
485             StringBundler msg = new StringBundler(4);
486 
487             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
488 
489             msg.append("userId=");
490             msg.append(userId);
491 
492             msg.append(StringPool.CLOSE_CURLY_BRACE);
493 
494             throw new NoSuchPasswordTrackerException(msg.toString());
495         }
496         else {
497             return list.get(0);
498         }
499     }
500 
501     public PasswordTracker[] findByUserId_PrevAndNext(long passwordTrackerId,
502         long userId, OrderByComparator obc)
503         throws NoSuchPasswordTrackerException, SystemException {
504         PasswordTracker passwordTracker = findByPrimaryKey(passwordTrackerId);
505 
506         int count = countByUserId(userId);
507 
508         Session session = null;
509 
510         try {
511             session = openSession();
512 
513             StringBundler query = null;
514 
515             if (obc != null) {
516                 query = new StringBundler(3 +
517                         (obc.getOrderByFields().length * 3));
518             }
519             else {
520                 query = new StringBundler(3);
521             }
522 
523             query.append(_SQL_SELECT_PASSWORDTRACKER_WHERE);
524 
525             query.append(_FINDER_COLUMN_USERID_USERID_2);
526 
527             if (obc != null) {
528                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
529             }
530 
531             else {
532                 query.append(PasswordTrackerModelImpl.ORDER_BY_JPQL);
533             }
534 
535             String sql = query.toString();
536 
537             Query q = session.createQuery(sql);
538 
539             QueryPos qPos = QueryPos.getInstance(q);
540 
541             qPos.add(userId);
542 
543             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
544                     passwordTracker);
545 
546             PasswordTracker[] array = new PasswordTrackerImpl[3];
547 
548             array[0] = (PasswordTracker)objArray[0];
549             array[1] = (PasswordTracker)objArray[1];
550             array[2] = (PasswordTracker)objArray[2];
551 
552             return array;
553         }
554         catch (Exception e) {
555             throw processException(e);
556         }
557         finally {
558             closeSession(session);
559         }
560     }
561 
562     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
563         throws SystemException {
564         Session session = null;
565 
566         try {
567             session = openSession();
568 
569             dynamicQuery.compile(session);
570 
571             return dynamicQuery.list();
572         }
573         catch (Exception e) {
574             throw processException(e);
575         }
576         finally {
577             closeSession(session);
578         }
579     }
580 
581     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
582         int start, int end) throws SystemException {
583         Session session = null;
584 
585         try {
586             session = openSession();
587 
588             dynamicQuery.setLimit(start, end);
589 
590             dynamicQuery.compile(session);
591 
592             return dynamicQuery.list();
593         }
594         catch (Exception e) {
595             throw processException(e);
596         }
597         finally {
598             closeSession(session);
599         }
600     }
601 
602     public List<PasswordTracker> findAll() throws SystemException {
603         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
604     }
605 
606     public List<PasswordTracker> findAll(int start, int end)
607         throws SystemException {
608         return findAll(start, end, null);
609     }
610 
611     public List<PasswordTracker> findAll(int start, int end,
612         OrderByComparator obc) throws SystemException {
613         Object[] finderArgs = new Object[] {
614                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
615             };
616 
617         List<PasswordTracker> list = (List<PasswordTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
618                 finderArgs, this);
619 
620         if (list == null) {
621             Session session = null;
622 
623             try {
624                 session = openSession();
625 
626                 StringBundler query = null;
627                 String sql = null;
628 
629                 if (obc != null) {
630                     query = new StringBundler(2 +
631                             (obc.getOrderByFields().length * 3));
632 
633                     query.append(_SQL_SELECT_PASSWORDTRACKER);
634 
635                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
636 
637                     sql = query.toString();
638                 }
639 
640                 else {
641                     sql = _SQL_SELECT_PASSWORDTRACKER.concat(PasswordTrackerModelImpl.ORDER_BY_JPQL);
642                 }
643 
644                 Query q = session.createQuery(sql);
645 
646                 if (obc == null) {
647                     list = (List<PasswordTracker>)QueryUtil.list(q,
648                             getDialect(), start, end, false);
649 
650                     Collections.sort(list);
651                 }
652                 else {
653                     list = (List<PasswordTracker>)QueryUtil.list(q,
654                             getDialect(), start, end);
655                 }
656             }
657             catch (Exception e) {
658                 throw processException(e);
659             }
660             finally {
661                 if (list == null) {
662                     list = new ArrayList<PasswordTracker>();
663                 }
664 
665                 cacheResult(list);
666 
667                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
668 
669                 closeSession(session);
670             }
671         }
672 
673         return list;
674     }
675 
676     public void removeByUserId(long userId) throws SystemException {
677         for (PasswordTracker passwordTracker : findByUserId(userId)) {
678             remove(passwordTracker);
679         }
680     }
681 
682     public void removeAll() throws SystemException {
683         for (PasswordTracker passwordTracker : findAll()) {
684             remove(passwordTracker);
685         }
686     }
687 
688     public int countByUserId(long userId) throws SystemException {
689         Object[] finderArgs = new Object[] { new Long(userId) };
690 
691         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
692                 finderArgs, this);
693 
694         if (count == null) {
695             Session session = null;
696 
697             try {
698                 session = openSession();
699 
700                 StringBundler query = new StringBundler(2);
701 
702                 query.append(_SQL_COUNT_PASSWORDTRACKER_WHERE);
703 
704                 query.append(_FINDER_COLUMN_USERID_USERID_2);
705 
706                 String sql = query.toString();
707 
708                 Query q = session.createQuery(sql);
709 
710                 QueryPos qPos = QueryPos.getInstance(q);
711 
712                 qPos.add(userId);
713 
714                 count = (Long)q.uniqueResult();
715             }
716             catch (Exception e) {
717                 throw processException(e);
718             }
719             finally {
720                 if (count == null) {
721                     count = Long.valueOf(0);
722                 }
723 
724                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
725                     finderArgs, count);
726 
727                 closeSession(session);
728             }
729         }
730 
731         return count.intValue();
732     }
733 
734     public int countAll() throws SystemException {
735         Object[] finderArgs = new Object[0];
736 
737         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
738                 finderArgs, this);
739 
740         if (count == null) {
741             Session session = null;
742 
743             try {
744                 session = openSession();
745 
746                 Query q = session.createQuery(_SQL_COUNT_PASSWORDTRACKER);
747 
748                 count = (Long)q.uniqueResult();
749             }
750             catch (Exception e) {
751                 throw processException(e);
752             }
753             finally {
754                 if (count == null) {
755                     count = Long.valueOf(0);
756                 }
757 
758                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
759                     count);
760 
761                 closeSession(session);
762             }
763         }
764 
765         return count.intValue();
766     }
767 
768     public void afterPropertiesSet() {
769         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
770                     com.liferay.portal.util.PropsUtil.get(
771                         "value.object.listener.com.liferay.portal.model.PasswordTracker")));
772 
773         if (listenerClassNames.length > 0) {
774             try {
775                 List<ModelListener<PasswordTracker>> listenersList = new ArrayList<ModelListener<PasswordTracker>>();
776 
777                 for (String listenerClassName : listenerClassNames) {
778                     listenersList.add((ModelListener<PasswordTracker>)Class.forName(
779                             listenerClassName).newInstance());
780                 }
781 
782                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
783             }
784             catch (Exception e) {
785                 _log.error(e);
786             }
787         }
788     }
789 
790     @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence")
791     protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
792     @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence")
793     protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
794     @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence")
795     protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
796     @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence")
797     protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
798     @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence")
799     protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
800     @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence")
801     protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
802     @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence")
803     protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
804     @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence")
805     protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
806     @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence")
807     protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
808     @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence")
809     protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
810     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence")
811     protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
812     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence")
813     protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
814     @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence")
815     protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
816     @BeanReference(name = "com.liferay.portal.service.persistence.LockPersistence")
817     protected com.liferay.portal.service.persistence.LockPersistence lockPersistence;
818     @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence")
819     protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
820     @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence")
821     protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
822     @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence")
823     protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
824     @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence")
825     protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
826     @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence")
827     protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
828     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence")
829     protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
830     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence")
831     protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
832     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence")
833     protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
834     @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence")
835     protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
836     @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence")
837     protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
838     @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence")
839     protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
840     @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence")
841     protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
842     @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence")
843     protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
844     @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence")
845     protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
846     @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence")
847     protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
848     @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence")
849     protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
850     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
851     protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
852     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence")
853     protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
854     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence")
855     protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
856     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence")
857     protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
858     @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence")
859     protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
860     @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence")
861     protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
862     @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence")
863     protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
864     @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence")
865     protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
866     @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
867     protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
868     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence")
869     protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
870     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence")
871     protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
872     @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence")
873     protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
874     @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence")
875     protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
876     @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence")
877     protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
878     @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence")
879     protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
880     @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence")
881     protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
882     private static final String _SQL_SELECT_PASSWORDTRACKER = "SELECT passwordTracker FROM PasswordTracker passwordTracker";
883     private static final String _SQL_SELECT_PASSWORDTRACKER_WHERE = "SELECT passwordTracker FROM PasswordTracker passwordTracker WHERE ";
884     private static final String _SQL_COUNT_PASSWORDTRACKER = "SELECT COUNT(passwordTracker) FROM PasswordTracker passwordTracker";
885     private static final String _SQL_COUNT_PASSWORDTRACKER_WHERE = "SELECT COUNT(passwordTracker) FROM PasswordTracker passwordTracker WHERE ";
886     private static final String _FINDER_COLUMN_USERID_USERID_2 = "passwordTracker.userId = ?";
887     private static final String _ORDER_BY_ENTITY_ALIAS = "passwordTracker.";
888     private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PasswordTracker exists with the primary key ";
889     private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PasswordTracker exists with the key {";
890     private static Log _log = LogFactoryUtil.getLog(PasswordTrackerPersistenceImpl.class);
891 }