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