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