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