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