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