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