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