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