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