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