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