001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchUserTrackerPathException;
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderPath;
024 import com.liferay.portal.kernel.dao.orm.Query;
025 import com.liferay.portal.kernel.dao.orm.QueryPos;
026 import com.liferay.portal.kernel.dao.orm.QueryUtil;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.model.CacheModel;
038 import com.liferay.portal.model.ModelListener;
039 import com.liferay.portal.model.UserTrackerPath;
040 import com.liferay.portal.model.impl.UserTrackerPathImpl;
041 import com.liferay.portal.model.impl.UserTrackerPathModelImpl;
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
062 public class UserTrackerPathPersistenceImpl extends BasePersistenceImpl<UserTrackerPath>
063 implements UserTrackerPathPersistence {
064
069 public static final String FINDER_CLASS_NAME_ENTITY = UserTrackerPathImpl.class.getName();
070 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
071 ".List1";
072 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073 ".List2";
074 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERTRACKERID =
075 new FinderPath(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
076 UserTrackerPathModelImpl.FINDER_CACHE_ENABLED,
077 UserTrackerPathImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
078 "findByUserTrackerId",
079 new String[] {
080 Long.class.getName(),
081
082 "java.lang.Integer", "java.lang.Integer",
083 "com.liferay.portal.kernel.util.OrderByComparator"
084 });
085 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID =
086 new FinderPath(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
087 UserTrackerPathModelImpl.FINDER_CACHE_ENABLED,
088 UserTrackerPathImpl.class,
089 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserTrackerId",
090 new String[] { Long.class.getName() },
091 UserTrackerPathModelImpl.USERTRACKERID_COLUMN_BITMASK);
092 public static final FinderPath FINDER_PATH_COUNT_BY_USERTRACKERID = new FinderPath(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
093 UserTrackerPathModelImpl.FINDER_CACHE_ENABLED, Long.class,
094 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserTrackerId",
095 new String[] { Long.class.getName() });
096 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
097 UserTrackerPathModelImpl.FINDER_CACHE_ENABLED,
098 UserTrackerPathImpl.class,
099 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
100 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
101 UserTrackerPathModelImpl.FINDER_CACHE_ENABLED,
102 UserTrackerPathImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
103 "findAll", new String[0]);
104 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
105 UserTrackerPathModelImpl.FINDER_CACHE_ENABLED, Long.class,
106 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
107
108
113 public void cacheResult(UserTrackerPath userTrackerPath) {
114 EntityCacheUtil.putResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
115 UserTrackerPathImpl.class, userTrackerPath.getPrimaryKey(),
116 userTrackerPath);
117
118 userTrackerPath.resetOriginalValues();
119 }
120
121
126 public void cacheResult(List<UserTrackerPath> userTrackerPaths) {
127 for (UserTrackerPath userTrackerPath : userTrackerPaths) {
128 if (EntityCacheUtil.getResult(
129 UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
130 UserTrackerPathImpl.class,
131 userTrackerPath.getPrimaryKey()) == null) {
132 cacheResult(userTrackerPath);
133 }
134 else {
135 userTrackerPath.resetOriginalValues();
136 }
137 }
138 }
139
140
147 @Override
148 public void clearCache() {
149 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
150 CacheRegistryUtil.clear(UserTrackerPathImpl.class.getName());
151 }
152
153 EntityCacheUtil.clearCache(UserTrackerPathImpl.class.getName());
154
155 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
156 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
157 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
158 }
159
160
167 @Override
168 public void clearCache(UserTrackerPath userTrackerPath) {
169 EntityCacheUtil.removeResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
170 UserTrackerPathImpl.class, userTrackerPath.getPrimaryKey());
171
172 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
173 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
174 }
175
176
182 public UserTrackerPath create(long userTrackerPathId) {
183 UserTrackerPath userTrackerPath = new UserTrackerPathImpl();
184
185 userTrackerPath.setNew(true);
186 userTrackerPath.setPrimaryKey(userTrackerPathId);
187
188 return userTrackerPath;
189 }
190
191
199 @Override
200 public UserTrackerPath remove(Serializable primaryKey)
201 throws NoSuchModelException, SystemException {
202 return remove(((Long)primaryKey).longValue());
203 }
204
205
213 public UserTrackerPath remove(long userTrackerPathId)
214 throws NoSuchUserTrackerPathException, SystemException {
215 Session session = null;
216
217 try {
218 session = openSession();
219
220 UserTrackerPath userTrackerPath = (UserTrackerPath)session.get(UserTrackerPathImpl.class,
221 Long.valueOf(userTrackerPathId));
222
223 if (userTrackerPath == null) {
224 if (_log.isWarnEnabled()) {
225 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
226 userTrackerPathId);
227 }
228
229 throw new NoSuchUserTrackerPathException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
230 userTrackerPathId);
231 }
232
233 return userTrackerPathPersistence.remove(userTrackerPath);
234 }
235 catch (NoSuchUserTrackerPathException nsee) {
236 throw nsee;
237 }
238 catch (Exception e) {
239 throw processException(e);
240 }
241 finally {
242 closeSession(session);
243 }
244 }
245
246
253 @Override
254 public UserTrackerPath remove(UserTrackerPath userTrackerPath)
255 throws SystemException {
256 return super.remove(userTrackerPath);
257 }
258
259 @Override
260 protected UserTrackerPath removeImpl(UserTrackerPath userTrackerPath)
261 throws SystemException {
262 userTrackerPath = toUnwrappedModel(userTrackerPath);
263
264 Session session = null;
265
266 try {
267 session = openSession();
268
269 BatchSessionUtil.delete(session, userTrackerPath);
270 }
271 catch (Exception e) {
272 throw processException(e);
273 }
274 finally {
275 closeSession(session);
276 }
277
278 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
279 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
280
281 EntityCacheUtil.removeResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
282 UserTrackerPathImpl.class, userTrackerPath.getPrimaryKey());
283
284 return userTrackerPath;
285 }
286
287 @Override
288 public UserTrackerPath updateImpl(
289 com.liferay.portal.model.UserTrackerPath userTrackerPath, boolean merge)
290 throws SystemException {
291 userTrackerPath = toUnwrappedModel(userTrackerPath);
292
293 boolean isNew = userTrackerPath.isNew();
294
295 UserTrackerPathModelImpl userTrackerPathModelImpl = (UserTrackerPathModelImpl)userTrackerPath;
296
297 Session session = null;
298
299 try {
300 session = openSession();
301
302 BatchSessionUtil.update(session, userTrackerPath, merge);
303
304 userTrackerPath.setNew(false);
305 }
306 catch (Exception e) {
307 throw processException(e);
308 }
309 finally {
310 closeSession(session);
311 }
312
313 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
314
315 if (isNew || !UserTrackerPathModelImpl.COLUMN_BITMASK_ENABLED) {
316 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
317 }
318
319 else {
320 if ((userTrackerPathModelImpl.getColumnBitmask() &
321 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID.getColumnBitmask()) != 0) {
322 Object[] args = new Object[] {
323 Long.valueOf(userTrackerPathModelImpl.getOriginalUserTrackerId())
324 };
325
326 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
327 args);
328 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID,
329 args);
330
331 args = new Object[] {
332 Long.valueOf(userTrackerPathModelImpl.getUserTrackerId())
333 };
334
335 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
336 args);
337 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID,
338 args);
339 }
340 }
341
342 EntityCacheUtil.putResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
343 UserTrackerPathImpl.class, userTrackerPath.getPrimaryKey(),
344 userTrackerPath);
345
346 return userTrackerPath;
347 }
348
349 protected UserTrackerPath toUnwrappedModel(UserTrackerPath userTrackerPath) {
350 if (userTrackerPath instanceof UserTrackerPathImpl) {
351 return userTrackerPath;
352 }
353
354 UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
355
356 userTrackerPathImpl.setNew(userTrackerPath.isNew());
357 userTrackerPathImpl.setPrimaryKey(userTrackerPath.getPrimaryKey());
358
359 userTrackerPathImpl.setUserTrackerPathId(userTrackerPath.getUserTrackerPathId());
360 userTrackerPathImpl.setUserTrackerId(userTrackerPath.getUserTrackerId());
361 userTrackerPathImpl.setPath(userTrackerPath.getPath());
362 userTrackerPathImpl.setPathDate(userTrackerPath.getPathDate());
363
364 return userTrackerPathImpl;
365 }
366
367
375 @Override
376 public UserTrackerPath findByPrimaryKey(Serializable primaryKey)
377 throws NoSuchModelException, SystemException {
378 return findByPrimaryKey(((Long)primaryKey).longValue());
379 }
380
381
389 public UserTrackerPath findByPrimaryKey(long userTrackerPathId)
390 throws NoSuchUserTrackerPathException, SystemException {
391 UserTrackerPath userTrackerPath = fetchByPrimaryKey(userTrackerPathId);
392
393 if (userTrackerPath == null) {
394 if (_log.isWarnEnabled()) {
395 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userTrackerPathId);
396 }
397
398 throw new NoSuchUserTrackerPathException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
399 userTrackerPathId);
400 }
401
402 return userTrackerPath;
403 }
404
405
412 @Override
413 public UserTrackerPath fetchByPrimaryKey(Serializable primaryKey)
414 throws SystemException {
415 return fetchByPrimaryKey(((Long)primaryKey).longValue());
416 }
417
418
425 public UserTrackerPath fetchByPrimaryKey(long userTrackerPathId)
426 throws SystemException {
427 UserTrackerPath userTrackerPath = (UserTrackerPath)EntityCacheUtil.getResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
428 UserTrackerPathImpl.class, userTrackerPathId);
429
430 if (userTrackerPath == _nullUserTrackerPath) {
431 return null;
432 }
433
434 if (userTrackerPath == null) {
435 Session session = null;
436
437 boolean hasException = false;
438
439 try {
440 session = openSession();
441
442 userTrackerPath = (UserTrackerPath)session.get(UserTrackerPathImpl.class,
443 Long.valueOf(userTrackerPathId));
444 }
445 catch (Exception e) {
446 hasException = true;
447
448 throw processException(e);
449 }
450 finally {
451 if (userTrackerPath != null) {
452 cacheResult(userTrackerPath);
453 }
454 else if (!hasException) {
455 EntityCacheUtil.putResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
456 UserTrackerPathImpl.class, userTrackerPathId,
457 _nullUserTrackerPath);
458 }
459
460 closeSession(session);
461 }
462 }
463
464 return userTrackerPath;
465 }
466
467
474 public List<UserTrackerPath> findByUserTrackerId(long userTrackerId)
475 throws SystemException {
476 return findByUserTrackerId(userTrackerId, QueryUtil.ALL_POS,
477 QueryUtil.ALL_POS, null);
478 }
479
480
493 public List<UserTrackerPath> findByUserTrackerId(long userTrackerId,
494 int start, int end) throws SystemException {
495 return findByUserTrackerId(userTrackerId, start, end, null);
496 }
497
498
512 public List<UserTrackerPath> findByUserTrackerId(long userTrackerId,
513 int start, int end, OrderByComparator orderByComparator)
514 throws SystemException {
515 FinderPath finderPath = null;
516 Object[] finderArgs = null;
517
518 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
519 (orderByComparator == null)) {
520 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID;
521 finderArgs = new Object[] { userTrackerId };
522 }
523 else {
524 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERTRACKERID;
525 finderArgs = new Object[] {
526 userTrackerId,
527
528 start, end, orderByComparator
529 };
530 }
531
532 List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(finderPath,
533 finderArgs, this);
534
535 if (list == null) {
536 StringBundler query = null;
537
538 if (orderByComparator != null) {
539 query = new StringBundler(3 +
540 (orderByComparator.getOrderByFields().length * 3));
541 }
542 else {
543 query = new StringBundler(2);
544 }
545
546 query.append(_SQL_SELECT_USERTRACKERPATH_WHERE);
547
548 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
549
550 if (orderByComparator != null) {
551 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
552 orderByComparator);
553 }
554
555 String sql = query.toString();
556
557 Session session = null;
558
559 try {
560 session = openSession();
561
562 Query q = session.createQuery(sql);
563
564 QueryPos qPos = QueryPos.getInstance(q);
565
566 qPos.add(userTrackerId);
567
568 list = (List<UserTrackerPath>)QueryUtil.list(q, getDialect(),
569 start, end);
570 }
571 catch (Exception e) {
572 throw processException(e);
573 }
574 finally {
575 if (list == null) {
576 FinderCacheUtil.removeResult(finderPath, finderArgs);
577 }
578 else {
579 cacheResult(list);
580
581 FinderCacheUtil.putResult(finderPath, finderArgs, list);
582 }
583
584 closeSession(session);
585 }
586 }
587
588 return list;
589 }
590
591
604 public UserTrackerPath findByUserTrackerId_First(long userTrackerId,
605 OrderByComparator orderByComparator)
606 throws NoSuchUserTrackerPathException, SystemException {
607 List<UserTrackerPath> list = findByUserTrackerId(userTrackerId, 0, 1,
608 orderByComparator);
609
610 if (list.isEmpty()) {
611 StringBundler msg = new StringBundler(4);
612
613 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
614
615 msg.append("userTrackerId=");
616 msg.append(userTrackerId);
617
618 msg.append(StringPool.CLOSE_CURLY_BRACE);
619
620 throw new NoSuchUserTrackerPathException(msg.toString());
621 }
622 else {
623 return list.get(0);
624 }
625 }
626
627
640 public UserTrackerPath findByUserTrackerId_Last(long userTrackerId,
641 OrderByComparator orderByComparator)
642 throws NoSuchUserTrackerPathException, SystemException {
643 int count = countByUserTrackerId(userTrackerId);
644
645 List<UserTrackerPath> list = findByUserTrackerId(userTrackerId,
646 count - 1, count, orderByComparator);
647
648 if (list.isEmpty()) {
649 StringBundler msg = new StringBundler(4);
650
651 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
652
653 msg.append("userTrackerId=");
654 msg.append(userTrackerId);
655
656 msg.append(StringPool.CLOSE_CURLY_BRACE);
657
658 throw new NoSuchUserTrackerPathException(msg.toString());
659 }
660 else {
661 return list.get(0);
662 }
663 }
664
665
679 public UserTrackerPath[] findByUserTrackerId_PrevAndNext(
680 long userTrackerPathId, long userTrackerId,
681 OrderByComparator orderByComparator)
682 throws NoSuchUserTrackerPathException, SystemException {
683 UserTrackerPath userTrackerPath = findByPrimaryKey(userTrackerPathId);
684
685 Session session = null;
686
687 try {
688 session = openSession();
689
690 UserTrackerPath[] array = new UserTrackerPathImpl[3];
691
692 array[0] = getByUserTrackerId_PrevAndNext(session, userTrackerPath,
693 userTrackerId, orderByComparator, true);
694
695 array[1] = userTrackerPath;
696
697 array[2] = getByUserTrackerId_PrevAndNext(session, userTrackerPath,
698 userTrackerId, orderByComparator, false);
699
700 return array;
701 }
702 catch (Exception e) {
703 throw processException(e);
704 }
705 finally {
706 closeSession(session);
707 }
708 }
709
710 protected UserTrackerPath getByUserTrackerId_PrevAndNext(Session session,
711 UserTrackerPath userTrackerPath, long userTrackerId,
712 OrderByComparator orderByComparator, boolean previous) {
713 StringBundler query = null;
714
715 if (orderByComparator != null) {
716 query = new StringBundler(6 +
717 (orderByComparator.getOrderByFields().length * 6));
718 }
719 else {
720 query = new StringBundler(3);
721 }
722
723 query.append(_SQL_SELECT_USERTRACKERPATH_WHERE);
724
725 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
726
727 if (orderByComparator != null) {
728 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
729
730 if (orderByConditionFields.length > 0) {
731 query.append(WHERE_AND);
732 }
733
734 for (int i = 0; i < orderByConditionFields.length; i++) {
735 query.append(_ORDER_BY_ENTITY_ALIAS);
736 query.append(orderByConditionFields[i]);
737
738 if ((i + 1) < orderByConditionFields.length) {
739 if (orderByComparator.isAscending() ^ previous) {
740 query.append(WHERE_GREATER_THAN_HAS_NEXT);
741 }
742 else {
743 query.append(WHERE_LESSER_THAN_HAS_NEXT);
744 }
745 }
746 else {
747 if (orderByComparator.isAscending() ^ previous) {
748 query.append(WHERE_GREATER_THAN);
749 }
750 else {
751 query.append(WHERE_LESSER_THAN);
752 }
753 }
754 }
755
756 query.append(ORDER_BY_CLAUSE);
757
758 String[] orderByFields = orderByComparator.getOrderByFields();
759
760 for (int i = 0; i < orderByFields.length; i++) {
761 query.append(_ORDER_BY_ENTITY_ALIAS);
762 query.append(orderByFields[i]);
763
764 if ((i + 1) < orderByFields.length) {
765 if (orderByComparator.isAscending() ^ previous) {
766 query.append(ORDER_BY_ASC_HAS_NEXT);
767 }
768 else {
769 query.append(ORDER_BY_DESC_HAS_NEXT);
770 }
771 }
772 else {
773 if (orderByComparator.isAscending() ^ previous) {
774 query.append(ORDER_BY_ASC);
775 }
776 else {
777 query.append(ORDER_BY_DESC);
778 }
779 }
780 }
781 }
782
783 String sql = query.toString();
784
785 Query q = session.createQuery(sql);
786
787 q.setFirstResult(0);
788 q.setMaxResults(2);
789
790 QueryPos qPos = QueryPos.getInstance(q);
791
792 qPos.add(userTrackerId);
793
794 if (orderByComparator != null) {
795 Object[] values = orderByComparator.getOrderByConditionValues(userTrackerPath);
796
797 for (Object value : values) {
798 qPos.add(value);
799 }
800 }
801
802 List<UserTrackerPath> list = q.list();
803
804 if (list.size() == 2) {
805 return list.get(1);
806 }
807 else {
808 return null;
809 }
810 }
811
812
818 public List<UserTrackerPath> findAll() throws SystemException {
819 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
820 }
821
822
834 public List<UserTrackerPath> findAll(int start, int end)
835 throws SystemException {
836 return findAll(start, end, null);
837 }
838
839
852 public List<UserTrackerPath> findAll(int start, int end,
853 OrderByComparator orderByComparator) throws SystemException {
854 FinderPath finderPath = null;
855 Object[] finderArgs = new Object[] { start, end, orderByComparator };
856
857 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
858 (orderByComparator == null)) {
859 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
860 finderArgs = FINDER_ARGS_EMPTY;
861 }
862 else {
863 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
864 finderArgs = new Object[] { start, end, orderByComparator };
865 }
866
867 List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(finderPath,
868 finderArgs, this);
869
870 if (list == null) {
871 StringBundler query = null;
872 String sql = null;
873
874 if (orderByComparator != null) {
875 query = new StringBundler(2 +
876 (orderByComparator.getOrderByFields().length * 3));
877
878 query.append(_SQL_SELECT_USERTRACKERPATH);
879
880 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
881 orderByComparator);
882
883 sql = query.toString();
884 }
885 else {
886 sql = _SQL_SELECT_USERTRACKERPATH;
887 }
888
889 Session session = null;
890
891 try {
892 session = openSession();
893
894 Query q = session.createQuery(sql);
895
896 if (orderByComparator == null) {
897 list = (List<UserTrackerPath>)QueryUtil.list(q,
898 getDialect(), start, end, false);
899
900 Collections.sort(list);
901 }
902 else {
903 list = (List<UserTrackerPath>)QueryUtil.list(q,
904 getDialect(), start, end);
905 }
906 }
907 catch (Exception e) {
908 throw processException(e);
909 }
910 finally {
911 if (list == null) {
912 FinderCacheUtil.removeResult(finderPath, finderArgs);
913 }
914 else {
915 cacheResult(list);
916
917 FinderCacheUtil.putResult(finderPath, finderArgs, list);
918 }
919
920 closeSession(session);
921 }
922 }
923
924 return list;
925 }
926
927
933 public void removeByUserTrackerId(long userTrackerId)
934 throws SystemException {
935 for (UserTrackerPath userTrackerPath : findByUserTrackerId(
936 userTrackerId)) {
937 userTrackerPathPersistence.remove(userTrackerPath);
938 }
939 }
940
941
946 public void removeAll() throws SystemException {
947 for (UserTrackerPath userTrackerPath : findAll()) {
948 userTrackerPathPersistence.remove(userTrackerPath);
949 }
950 }
951
952
959 public int countByUserTrackerId(long userTrackerId)
960 throws SystemException {
961 Object[] finderArgs = new Object[] { userTrackerId };
962
963 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
964 finderArgs, this);
965
966 if (count == null) {
967 StringBundler query = new StringBundler(2);
968
969 query.append(_SQL_COUNT_USERTRACKERPATH_WHERE);
970
971 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
972
973 String sql = query.toString();
974
975 Session session = null;
976
977 try {
978 session = openSession();
979
980 Query q = session.createQuery(sql);
981
982 QueryPos qPos = QueryPos.getInstance(q);
983
984 qPos.add(userTrackerId);
985
986 count = (Long)q.uniqueResult();
987 }
988 catch (Exception e) {
989 throw processException(e);
990 }
991 finally {
992 if (count == null) {
993 count = Long.valueOf(0);
994 }
995
996 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
997 finderArgs, count);
998
999 closeSession(session);
1000 }
1001 }
1002
1003 return count.intValue();
1004 }
1005
1006
1012 public int countAll() throws SystemException {
1013 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1014 FINDER_ARGS_EMPTY, this);
1015
1016 if (count == null) {
1017 Session session = null;
1018
1019 try {
1020 session = openSession();
1021
1022 Query q = session.createQuery(_SQL_COUNT_USERTRACKERPATH);
1023
1024 count = (Long)q.uniqueResult();
1025 }
1026 catch (Exception e) {
1027 throw processException(e);
1028 }
1029 finally {
1030 if (count == null) {
1031 count = Long.valueOf(0);
1032 }
1033
1034 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1035 FINDER_ARGS_EMPTY, count);
1036
1037 closeSession(session);
1038 }
1039 }
1040
1041 return count.intValue();
1042 }
1043
1044
1047 public void afterPropertiesSet() {
1048 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1049 com.liferay.portal.util.PropsUtil.get(
1050 "value.object.listener.com.liferay.portal.model.UserTrackerPath")));
1051
1052 if (listenerClassNames.length > 0) {
1053 try {
1054 List<ModelListener<UserTrackerPath>> listenersList = new ArrayList<ModelListener<UserTrackerPath>>();
1055
1056 for (String listenerClassName : listenerClassNames) {
1057 listenersList.add((ModelListener<UserTrackerPath>)InstanceFactory.newInstance(
1058 listenerClassName));
1059 }
1060
1061 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1062 }
1063 catch (Exception e) {
1064 _log.error(e);
1065 }
1066 }
1067 }
1068
1069 public void destroy() {
1070 EntityCacheUtil.removeCache(UserTrackerPathImpl.class.getName());
1071 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1072 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1073 }
1074
1075 @BeanReference(type = AccountPersistence.class)
1076 protected AccountPersistence accountPersistence;
1077 @BeanReference(type = AddressPersistence.class)
1078 protected AddressPersistence addressPersistence;
1079 @BeanReference(type = BrowserTrackerPersistence.class)
1080 protected BrowserTrackerPersistence browserTrackerPersistence;
1081 @BeanReference(type = ClassNamePersistence.class)
1082 protected ClassNamePersistence classNamePersistence;
1083 @BeanReference(type = ClusterGroupPersistence.class)
1084 protected ClusterGroupPersistence clusterGroupPersistence;
1085 @BeanReference(type = CompanyPersistence.class)
1086 protected CompanyPersistence companyPersistence;
1087 @BeanReference(type = ContactPersistence.class)
1088 protected ContactPersistence contactPersistence;
1089 @BeanReference(type = CountryPersistence.class)
1090 protected CountryPersistence countryPersistence;
1091 @BeanReference(type = EmailAddressPersistence.class)
1092 protected EmailAddressPersistence emailAddressPersistence;
1093 @BeanReference(type = GroupPersistence.class)
1094 protected GroupPersistence groupPersistence;
1095 @BeanReference(type = ImagePersistence.class)
1096 protected ImagePersistence imagePersistence;
1097 @BeanReference(type = LayoutPersistence.class)
1098 protected LayoutPersistence layoutPersistence;
1099 @BeanReference(type = LayoutBranchPersistence.class)
1100 protected LayoutBranchPersistence layoutBranchPersistence;
1101 @BeanReference(type = LayoutPrototypePersistence.class)
1102 protected LayoutPrototypePersistence layoutPrototypePersistence;
1103 @BeanReference(type = LayoutRevisionPersistence.class)
1104 protected LayoutRevisionPersistence layoutRevisionPersistence;
1105 @BeanReference(type = LayoutSetPersistence.class)
1106 protected LayoutSetPersistence layoutSetPersistence;
1107 @BeanReference(type = LayoutSetBranchPersistence.class)
1108 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1109 @BeanReference(type = LayoutSetPrototypePersistence.class)
1110 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1111 @BeanReference(type = ListTypePersistence.class)
1112 protected ListTypePersistence listTypePersistence;
1113 @BeanReference(type = LockPersistence.class)
1114 protected LockPersistence lockPersistence;
1115 @BeanReference(type = MembershipRequestPersistence.class)
1116 protected MembershipRequestPersistence membershipRequestPersistence;
1117 @BeanReference(type = OrganizationPersistence.class)
1118 protected OrganizationPersistence organizationPersistence;
1119 @BeanReference(type = OrgGroupPermissionPersistence.class)
1120 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1121 @BeanReference(type = OrgGroupRolePersistence.class)
1122 protected OrgGroupRolePersistence orgGroupRolePersistence;
1123 @BeanReference(type = OrgLaborPersistence.class)
1124 protected OrgLaborPersistence orgLaborPersistence;
1125 @BeanReference(type = PasswordPolicyPersistence.class)
1126 protected PasswordPolicyPersistence passwordPolicyPersistence;
1127 @BeanReference(type = PasswordPolicyRelPersistence.class)
1128 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1129 @BeanReference(type = PasswordTrackerPersistence.class)
1130 protected PasswordTrackerPersistence passwordTrackerPersistence;
1131 @BeanReference(type = PermissionPersistence.class)
1132 protected PermissionPersistence permissionPersistence;
1133 @BeanReference(type = PhonePersistence.class)
1134 protected PhonePersistence phonePersistence;
1135 @BeanReference(type = PluginSettingPersistence.class)
1136 protected PluginSettingPersistence pluginSettingPersistence;
1137 @BeanReference(type = PortalPreferencesPersistence.class)
1138 protected PortalPreferencesPersistence portalPreferencesPersistence;
1139 @BeanReference(type = PortletPersistence.class)
1140 protected PortletPersistence portletPersistence;
1141 @BeanReference(type = PortletItemPersistence.class)
1142 protected PortletItemPersistence portletItemPersistence;
1143 @BeanReference(type = PortletPreferencesPersistence.class)
1144 protected PortletPreferencesPersistence portletPreferencesPersistence;
1145 @BeanReference(type = RegionPersistence.class)
1146 protected RegionPersistence regionPersistence;
1147 @BeanReference(type = ReleasePersistence.class)
1148 protected ReleasePersistence releasePersistence;
1149 @BeanReference(type = RepositoryPersistence.class)
1150 protected RepositoryPersistence repositoryPersistence;
1151 @BeanReference(type = RepositoryEntryPersistence.class)
1152 protected RepositoryEntryPersistence repositoryEntryPersistence;
1153 @BeanReference(type = ResourcePersistence.class)
1154 protected ResourcePersistence resourcePersistence;
1155 @BeanReference(type = ResourceActionPersistence.class)
1156 protected ResourceActionPersistence resourceActionPersistence;
1157 @BeanReference(type = ResourceBlockPersistence.class)
1158 protected ResourceBlockPersistence resourceBlockPersistence;
1159 @BeanReference(type = ResourceBlockPermissionPersistence.class)
1160 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1161 @BeanReference(type = ResourceCodePersistence.class)
1162 protected ResourceCodePersistence resourceCodePersistence;
1163 @BeanReference(type = ResourcePermissionPersistence.class)
1164 protected ResourcePermissionPersistence resourcePermissionPersistence;
1165 @BeanReference(type = ResourceTypePermissionPersistence.class)
1166 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1167 @BeanReference(type = RolePersistence.class)
1168 protected RolePersistence rolePersistence;
1169 @BeanReference(type = ServiceComponentPersistence.class)
1170 protected ServiceComponentPersistence serviceComponentPersistence;
1171 @BeanReference(type = ShardPersistence.class)
1172 protected ShardPersistence shardPersistence;
1173 @BeanReference(type = SubscriptionPersistence.class)
1174 protected SubscriptionPersistence subscriptionPersistence;
1175 @BeanReference(type = TeamPersistence.class)
1176 protected TeamPersistence teamPersistence;
1177 @BeanReference(type = TicketPersistence.class)
1178 protected TicketPersistence ticketPersistence;
1179 @BeanReference(type = UserPersistence.class)
1180 protected UserPersistence userPersistence;
1181 @BeanReference(type = UserGroupPersistence.class)
1182 protected UserGroupPersistence userGroupPersistence;
1183 @BeanReference(type = UserGroupGroupRolePersistence.class)
1184 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1185 @BeanReference(type = UserGroupRolePersistence.class)
1186 protected UserGroupRolePersistence userGroupRolePersistence;
1187 @BeanReference(type = UserIdMapperPersistence.class)
1188 protected UserIdMapperPersistence userIdMapperPersistence;
1189 @BeanReference(type = UserNotificationEventPersistence.class)
1190 protected UserNotificationEventPersistence userNotificationEventPersistence;
1191 @BeanReference(type = UserTrackerPersistence.class)
1192 protected UserTrackerPersistence userTrackerPersistence;
1193 @BeanReference(type = UserTrackerPathPersistence.class)
1194 protected UserTrackerPathPersistence userTrackerPathPersistence;
1195 @BeanReference(type = VirtualHostPersistence.class)
1196 protected VirtualHostPersistence virtualHostPersistence;
1197 @BeanReference(type = WebDAVPropsPersistence.class)
1198 protected WebDAVPropsPersistence webDAVPropsPersistence;
1199 @BeanReference(type = WebsitePersistence.class)
1200 protected WebsitePersistence websitePersistence;
1201 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1202 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1203 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1204 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1205 private static final String _SQL_SELECT_USERTRACKERPATH = "SELECT userTrackerPath FROM UserTrackerPath userTrackerPath";
1206 private static final String _SQL_SELECT_USERTRACKERPATH_WHERE = "SELECT userTrackerPath FROM UserTrackerPath userTrackerPath WHERE ";
1207 private static final String _SQL_COUNT_USERTRACKERPATH = "SELECT COUNT(userTrackerPath) FROM UserTrackerPath userTrackerPath";
1208 private static final String _SQL_COUNT_USERTRACKERPATH_WHERE = "SELECT COUNT(userTrackerPath) FROM UserTrackerPath userTrackerPath WHERE ";
1209 private static final String _FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2 = "userTrackerPath.userTrackerId = ?";
1210 private static final String _ORDER_BY_ENTITY_ALIAS = "userTrackerPath.";
1211 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserTrackerPath exists with the primary key ";
1212 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserTrackerPath exists with the key {";
1213 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1214 private static Log _log = LogFactoryUtil.getLog(UserTrackerPathPersistenceImpl.class);
1215 private static UserTrackerPath _nullUserTrackerPath = new UserTrackerPathImpl() {
1216 @Override
1217 public Object clone() {
1218 return this;
1219 }
1220
1221 @Override
1222 public CacheModel<UserTrackerPath> toCacheModel() {
1223 return _nullUserTrackerPathCacheModel;
1224 }
1225 };
1226
1227 private static CacheModel<UserTrackerPath> _nullUserTrackerPathCacheModel = new CacheModel<UserTrackerPath>() {
1228 public UserTrackerPath toEntityModel() {
1229 return _nullUserTrackerPath;
1230 }
1231 };
1232 }