1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchLockException;
18  import com.liferay.portal.NoSuchModelException;
19  import com.liferay.portal.SystemException;
20  import com.liferay.portal.kernel.annotation.BeanReference;
21  import com.liferay.portal.kernel.cache.CacheRegistry;
22  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
23  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
24  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
25  import com.liferay.portal.kernel.dao.orm.FinderPath;
26  import com.liferay.portal.kernel.dao.orm.Query;
27  import com.liferay.portal.kernel.dao.orm.QueryPos;
28  import com.liferay.portal.kernel.dao.orm.QueryUtil;
29  import com.liferay.portal.kernel.dao.orm.Session;
30  import com.liferay.portal.kernel.log.Log;
31  import com.liferay.portal.kernel.log.LogFactoryUtil;
32  import com.liferay.portal.kernel.util.CalendarUtil;
33  import com.liferay.portal.kernel.util.GetterUtil;
34  import com.liferay.portal.kernel.util.OrderByComparator;
35  import com.liferay.portal.kernel.util.StringBundler;
36  import com.liferay.portal.kernel.util.StringPool;
37  import com.liferay.portal.kernel.util.StringUtil;
38  import com.liferay.portal.kernel.util.Validator;
39  import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
40  import com.liferay.portal.model.Lock;
41  import com.liferay.portal.model.ModelListener;
42  import com.liferay.portal.model.impl.LockImpl;
43  import com.liferay.portal.model.impl.LockModelImpl;
44  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
45  
46  import java.io.Serializable;
47  
48  import java.util.ArrayList;
49  import java.util.Collections;
50  import java.util.Date;
51  import java.util.List;
52  
53  /**
54   * <a href="LockPersistenceImpl.java.html"><b><i>View Source</i></b></a>
55   *
56   * <p>
57   * ServiceBuilder generated this class. Modifications in this class will be
58   * overwritten the next time is generated.
59   * </p>
60   *
61   * @author    Brian Wing Shun Chan
62   * @see       LockPersistence
63   * @see       LockUtil
64   * @generated
65   */
66  public class LockPersistenceImpl extends BasePersistenceImpl<Lock>
67      implements LockPersistence {
68      public static final String FINDER_CLASS_NAME_ENTITY = LockImpl.class.getName();
69      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
70          ".List";
71      public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(LockModelImpl.ENTITY_CACHE_ENABLED,
72              LockModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
73              "findByUuid", new String[] { String.class.getName() });
74      public static final FinderPath FINDER_PATH_FIND_BY_OBC_UUID = new FinderPath(LockModelImpl.ENTITY_CACHE_ENABLED,
75              LockModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
76              "findByUuid",
77              new String[] {
78                  String.class.getName(),
79                  
80              "java.lang.Integer", "java.lang.Integer",
81                  "com.liferay.portal.kernel.util.OrderByComparator"
82              });
83      public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(LockModelImpl.ENTITY_CACHE_ENABLED,
84              LockModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
85              "countByUuid", new String[] { String.class.getName() });
86      public static final FinderPath FINDER_PATH_FIND_BY_EXPIRATIONDATE = new FinderPath(LockModelImpl.ENTITY_CACHE_ENABLED,
87              LockModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
88              "findByExpirationDate", new String[] { Date.class.getName() });
89      public static final FinderPath FINDER_PATH_FIND_BY_OBC_EXPIRATIONDATE = new FinderPath(LockModelImpl.ENTITY_CACHE_ENABLED,
90              LockModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
91              "findByExpirationDate",
92              new String[] {
93                  Date.class.getName(),
94                  
95              "java.lang.Integer", "java.lang.Integer",
96                  "com.liferay.portal.kernel.util.OrderByComparator"
97              });
98      public static final FinderPath FINDER_PATH_COUNT_BY_EXPIRATIONDATE = new FinderPath(LockModelImpl.ENTITY_CACHE_ENABLED,
99              LockModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
100             "countByExpirationDate", new String[] { Date.class.getName() });
101     public static final FinderPath FINDER_PATH_FETCH_BY_C_K = new FinderPath(LockModelImpl.ENTITY_CACHE_ENABLED,
102             LockModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
103             "fetchByC_K",
104             new String[] { String.class.getName(), String.class.getName() });
105     public static final FinderPath FINDER_PATH_COUNT_BY_C_K = new FinderPath(LockModelImpl.ENTITY_CACHE_ENABLED,
106             LockModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
107             "countByC_K",
108             new String[] { String.class.getName(), String.class.getName() });
109     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(LockModelImpl.ENTITY_CACHE_ENABLED,
110             LockModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
111             "findAll", new String[0]);
112     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(LockModelImpl.ENTITY_CACHE_ENABLED,
113             LockModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
114             "countAll", new String[0]);
115 
116     public void cacheResult(Lock lock) {
117         EntityCacheUtil.putResult(LockModelImpl.ENTITY_CACHE_ENABLED,
118             LockImpl.class, lock.getPrimaryKey(), lock);
119 
120         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_K,
121             new Object[] { lock.getClassName(), lock.getKey() }, lock);
122     }
123 
124     public void cacheResult(List<Lock> locks) {
125         for (Lock lock : locks) {
126             if (EntityCacheUtil.getResult(LockModelImpl.ENTITY_CACHE_ENABLED,
127                         LockImpl.class, lock.getPrimaryKey(), this) == null) {
128                 cacheResult(lock);
129             }
130         }
131     }
132 
133     public void clearCache() {
134         CacheRegistry.clear(LockImpl.class.getName());
135         EntityCacheUtil.clearCache(LockImpl.class.getName());
136         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
137         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
138     }
139 
140     public Lock create(long lockId) {
141         Lock lock = new LockImpl();
142 
143         lock.setNew(true);
144         lock.setPrimaryKey(lockId);
145 
146         String uuid = PortalUUIDUtil.generate();
147 
148         lock.setUuid(uuid);
149 
150         return lock;
151     }
152 
153     public Lock remove(Serializable primaryKey)
154         throws NoSuchModelException, SystemException {
155         return remove(((Long)primaryKey).longValue());
156     }
157 
158     public Lock remove(long lockId) throws NoSuchLockException, SystemException {
159         Session session = null;
160 
161         try {
162             session = openSession();
163 
164             Lock lock = (Lock)session.get(LockImpl.class, new Long(lockId));
165 
166             if (lock == null) {
167                 if (_log.isWarnEnabled()) {
168                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + lockId);
169                 }
170 
171                 throw new NoSuchLockException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
172                     lockId);
173             }
174 
175             return remove(lock);
176         }
177         catch (NoSuchLockException nsee) {
178             throw nsee;
179         }
180         catch (Exception e) {
181             throw processException(e);
182         }
183         finally {
184             closeSession(session);
185         }
186     }
187 
188     public Lock remove(Lock lock) throws SystemException {
189         for (ModelListener<Lock> listener : listeners) {
190             listener.onBeforeRemove(lock);
191         }
192 
193         lock = removeImpl(lock);
194 
195         for (ModelListener<Lock> listener : listeners) {
196             listener.onAfterRemove(lock);
197         }
198 
199         return lock;
200     }
201 
202     protected Lock removeImpl(Lock lock) throws SystemException {
203         lock = toUnwrappedModel(lock);
204 
205         Session session = null;
206 
207         try {
208             session = openSession();
209 
210             if (lock.isCachedModel() || BatchSessionUtil.isEnabled()) {
211                 Object staleObject = session.get(LockImpl.class,
212                         lock.getPrimaryKeyObj());
213 
214                 if (staleObject != null) {
215                     session.evict(staleObject);
216                 }
217             }
218 
219             session.delete(lock);
220 
221             session.flush();
222         }
223         catch (Exception e) {
224             throw processException(e);
225         }
226         finally {
227             closeSession(session);
228         }
229 
230         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
231 
232         LockModelImpl lockModelImpl = (LockModelImpl)lock;
233 
234         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_K,
235             new Object[] {
236                 lockModelImpl.getOriginalClassName(),
237                 
238             lockModelImpl.getOriginalKey()
239             });
240 
241         EntityCacheUtil.removeResult(LockModelImpl.ENTITY_CACHE_ENABLED,
242             LockImpl.class, lock.getPrimaryKey());
243 
244         return lock;
245     }
246 
247     /**
248      * @deprecated Use {@link BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)}.
249      */
250     public Lock update(Lock lock) throws SystemException {
251         if (_log.isWarnEnabled()) {
252             _log.warn(
253                 "Using the deprecated update(Lock lock) method. Use update(Lock lock, boolean merge) instead.");
254         }
255 
256         return update(lock, false);
257     }
258 
259     public Lock updateImpl(com.liferay.portal.model.Lock lock, boolean merge)
260         throws SystemException {
261         lock = toUnwrappedModel(lock);
262 
263         boolean isNew = lock.isNew();
264 
265         LockModelImpl lockModelImpl = (LockModelImpl)lock;
266 
267         if (Validator.isNull(lock.getUuid())) {
268             String uuid = PortalUUIDUtil.generate();
269 
270             lock.setUuid(uuid);
271         }
272 
273         Session session = null;
274 
275         try {
276             session = openSession();
277 
278             BatchSessionUtil.update(session, lock, merge);
279 
280             lock.setNew(false);
281         }
282         catch (Exception e) {
283             throw processException(e);
284         }
285         finally {
286             closeSession(session);
287         }
288 
289         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
290 
291         EntityCacheUtil.putResult(LockModelImpl.ENTITY_CACHE_ENABLED,
292             LockImpl.class, lock.getPrimaryKey(), lock);
293 
294         if (!isNew &&
295                 (!Validator.equals(lock.getClassName(),
296                     lockModelImpl.getOriginalClassName()) ||
297                 !Validator.equals(lock.getKey(), lockModelImpl.getOriginalKey()))) {
298             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_K,
299                 new Object[] {
300                     lockModelImpl.getOriginalClassName(),
301                     
302                 lockModelImpl.getOriginalKey()
303                 });
304         }
305 
306         if (isNew ||
307                 (!Validator.equals(lock.getClassName(),
308                     lockModelImpl.getOriginalClassName()) ||
309                 !Validator.equals(lock.getKey(), lockModelImpl.getOriginalKey()))) {
310             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_K,
311                 new Object[] { lock.getClassName(), lock.getKey() }, lock);
312         }
313 
314         return lock;
315     }
316 
317     protected Lock toUnwrappedModel(Lock lock) {
318         if (lock instanceof LockImpl) {
319             return lock;
320         }
321 
322         LockImpl lockImpl = new LockImpl();
323 
324         lockImpl.setNew(lock.isNew());
325         lockImpl.setPrimaryKey(lock.getPrimaryKey());
326 
327         lockImpl.setUuid(lock.getUuid());
328         lockImpl.setLockId(lock.getLockId());
329         lockImpl.setCompanyId(lock.getCompanyId());
330         lockImpl.setUserId(lock.getUserId());
331         lockImpl.setUserName(lock.getUserName());
332         lockImpl.setCreateDate(lock.getCreateDate());
333         lockImpl.setClassName(lock.getClassName());
334         lockImpl.setKey(lock.getKey());
335         lockImpl.setOwner(lock.getOwner());
336         lockImpl.setInheritable(lock.isInheritable());
337         lockImpl.setExpirationDate(lock.getExpirationDate());
338 
339         return lockImpl;
340     }
341 
342     public Lock findByPrimaryKey(Serializable primaryKey)
343         throws NoSuchModelException, SystemException {
344         return findByPrimaryKey(((Long)primaryKey).longValue());
345     }
346 
347     public Lock findByPrimaryKey(long lockId)
348         throws NoSuchLockException, SystemException {
349         Lock lock = fetchByPrimaryKey(lockId);
350 
351         if (lock == null) {
352             if (_log.isWarnEnabled()) {
353                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + lockId);
354             }
355 
356             throw new NoSuchLockException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
357                 lockId);
358         }
359 
360         return lock;
361     }
362 
363     public Lock fetchByPrimaryKey(Serializable primaryKey)
364         throws SystemException {
365         return fetchByPrimaryKey(((Long)primaryKey).longValue());
366     }
367 
368     public Lock fetchByPrimaryKey(long lockId) throws SystemException {
369         Lock lock = (Lock)EntityCacheUtil.getResult(LockModelImpl.ENTITY_CACHE_ENABLED,
370                 LockImpl.class, lockId, this);
371 
372         if (lock == null) {
373             Session session = null;
374 
375             try {
376                 session = openSession();
377 
378                 lock = (Lock)session.get(LockImpl.class, new Long(lockId));
379             }
380             catch (Exception e) {
381                 throw processException(e);
382             }
383             finally {
384                 if (lock != null) {
385                     cacheResult(lock);
386                 }
387 
388                 closeSession(session);
389             }
390         }
391 
392         return lock;
393     }
394 
395     public List<Lock> findByUuid(String uuid) throws SystemException {
396         Object[] finderArgs = new Object[] { uuid };
397 
398         List<Lock> list = (List<Lock>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
399                 finderArgs, this);
400 
401         if (list == null) {
402             Session session = null;
403 
404             try {
405                 session = openSession();
406 
407                 StringBundler query = new StringBundler(2);
408 
409                 query.append(_SQL_SELECT_LOCK_WHERE);
410 
411                 if (uuid == null) {
412                     query.append(_FINDER_COLUMN_UUID_UUID_1);
413                 }
414                 else {
415                     if (uuid.equals(StringPool.BLANK)) {
416                         query.append(_FINDER_COLUMN_UUID_UUID_3);
417                     }
418                     else {
419                         query.append(_FINDER_COLUMN_UUID_UUID_2);
420                     }
421                 }
422 
423                 String sql = query.toString();
424 
425                 Query q = session.createQuery(sql);
426 
427                 QueryPos qPos = QueryPos.getInstance(q);
428 
429                 if (uuid != null) {
430                     qPos.add(uuid);
431                 }
432 
433                 list = q.list();
434             }
435             catch (Exception e) {
436                 throw processException(e);
437             }
438             finally {
439                 if (list == null) {
440                     list = new ArrayList<Lock>();
441                 }
442 
443                 cacheResult(list);
444 
445                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
446                     list);
447 
448                 closeSession(session);
449             }
450         }
451 
452         return list;
453     }
454 
455     public List<Lock> findByUuid(String uuid, int start, int end)
456         throws SystemException {
457         return findByUuid(uuid, start, end, null);
458     }
459 
460     public List<Lock> findByUuid(String uuid, int start, int end,
461         OrderByComparator obc) throws SystemException {
462         Object[] finderArgs = new Object[] {
463                 uuid,
464                 
465                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
466             };
467 
468         List<Lock> list = (List<Lock>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_UUID,
469                 finderArgs, this);
470 
471         if (list == null) {
472             Session session = null;
473 
474             try {
475                 session = openSession();
476 
477                 StringBundler query = null;
478 
479                 if (obc != null) {
480                     query = new StringBundler(3 +
481                             (obc.getOrderByFields().length * 3));
482                 }
483                 else {
484                     query = new StringBundler(2);
485                 }
486 
487                 query.append(_SQL_SELECT_LOCK_WHERE);
488 
489                 if (uuid == null) {
490                     query.append(_FINDER_COLUMN_UUID_UUID_1);
491                 }
492                 else {
493                     if (uuid.equals(StringPool.BLANK)) {
494                         query.append(_FINDER_COLUMN_UUID_UUID_3);
495                     }
496                     else {
497                         query.append(_FINDER_COLUMN_UUID_UUID_2);
498                     }
499                 }
500 
501                 if (obc != null) {
502                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
503                 }
504 
505                 String sql = query.toString();
506 
507                 Query q = session.createQuery(sql);
508 
509                 QueryPos qPos = QueryPos.getInstance(q);
510 
511                 if (uuid != null) {
512                     qPos.add(uuid);
513                 }
514 
515                 list = (List<Lock>)QueryUtil.list(q, getDialect(), start, end);
516             }
517             catch (Exception e) {
518                 throw processException(e);
519             }
520             finally {
521                 if (list == null) {
522                     list = new ArrayList<Lock>();
523                 }
524 
525                 cacheResult(list);
526 
527                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_UUID,
528                     finderArgs, list);
529 
530                 closeSession(session);
531             }
532         }
533 
534         return list;
535     }
536 
537     public Lock findByUuid_First(String uuid, OrderByComparator obc)
538         throws NoSuchLockException, SystemException {
539         List<Lock> list = findByUuid(uuid, 0, 1, obc);
540 
541         if (list.isEmpty()) {
542             StringBundler msg = new StringBundler(4);
543 
544             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
545 
546             msg.append("uuid=");
547             msg.append(uuid);
548 
549             msg.append(StringPool.CLOSE_CURLY_BRACE);
550 
551             throw new NoSuchLockException(msg.toString());
552         }
553         else {
554             return list.get(0);
555         }
556     }
557 
558     public Lock findByUuid_Last(String uuid, OrderByComparator obc)
559         throws NoSuchLockException, SystemException {
560         int count = countByUuid(uuid);
561 
562         List<Lock> list = findByUuid(uuid, count - 1, count, obc);
563 
564         if (list.isEmpty()) {
565             StringBundler msg = new StringBundler(4);
566 
567             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
568 
569             msg.append("uuid=");
570             msg.append(uuid);
571 
572             msg.append(StringPool.CLOSE_CURLY_BRACE);
573 
574             throw new NoSuchLockException(msg.toString());
575         }
576         else {
577             return list.get(0);
578         }
579     }
580 
581     public Lock[] findByUuid_PrevAndNext(long lockId, String uuid,
582         OrderByComparator obc) throws NoSuchLockException, SystemException {
583         Lock lock = findByPrimaryKey(lockId);
584 
585         int count = countByUuid(uuid);
586 
587         Session session = null;
588 
589         try {
590             session = openSession();
591 
592             StringBundler query = null;
593 
594             if (obc != null) {
595                 query = new StringBundler(3 +
596                         (obc.getOrderByFields().length * 3));
597             }
598             else {
599                 query = new StringBundler(2);
600             }
601 
602             query.append(_SQL_SELECT_LOCK_WHERE);
603 
604             if (uuid == null) {
605                 query.append(_FINDER_COLUMN_UUID_UUID_1);
606             }
607             else {
608                 if (uuid.equals(StringPool.BLANK)) {
609                     query.append(_FINDER_COLUMN_UUID_UUID_3);
610                 }
611                 else {
612                     query.append(_FINDER_COLUMN_UUID_UUID_2);
613                 }
614             }
615 
616             if (obc != null) {
617                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
618             }
619 
620             String sql = query.toString();
621 
622             Query q = session.createQuery(sql);
623 
624             QueryPos qPos = QueryPos.getInstance(q);
625 
626             if (uuid != null) {
627                 qPos.add(uuid);
628             }
629 
630             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, lock);
631 
632             Lock[] array = new LockImpl[3];
633 
634             array[0] = (Lock)objArray[0];
635             array[1] = (Lock)objArray[1];
636             array[2] = (Lock)objArray[2];
637 
638             return array;
639         }
640         catch (Exception e) {
641             throw processException(e);
642         }
643         finally {
644             closeSession(session);
645         }
646     }
647 
648     public List<Lock> findByExpirationDate(Date expirationDate)
649         throws SystemException {
650         Object[] finderArgs = new Object[] { expirationDate };
651 
652         List<Lock> list = (List<Lock>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_EXPIRATIONDATE,
653                 finderArgs, this);
654 
655         if (list == null) {
656             Session session = null;
657 
658             try {
659                 session = openSession();
660 
661                 StringBundler query = new StringBundler(2);
662 
663                 query.append(_SQL_SELECT_LOCK_WHERE);
664 
665                 if (expirationDate == null) {
666                     query.append(_FINDER_COLUMN_EXPIRATIONDATE_EXPIRATIONDATE_1);
667                 }
668                 else {
669                     query.append(_FINDER_COLUMN_EXPIRATIONDATE_EXPIRATIONDATE_2);
670                 }
671 
672                 String sql = query.toString();
673 
674                 Query q = session.createQuery(sql);
675 
676                 QueryPos qPos = QueryPos.getInstance(q);
677 
678                 if (expirationDate != null) {
679                     qPos.add(CalendarUtil.getTimestamp(expirationDate));
680                 }
681 
682                 list = q.list();
683             }
684             catch (Exception e) {
685                 throw processException(e);
686             }
687             finally {
688                 if (list == null) {
689                     list = new ArrayList<Lock>();
690                 }
691 
692                 cacheResult(list);
693 
694                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_EXPIRATIONDATE,
695                     finderArgs, list);
696 
697                 closeSession(session);
698             }
699         }
700 
701         return list;
702     }
703 
704     public List<Lock> findByExpirationDate(Date expirationDate, int start,
705         int end) throws SystemException {
706         return findByExpirationDate(expirationDate, start, end, null);
707     }
708 
709     public List<Lock> findByExpirationDate(Date expirationDate, int start,
710         int end, OrderByComparator obc) throws SystemException {
711         Object[] finderArgs = new Object[] {
712                 expirationDate,
713                 
714                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
715             };
716 
717         List<Lock> list = (List<Lock>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_EXPIRATIONDATE,
718                 finderArgs, this);
719 
720         if (list == null) {
721             Session session = null;
722 
723             try {
724                 session = openSession();
725 
726                 StringBundler query = null;
727 
728                 if (obc != null) {
729                     query = new StringBundler(3 +
730                             (obc.getOrderByFields().length * 3));
731                 }
732                 else {
733                     query = new StringBundler(2);
734                 }
735 
736                 query.append(_SQL_SELECT_LOCK_WHERE);
737 
738                 if (expirationDate == null) {
739                     query.append(_FINDER_COLUMN_EXPIRATIONDATE_EXPIRATIONDATE_1);
740                 }
741                 else {
742                     query.append(_FINDER_COLUMN_EXPIRATIONDATE_EXPIRATIONDATE_2);
743                 }
744 
745                 if (obc != null) {
746                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
747                 }
748 
749                 String sql = query.toString();
750 
751                 Query q = session.createQuery(sql);
752 
753                 QueryPos qPos = QueryPos.getInstance(q);
754 
755                 if (expirationDate != null) {
756                     qPos.add(CalendarUtil.getTimestamp(expirationDate));
757                 }
758 
759                 list = (List<Lock>)QueryUtil.list(q, getDialect(), start, end);
760             }
761             catch (Exception e) {
762                 throw processException(e);
763             }
764             finally {
765                 if (list == null) {
766                     list = new ArrayList<Lock>();
767                 }
768 
769                 cacheResult(list);
770 
771                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_EXPIRATIONDATE,
772                     finderArgs, list);
773 
774                 closeSession(session);
775             }
776         }
777 
778         return list;
779     }
780 
781     public Lock findByExpirationDate_First(Date expirationDate,
782         OrderByComparator obc) throws NoSuchLockException, SystemException {
783         List<Lock> list = findByExpirationDate(expirationDate, 0, 1, obc);
784 
785         if (list.isEmpty()) {
786             StringBundler msg = new StringBundler(4);
787 
788             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
789 
790             msg.append("expirationDate=");
791             msg.append(expirationDate);
792 
793             msg.append(StringPool.CLOSE_CURLY_BRACE);
794 
795             throw new NoSuchLockException(msg.toString());
796         }
797         else {
798             return list.get(0);
799         }
800     }
801 
802     public Lock findByExpirationDate_Last(Date expirationDate,
803         OrderByComparator obc) throws NoSuchLockException, SystemException {
804         int count = countByExpirationDate(expirationDate);
805 
806         List<Lock> list = findByExpirationDate(expirationDate, count - 1,
807                 count, obc);
808 
809         if (list.isEmpty()) {
810             StringBundler msg = new StringBundler(4);
811 
812             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
813 
814             msg.append("expirationDate=");
815             msg.append(expirationDate);
816 
817             msg.append(StringPool.CLOSE_CURLY_BRACE);
818 
819             throw new NoSuchLockException(msg.toString());
820         }
821         else {
822             return list.get(0);
823         }
824     }
825 
826     public Lock[] findByExpirationDate_PrevAndNext(long lockId,
827         Date expirationDate, OrderByComparator obc)
828         throws NoSuchLockException, SystemException {
829         Lock lock = findByPrimaryKey(lockId);
830 
831         int count = countByExpirationDate(expirationDate);
832 
833         Session session = null;
834 
835         try {
836             session = openSession();
837 
838             StringBundler query = null;
839 
840             if (obc != null) {
841                 query = new StringBundler(3 +
842                         (obc.getOrderByFields().length * 3));
843             }
844             else {
845                 query = new StringBundler(2);
846             }
847 
848             query.append(_SQL_SELECT_LOCK_WHERE);
849 
850             if (expirationDate == null) {
851                 query.append(_FINDER_COLUMN_EXPIRATIONDATE_EXPIRATIONDATE_1);
852             }
853             else {
854                 query.append(_FINDER_COLUMN_EXPIRATIONDATE_EXPIRATIONDATE_2);
855             }
856 
857             if (obc != null) {
858                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
859             }
860 
861             String sql = query.toString();
862 
863             Query q = session.createQuery(sql);
864 
865             QueryPos qPos = QueryPos.getInstance(q);
866 
867             if (expirationDate != null) {
868                 qPos.add(CalendarUtil.getTimestamp(expirationDate));
869             }
870 
871             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, lock);
872 
873             Lock[] array = new LockImpl[3];
874 
875             array[0] = (Lock)objArray[0];
876             array[1] = (Lock)objArray[1];
877             array[2] = (Lock)objArray[2];
878 
879             return array;
880         }
881         catch (Exception e) {
882             throw processException(e);
883         }
884         finally {
885             closeSession(session);
886         }
887     }
888 
889     public Lock findByC_K(String className, String key)
890         throws NoSuchLockException, SystemException {
891         Lock lock = fetchByC_K(className, key);
892 
893         if (lock == null) {
894             StringBundler msg = new StringBundler(6);
895 
896             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
897 
898             msg.append("className=");
899             msg.append(className);
900 
901             msg.append(", key=");
902             msg.append(key);
903 
904             msg.append(StringPool.CLOSE_CURLY_BRACE);
905 
906             if (_log.isWarnEnabled()) {
907                 _log.warn(msg.toString());
908             }
909 
910             throw new NoSuchLockException(msg.toString());
911         }
912 
913         return lock;
914     }
915 
916     public Lock fetchByC_K(String className, String key)
917         throws SystemException {
918         return fetchByC_K(className, key, true);
919     }
920 
921     public Lock fetchByC_K(String className, String key,
922         boolean retrieveFromCache) throws SystemException {
923         Object[] finderArgs = new Object[] { className, key };
924 
925         Object result = null;
926 
927         if (retrieveFromCache) {
928             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_K,
929                     finderArgs, this);
930         }
931 
932         if (result == null) {
933             Session session = null;
934 
935             try {
936                 session = openSession();
937 
938                 StringBundler query = new StringBundler(3);
939 
940                 query.append(_SQL_SELECT_LOCK_WHERE);
941 
942                 if (className == null) {
943                     query.append(_FINDER_COLUMN_C_K_CLASSNAME_1);
944                 }
945                 else {
946                     if (className.equals(StringPool.BLANK)) {
947                         query.append(_FINDER_COLUMN_C_K_CLASSNAME_3);
948                     }
949                     else {
950                         query.append(_FINDER_COLUMN_C_K_CLASSNAME_2);
951                     }
952                 }
953 
954                 if (key == null) {
955                     query.append(_FINDER_COLUMN_C_K_KEY_1);
956                 }
957                 else {
958                     if (key.equals(StringPool.BLANK)) {
959                         query.append(_FINDER_COLUMN_C_K_KEY_3);
960                     }
961                     else {
962                         query.append(_FINDER_COLUMN_C_K_KEY_2);
963                     }
964                 }
965 
966                 String sql = query.toString();
967 
968                 Query q = session.createQuery(sql);
969 
970                 QueryPos qPos = QueryPos.getInstance(q);
971 
972                 if (className != null) {
973                     qPos.add(className);
974                 }
975 
976                 if (key != null) {
977                     qPos.add(key);
978                 }
979 
980                 List<Lock> list = q.list();
981 
982                 result = list;
983 
984                 Lock lock = null;
985 
986                 if (list.isEmpty()) {
987                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_K,
988                         finderArgs, list);
989                 }
990                 else {
991                     lock = list.get(0);
992 
993                     cacheResult(lock);
994 
995                     if ((lock.getClassName() == null) ||
996                             !lock.getClassName().equals(className) ||
997                             (lock.getKey() == null) ||
998                             !lock.getKey().equals(key)) {
999                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_K,
1000                            finderArgs, lock);
1001                    }
1002                }
1003
1004                return lock;
1005            }
1006            catch (Exception e) {
1007                throw processException(e);
1008            }
1009            finally {
1010                if (result == null) {
1011                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_K,
1012                        finderArgs, new ArrayList<Lock>());
1013                }
1014
1015                closeSession(session);
1016            }
1017        }
1018        else {
1019            if (result instanceof List<?>) {
1020                return null;
1021            }
1022            else {
1023                return (Lock)result;
1024            }
1025        }
1026    }
1027
1028    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1029        throws SystemException {
1030        Session session = null;
1031
1032        try {
1033            session = openSession();
1034
1035            dynamicQuery.compile(session);
1036
1037            return dynamicQuery.list();
1038        }
1039        catch (Exception e) {
1040            throw processException(e);
1041        }
1042        finally {
1043            closeSession(session);
1044        }
1045    }
1046
1047    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1048        int start, int end) throws SystemException {
1049        Session session = null;
1050
1051        try {
1052            session = openSession();
1053
1054            dynamicQuery.setLimit(start, end);
1055
1056            dynamicQuery.compile(session);
1057
1058            return dynamicQuery.list();
1059        }
1060        catch (Exception e) {
1061            throw processException(e);
1062        }
1063        finally {
1064            closeSession(session);
1065        }
1066    }
1067
1068    public List<Lock> findAll() throws SystemException {
1069        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1070    }
1071
1072    public List<Lock> findAll(int start, int end) throws SystemException {
1073        return findAll(start, end, null);
1074    }
1075
1076    public List<Lock> findAll(int start, int end, OrderByComparator obc)
1077        throws SystemException {
1078        Object[] finderArgs = new Object[] {
1079                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1080            };
1081
1082        List<Lock> list = (List<Lock>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1083                finderArgs, this);
1084
1085        if (list == null) {
1086            Session session = null;
1087
1088            try {
1089                session = openSession();
1090
1091                StringBundler query = null;
1092                String sql = null;
1093
1094                if (obc != null) {
1095                    query = new StringBundler(2 +
1096                            (obc.getOrderByFields().length * 3));
1097
1098                    query.append(_SQL_SELECT_LOCK);
1099
1100                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1101
1102                    sql = query.toString();
1103                }
1104
1105                sql = _SQL_SELECT_LOCK;
1106
1107                Query q = session.createQuery(sql);
1108
1109                if (obc == null) {
1110                    list = (List<Lock>)QueryUtil.list(q, getDialect(), start,
1111                            end, false);
1112
1113                    Collections.sort(list);
1114                }
1115                else {
1116                    list = (List<Lock>)QueryUtil.list(q, getDialect(), start,
1117                            end);
1118                }
1119            }
1120            catch (Exception e) {
1121                throw processException(e);
1122            }
1123            finally {
1124                if (list == null) {
1125                    list = new ArrayList<Lock>();
1126                }
1127
1128                cacheResult(list);
1129
1130                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1131
1132                closeSession(session);
1133            }
1134        }
1135
1136        return list;
1137    }
1138
1139    public void removeByUuid(String uuid) throws SystemException {
1140        for (Lock lock : findByUuid(uuid)) {
1141            remove(lock);
1142        }
1143    }
1144
1145    public void removeByExpirationDate(Date expirationDate)
1146        throws SystemException {
1147        for (Lock lock : findByExpirationDate(expirationDate)) {
1148            remove(lock);
1149        }
1150    }
1151
1152    public void removeByC_K(String className, String key)
1153        throws NoSuchLockException, SystemException {
1154        Lock lock = findByC_K(className, key);
1155
1156        remove(lock);
1157    }
1158
1159    public void removeAll() throws SystemException {
1160        for (Lock lock : findAll()) {
1161            remove(lock);
1162        }
1163    }
1164
1165    public int countByUuid(String uuid) throws SystemException {
1166        Object[] finderArgs = new Object[] { uuid };
1167
1168        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
1169                finderArgs, this);
1170
1171        if (count == null) {
1172            Session session = null;
1173
1174            try {
1175                session = openSession();
1176
1177                StringBundler query = new StringBundler(2);
1178
1179                query.append(_SQL_COUNT_LOCK_WHERE);
1180
1181                if (uuid == null) {
1182                    query.append(_FINDER_COLUMN_UUID_UUID_1);
1183                }
1184                else {
1185                    if (uuid.equals(StringPool.BLANK)) {
1186                        query.append(_FINDER_COLUMN_UUID_UUID_3);
1187                    }
1188                    else {
1189                        query.append(_FINDER_COLUMN_UUID_UUID_2);
1190                    }
1191                }
1192
1193                String sql = query.toString();
1194
1195                Query q = session.createQuery(sql);
1196
1197                QueryPos qPos = QueryPos.getInstance(q);
1198
1199                if (uuid != null) {
1200                    qPos.add(uuid);
1201                }
1202
1203                count = (Long)q.uniqueResult();
1204            }
1205            catch (Exception e) {
1206                throw processException(e);
1207            }
1208            finally {
1209                if (count == null) {
1210                    count = Long.valueOf(0);
1211                }
1212
1213                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
1214                    finderArgs, count);
1215
1216                closeSession(session);
1217            }
1218        }
1219
1220        return count.intValue();
1221    }
1222
1223    public int countByExpirationDate(Date expirationDate)
1224        throws SystemException {
1225        Object[] finderArgs = new Object[] { expirationDate };
1226
1227        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_EXPIRATIONDATE,
1228                finderArgs, this);
1229
1230        if (count == null) {
1231            Session session = null;
1232
1233            try {
1234                session = openSession();
1235
1236                StringBundler query = new StringBundler(2);
1237
1238                query.append(_SQL_COUNT_LOCK_WHERE);
1239
1240                if (expirationDate == null) {
1241                    query.append(_FINDER_COLUMN_EXPIRATIONDATE_EXPIRATIONDATE_1);
1242                }
1243                else {
1244                    query.append(_FINDER_COLUMN_EXPIRATIONDATE_EXPIRATIONDATE_2);
1245                }
1246
1247                String sql = query.toString();
1248
1249                Query q = session.createQuery(sql);
1250
1251                QueryPos qPos = QueryPos.getInstance(q);
1252
1253                if (expirationDate != null) {
1254                    qPos.add(CalendarUtil.getTimestamp(expirationDate));
1255                }
1256
1257                count = (Long)q.uniqueResult();
1258            }
1259            catch (Exception e) {
1260                throw processException(e);
1261            }
1262            finally {
1263                if (count == null) {
1264                    count = Long.valueOf(0);
1265                }
1266
1267                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_EXPIRATIONDATE,
1268                    finderArgs, count);
1269
1270                closeSession(session);
1271            }
1272        }
1273
1274        return count.intValue();
1275    }
1276
1277    public int countByC_K(String className, String key)
1278        throws SystemException {
1279        Object[] finderArgs = new Object[] { className, key };
1280
1281        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_K,
1282                finderArgs, this);
1283
1284        if (count == null) {
1285            Session session = null;
1286
1287            try {
1288                session = openSession();
1289
1290                StringBundler query = new StringBundler(3);
1291
1292                query.append(_SQL_COUNT_LOCK_WHERE);
1293
1294                if (className == null) {
1295                    query.append(_FINDER_COLUMN_C_K_CLASSNAME_1);
1296                }
1297                else {
1298                    if (className.equals(StringPool.BLANK)) {
1299                        query.append(_FINDER_COLUMN_C_K_CLASSNAME_3);
1300                    }
1301                    else {
1302                        query.append(_FINDER_COLUMN_C_K_CLASSNAME_2);
1303                    }
1304                }
1305
1306                if (key == null) {
1307                    query.append(_FINDER_COLUMN_C_K_KEY_1);
1308                }
1309                else {
1310                    if (key.equals(StringPool.BLANK)) {
1311                        query.append(_FINDER_COLUMN_C_K_KEY_3);
1312                    }
1313                    else {
1314                        query.append(_FINDER_COLUMN_C_K_KEY_2);
1315                    }
1316                }
1317
1318                String sql = query.toString();
1319
1320                Query q = session.createQuery(sql);
1321
1322                QueryPos qPos = QueryPos.getInstance(q);
1323
1324                if (className != null) {
1325                    qPos.add(className);
1326                }
1327
1328                if (key != null) {
1329                    qPos.add(key);
1330                }
1331
1332                count = (Long)q.uniqueResult();
1333            }
1334            catch (Exception e) {
1335                throw processException(e);
1336            }
1337            finally {
1338                if (count == null) {
1339                    count = Long.valueOf(0);
1340                }
1341
1342                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_K, finderArgs,
1343                    count);
1344
1345                closeSession(session);
1346            }
1347        }
1348
1349        return count.intValue();
1350    }
1351
1352    public int countAll() throws SystemException {
1353        Object[] finderArgs = new Object[0];
1354
1355        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1356                finderArgs, this);
1357
1358        if (count == null) {
1359            Session session = null;
1360
1361            try {
1362                session = openSession();
1363
1364                Query q = session.createQuery(_SQL_COUNT_LOCK);
1365
1366                count = (Long)q.uniqueResult();
1367            }
1368            catch (Exception e) {
1369                throw processException(e);
1370            }
1371            finally {
1372                if (count == null) {
1373                    count = Long.valueOf(0);
1374                }
1375
1376                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1377                    count);
1378
1379                closeSession(session);
1380            }
1381        }
1382
1383        return count.intValue();
1384    }
1385
1386    public void afterPropertiesSet() {
1387        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1388                    com.liferay.portal.util.PropsUtil.get(
1389                        "value.object.listener.com.liferay.portal.model.Lock")));
1390
1391        if (listenerClassNames.length > 0) {
1392            try {
1393                List<ModelListener<Lock>> listenersList = new ArrayList<ModelListener<Lock>>();
1394
1395                for (String listenerClassName : listenerClassNames) {
1396                    listenersList.add((ModelListener<Lock>)Class.forName(
1397                            listenerClassName).newInstance());
1398                }
1399
1400                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1401            }
1402            catch (Exception e) {
1403                _log.error(e);
1404            }
1405        }
1406    }
1407
1408    @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence")
1409    protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
1410    @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence")
1411    protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
1412    @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence")
1413    protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
1414    @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence")
1415    protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
1416    @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence")
1417    protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
1418    @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence")
1419    protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
1420    @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence")
1421    protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
1422    @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence")
1423    protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
1424    @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence")
1425    protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
1426    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence")
1427    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
1428    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence")
1429    protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
1430    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence")
1431    protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
1432    @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence")
1433    protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
1434    @BeanReference(name = "com.liferay.portal.service.persistence.LockPersistence")
1435    protected com.liferay.portal.service.persistence.LockPersistence lockPersistence;
1436    @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence")
1437    protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
1438    @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence")
1439    protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
1440    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence")
1441    protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1442    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence")
1443    protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
1444    @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence")
1445    protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
1446    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence")
1447    protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
1448    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence")
1449    protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1450    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence")
1451    protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
1452    @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence")
1453    protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
1454    @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence")
1455    protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
1456    @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence")
1457    protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
1458    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence")
1459    protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
1460    @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence")
1461    protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
1462    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence")
1463    protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
1464    @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence")
1465    protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
1466    @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence")
1467    protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
1468    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
1469    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
1470    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence")
1471    protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
1472    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence")
1473    protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
1474    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence")
1475    protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
1476    @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence")
1477    protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
1478    @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence")
1479    protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
1480    @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence")
1481    protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
1482    @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence")
1483    protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
1484    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
1485    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
1486    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence")
1487    protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
1488    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence")
1489    protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
1490    @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence")
1491    protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
1492    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence")
1493    protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
1494    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence")
1495    protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
1496    @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence")
1497    protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
1498    @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence")
1499    protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
1500    private static final String _SQL_SELECT_LOCK = "SELECT lock FROM Lock lock";
1501    private static final String _SQL_SELECT_LOCK_WHERE = "SELECT lock FROM Lock lock WHERE ";
1502    private static final String _SQL_COUNT_LOCK = "SELECT COUNT(lock) FROM Lock lock";
1503    private static final String _SQL_COUNT_LOCK_WHERE = "SELECT COUNT(lock) FROM Lock lock WHERE ";
1504    private static final String _FINDER_COLUMN_UUID_UUID_1 = "lock.uuid IS NULL";
1505    private static final String _FINDER_COLUMN_UUID_UUID_2 = "lock.uuid = ?";
1506    private static final String _FINDER_COLUMN_UUID_UUID_3 = "(lock.uuid IS NULL OR lock.uuid = ?)";
1507    private static final String _FINDER_COLUMN_EXPIRATIONDATE_EXPIRATIONDATE_1 = "lock.expirationDate < NULL";
1508    private static final String _FINDER_COLUMN_EXPIRATIONDATE_EXPIRATIONDATE_2 = "lock.expirationDate < ?";
1509    private static final String _FINDER_COLUMN_C_K_CLASSNAME_1 = "lock.className IS NULL AND ";
1510    private static final String _FINDER_COLUMN_C_K_CLASSNAME_2 = "lock.className = ? AND ";
1511    private static final String _FINDER_COLUMN_C_K_CLASSNAME_3 = "(lock.className IS NULL OR lock.className = ?) AND ";
1512    private static final String _FINDER_COLUMN_C_K_KEY_1 = "lock.key IS NULL";
1513    private static final String _FINDER_COLUMN_C_K_KEY_2 = "lock.key = ?";
1514    private static final String _FINDER_COLUMN_C_K_KEY_3 = "(lock.key IS NULL OR lock.key = ?)";
1515    private static final String _ORDER_BY_ENTITY_ALIAS = "lock.";
1516    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Lock exists with the primary key ";
1517    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Lock exists with the key {";
1518    private static Log _log = LogFactoryUtil.getLog(LockPersistenceImpl.class);
1519}