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