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.InstanceFactory;
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[] {
71                  Long.class.getName(),
72                  
73              "java.lang.Integer", "java.lang.Integer",
74                  "com.liferay.portal.kernel.util.OrderByComparator"
75              });
76      public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
77              PasswordTrackerModelImpl.FINDER_CACHE_ENABLED,
78              FINDER_CLASS_NAME_LIST, "countByUserId",
79              new String[] { Long.class.getName() });
80      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
81              PasswordTrackerModelImpl.FINDER_CACHE_ENABLED,
82              FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
83      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
84              PasswordTrackerModelImpl.FINDER_CACHE_ENABLED,
85              FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
86  
87      public void cacheResult(PasswordTracker passwordTracker) {
88          EntityCacheUtil.putResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
89              PasswordTrackerImpl.class, passwordTracker.getPrimaryKey(),
90              passwordTracker);
91      }
92  
93      public void cacheResult(List<PasswordTracker> passwordTrackers) {
94          for (PasswordTracker passwordTracker : passwordTrackers) {
95              if (EntityCacheUtil.getResult(
96                          PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
97                          PasswordTrackerImpl.class,
98                          passwordTracker.getPrimaryKey(), this) == null) {
99                  cacheResult(passwordTracker);
100             }
101         }
102     }
103 
104     public void clearCache() {
105         CacheRegistry.clear(PasswordTrackerImpl.class.getName());
106         EntityCacheUtil.clearCache(PasswordTrackerImpl.class.getName());
107         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
108         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
109     }
110 
111     public void clearCache(PasswordTracker passwordTracker) {
112         EntityCacheUtil.removeResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
113             PasswordTrackerImpl.class, passwordTracker.getPrimaryKey());
114     }
115 
116     public PasswordTracker create(long passwordTrackerId) {
117         PasswordTracker passwordTracker = new PasswordTrackerImpl();
118 
119         passwordTracker.setNew(true);
120         passwordTracker.setPrimaryKey(passwordTrackerId);
121 
122         return passwordTracker;
123     }
124 
125     public PasswordTracker remove(Serializable primaryKey)
126         throws NoSuchModelException, SystemException {
127         return remove(((Long)primaryKey).longValue());
128     }
129 
130     public PasswordTracker remove(long passwordTrackerId)
131         throws NoSuchPasswordTrackerException, SystemException {
132         Session session = null;
133 
134         try {
135             session = openSession();
136 
137             PasswordTracker passwordTracker = (PasswordTracker)session.get(PasswordTrackerImpl.class,
138                     new Long(passwordTrackerId));
139 
140             if (passwordTracker == null) {
141                 if (_log.isWarnEnabled()) {
142                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
143                         passwordTrackerId);
144                 }
145 
146                 throw new NoSuchPasswordTrackerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
147                     passwordTrackerId);
148             }
149 
150             return remove(passwordTracker);
151         }
152         catch (NoSuchPasswordTrackerException nsee) {
153             throw nsee;
154         }
155         catch (Exception e) {
156             throw processException(e);
157         }
158         finally {
159             closeSession(session);
160         }
161     }
162 
163     protected PasswordTracker removeImpl(PasswordTracker passwordTracker)
164         throws SystemException {
165         passwordTracker = toUnwrappedModel(passwordTracker);
166 
167         Session session = null;
168 
169         try {
170             session = openSession();
171 
172             BatchSessionUtil.delete(session, passwordTracker);
173         }
174         catch (Exception e) {
175             throw processException(e);
176         }
177         finally {
178             closeSession(session);
179         }
180 
181         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
182 
183         EntityCacheUtil.removeResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
184             PasswordTrackerImpl.class, passwordTracker.getPrimaryKey());
185 
186         return passwordTracker;
187     }
188 
189     /**
190      * @deprecated Use {@link BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)}.
191      */
192     public PasswordTracker update(PasswordTracker passwordTracker)
193         throws SystemException {
194         if (_log.isWarnEnabled()) {
195             _log.warn(
196                 "Using the deprecated update(PasswordTracker passwordTracker) method. Use update(PasswordTracker passwordTracker, boolean merge) instead.");
197         }
198 
199         return update(passwordTracker, false);
200     }
201 
202     public PasswordTracker updateImpl(
203         com.liferay.portal.model.PasswordTracker passwordTracker, boolean merge)
204         throws SystemException {
205         passwordTracker = toUnwrappedModel(passwordTracker);
206 
207         Session session = null;
208 
209         try {
210             session = openSession();
211 
212             BatchSessionUtil.update(session, passwordTracker, merge);
213 
214             passwordTracker.setNew(false);
215         }
216         catch (Exception e) {
217             throw processException(e);
218         }
219         finally {
220             closeSession(session);
221         }
222 
223         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
224 
225         EntityCacheUtil.putResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
226             PasswordTrackerImpl.class, passwordTracker.getPrimaryKey(),
227             passwordTracker);
228 
229         return passwordTracker;
230     }
231 
232     protected PasswordTracker toUnwrappedModel(PasswordTracker passwordTracker) {
233         if (passwordTracker instanceof PasswordTrackerImpl) {
234             return passwordTracker;
235         }
236 
237         PasswordTrackerImpl passwordTrackerImpl = new PasswordTrackerImpl();
238 
239         passwordTrackerImpl.setNew(passwordTracker.isNew());
240         passwordTrackerImpl.setPrimaryKey(passwordTracker.getPrimaryKey());
241 
242         passwordTrackerImpl.setPasswordTrackerId(passwordTracker.getPasswordTrackerId());
243         passwordTrackerImpl.setUserId(passwordTracker.getUserId());
244         passwordTrackerImpl.setCreateDate(passwordTracker.getCreateDate());
245         passwordTrackerImpl.setPassword(passwordTracker.getPassword());
246 
247         return passwordTrackerImpl;
248     }
249 
250     public PasswordTracker findByPrimaryKey(Serializable primaryKey)
251         throws NoSuchModelException, SystemException {
252         return findByPrimaryKey(((Long)primaryKey).longValue());
253     }
254 
255     public PasswordTracker findByPrimaryKey(long passwordTrackerId)
256         throws NoSuchPasswordTrackerException, SystemException {
257         PasswordTracker passwordTracker = fetchByPrimaryKey(passwordTrackerId);
258 
259         if (passwordTracker == null) {
260             if (_log.isWarnEnabled()) {
261                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + passwordTrackerId);
262             }
263 
264             throw new NoSuchPasswordTrackerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
265                 passwordTrackerId);
266         }
267 
268         return passwordTracker;
269     }
270 
271     public PasswordTracker fetchByPrimaryKey(Serializable primaryKey)
272         throws SystemException {
273         return fetchByPrimaryKey(((Long)primaryKey).longValue());
274     }
275 
276     public PasswordTracker fetchByPrimaryKey(long passwordTrackerId)
277         throws SystemException {
278         PasswordTracker passwordTracker = (PasswordTracker)EntityCacheUtil.getResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
279                 PasswordTrackerImpl.class, passwordTrackerId, this);
280 
281         if (passwordTracker == null) {
282             Session session = null;
283 
284             try {
285                 session = openSession();
286 
287                 passwordTracker = (PasswordTracker)session.get(PasswordTrackerImpl.class,
288                         new Long(passwordTrackerId));
289             }
290             catch (Exception e) {
291                 throw processException(e);
292             }
293             finally {
294                 if (passwordTracker != null) {
295                     cacheResult(passwordTracker);
296                 }
297 
298                 closeSession(session);
299             }
300         }
301 
302         return passwordTracker;
303     }
304 
305     public List<PasswordTracker> findByUserId(long userId)
306         throws SystemException {
307         return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
308     }
309 
310     public List<PasswordTracker> findByUserId(long userId, int start, int end)
311         throws SystemException {
312         return findByUserId(userId, start, end, null);
313     }
314 
315     public List<PasswordTracker> findByUserId(long userId, int start, int end,
316         OrderByComparator orderByComparator) throws SystemException {
317         Object[] finderArgs = new Object[] {
318                 userId,
319                 
320                 String.valueOf(start), String.valueOf(end),
321                 String.valueOf(orderByComparator)
322             };
323 
324         List<PasswordTracker> list = (List<PasswordTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
325                 finderArgs, this);
326 
327         if (list == null) {
328             StringBundler query = null;
329 
330             if (orderByComparator != null) {
331                 query = new StringBundler(3 +
332                         (orderByComparator.getOrderByFields().length * 3));
333             }
334             else {
335                 query = new StringBundler(3);
336             }
337 
338             query.append(_SQL_SELECT_PASSWORDTRACKER_WHERE);
339 
340             query.append(_FINDER_COLUMN_USERID_USERID_2);
341 
342             if (orderByComparator != null) {
343                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
344                     orderByComparator);
345             }
346 
347             else {
348                 query.append(PasswordTrackerModelImpl.ORDER_BY_JPQL);
349             }
350 
351             String sql = query.toString();
352 
353             Session session = null;
354 
355             try {
356                 session = openSession();
357 
358                 Query q = session.createQuery(sql);
359 
360                 QueryPos qPos = QueryPos.getInstance(q);
361 
362                 qPos.add(userId);
363 
364                 list = (List<PasswordTracker>)QueryUtil.list(q, getDialect(),
365                         start, end);
366             }
367             catch (Exception e) {
368                 throw processException(e);
369             }
370             finally {
371                 if (list == null) {
372                     list = new ArrayList<PasswordTracker>();
373                 }
374 
375                 cacheResult(list);
376 
377                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
378                     finderArgs, list);
379 
380                 closeSession(session);
381             }
382         }
383 
384         return list;
385     }
386 
387     public PasswordTracker findByUserId_First(long userId,
388         OrderByComparator orderByComparator)
389         throws NoSuchPasswordTrackerException, SystemException {
390         List<PasswordTracker> list = findByUserId(userId, 0, 1,
391                 orderByComparator);
392 
393         if (list.isEmpty()) {
394             StringBundler msg = new StringBundler(4);
395 
396             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
397 
398             msg.append("userId=");
399             msg.append(userId);
400 
401             msg.append(StringPool.CLOSE_CURLY_BRACE);
402 
403             throw new NoSuchPasswordTrackerException(msg.toString());
404         }
405         else {
406             return list.get(0);
407         }
408     }
409 
410     public PasswordTracker findByUserId_Last(long userId,
411         OrderByComparator orderByComparator)
412         throws NoSuchPasswordTrackerException, SystemException {
413         int count = countByUserId(userId);
414 
415         List<PasswordTracker> list = findByUserId(userId, count - 1, count,
416                 orderByComparator);
417 
418         if (list.isEmpty()) {
419             StringBundler msg = new StringBundler(4);
420 
421             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
422 
423             msg.append("userId=");
424             msg.append(userId);
425 
426             msg.append(StringPool.CLOSE_CURLY_BRACE);
427 
428             throw new NoSuchPasswordTrackerException(msg.toString());
429         }
430         else {
431             return list.get(0);
432         }
433     }
434 
435     public PasswordTracker[] findByUserId_PrevAndNext(long passwordTrackerId,
436         long userId, OrderByComparator orderByComparator)
437         throws NoSuchPasswordTrackerException, SystemException {
438         PasswordTracker passwordTracker = findByPrimaryKey(passwordTrackerId);
439 
440         Session session = null;
441 
442         try {
443             session = openSession();
444 
445             PasswordTracker[] array = new PasswordTrackerImpl[3];
446 
447             array[0] = getByUserId_PrevAndNext(session, passwordTracker,
448                     userId, orderByComparator, true);
449 
450             array[1] = passwordTracker;
451 
452             array[2] = getByUserId_PrevAndNext(session, passwordTracker,
453                     userId, orderByComparator, false);
454 
455             return array;
456         }
457         catch (Exception e) {
458             throw processException(e);
459         }
460         finally {
461             closeSession(session);
462         }
463     }
464 
465     protected PasswordTracker getByUserId_PrevAndNext(Session session,
466         PasswordTracker passwordTracker, long userId,
467         OrderByComparator orderByComparator, boolean previous) {
468         StringBundler query = null;
469 
470         if (orderByComparator != null) {
471             query = new StringBundler(6 +
472                     (orderByComparator.getOrderByFields().length * 6));
473         }
474         else {
475             query = new StringBundler(3);
476         }
477 
478         query.append(_SQL_SELECT_PASSWORDTRACKER_WHERE);
479 
480         query.append(_FINDER_COLUMN_USERID_USERID_2);
481 
482         if (orderByComparator != null) {
483             String[] orderByFields = orderByComparator.getOrderByFields();
484 
485             if (orderByFields.length > 0) {
486                 query.append(WHERE_AND);
487             }
488 
489             for (int i = 0; i < orderByFields.length; i++) {
490                 query.append(_ORDER_BY_ENTITY_ALIAS);
491                 query.append(orderByFields[i]);
492 
493                 if ((i + 1) < orderByFields.length) {
494                     if (orderByComparator.isAscending() ^ previous) {
495                         query.append(WHERE_GREATER_THAN_HAS_NEXT);
496                     }
497                     else {
498                         query.append(WHERE_LESSER_THAN_HAS_NEXT);
499                     }
500                 }
501                 else {
502                     if (orderByComparator.isAscending() ^ previous) {
503                         query.append(WHERE_GREATER_THAN);
504                     }
505                     else {
506                         query.append(WHERE_LESSER_THAN);
507                     }
508                 }
509             }
510 
511             query.append(ORDER_BY_CLAUSE);
512 
513             for (int i = 0; i < orderByFields.length; i++) {
514                 query.append(_ORDER_BY_ENTITY_ALIAS);
515                 query.append(orderByFields[i]);
516 
517                 if ((i + 1) < orderByFields.length) {
518                     if (orderByComparator.isAscending() ^ previous) {
519                         query.append(ORDER_BY_ASC_HAS_NEXT);
520                     }
521                     else {
522                         query.append(ORDER_BY_DESC_HAS_NEXT);
523                     }
524                 }
525                 else {
526                     if (orderByComparator.isAscending() ^ previous) {
527                         query.append(ORDER_BY_ASC);
528                     }
529                     else {
530                         query.append(ORDER_BY_DESC);
531                     }
532                 }
533             }
534         }
535 
536         else {
537             query.append(PasswordTrackerModelImpl.ORDER_BY_JPQL);
538         }
539 
540         String sql = query.toString();
541 
542         Query q = session.createQuery(sql);
543 
544         q.setFirstResult(0);
545         q.setMaxResults(2);
546 
547         QueryPos qPos = QueryPos.getInstance(q);
548 
549         qPos.add(userId);
550 
551         if (orderByComparator != null) {
552             Object[] values = orderByComparator.getOrderByValues(passwordTracker);
553 
554             for (Object value : values) {
555                 qPos.add(value);
556             }
557         }
558 
559         List<PasswordTracker> list = q.list();
560 
561         if (list.size() == 2) {
562             return list.get(1);
563         }
564         else {
565             return null;
566         }
567     }
568 
569     public List<PasswordTracker> findAll() throws SystemException {
570         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
571     }
572 
573     public List<PasswordTracker> findAll(int start, int end)
574         throws SystemException {
575         return findAll(start, end, null);
576     }
577 
578     public List<PasswordTracker> findAll(int start, int end,
579         OrderByComparator orderByComparator) throws SystemException {
580         Object[] finderArgs = new Object[] {
581                 String.valueOf(start), String.valueOf(end),
582                 String.valueOf(orderByComparator)
583             };
584 
585         List<PasswordTracker> list = (List<PasswordTracker>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
586                 finderArgs, this);
587 
588         if (list == null) {
589             StringBundler query = null;
590             String sql = null;
591 
592             if (orderByComparator != null) {
593                 query = new StringBundler(2 +
594                         (orderByComparator.getOrderByFields().length * 3));
595 
596                 query.append(_SQL_SELECT_PASSWORDTRACKER);
597 
598                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
599                     orderByComparator);
600 
601                 sql = query.toString();
602             }
603             else {
604                 sql = _SQL_SELECT_PASSWORDTRACKER.concat(PasswordTrackerModelImpl.ORDER_BY_JPQL);
605             }
606 
607             Session session = null;
608 
609             try {
610                 session = openSession();
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[] { userId };
658 
659         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
660                 finderArgs, this);
661 
662         if (count == null) {
663             StringBundler query = new StringBundler(2);
664 
665             query.append(_SQL_COUNT_PASSWORDTRACKER_WHERE);
666 
667             query.append(_FINDER_COLUMN_USERID_USERID_2);
668 
669             String sql = query.toString();
670 
671             Session session = null;
672 
673             try {
674                 session = openSession();
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>)InstanceFactory.newInstance(
747                             listenerClassName));
748                 }
749 
750                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
751             }
752             catch (Exception e) {
753                 _log.error(e);
754             }
755         }
756     }
757 
758     public void destroy() {
759         EntityCacheUtil.removeCache(PasswordTrackerImpl.class.getName());
760         FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
761         FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
762     }
763 
764     @BeanReference(type = AccountPersistence.class)
765     protected AccountPersistence accountPersistence;
766     @BeanReference(type = AddressPersistence.class)
767     protected AddressPersistence addressPersistence;
768     @BeanReference(type = BrowserTrackerPersistence.class)
769     protected BrowserTrackerPersistence browserTrackerPersistence;
770     @BeanReference(type = ClassNamePersistence.class)
771     protected ClassNamePersistence classNamePersistence;
772     @BeanReference(type = CompanyPersistence.class)
773     protected CompanyPersistence companyPersistence;
774     @BeanReference(type = ContactPersistence.class)
775     protected ContactPersistence contactPersistence;
776     @BeanReference(type = CountryPersistence.class)
777     protected CountryPersistence countryPersistence;
778     @BeanReference(type = EmailAddressPersistence.class)
779     protected EmailAddressPersistence emailAddressPersistence;
780     @BeanReference(type = GroupPersistence.class)
781     protected GroupPersistence groupPersistence;
782     @BeanReference(type = ImagePersistence.class)
783     protected ImagePersistence imagePersistence;
784     @BeanReference(type = LayoutPersistence.class)
785     protected LayoutPersistence layoutPersistence;
786     @BeanReference(type = LayoutSetPersistence.class)
787     protected LayoutSetPersistence layoutSetPersistence;
788     @BeanReference(type = ListTypePersistence.class)
789     protected ListTypePersistence listTypePersistence;
790     @BeanReference(type = LockPersistence.class)
791     protected LockPersistence lockPersistence;
792     @BeanReference(type = MembershipRequestPersistence.class)
793     protected MembershipRequestPersistence membershipRequestPersistence;
794     @BeanReference(type = OrganizationPersistence.class)
795     protected OrganizationPersistence organizationPersistence;
796     @BeanReference(type = OrgGroupPermissionPersistence.class)
797     protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
798     @BeanReference(type = OrgGroupRolePersistence.class)
799     protected OrgGroupRolePersistence orgGroupRolePersistence;
800     @BeanReference(type = OrgLaborPersistence.class)
801     protected OrgLaborPersistence orgLaborPersistence;
802     @BeanReference(type = PasswordPolicyPersistence.class)
803     protected PasswordPolicyPersistence passwordPolicyPersistence;
804     @BeanReference(type = PasswordPolicyRelPersistence.class)
805     protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
806     @BeanReference(type = PasswordTrackerPersistence.class)
807     protected PasswordTrackerPersistence passwordTrackerPersistence;
808     @BeanReference(type = PermissionPersistence.class)
809     protected PermissionPersistence permissionPersistence;
810     @BeanReference(type = PhonePersistence.class)
811     protected PhonePersistence phonePersistence;
812     @BeanReference(type = PluginSettingPersistence.class)
813     protected PluginSettingPersistence pluginSettingPersistence;
814     @BeanReference(type = PortletPersistence.class)
815     protected PortletPersistence portletPersistence;
816     @BeanReference(type = PortletItemPersistence.class)
817     protected PortletItemPersistence portletItemPersistence;
818     @BeanReference(type = PortletPreferencesPersistence.class)
819     protected PortletPreferencesPersistence portletPreferencesPersistence;
820     @BeanReference(type = RegionPersistence.class)
821     protected RegionPersistence regionPersistence;
822     @BeanReference(type = ReleasePersistence.class)
823     protected ReleasePersistence releasePersistence;
824     @BeanReference(type = ResourcePersistence.class)
825     protected ResourcePersistence resourcePersistence;
826     @BeanReference(type = ResourceActionPersistence.class)
827     protected ResourceActionPersistence resourceActionPersistence;
828     @BeanReference(type = ResourceCodePersistence.class)
829     protected ResourceCodePersistence resourceCodePersistence;
830     @BeanReference(type = ResourcePermissionPersistence.class)
831     protected ResourcePermissionPersistence resourcePermissionPersistence;
832     @BeanReference(type = RolePersistence.class)
833     protected RolePersistence rolePersistence;
834     @BeanReference(type = ServiceComponentPersistence.class)
835     protected ServiceComponentPersistence serviceComponentPersistence;
836     @BeanReference(type = ShardPersistence.class)
837     protected ShardPersistence shardPersistence;
838     @BeanReference(type = SubscriptionPersistence.class)
839     protected SubscriptionPersistence subscriptionPersistence;
840     @BeanReference(type = UserPersistence.class)
841     protected UserPersistence userPersistence;
842     @BeanReference(type = UserGroupPersistence.class)
843     protected UserGroupPersistence userGroupPersistence;
844     @BeanReference(type = UserGroupGroupRolePersistence.class)
845     protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
846     @BeanReference(type = UserGroupRolePersistence.class)
847     protected UserGroupRolePersistence userGroupRolePersistence;
848     @BeanReference(type = UserIdMapperPersistence.class)
849     protected UserIdMapperPersistence userIdMapperPersistence;
850     @BeanReference(type = UserTrackerPersistence.class)
851     protected UserTrackerPersistence userTrackerPersistence;
852     @BeanReference(type = UserTrackerPathPersistence.class)
853     protected UserTrackerPathPersistence userTrackerPathPersistence;
854     @BeanReference(type = WebDAVPropsPersistence.class)
855     protected WebDAVPropsPersistence webDAVPropsPersistence;
856     @BeanReference(type = WebsitePersistence.class)
857     protected WebsitePersistence websitePersistence;
858     private static final String _SQL_SELECT_PASSWORDTRACKER = "SELECT passwordTracker FROM PasswordTracker passwordTracker";
859     private static final String _SQL_SELECT_PASSWORDTRACKER_WHERE = "SELECT passwordTracker FROM PasswordTracker passwordTracker WHERE ";
860     private static final String _SQL_COUNT_PASSWORDTRACKER = "SELECT COUNT(passwordTracker) FROM PasswordTracker passwordTracker";
861     private static final String _SQL_COUNT_PASSWORDTRACKER_WHERE = "SELECT COUNT(passwordTracker) FROM PasswordTracker passwordTracker WHERE ";
862     private static final String _FINDER_COLUMN_USERID_USERID_2 = "passwordTracker.userId = ?";
863     private static final String _ORDER_BY_ENTITY_ALIAS = "passwordTracker.";
864     private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PasswordTracker exists with the primary key ";
865     private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PasswordTracker exists with the key {";
866     private static Log _log = LogFactoryUtil.getLog(PasswordTrackerPersistenceImpl.class);
867 }