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