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