001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.NoSuchUserIdMapperException;
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.kernel.util.Validator;
038    import com.liferay.portal.model.CacheModel;
039    import com.liferay.portal.model.ModelListener;
040    import com.liferay.portal.model.UserIdMapper;
041    import com.liferay.portal.model.impl.UserIdMapperImpl;
042    import com.liferay.portal.model.impl.UserIdMapperModelImpl;
043    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
044    
045    import java.io.Serializable;
046    
047    import java.util.ArrayList;
048    import java.util.Collections;
049    import java.util.List;
050    
051    /**
052     * The persistence implementation for the user ID mapper service.
053     *
054     * <p>
055     * Caching information and settings can be found in <code>portal.properties</code>
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see UserIdMapperPersistence
060     * @see UserIdMapperUtil
061     * @generated
062     */
063    public class UserIdMapperPersistenceImpl extends BasePersistenceImpl<UserIdMapper>
064            implements UserIdMapperPersistence {
065            /*
066             * NOTE FOR DEVELOPERS:
067             *
068             * Never modify or reference this class directly. Always use {@link UserIdMapperUtil} to access the user ID mapper persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
069             */
070            public static final String FINDER_CLASS_NAME_ENTITY = UserIdMapperImpl.class.getName();
071            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
072                    ".List1";
073            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074                    ".List2";
075            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID = new FinderPath(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
076                            UserIdMapperModelImpl.FINDER_CACHE_ENABLED, UserIdMapperImpl.class,
077                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUserId",
078                            new String[] {
079                                    Long.class.getName(),
080                                    
081                            "java.lang.Integer", "java.lang.Integer",
082                                    "com.liferay.portal.kernel.util.OrderByComparator"
083                            });
084            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID =
085                    new FinderPath(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
086                            UserIdMapperModelImpl.FINDER_CACHE_ENABLED, UserIdMapperImpl.class,
087                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserId",
088                            new String[] { Long.class.getName() },
089                            UserIdMapperModelImpl.USERID_COLUMN_BITMASK);
090            public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
091                            UserIdMapperModelImpl.FINDER_CACHE_ENABLED, Long.class,
092                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserId",
093                            new String[] { Long.class.getName() });
094            public static final FinderPath FINDER_PATH_FETCH_BY_U_T = new FinderPath(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
095                            UserIdMapperModelImpl.FINDER_CACHE_ENABLED, UserIdMapperImpl.class,
096                            FINDER_CLASS_NAME_ENTITY, "fetchByU_T",
097                            new String[] { Long.class.getName(), String.class.getName() },
098                            UserIdMapperModelImpl.USERID_COLUMN_BITMASK |
099                            UserIdMapperModelImpl.TYPE_COLUMN_BITMASK);
100            public static final FinderPath FINDER_PATH_COUNT_BY_U_T = new FinderPath(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
101                            UserIdMapperModelImpl.FINDER_CACHE_ENABLED, Long.class,
102                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByU_T",
103                            new String[] { Long.class.getName(), String.class.getName() });
104            public static final FinderPath FINDER_PATH_FETCH_BY_T_E = new FinderPath(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
105                            UserIdMapperModelImpl.FINDER_CACHE_ENABLED, UserIdMapperImpl.class,
106                            FINDER_CLASS_NAME_ENTITY, "fetchByT_E",
107                            new String[] { String.class.getName(), String.class.getName() },
108                            UserIdMapperModelImpl.TYPE_COLUMN_BITMASK |
109                            UserIdMapperModelImpl.EXTERNALUSERID_COLUMN_BITMASK);
110            public static final FinderPath FINDER_PATH_COUNT_BY_T_E = new FinderPath(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
111                            UserIdMapperModelImpl.FINDER_CACHE_ENABLED, Long.class,
112                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByT_E",
113                            new String[] { String.class.getName(), String.class.getName() });
114            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
115                            UserIdMapperModelImpl.FINDER_CACHE_ENABLED, UserIdMapperImpl.class,
116                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
117            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
118                            UserIdMapperModelImpl.FINDER_CACHE_ENABLED, UserIdMapperImpl.class,
119                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
120            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
121                            UserIdMapperModelImpl.FINDER_CACHE_ENABLED, Long.class,
122                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
123    
124            /**
125             * Caches the user ID mapper in the entity cache if it is enabled.
126             *
127             * @param userIdMapper the user ID mapper
128             */
129            public void cacheResult(UserIdMapper userIdMapper) {
130                    EntityCacheUtil.putResult(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
131                            UserIdMapperImpl.class, userIdMapper.getPrimaryKey(), userIdMapper);
132    
133                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_T,
134                            new Object[] {
135                                    Long.valueOf(userIdMapper.getUserId()),
136                                    
137                            userIdMapper.getType()
138                            }, userIdMapper);
139    
140                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_E,
141                            new Object[] {
142                                    userIdMapper.getType(),
143                                    
144                            userIdMapper.getExternalUserId()
145                            }, userIdMapper);
146    
147                    userIdMapper.resetOriginalValues();
148            }
149    
150            /**
151             * Caches the user ID mappers in the entity cache if it is enabled.
152             *
153             * @param userIdMappers the user ID mappers
154             */
155            public void cacheResult(List<UserIdMapper> userIdMappers) {
156                    for (UserIdMapper userIdMapper : userIdMappers) {
157                            if (EntityCacheUtil.getResult(
158                                                    UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
159                                                    UserIdMapperImpl.class, userIdMapper.getPrimaryKey()) == null) {
160                                    cacheResult(userIdMapper);
161                            }
162                            else {
163                                    userIdMapper.resetOriginalValues();
164                            }
165                    }
166            }
167    
168            /**
169             * Clears the cache for all user ID mappers.
170             *
171             * <p>
172             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
173             * </p>
174             */
175            @Override
176            public void clearCache() {
177                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
178                            CacheRegistryUtil.clear(UserIdMapperImpl.class.getName());
179                    }
180    
181                    EntityCacheUtil.clearCache(UserIdMapperImpl.class.getName());
182    
183                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
184                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
185                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
186            }
187    
188            /**
189             * Clears the cache for the user ID mapper.
190             *
191             * <p>
192             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
193             * </p>
194             */
195            @Override
196            public void clearCache(UserIdMapper userIdMapper) {
197                    EntityCacheUtil.removeResult(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
198                            UserIdMapperImpl.class, userIdMapper.getPrimaryKey());
199    
200                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
201                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
202    
203                    clearUniqueFindersCache(userIdMapper);
204            }
205    
206            @Override
207            public void clearCache(List<UserIdMapper> userIdMappers) {
208                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
209                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
210    
211                    for (UserIdMapper userIdMapper : userIdMappers) {
212                            EntityCacheUtil.removeResult(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
213                                    UserIdMapperImpl.class, userIdMapper.getPrimaryKey());
214    
215                            clearUniqueFindersCache(userIdMapper);
216                    }
217            }
218    
219            protected void clearUniqueFindersCache(UserIdMapper userIdMapper) {
220                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_T,
221                            new Object[] {
222                                    Long.valueOf(userIdMapper.getUserId()),
223                                    
224                            userIdMapper.getType()
225                            });
226    
227                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_E,
228                            new Object[] {
229                                    userIdMapper.getType(),
230                                    
231                            userIdMapper.getExternalUserId()
232                            });
233            }
234    
235            /**
236             * Creates a new user ID mapper with the primary key. Does not add the user ID mapper to the database.
237             *
238             * @param userIdMapperId the primary key for the new user ID mapper
239             * @return the new user ID mapper
240             */
241            public UserIdMapper create(long userIdMapperId) {
242                    UserIdMapper userIdMapper = new UserIdMapperImpl();
243    
244                    userIdMapper.setNew(true);
245                    userIdMapper.setPrimaryKey(userIdMapperId);
246    
247                    return userIdMapper;
248            }
249    
250            /**
251             * Removes the user ID mapper with the primary key from the database. Also notifies the appropriate model listeners.
252             *
253             * @param userIdMapperId the primary key of the user ID mapper
254             * @return the user ID mapper that was removed
255             * @throws com.liferay.portal.NoSuchUserIdMapperException if a user ID mapper with the primary key could not be found
256             * @throws SystemException if a system exception occurred
257             */
258            public UserIdMapper remove(long userIdMapperId)
259                    throws NoSuchUserIdMapperException, SystemException {
260                    return remove(Long.valueOf(userIdMapperId));
261            }
262    
263            /**
264             * Removes the user ID mapper with the primary key from the database. Also notifies the appropriate model listeners.
265             *
266             * @param primaryKey the primary key of the user ID mapper
267             * @return the user ID mapper that was removed
268             * @throws com.liferay.portal.NoSuchUserIdMapperException if a user ID mapper with the primary key could not be found
269             * @throws SystemException if a system exception occurred
270             */
271            @Override
272            public UserIdMapper remove(Serializable primaryKey)
273                    throws NoSuchUserIdMapperException, SystemException {
274                    Session session = null;
275    
276                    try {
277                            session = openSession();
278    
279                            UserIdMapper userIdMapper = (UserIdMapper)session.get(UserIdMapperImpl.class,
280                                            primaryKey);
281    
282                            if (userIdMapper == null) {
283                                    if (_log.isWarnEnabled()) {
284                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
285                                    }
286    
287                                    throw new NoSuchUserIdMapperException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
288                                            primaryKey);
289                            }
290    
291                            return remove(userIdMapper);
292                    }
293                    catch (NoSuchUserIdMapperException nsee) {
294                            throw nsee;
295                    }
296                    catch (Exception e) {
297                            throw processException(e);
298                    }
299                    finally {
300                            closeSession(session);
301                    }
302            }
303    
304            @Override
305            protected UserIdMapper removeImpl(UserIdMapper userIdMapper)
306                    throws SystemException {
307                    userIdMapper = toUnwrappedModel(userIdMapper);
308    
309                    Session session = null;
310    
311                    try {
312                            session = openSession();
313    
314                            if (userIdMapper.isCachedModel()) {
315                                    userIdMapper = (UserIdMapper)session.get(UserIdMapperImpl.class,
316                                                    userIdMapper.getPrimaryKeyObj());
317                            }
318    
319                            session.delete(userIdMapper);
320                    }
321                    catch (Exception e) {
322                            throw processException(e);
323                    }
324                    finally {
325                            closeSession(session);
326                    }
327    
328                    clearCache(userIdMapper);
329    
330                    return userIdMapper;
331            }
332    
333            @Override
334            public UserIdMapper updateImpl(
335                    com.liferay.portal.model.UserIdMapper userIdMapper)
336                    throws SystemException {
337                    userIdMapper = toUnwrappedModel(userIdMapper);
338    
339                    boolean isNew = userIdMapper.isNew();
340    
341                    UserIdMapperModelImpl userIdMapperModelImpl = (UserIdMapperModelImpl)userIdMapper;
342    
343                    Session session = null;
344    
345                    try {
346                            session = openSession();
347    
348                            if (userIdMapper.isNew()) {
349                                    session.save(userIdMapper);
350    
351                                    userIdMapper.setNew(false);
352                            }
353                            else {
354                                    session.merge(userIdMapper);
355                            }
356                    }
357                    catch (Exception e) {
358                            throw processException(e);
359                    }
360                    finally {
361                            closeSession(session);
362                    }
363    
364                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
365    
366                    if (isNew || !UserIdMapperModelImpl.COLUMN_BITMASK_ENABLED) {
367                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
368                    }
369    
370                    else {
371                            if ((userIdMapperModelImpl.getColumnBitmask() &
372                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
373                                    Object[] args = new Object[] {
374                                                    Long.valueOf(userIdMapperModelImpl.getOriginalUserId())
375                                            };
376    
377                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
378                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
379                                            args);
380    
381                                    args = new Object[] {
382                                                    Long.valueOf(userIdMapperModelImpl.getUserId())
383                                            };
384    
385                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
386                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
387                                            args);
388                            }
389                    }
390    
391                    EntityCacheUtil.putResult(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
392                            UserIdMapperImpl.class, userIdMapper.getPrimaryKey(), userIdMapper);
393    
394                    if (isNew) {
395                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_T,
396                                    new Object[] {
397                                            Long.valueOf(userIdMapper.getUserId()),
398                                            
399                                    userIdMapper.getType()
400                                    }, userIdMapper);
401    
402                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_E,
403                                    new Object[] {
404                                            userIdMapper.getType(),
405                                            
406                                    userIdMapper.getExternalUserId()
407                                    }, userIdMapper);
408                    }
409                    else {
410                            if ((userIdMapperModelImpl.getColumnBitmask() &
411                                            FINDER_PATH_FETCH_BY_U_T.getColumnBitmask()) != 0) {
412                                    Object[] args = new Object[] {
413                                                    Long.valueOf(userIdMapperModelImpl.getOriginalUserId()),
414                                                    
415                                                    userIdMapperModelImpl.getOriginalType()
416                                            };
417    
418                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_T, args);
419    
420                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_T, args);
421    
422                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_T,
423                                            new Object[] {
424                                                    Long.valueOf(userIdMapper.getUserId()),
425                                                    
426                                            userIdMapper.getType()
427                                            }, userIdMapper);
428                            }
429    
430                            if ((userIdMapperModelImpl.getColumnBitmask() &
431                                            FINDER_PATH_FETCH_BY_T_E.getColumnBitmask()) != 0) {
432                                    Object[] args = new Object[] {
433                                                    userIdMapperModelImpl.getOriginalType(),
434                                                    
435                                                    userIdMapperModelImpl.getOriginalExternalUserId()
436                                            };
437    
438                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_E, args);
439    
440                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_E, args);
441    
442                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_E,
443                                            new Object[] {
444                                                    userIdMapper.getType(),
445                                                    
446                                            userIdMapper.getExternalUserId()
447                                            }, userIdMapper);
448                            }
449                    }
450    
451                    return userIdMapper;
452            }
453    
454            protected UserIdMapper toUnwrappedModel(UserIdMapper userIdMapper) {
455                    if (userIdMapper instanceof UserIdMapperImpl) {
456                            return userIdMapper;
457                    }
458    
459                    UserIdMapperImpl userIdMapperImpl = new UserIdMapperImpl();
460    
461                    userIdMapperImpl.setNew(userIdMapper.isNew());
462                    userIdMapperImpl.setPrimaryKey(userIdMapper.getPrimaryKey());
463    
464                    userIdMapperImpl.setUserIdMapperId(userIdMapper.getUserIdMapperId());
465                    userIdMapperImpl.setUserId(userIdMapper.getUserId());
466                    userIdMapperImpl.setType(userIdMapper.getType());
467                    userIdMapperImpl.setDescription(userIdMapper.getDescription());
468                    userIdMapperImpl.setExternalUserId(userIdMapper.getExternalUserId());
469    
470                    return userIdMapperImpl;
471            }
472    
473            /**
474             * Returns the user ID mapper with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
475             *
476             * @param primaryKey the primary key of the user ID mapper
477             * @return the user ID mapper
478             * @throws com.liferay.portal.NoSuchModelException if a user ID mapper with the primary key could not be found
479             * @throws SystemException if a system exception occurred
480             */
481            @Override
482            public UserIdMapper findByPrimaryKey(Serializable primaryKey)
483                    throws NoSuchModelException, SystemException {
484                    return findByPrimaryKey(((Long)primaryKey).longValue());
485            }
486    
487            /**
488             * Returns the user ID mapper with the primary key or throws a {@link com.liferay.portal.NoSuchUserIdMapperException} if it could not be found.
489             *
490             * @param userIdMapperId the primary key of the user ID mapper
491             * @return the user ID mapper
492             * @throws com.liferay.portal.NoSuchUserIdMapperException if a user ID mapper with the primary key could not be found
493             * @throws SystemException if a system exception occurred
494             */
495            public UserIdMapper findByPrimaryKey(long userIdMapperId)
496                    throws NoSuchUserIdMapperException, SystemException {
497                    UserIdMapper userIdMapper = fetchByPrimaryKey(userIdMapperId);
498    
499                    if (userIdMapper == null) {
500                            if (_log.isWarnEnabled()) {
501                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userIdMapperId);
502                            }
503    
504                            throw new NoSuchUserIdMapperException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
505                                    userIdMapperId);
506                    }
507    
508                    return userIdMapper;
509            }
510    
511            /**
512             * Returns the user ID mapper with the primary key or returns <code>null</code> if it could not be found.
513             *
514             * @param primaryKey the primary key of the user ID mapper
515             * @return the user ID mapper, or <code>null</code> if a user ID mapper with the primary key could not be found
516             * @throws SystemException if a system exception occurred
517             */
518            @Override
519            public UserIdMapper fetchByPrimaryKey(Serializable primaryKey)
520                    throws SystemException {
521                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
522            }
523    
524            /**
525             * Returns the user ID mapper with the primary key or returns <code>null</code> if it could not be found.
526             *
527             * @param userIdMapperId the primary key of the user ID mapper
528             * @return the user ID mapper, or <code>null</code> if a user ID mapper with the primary key could not be found
529             * @throws SystemException if a system exception occurred
530             */
531            public UserIdMapper fetchByPrimaryKey(long userIdMapperId)
532                    throws SystemException {
533                    UserIdMapper userIdMapper = (UserIdMapper)EntityCacheUtil.getResult(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
534                                    UserIdMapperImpl.class, userIdMapperId);
535    
536                    if (userIdMapper == _nullUserIdMapper) {
537                            return null;
538                    }
539    
540                    if (userIdMapper == null) {
541                            Session session = null;
542    
543                            boolean hasException = false;
544    
545                            try {
546                                    session = openSession();
547    
548                                    userIdMapper = (UserIdMapper)session.get(UserIdMapperImpl.class,
549                                                    Long.valueOf(userIdMapperId));
550                            }
551                            catch (Exception e) {
552                                    hasException = true;
553    
554                                    throw processException(e);
555                            }
556                            finally {
557                                    if (userIdMapper != null) {
558                                            cacheResult(userIdMapper);
559                                    }
560                                    else if (!hasException) {
561                                            EntityCacheUtil.putResult(UserIdMapperModelImpl.ENTITY_CACHE_ENABLED,
562                                                    UserIdMapperImpl.class, userIdMapperId,
563                                                    _nullUserIdMapper);
564                                    }
565    
566                                    closeSession(session);
567                            }
568                    }
569    
570                    return userIdMapper;
571            }
572    
573            /**
574             * Returns all the user ID mappers where userId = &#63;.
575             *
576             * @param userId the user ID
577             * @return the matching user ID mappers
578             * @throws SystemException if a system exception occurred
579             */
580            public List<UserIdMapper> findByUserId(long userId)
581                    throws SystemException {
582                    return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
583            }
584    
585            /**
586             * Returns a range of all the user ID mappers where userId = &#63;.
587             *
588             * <p>
589             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
590             * </p>
591             *
592             * @param userId the user ID
593             * @param start the lower bound of the range of user ID mappers
594             * @param end the upper bound of the range of user ID mappers (not inclusive)
595             * @return the range of matching user ID mappers
596             * @throws SystemException if a system exception occurred
597             */
598            public List<UserIdMapper> findByUserId(long userId, int start, int end)
599                    throws SystemException {
600                    return findByUserId(userId, start, end, null);
601            }
602    
603            /**
604             * Returns an ordered range of all the user ID mappers where userId = &#63;.
605             *
606             * <p>
607             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
608             * </p>
609             *
610             * @param userId the user ID
611             * @param start the lower bound of the range of user ID mappers
612             * @param end the upper bound of the range of user ID mappers (not inclusive)
613             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
614             * @return the ordered range of matching user ID mappers
615             * @throws SystemException if a system exception occurred
616             */
617            public List<UserIdMapper> findByUserId(long userId, int start, int end,
618                    OrderByComparator orderByComparator) throws SystemException {
619                    FinderPath finderPath = null;
620                    Object[] finderArgs = null;
621    
622                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
623                                    (orderByComparator == null)) {
624                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
625                            finderArgs = new Object[] { userId };
626                    }
627                    else {
628                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
629                            finderArgs = new Object[] { userId, start, end, orderByComparator };
630                    }
631    
632                    List<UserIdMapper> list = (List<UserIdMapper>)FinderCacheUtil.getResult(finderPath,
633                                    finderArgs, this);
634    
635                    if ((list != null) && !list.isEmpty()) {
636                            for (UserIdMapper userIdMapper : list) {
637                                    if ((userId != userIdMapper.getUserId())) {
638                                            list = null;
639    
640                                            break;
641                                    }
642                            }
643                    }
644    
645                    if (list == null) {
646                            StringBundler query = null;
647    
648                            if (orderByComparator != null) {
649                                    query = new StringBundler(3 +
650                                                    (orderByComparator.getOrderByFields().length * 3));
651                            }
652                            else {
653                                    query = new StringBundler(2);
654                            }
655    
656                            query.append(_SQL_SELECT_USERIDMAPPER_WHERE);
657    
658                            query.append(_FINDER_COLUMN_USERID_USERID_2);
659    
660                            if (orderByComparator != null) {
661                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
662                                            orderByComparator);
663                            }
664    
665                            String sql = query.toString();
666    
667                            Session session = null;
668    
669                            try {
670                                    session = openSession();
671    
672                                    Query q = session.createQuery(sql);
673    
674                                    QueryPos qPos = QueryPos.getInstance(q);
675    
676                                    qPos.add(userId);
677    
678                                    list = (List<UserIdMapper>)QueryUtil.list(q, getDialect(),
679                                                    start, end);
680                            }
681                            catch (Exception e) {
682                                    throw processException(e);
683                            }
684                            finally {
685                                    if (list == null) {
686                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
687                                    }
688                                    else {
689                                            cacheResult(list);
690    
691                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
692                                    }
693    
694                                    closeSession(session);
695                            }
696                    }
697    
698                    return list;
699            }
700    
701            /**
702             * Returns the first user ID mapper in the ordered set where userId = &#63;.
703             *
704             * @param userId the user ID
705             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
706             * @return the first matching user ID mapper
707             * @throws com.liferay.portal.NoSuchUserIdMapperException if a matching user ID mapper could not be found
708             * @throws SystemException if a system exception occurred
709             */
710            public UserIdMapper findByUserId_First(long userId,
711                    OrderByComparator orderByComparator)
712                    throws NoSuchUserIdMapperException, SystemException {
713                    UserIdMapper userIdMapper = fetchByUserId_First(userId,
714                                    orderByComparator);
715    
716                    if (userIdMapper != null) {
717                            return userIdMapper;
718                    }
719    
720                    StringBundler msg = new StringBundler(4);
721    
722                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
723    
724                    msg.append("userId=");
725                    msg.append(userId);
726    
727                    msg.append(StringPool.CLOSE_CURLY_BRACE);
728    
729                    throw new NoSuchUserIdMapperException(msg.toString());
730            }
731    
732            /**
733             * Returns the first user ID mapper in the ordered set where userId = &#63;.
734             *
735             * @param userId the user ID
736             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
737             * @return the first matching user ID mapper, or <code>null</code> if a matching user ID mapper could not be found
738             * @throws SystemException if a system exception occurred
739             */
740            public UserIdMapper fetchByUserId_First(long userId,
741                    OrderByComparator orderByComparator) throws SystemException {
742                    List<UserIdMapper> list = findByUserId(userId, 0, 1, orderByComparator);
743    
744                    if (!list.isEmpty()) {
745                            return list.get(0);
746                    }
747    
748                    return null;
749            }
750    
751            /**
752             * Returns the last user ID mapper in the ordered set where userId = &#63;.
753             *
754             * @param userId the user ID
755             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
756             * @return the last matching user ID mapper
757             * @throws com.liferay.portal.NoSuchUserIdMapperException if a matching user ID mapper could not be found
758             * @throws SystemException if a system exception occurred
759             */
760            public UserIdMapper findByUserId_Last(long userId,
761                    OrderByComparator orderByComparator)
762                    throws NoSuchUserIdMapperException, SystemException {
763                    UserIdMapper userIdMapper = fetchByUserId_Last(userId, orderByComparator);
764    
765                    if (userIdMapper != null) {
766                            return userIdMapper;
767                    }
768    
769                    StringBundler msg = new StringBundler(4);
770    
771                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
772    
773                    msg.append("userId=");
774                    msg.append(userId);
775    
776                    msg.append(StringPool.CLOSE_CURLY_BRACE);
777    
778                    throw new NoSuchUserIdMapperException(msg.toString());
779            }
780    
781            /**
782             * Returns the last user ID mapper in the ordered set where userId = &#63;.
783             *
784             * @param userId the user ID
785             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
786             * @return the last matching user ID mapper, or <code>null</code> if a matching user ID mapper could not be found
787             * @throws SystemException if a system exception occurred
788             */
789            public UserIdMapper fetchByUserId_Last(long userId,
790                    OrderByComparator orderByComparator) throws SystemException {
791                    int count = countByUserId(userId);
792    
793                    List<UserIdMapper> list = findByUserId(userId, count - 1, count,
794                                    orderByComparator);
795    
796                    if (!list.isEmpty()) {
797                            return list.get(0);
798                    }
799    
800                    return null;
801            }
802    
803            /**
804             * Returns the user ID mappers before and after the current user ID mapper in the ordered set where userId = &#63;.
805             *
806             * @param userIdMapperId the primary key of the current user ID mapper
807             * @param userId the user ID
808             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
809             * @return the previous, current, and next user ID mapper
810             * @throws com.liferay.portal.NoSuchUserIdMapperException if a user ID mapper with the primary key could not be found
811             * @throws SystemException if a system exception occurred
812             */
813            public UserIdMapper[] findByUserId_PrevAndNext(long userIdMapperId,
814                    long userId, OrderByComparator orderByComparator)
815                    throws NoSuchUserIdMapperException, SystemException {
816                    UserIdMapper userIdMapper = findByPrimaryKey(userIdMapperId);
817    
818                    Session session = null;
819    
820                    try {
821                            session = openSession();
822    
823                            UserIdMapper[] array = new UserIdMapperImpl[3];
824    
825                            array[0] = getByUserId_PrevAndNext(session, userIdMapper, userId,
826                                            orderByComparator, true);
827    
828                            array[1] = userIdMapper;
829    
830                            array[2] = getByUserId_PrevAndNext(session, userIdMapper, userId,
831                                            orderByComparator, false);
832    
833                            return array;
834                    }
835                    catch (Exception e) {
836                            throw processException(e);
837                    }
838                    finally {
839                            closeSession(session);
840                    }
841            }
842    
843            protected UserIdMapper getByUserId_PrevAndNext(Session session,
844                    UserIdMapper userIdMapper, long userId,
845                    OrderByComparator orderByComparator, boolean previous) {
846                    StringBundler query = null;
847    
848                    if (orderByComparator != null) {
849                            query = new StringBundler(6 +
850                                            (orderByComparator.getOrderByFields().length * 6));
851                    }
852                    else {
853                            query = new StringBundler(3);
854                    }
855    
856                    query.append(_SQL_SELECT_USERIDMAPPER_WHERE);
857    
858                    query.append(_FINDER_COLUMN_USERID_USERID_2);
859    
860                    if (orderByComparator != null) {
861                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
862    
863                            if (orderByConditionFields.length > 0) {
864                                    query.append(WHERE_AND);
865                            }
866    
867                            for (int i = 0; i < orderByConditionFields.length; i++) {
868                                    query.append(_ORDER_BY_ENTITY_ALIAS);
869                                    query.append(orderByConditionFields[i]);
870    
871                                    if ((i + 1) < orderByConditionFields.length) {
872                                            if (orderByComparator.isAscending() ^ previous) {
873                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
874                                            }
875                                            else {
876                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
877                                            }
878                                    }
879                                    else {
880                                            if (orderByComparator.isAscending() ^ previous) {
881                                                    query.append(WHERE_GREATER_THAN);
882                                            }
883                                            else {
884                                                    query.append(WHERE_LESSER_THAN);
885                                            }
886                                    }
887                            }
888    
889                            query.append(ORDER_BY_CLAUSE);
890    
891                            String[] orderByFields = orderByComparator.getOrderByFields();
892    
893                            for (int i = 0; i < orderByFields.length; i++) {
894                                    query.append(_ORDER_BY_ENTITY_ALIAS);
895                                    query.append(orderByFields[i]);
896    
897                                    if ((i + 1) < orderByFields.length) {
898                                            if (orderByComparator.isAscending() ^ previous) {
899                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
900                                            }
901                                            else {
902                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
903                                            }
904                                    }
905                                    else {
906                                            if (orderByComparator.isAscending() ^ previous) {
907                                                    query.append(ORDER_BY_ASC);
908                                            }
909                                            else {
910                                                    query.append(ORDER_BY_DESC);
911                                            }
912                                    }
913                            }
914                    }
915    
916                    String sql = query.toString();
917    
918                    Query q = session.createQuery(sql);
919    
920                    q.setFirstResult(0);
921                    q.setMaxResults(2);
922    
923                    QueryPos qPos = QueryPos.getInstance(q);
924    
925                    qPos.add(userId);
926    
927                    if (orderByComparator != null) {
928                            Object[] values = orderByComparator.getOrderByConditionValues(userIdMapper);
929    
930                            for (Object value : values) {
931                                    qPos.add(value);
932                            }
933                    }
934    
935                    List<UserIdMapper> list = q.list();
936    
937                    if (list.size() == 2) {
938                            return list.get(1);
939                    }
940                    else {
941                            return null;
942                    }
943            }
944    
945            /**
946             * Returns the user ID mapper where userId = &#63; and type = &#63; or throws a {@link com.liferay.portal.NoSuchUserIdMapperException} if it could not be found.
947             *
948             * @param userId the user ID
949             * @param type the type
950             * @return the matching user ID mapper
951             * @throws com.liferay.portal.NoSuchUserIdMapperException if a matching user ID mapper could not be found
952             * @throws SystemException if a system exception occurred
953             */
954            public UserIdMapper findByU_T(long userId, String type)
955                    throws NoSuchUserIdMapperException, SystemException {
956                    UserIdMapper userIdMapper = fetchByU_T(userId, type);
957    
958                    if (userIdMapper == null) {
959                            StringBundler msg = new StringBundler(6);
960    
961                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
962    
963                            msg.append("userId=");
964                            msg.append(userId);
965    
966                            msg.append(", type=");
967                            msg.append(type);
968    
969                            msg.append(StringPool.CLOSE_CURLY_BRACE);
970    
971                            if (_log.isWarnEnabled()) {
972                                    _log.warn(msg.toString());
973                            }
974    
975                            throw new NoSuchUserIdMapperException(msg.toString());
976                    }
977    
978                    return userIdMapper;
979            }
980    
981            /**
982             * Returns the user ID mapper where userId = &#63; and type = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
983             *
984             * @param userId the user ID
985             * @param type the type
986             * @return the matching user ID mapper, or <code>null</code> if a matching user ID mapper could not be found
987             * @throws SystemException if a system exception occurred
988             */
989            public UserIdMapper fetchByU_T(long userId, String type)
990                    throws SystemException {
991                    return fetchByU_T(userId, type, true);
992            }
993    
994            /**
995             * Returns the user ID mapper where userId = &#63; and type = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
996             *
997             * @param userId the user ID
998             * @param type the type
999             * @param retrieveFromCache whether to use the finder cache
1000             * @return the matching user ID mapper, or <code>null</code> if a matching user ID mapper could not be found
1001             * @throws SystemException if a system exception occurred
1002             */
1003            public UserIdMapper fetchByU_T(long userId, String type,
1004                    boolean retrieveFromCache) throws SystemException {
1005                    Object[] finderArgs = new Object[] { userId, type };
1006    
1007                    Object result = null;
1008    
1009                    if (retrieveFromCache) {
1010                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_U_T,
1011                                            finderArgs, this);
1012                    }
1013    
1014                    if (result instanceof UserIdMapper) {
1015                            UserIdMapper userIdMapper = (UserIdMapper)result;
1016    
1017                            if ((userId != userIdMapper.getUserId()) ||
1018                                            !Validator.equals(type, userIdMapper.getType())) {
1019                                    result = null;
1020                            }
1021                    }
1022    
1023                    if (result == null) {
1024                            StringBundler query = new StringBundler(3);
1025    
1026                            query.append(_SQL_SELECT_USERIDMAPPER_WHERE);
1027    
1028                            query.append(_FINDER_COLUMN_U_T_USERID_2);
1029    
1030                            if (type == null) {
1031                                    query.append(_FINDER_COLUMN_U_T_TYPE_1);
1032                            }
1033                            else {
1034                                    if (type.equals(StringPool.BLANK)) {
1035                                            query.append(_FINDER_COLUMN_U_T_TYPE_3);
1036                                    }
1037                                    else {
1038                                            query.append(_FINDER_COLUMN_U_T_TYPE_2);
1039                                    }
1040                            }
1041    
1042                            String sql = query.toString();
1043    
1044                            Session session = null;
1045    
1046                            try {
1047                                    session = openSession();
1048    
1049                                    Query q = session.createQuery(sql);
1050    
1051                                    QueryPos qPos = QueryPos.getInstance(q);
1052    
1053                                    qPos.add(userId);
1054    
1055                                    if (type != null) {
1056                                            qPos.add(type);
1057                                    }
1058    
1059                                    List<UserIdMapper> list = q.list();
1060    
1061                                    result = list;
1062    
1063                                    UserIdMapper userIdMapper = null;
1064    
1065                                    if (list.isEmpty()) {
1066                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_T,
1067                                                    finderArgs, list);
1068                                    }
1069                                    else {
1070                                            userIdMapper = list.get(0);
1071    
1072                                            cacheResult(userIdMapper);
1073    
1074                                            if ((userIdMapper.getUserId() != userId) ||
1075                                                            (userIdMapper.getType() == null) ||
1076                                                            !userIdMapper.getType().equals(type)) {
1077                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_T,
1078                                                            finderArgs, userIdMapper);
1079                                            }
1080                                    }
1081    
1082                                    return userIdMapper;
1083                            }
1084                            catch (Exception e) {
1085                                    throw processException(e);
1086                            }
1087                            finally {
1088                                    if (result == null) {
1089                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_T,
1090                                                    finderArgs);
1091                                    }
1092    
1093                                    closeSession(session);
1094                            }
1095                    }
1096                    else {
1097                            if (result instanceof List<?>) {
1098                                    return null;
1099                            }
1100                            else {
1101                                    return (UserIdMapper)result;
1102                            }
1103                    }
1104            }
1105    
1106            /**
1107             * Returns the user ID mapper where type = &#63; and externalUserId = &#63; or throws a {@link com.liferay.portal.NoSuchUserIdMapperException} if it could not be found.
1108             *
1109             * @param type the type
1110             * @param externalUserId the external user ID
1111             * @return the matching user ID mapper
1112             * @throws com.liferay.portal.NoSuchUserIdMapperException if a matching user ID mapper could not be found
1113             * @throws SystemException if a system exception occurred
1114             */
1115            public UserIdMapper findByT_E(String type, String externalUserId)
1116                    throws NoSuchUserIdMapperException, SystemException {
1117                    UserIdMapper userIdMapper = fetchByT_E(type, externalUserId);
1118    
1119                    if (userIdMapper == null) {
1120                            StringBundler msg = new StringBundler(6);
1121    
1122                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1123    
1124                            msg.append("type=");
1125                            msg.append(type);
1126    
1127                            msg.append(", externalUserId=");
1128                            msg.append(externalUserId);
1129    
1130                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1131    
1132                            if (_log.isWarnEnabled()) {
1133                                    _log.warn(msg.toString());
1134                            }
1135    
1136                            throw new NoSuchUserIdMapperException(msg.toString());
1137                    }
1138    
1139                    return userIdMapper;
1140            }
1141    
1142            /**
1143             * Returns the user ID mapper where type = &#63; and externalUserId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1144             *
1145             * @param type the type
1146             * @param externalUserId the external user ID
1147             * @return the matching user ID mapper, or <code>null</code> if a matching user ID mapper could not be found
1148             * @throws SystemException if a system exception occurred
1149             */
1150            public UserIdMapper fetchByT_E(String type, String externalUserId)
1151                    throws SystemException {
1152                    return fetchByT_E(type, externalUserId, true);
1153            }
1154    
1155            /**
1156             * Returns the user ID mapper where type = &#63; and externalUserId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1157             *
1158             * @param type the type
1159             * @param externalUserId the external user ID
1160             * @param retrieveFromCache whether to use the finder cache
1161             * @return the matching user ID mapper, or <code>null</code> if a matching user ID mapper could not be found
1162             * @throws SystemException if a system exception occurred
1163             */
1164            public UserIdMapper fetchByT_E(String type, String externalUserId,
1165                    boolean retrieveFromCache) throws SystemException {
1166                    Object[] finderArgs = new Object[] { type, externalUserId };
1167    
1168                    Object result = null;
1169    
1170                    if (retrieveFromCache) {
1171                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_T_E,
1172                                            finderArgs, this);
1173                    }
1174    
1175                    if (result instanceof UserIdMapper) {
1176                            UserIdMapper userIdMapper = (UserIdMapper)result;
1177    
1178                            if (!Validator.equals(type, userIdMapper.getType()) ||
1179                                            !Validator.equals(externalUserId,
1180                                                    userIdMapper.getExternalUserId())) {
1181                                    result = null;
1182                            }
1183                    }
1184    
1185                    if (result == null) {
1186                            StringBundler query = new StringBundler(3);
1187    
1188                            query.append(_SQL_SELECT_USERIDMAPPER_WHERE);
1189    
1190                            if (type == null) {
1191                                    query.append(_FINDER_COLUMN_T_E_TYPE_1);
1192                            }
1193                            else {
1194                                    if (type.equals(StringPool.BLANK)) {
1195                                            query.append(_FINDER_COLUMN_T_E_TYPE_3);
1196                                    }
1197                                    else {
1198                                            query.append(_FINDER_COLUMN_T_E_TYPE_2);
1199                                    }
1200                            }
1201    
1202                            if (externalUserId == null) {
1203                                    query.append(_FINDER_COLUMN_T_E_EXTERNALUSERID_1);
1204                            }
1205                            else {
1206                                    if (externalUserId.equals(StringPool.BLANK)) {
1207                                            query.append(_FINDER_COLUMN_T_E_EXTERNALUSERID_3);
1208                                    }
1209                                    else {
1210                                            query.append(_FINDER_COLUMN_T_E_EXTERNALUSERID_2);
1211                                    }
1212                            }
1213    
1214                            String sql = query.toString();
1215    
1216                            Session session = null;
1217    
1218                            try {
1219                                    session = openSession();
1220    
1221                                    Query q = session.createQuery(sql);
1222    
1223                                    QueryPos qPos = QueryPos.getInstance(q);
1224    
1225                                    if (type != null) {
1226                                            qPos.add(type);
1227                                    }
1228    
1229                                    if (externalUserId != null) {
1230                                            qPos.add(externalUserId);
1231                                    }
1232    
1233                                    List<UserIdMapper> list = q.list();
1234    
1235                                    result = list;
1236    
1237                                    UserIdMapper userIdMapper = null;
1238    
1239                                    if (list.isEmpty()) {
1240                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_E,
1241                                                    finderArgs, list);
1242                                    }
1243                                    else {
1244                                            userIdMapper = list.get(0);
1245    
1246                                            cacheResult(userIdMapper);
1247    
1248                                            if ((userIdMapper.getType() == null) ||
1249                                                            !userIdMapper.getType().equals(type) ||
1250                                                            (userIdMapper.getExternalUserId() == null) ||
1251                                                            !userIdMapper.getExternalUserId()
1252                                                                                             .equals(externalUserId)) {
1253                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_E,
1254                                                            finderArgs, userIdMapper);
1255                                            }
1256                                    }
1257    
1258                                    return userIdMapper;
1259                            }
1260                            catch (Exception e) {
1261                                    throw processException(e);
1262                            }
1263                            finally {
1264                                    if (result == null) {
1265                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_E,
1266                                                    finderArgs);
1267                                    }
1268    
1269                                    closeSession(session);
1270                            }
1271                    }
1272                    else {
1273                            if (result instanceof List<?>) {
1274                                    return null;
1275                            }
1276                            else {
1277                                    return (UserIdMapper)result;
1278                            }
1279                    }
1280            }
1281    
1282            /**
1283             * Returns all the user ID mappers.
1284             *
1285             * @return the user ID mappers
1286             * @throws SystemException if a system exception occurred
1287             */
1288            public List<UserIdMapper> findAll() throws SystemException {
1289                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1290            }
1291    
1292            /**
1293             * Returns a range of all the user ID mappers.
1294             *
1295             * <p>
1296             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1297             * </p>
1298             *
1299             * @param start the lower bound of the range of user ID mappers
1300             * @param end the upper bound of the range of user ID mappers (not inclusive)
1301             * @return the range of user ID mappers
1302             * @throws SystemException if a system exception occurred
1303             */
1304            public List<UserIdMapper> findAll(int start, int end)
1305                    throws SystemException {
1306                    return findAll(start, end, null);
1307            }
1308    
1309            /**
1310             * Returns an ordered range of all the user ID mappers.
1311             *
1312             * <p>
1313             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1314             * </p>
1315             *
1316             * @param start the lower bound of the range of user ID mappers
1317             * @param end the upper bound of the range of user ID mappers (not inclusive)
1318             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1319             * @return the ordered range of user ID mappers
1320             * @throws SystemException if a system exception occurred
1321             */
1322            public List<UserIdMapper> findAll(int start, int end,
1323                    OrderByComparator orderByComparator) throws SystemException {
1324                    FinderPath finderPath = null;
1325                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
1326    
1327                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1328                                    (orderByComparator == null)) {
1329                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1330                            finderArgs = FINDER_ARGS_EMPTY;
1331                    }
1332                    else {
1333                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1334                            finderArgs = new Object[] { start, end, orderByComparator };
1335                    }
1336    
1337                    List<UserIdMapper> list = (List<UserIdMapper>)FinderCacheUtil.getResult(finderPath,
1338                                    finderArgs, this);
1339    
1340                    if (list == null) {
1341                            StringBundler query = null;
1342                            String sql = null;
1343    
1344                            if (orderByComparator != null) {
1345                                    query = new StringBundler(2 +
1346                                                    (orderByComparator.getOrderByFields().length * 3));
1347    
1348                                    query.append(_SQL_SELECT_USERIDMAPPER);
1349    
1350                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1351                                            orderByComparator);
1352    
1353                                    sql = query.toString();
1354                            }
1355                            else {
1356                                    sql = _SQL_SELECT_USERIDMAPPER;
1357                            }
1358    
1359                            Session session = null;
1360    
1361                            try {
1362                                    session = openSession();
1363    
1364                                    Query q = session.createQuery(sql);
1365    
1366                                    if (orderByComparator == null) {
1367                                            list = (List<UserIdMapper>)QueryUtil.list(q, getDialect(),
1368                                                            start, end, false);
1369    
1370                                            Collections.sort(list);
1371                                    }
1372                                    else {
1373                                            list = (List<UserIdMapper>)QueryUtil.list(q, getDialect(),
1374                                                            start, end);
1375                                    }
1376                            }
1377                            catch (Exception e) {
1378                                    throw processException(e);
1379                            }
1380                            finally {
1381                                    if (list == null) {
1382                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1383                                    }
1384                                    else {
1385                                            cacheResult(list);
1386    
1387                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1388                                    }
1389    
1390                                    closeSession(session);
1391                            }
1392                    }
1393    
1394                    return list;
1395            }
1396    
1397            /**
1398             * Removes all the user ID mappers where userId = &#63; from the database.
1399             *
1400             * @param userId the user ID
1401             * @throws SystemException if a system exception occurred
1402             */
1403            public void removeByUserId(long userId) throws SystemException {
1404                    for (UserIdMapper userIdMapper : findByUserId(userId)) {
1405                            remove(userIdMapper);
1406                    }
1407            }
1408    
1409            /**
1410             * Removes the user ID mapper where userId = &#63; and type = &#63; from the database.
1411             *
1412             * @param userId the user ID
1413             * @param type the type
1414             * @return the user ID mapper that was removed
1415             * @throws SystemException if a system exception occurred
1416             */
1417            public UserIdMapper removeByU_T(long userId, String type)
1418                    throws NoSuchUserIdMapperException, SystemException {
1419                    UserIdMapper userIdMapper = findByU_T(userId, type);
1420    
1421                    return remove(userIdMapper);
1422            }
1423    
1424            /**
1425             * Removes the user ID mapper where type = &#63; and externalUserId = &#63; from the database.
1426             *
1427             * @param type the type
1428             * @param externalUserId the external user ID
1429             * @return the user ID mapper that was removed
1430             * @throws SystemException if a system exception occurred
1431             */
1432            public UserIdMapper removeByT_E(String type, String externalUserId)
1433                    throws NoSuchUserIdMapperException, SystemException {
1434                    UserIdMapper userIdMapper = findByT_E(type, externalUserId);
1435    
1436                    return remove(userIdMapper);
1437            }
1438    
1439            /**
1440             * Removes all the user ID mappers from the database.
1441             *
1442             * @throws SystemException if a system exception occurred
1443             */
1444            public void removeAll() throws SystemException {
1445                    for (UserIdMapper userIdMapper : findAll()) {
1446                            remove(userIdMapper);
1447                    }
1448            }
1449    
1450            /**
1451             * Returns the number of user ID mappers where userId = &#63;.
1452             *
1453             * @param userId the user ID
1454             * @return the number of matching user ID mappers
1455             * @throws SystemException if a system exception occurred
1456             */
1457            public int countByUserId(long userId) throws SystemException {
1458                    Object[] finderArgs = new Object[] { userId };
1459    
1460                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
1461                                    finderArgs, this);
1462    
1463                    if (count == null) {
1464                            StringBundler query = new StringBundler(2);
1465    
1466                            query.append(_SQL_COUNT_USERIDMAPPER_WHERE);
1467    
1468                            query.append(_FINDER_COLUMN_USERID_USERID_2);
1469    
1470                            String sql = query.toString();
1471    
1472                            Session session = null;
1473    
1474                            try {
1475                                    session = openSession();
1476    
1477                                    Query q = session.createQuery(sql);
1478    
1479                                    QueryPos qPos = QueryPos.getInstance(q);
1480    
1481                                    qPos.add(userId);
1482    
1483                                    count = (Long)q.uniqueResult();
1484                            }
1485                            catch (Exception e) {
1486                                    throw processException(e);
1487                            }
1488                            finally {
1489                                    if (count == null) {
1490                                            count = Long.valueOf(0);
1491                                    }
1492    
1493                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
1494                                            finderArgs, count);
1495    
1496                                    closeSession(session);
1497                            }
1498                    }
1499    
1500                    return count.intValue();
1501            }
1502    
1503            /**
1504             * Returns the number of user ID mappers where userId = &#63; and type = &#63;.
1505             *
1506             * @param userId the user ID
1507             * @param type the type
1508             * @return the number of matching user ID mappers
1509             * @throws SystemException if a system exception occurred
1510             */
1511            public int countByU_T(long userId, String type) throws SystemException {
1512                    Object[] finderArgs = new Object[] { userId, type };
1513    
1514                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_T,
1515                                    finderArgs, this);
1516    
1517                    if (count == null) {
1518                            StringBundler query = new StringBundler(3);
1519    
1520                            query.append(_SQL_COUNT_USERIDMAPPER_WHERE);
1521    
1522                            query.append(_FINDER_COLUMN_U_T_USERID_2);
1523    
1524                            if (type == null) {
1525                                    query.append(_FINDER_COLUMN_U_T_TYPE_1);
1526                            }
1527                            else {
1528                                    if (type.equals(StringPool.BLANK)) {
1529                                            query.append(_FINDER_COLUMN_U_T_TYPE_3);
1530                                    }
1531                                    else {
1532                                            query.append(_FINDER_COLUMN_U_T_TYPE_2);
1533                                    }
1534                            }
1535    
1536                            String sql = query.toString();
1537    
1538                            Session session = null;
1539    
1540                            try {
1541                                    session = openSession();
1542    
1543                                    Query q = session.createQuery(sql);
1544    
1545                                    QueryPos qPos = QueryPos.getInstance(q);
1546    
1547                                    qPos.add(userId);
1548    
1549                                    if (type != null) {
1550                                            qPos.add(type);
1551                                    }
1552    
1553                                    count = (Long)q.uniqueResult();
1554                            }
1555                            catch (Exception e) {
1556                                    throw processException(e);
1557                            }
1558                            finally {
1559                                    if (count == null) {
1560                                            count = Long.valueOf(0);
1561                                    }
1562    
1563                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_T, finderArgs,
1564                                            count);
1565    
1566                                    closeSession(session);
1567                            }
1568                    }
1569    
1570                    return count.intValue();
1571            }
1572    
1573            /**
1574             * Returns the number of user ID mappers where type = &#63; and externalUserId = &#63;.
1575             *
1576             * @param type the type
1577             * @param externalUserId the external user ID
1578             * @return the number of matching user ID mappers
1579             * @throws SystemException if a system exception occurred
1580             */
1581            public int countByT_E(String type, String externalUserId)
1582                    throws SystemException {
1583                    Object[] finderArgs = new Object[] { type, externalUserId };
1584    
1585                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_E,
1586                                    finderArgs, this);
1587    
1588                    if (count == null) {
1589                            StringBundler query = new StringBundler(3);
1590    
1591                            query.append(_SQL_COUNT_USERIDMAPPER_WHERE);
1592    
1593                            if (type == null) {
1594                                    query.append(_FINDER_COLUMN_T_E_TYPE_1);
1595                            }
1596                            else {
1597                                    if (type.equals(StringPool.BLANK)) {
1598                                            query.append(_FINDER_COLUMN_T_E_TYPE_3);
1599                                    }
1600                                    else {
1601                                            query.append(_FINDER_COLUMN_T_E_TYPE_2);
1602                                    }
1603                            }
1604    
1605                            if (externalUserId == null) {
1606                                    query.append(_FINDER_COLUMN_T_E_EXTERNALUSERID_1);
1607                            }
1608                            else {
1609                                    if (externalUserId.equals(StringPool.BLANK)) {
1610                                            query.append(_FINDER_COLUMN_T_E_EXTERNALUSERID_3);
1611                                    }
1612                                    else {
1613                                            query.append(_FINDER_COLUMN_T_E_EXTERNALUSERID_2);
1614                                    }
1615                            }
1616    
1617                            String sql = query.toString();
1618    
1619                            Session session = null;
1620    
1621                            try {
1622                                    session = openSession();
1623    
1624                                    Query q = session.createQuery(sql);
1625    
1626                                    QueryPos qPos = QueryPos.getInstance(q);
1627    
1628                                    if (type != null) {
1629                                            qPos.add(type);
1630                                    }
1631    
1632                                    if (externalUserId != null) {
1633                                            qPos.add(externalUserId);
1634                                    }
1635    
1636                                    count = (Long)q.uniqueResult();
1637                            }
1638                            catch (Exception e) {
1639                                    throw processException(e);
1640                            }
1641                            finally {
1642                                    if (count == null) {
1643                                            count = Long.valueOf(0);
1644                                    }
1645    
1646                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_E, finderArgs,
1647                                            count);
1648    
1649                                    closeSession(session);
1650                            }
1651                    }
1652    
1653                    return count.intValue();
1654            }
1655    
1656            /**
1657             * Returns the number of user ID mappers.
1658             *
1659             * @return the number of user ID mappers
1660             * @throws SystemException if a system exception occurred
1661             */
1662            public int countAll() throws SystemException {
1663                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1664                                    FINDER_ARGS_EMPTY, this);
1665    
1666                    if (count == null) {
1667                            Session session = null;
1668    
1669                            try {
1670                                    session = openSession();
1671    
1672                                    Query q = session.createQuery(_SQL_COUNT_USERIDMAPPER);
1673    
1674                                    count = (Long)q.uniqueResult();
1675                            }
1676                            catch (Exception e) {
1677                                    throw processException(e);
1678                            }
1679                            finally {
1680                                    if (count == null) {
1681                                            count = Long.valueOf(0);
1682                                    }
1683    
1684                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1685                                            FINDER_ARGS_EMPTY, count);
1686    
1687                                    closeSession(session);
1688                            }
1689                    }
1690    
1691                    return count.intValue();
1692            }
1693    
1694            /**
1695             * Initializes the user ID mapper persistence.
1696             */
1697            public void afterPropertiesSet() {
1698                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1699                                            com.liferay.portal.util.PropsUtil.get(
1700                                                    "value.object.listener.com.liferay.portal.model.UserIdMapper")));
1701    
1702                    if (listenerClassNames.length > 0) {
1703                            try {
1704                                    List<ModelListener<UserIdMapper>> listenersList = new ArrayList<ModelListener<UserIdMapper>>();
1705    
1706                                    for (String listenerClassName : listenerClassNames) {
1707                                            listenersList.add((ModelListener<UserIdMapper>)InstanceFactory.newInstance(
1708                                                            listenerClassName));
1709                                    }
1710    
1711                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1712                            }
1713                            catch (Exception e) {
1714                                    _log.error(e);
1715                            }
1716                    }
1717            }
1718    
1719            public void destroy() {
1720                    EntityCacheUtil.removeCache(UserIdMapperImpl.class.getName());
1721                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1722                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1723            }
1724    
1725            @BeanReference(type = AccountPersistence.class)
1726            protected AccountPersistence accountPersistence;
1727            @BeanReference(type = AddressPersistence.class)
1728            protected AddressPersistence addressPersistence;
1729            @BeanReference(type = BrowserTrackerPersistence.class)
1730            protected BrowserTrackerPersistence browserTrackerPersistence;
1731            @BeanReference(type = ClassNamePersistence.class)
1732            protected ClassNamePersistence classNamePersistence;
1733            @BeanReference(type = ClusterGroupPersistence.class)
1734            protected ClusterGroupPersistence clusterGroupPersistence;
1735            @BeanReference(type = CompanyPersistence.class)
1736            protected CompanyPersistence companyPersistence;
1737            @BeanReference(type = ContactPersistence.class)
1738            protected ContactPersistence contactPersistence;
1739            @BeanReference(type = CountryPersistence.class)
1740            protected CountryPersistence countryPersistence;
1741            @BeanReference(type = EmailAddressPersistence.class)
1742            protected EmailAddressPersistence emailAddressPersistence;
1743            @BeanReference(type = GroupPersistence.class)
1744            protected GroupPersistence groupPersistence;
1745            @BeanReference(type = ImagePersistence.class)
1746            protected ImagePersistence imagePersistence;
1747            @BeanReference(type = LayoutPersistence.class)
1748            protected LayoutPersistence layoutPersistence;
1749            @BeanReference(type = LayoutBranchPersistence.class)
1750            protected LayoutBranchPersistence layoutBranchPersistence;
1751            @BeanReference(type = LayoutPrototypePersistence.class)
1752            protected LayoutPrototypePersistence layoutPrototypePersistence;
1753            @BeanReference(type = LayoutRevisionPersistence.class)
1754            protected LayoutRevisionPersistence layoutRevisionPersistence;
1755            @BeanReference(type = LayoutSetPersistence.class)
1756            protected LayoutSetPersistence layoutSetPersistence;
1757            @BeanReference(type = LayoutSetBranchPersistence.class)
1758            protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1759            @BeanReference(type = LayoutSetPrototypePersistence.class)
1760            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1761            @BeanReference(type = ListTypePersistence.class)
1762            protected ListTypePersistence listTypePersistence;
1763            @BeanReference(type = LockPersistence.class)
1764            protected LockPersistence lockPersistence;
1765            @BeanReference(type = MembershipRequestPersistence.class)
1766            protected MembershipRequestPersistence membershipRequestPersistence;
1767            @BeanReference(type = OrganizationPersistence.class)
1768            protected OrganizationPersistence organizationPersistence;
1769            @BeanReference(type = OrgGroupRolePersistence.class)
1770            protected OrgGroupRolePersistence orgGroupRolePersistence;
1771            @BeanReference(type = OrgLaborPersistence.class)
1772            protected OrgLaborPersistence orgLaborPersistence;
1773            @BeanReference(type = PasswordPolicyPersistence.class)
1774            protected PasswordPolicyPersistence passwordPolicyPersistence;
1775            @BeanReference(type = PasswordPolicyRelPersistence.class)
1776            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1777            @BeanReference(type = PasswordTrackerPersistence.class)
1778            protected PasswordTrackerPersistence passwordTrackerPersistence;
1779            @BeanReference(type = PhonePersistence.class)
1780            protected PhonePersistence phonePersistence;
1781            @BeanReference(type = PluginSettingPersistence.class)
1782            protected PluginSettingPersistence pluginSettingPersistence;
1783            @BeanReference(type = PortalPreferencesPersistence.class)
1784            protected PortalPreferencesPersistence portalPreferencesPersistence;
1785            @BeanReference(type = PortletPersistence.class)
1786            protected PortletPersistence portletPersistence;
1787            @BeanReference(type = PortletItemPersistence.class)
1788            protected PortletItemPersistence portletItemPersistence;
1789            @BeanReference(type = PortletPreferencesPersistence.class)
1790            protected PortletPreferencesPersistence portletPreferencesPersistence;
1791            @BeanReference(type = RegionPersistence.class)
1792            protected RegionPersistence regionPersistence;
1793            @BeanReference(type = ReleasePersistence.class)
1794            protected ReleasePersistence releasePersistence;
1795            @BeanReference(type = RepositoryPersistence.class)
1796            protected RepositoryPersistence repositoryPersistence;
1797            @BeanReference(type = RepositoryEntryPersistence.class)
1798            protected RepositoryEntryPersistence repositoryEntryPersistence;
1799            @BeanReference(type = ResourceActionPersistence.class)
1800            protected ResourceActionPersistence resourceActionPersistence;
1801            @BeanReference(type = ResourceBlockPersistence.class)
1802            protected ResourceBlockPersistence resourceBlockPersistence;
1803            @BeanReference(type = ResourceBlockPermissionPersistence.class)
1804            protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1805            @BeanReference(type = ResourcePermissionPersistence.class)
1806            protected ResourcePermissionPersistence resourcePermissionPersistence;
1807            @BeanReference(type = ResourceTypePermissionPersistence.class)
1808            protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1809            @BeanReference(type = RolePersistence.class)
1810            protected RolePersistence rolePersistence;
1811            @BeanReference(type = ServiceComponentPersistence.class)
1812            protected ServiceComponentPersistence serviceComponentPersistence;
1813            @BeanReference(type = ShardPersistence.class)
1814            protected ShardPersistence shardPersistence;
1815            @BeanReference(type = SubscriptionPersistence.class)
1816            protected SubscriptionPersistence subscriptionPersistence;
1817            @BeanReference(type = TeamPersistence.class)
1818            protected TeamPersistence teamPersistence;
1819            @BeanReference(type = TicketPersistence.class)
1820            protected TicketPersistence ticketPersistence;
1821            @BeanReference(type = UserPersistence.class)
1822            protected UserPersistence userPersistence;
1823            @BeanReference(type = UserGroupPersistence.class)
1824            protected UserGroupPersistence userGroupPersistence;
1825            @BeanReference(type = UserGroupGroupRolePersistence.class)
1826            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1827            @BeanReference(type = UserGroupRolePersistence.class)
1828            protected UserGroupRolePersistence userGroupRolePersistence;
1829            @BeanReference(type = UserIdMapperPersistence.class)
1830            protected UserIdMapperPersistence userIdMapperPersistence;
1831            @BeanReference(type = UserNotificationEventPersistence.class)
1832            protected UserNotificationEventPersistence userNotificationEventPersistence;
1833            @BeanReference(type = UserTrackerPersistence.class)
1834            protected UserTrackerPersistence userTrackerPersistence;
1835            @BeanReference(type = UserTrackerPathPersistence.class)
1836            protected UserTrackerPathPersistence userTrackerPathPersistence;
1837            @BeanReference(type = VirtualHostPersistence.class)
1838            protected VirtualHostPersistence virtualHostPersistence;
1839            @BeanReference(type = WebDAVPropsPersistence.class)
1840            protected WebDAVPropsPersistence webDAVPropsPersistence;
1841            @BeanReference(type = WebsitePersistence.class)
1842            protected WebsitePersistence websitePersistence;
1843            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1844            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1845            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1846            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1847            private static final String _SQL_SELECT_USERIDMAPPER = "SELECT userIdMapper FROM UserIdMapper userIdMapper";
1848            private static final String _SQL_SELECT_USERIDMAPPER_WHERE = "SELECT userIdMapper FROM UserIdMapper userIdMapper WHERE ";
1849            private static final String _SQL_COUNT_USERIDMAPPER = "SELECT COUNT(userIdMapper) FROM UserIdMapper userIdMapper";
1850            private static final String _SQL_COUNT_USERIDMAPPER_WHERE = "SELECT COUNT(userIdMapper) FROM UserIdMapper userIdMapper WHERE ";
1851            private static final String _FINDER_COLUMN_USERID_USERID_2 = "userIdMapper.userId = ?";
1852            private static final String _FINDER_COLUMN_U_T_USERID_2 = "userIdMapper.userId = ? AND ";
1853            private static final String _FINDER_COLUMN_U_T_TYPE_1 = "userIdMapper.type IS NULL";
1854            private static final String _FINDER_COLUMN_U_T_TYPE_2 = "userIdMapper.type = ?";
1855            private static final String _FINDER_COLUMN_U_T_TYPE_3 = "(userIdMapper.type IS NULL OR userIdMapper.type = ?)";
1856            private static final String _FINDER_COLUMN_T_E_TYPE_1 = "userIdMapper.type IS NULL AND ";
1857            private static final String _FINDER_COLUMN_T_E_TYPE_2 = "userIdMapper.type = ? AND ";
1858            private static final String _FINDER_COLUMN_T_E_TYPE_3 = "(userIdMapper.type IS NULL OR userIdMapper.type = ?) AND ";
1859            private static final String _FINDER_COLUMN_T_E_EXTERNALUSERID_1 = "userIdMapper.externalUserId IS NULL";
1860            private static final String _FINDER_COLUMN_T_E_EXTERNALUSERID_2 = "userIdMapper.externalUserId = ?";
1861            private static final String _FINDER_COLUMN_T_E_EXTERNALUSERID_3 = "(userIdMapper.externalUserId IS NULL OR userIdMapper.externalUserId = ?)";
1862            private static final String _ORDER_BY_ENTITY_ALIAS = "userIdMapper.";
1863            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserIdMapper exists with the primary key ";
1864            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserIdMapper exists with the key {";
1865            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1866            private static Log _log = LogFactoryUtil.getLog(UserIdMapperPersistenceImpl.class);
1867            private static UserIdMapper _nullUserIdMapper = new UserIdMapperImpl() {
1868                            @Override
1869                            public Object clone() {
1870                                    return this;
1871                            }
1872    
1873                            @Override
1874                            public CacheModel<UserIdMapper> toCacheModel() {
1875                                    return _nullUserIdMapperCacheModel;
1876                            }
1877                    };
1878    
1879            private static CacheModel<UserIdMapper> _nullUserIdMapperCacheModel = new CacheModel<UserIdMapper>() {
1880                            public UserIdMapper toEntityModel() {
1881                                    return _nullUserIdMapper;
1882                            }
1883                    };
1884    }