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