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