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