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, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
099 "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,
103 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "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 @Override
177 public void clearCache(List<UserTrackerPath> userTrackerPaths) {
178 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
179 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
180
181 for (UserTrackerPath userTrackerPath : userTrackerPaths) {
182 EntityCacheUtil.removeResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
183 UserTrackerPathImpl.class, userTrackerPath.getPrimaryKey());
184 }
185 }
186
187
193 public UserTrackerPath create(long userTrackerPathId) {
194 UserTrackerPath userTrackerPath = new UserTrackerPathImpl();
195
196 userTrackerPath.setNew(true);
197 userTrackerPath.setPrimaryKey(userTrackerPathId);
198
199 return userTrackerPath;
200 }
201
202
210 public UserTrackerPath remove(long userTrackerPathId)
211 throws NoSuchUserTrackerPathException, SystemException {
212 return remove(Long.valueOf(userTrackerPathId));
213 }
214
215
223 @Override
224 public UserTrackerPath remove(Serializable primaryKey)
225 throws NoSuchUserTrackerPathException, SystemException {
226 Session session = null;
227
228 try {
229 session = openSession();
230
231 UserTrackerPath userTrackerPath = (UserTrackerPath)session.get(UserTrackerPathImpl.class,
232 primaryKey);
233
234 if (userTrackerPath == null) {
235 if (_log.isWarnEnabled()) {
236 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
237 }
238
239 throw new NoSuchUserTrackerPathException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
240 primaryKey);
241 }
242
243 return remove(userTrackerPath);
244 }
245 catch (NoSuchUserTrackerPathException nsee) {
246 throw nsee;
247 }
248 catch (Exception e) {
249 throw processException(e);
250 }
251 finally {
252 closeSession(session);
253 }
254 }
255
256 @Override
257 protected UserTrackerPath removeImpl(UserTrackerPath userTrackerPath)
258 throws SystemException {
259 userTrackerPath = toUnwrappedModel(userTrackerPath);
260
261 Session session = null;
262
263 try {
264 session = openSession();
265
266 BatchSessionUtil.delete(session, userTrackerPath);
267 }
268 catch (Exception e) {
269 throw processException(e);
270 }
271 finally {
272 closeSession(session);
273 }
274
275 clearCache(userTrackerPath);
276
277 return userTrackerPath;
278 }
279
280 @Override
281 public UserTrackerPath updateImpl(
282 com.liferay.portal.model.UserTrackerPath userTrackerPath, boolean merge)
283 throws SystemException {
284 userTrackerPath = toUnwrappedModel(userTrackerPath);
285
286 boolean isNew = userTrackerPath.isNew();
287
288 UserTrackerPathModelImpl userTrackerPathModelImpl = (UserTrackerPathModelImpl)userTrackerPath;
289
290 Session session = null;
291
292 try {
293 session = openSession();
294
295 BatchSessionUtil.update(session, userTrackerPath, merge);
296
297 userTrackerPath.setNew(false);
298 }
299 catch (Exception e) {
300 throw processException(e);
301 }
302 finally {
303 closeSession(session);
304 }
305
306 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
307
308 if (isNew || !UserTrackerPathModelImpl.COLUMN_BITMASK_ENABLED) {
309 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
310 }
311 else {
312 if ((userTrackerPathModelImpl.getColumnBitmask() &
313 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID.getColumnBitmask()) != 0) {
314 Object[] args = new Object[] {
315 Long.valueOf(userTrackerPathModelImpl.getOriginalUserTrackerId())
316 };
317
318 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
319 args);
320 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID,
321 args);
322
323 args = new Object[] {
324 Long.valueOf(userTrackerPathModelImpl.getUserTrackerId())
325 };
326
327 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
328 args);
329 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID,
330 args);
331 }
332 }
333
334 EntityCacheUtil.putResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
335 UserTrackerPathImpl.class, userTrackerPath.getPrimaryKey(),
336 userTrackerPath);
337
338 return userTrackerPath;
339 }
340
341 protected UserTrackerPath toUnwrappedModel(UserTrackerPath userTrackerPath) {
342 if (userTrackerPath instanceof UserTrackerPathImpl) {
343 return userTrackerPath;
344 }
345
346 UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
347
348 userTrackerPathImpl.setNew(userTrackerPath.isNew());
349 userTrackerPathImpl.setPrimaryKey(userTrackerPath.getPrimaryKey());
350
351 userTrackerPathImpl.setUserTrackerPathId(userTrackerPath.getUserTrackerPathId());
352 userTrackerPathImpl.setUserTrackerId(userTrackerPath.getUserTrackerId());
353 userTrackerPathImpl.setPath(userTrackerPath.getPath());
354 userTrackerPathImpl.setPathDate(userTrackerPath.getPathDate());
355
356 return userTrackerPathImpl;
357 }
358
359
367 @Override
368 public UserTrackerPath findByPrimaryKey(Serializable primaryKey)
369 throws NoSuchModelException, SystemException {
370 return findByPrimaryKey(((Long)primaryKey).longValue());
371 }
372
373
381 public UserTrackerPath findByPrimaryKey(long userTrackerPathId)
382 throws NoSuchUserTrackerPathException, SystemException {
383 UserTrackerPath userTrackerPath = fetchByPrimaryKey(userTrackerPathId);
384
385 if (userTrackerPath == null) {
386 if (_log.isWarnEnabled()) {
387 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userTrackerPathId);
388 }
389
390 throw new NoSuchUserTrackerPathException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
391 userTrackerPathId);
392 }
393
394 return userTrackerPath;
395 }
396
397
404 @Override
405 public UserTrackerPath fetchByPrimaryKey(Serializable primaryKey)
406 throws SystemException {
407 return fetchByPrimaryKey(((Long)primaryKey).longValue());
408 }
409
410
417 public UserTrackerPath fetchByPrimaryKey(long userTrackerPathId)
418 throws SystemException {
419 UserTrackerPath userTrackerPath = (UserTrackerPath)EntityCacheUtil.getResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
420 UserTrackerPathImpl.class, userTrackerPathId);
421
422 if (userTrackerPath == _nullUserTrackerPath) {
423 return null;
424 }
425
426 if (userTrackerPath == null) {
427 Session session = null;
428
429 boolean hasException = false;
430
431 try {
432 session = openSession();
433
434 userTrackerPath = (UserTrackerPath)session.get(UserTrackerPathImpl.class,
435 Long.valueOf(userTrackerPathId));
436 }
437 catch (Exception e) {
438 hasException = true;
439
440 throw processException(e);
441 }
442 finally {
443 if (userTrackerPath != null) {
444 cacheResult(userTrackerPath);
445 }
446 else if (!hasException) {
447 EntityCacheUtil.putResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
448 UserTrackerPathImpl.class, userTrackerPathId,
449 _nullUserTrackerPath);
450 }
451
452 closeSession(session);
453 }
454 }
455
456 return userTrackerPath;
457 }
458
459
466 public List<UserTrackerPath> findByUserTrackerId(long userTrackerId)
467 throws SystemException {
468 return findByUserTrackerId(userTrackerId, QueryUtil.ALL_POS,
469 QueryUtil.ALL_POS, null);
470 }
471
472
485 public List<UserTrackerPath> findByUserTrackerId(long userTrackerId,
486 int start, int end) throws SystemException {
487 return findByUserTrackerId(userTrackerId, start, end, null);
488 }
489
490
504 public List<UserTrackerPath> findByUserTrackerId(long userTrackerId,
505 int start, int end, OrderByComparator orderByComparator)
506 throws SystemException {
507 FinderPath finderPath = null;
508 Object[] finderArgs = null;
509
510 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
511 (orderByComparator == null)) {
512 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID;
513 finderArgs = new Object[] { userTrackerId };
514 }
515 else {
516 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERTRACKERID;
517 finderArgs = new Object[] {
518 userTrackerId,
519
520 start, end, orderByComparator
521 };
522 }
523
524 List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(finderPath,
525 finderArgs, this);
526
527 if ((list != null) && !list.isEmpty()) {
528 for (UserTrackerPath userTrackerPath : list) {
529 if ((userTrackerId != userTrackerPath.getUserTrackerId())) {
530 list = null;
531
532 break;
533 }
534 }
535 }
536
537 if (list == null) {
538 StringBundler query = null;
539
540 if (orderByComparator != null) {
541 query = new StringBundler(3 +
542 (orderByComparator.getOrderByFields().length * 3));
543 }
544 else {
545 query = new StringBundler(2);
546 }
547
548 query.append(_SQL_SELECT_USERTRACKERPATH_WHERE);
549
550 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
551
552 if (orderByComparator != null) {
553 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
554 orderByComparator);
555 }
556
557 String sql = query.toString();
558
559 Session session = null;
560
561 try {
562 session = openSession();
563
564 Query q = session.createQuery(sql);
565
566 QueryPos qPos = QueryPos.getInstance(q);
567
568 qPos.add(userTrackerId);
569
570 list = (List<UserTrackerPath>)QueryUtil.list(q, getDialect(),
571 start, end);
572 }
573 catch (Exception e) {
574 throw processException(e);
575 }
576 finally {
577 if (list == null) {
578 FinderCacheUtil.removeResult(finderPath, finderArgs);
579 }
580 else {
581 cacheResult(list);
582
583 FinderCacheUtil.putResult(finderPath, finderArgs, list);
584 }
585
586 closeSession(session);
587 }
588 }
589
590 return list;
591 }
592
593
606 public UserTrackerPath findByUserTrackerId_First(long userTrackerId,
607 OrderByComparator orderByComparator)
608 throws NoSuchUserTrackerPathException, SystemException {
609 List<UserTrackerPath> list = findByUserTrackerId(userTrackerId, 0, 1,
610 orderByComparator);
611
612 if (list.isEmpty()) {
613 StringBundler msg = new StringBundler(4);
614
615 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
616
617 msg.append("userTrackerId=");
618 msg.append(userTrackerId);
619
620 msg.append(StringPool.CLOSE_CURLY_BRACE);
621
622 throw new NoSuchUserTrackerPathException(msg.toString());
623 }
624 else {
625 return list.get(0);
626 }
627 }
628
629
642 public UserTrackerPath findByUserTrackerId_Last(long userTrackerId,
643 OrderByComparator orderByComparator)
644 throws NoSuchUserTrackerPathException, SystemException {
645 int count = countByUserTrackerId(userTrackerId);
646
647 List<UserTrackerPath> list = findByUserTrackerId(userTrackerId,
648 count - 1, count, orderByComparator);
649
650 if (list.isEmpty()) {
651 StringBundler msg = new StringBundler(4);
652
653 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
654
655 msg.append("userTrackerId=");
656 msg.append(userTrackerId);
657
658 msg.append(StringPool.CLOSE_CURLY_BRACE);
659
660 throw new NoSuchUserTrackerPathException(msg.toString());
661 }
662 else {
663 return list.get(0);
664 }
665 }
666
667
681 public UserTrackerPath[] findByUserTrackerId_PrevAndNext(
682 long userTrackerPathId, long userTrackerId,
683 OrderByComparator orderByComparator)
684 throws NoSuchUserTrackerPathException, SystemException {
685 UserTrackerPath userTrackerPath = findByPrimaryKey(userTrackerPathId);
686
687 Session session = null;
688
689 try {
690 session = openSession();
691
692 UserTrackerPath[] array = new UserTrackerPathImpl[3];
693
694 array[0] = getByUserTrackerId_PrevAndNext(session, userTrackerPath,
695 userTrackerId, orderByComparator, true);
696
697 array[1] = userTrackerPath;
698
699 array[2] = getByUserTrackerId_PrevAndNext(session, userTrackerPath,
700 userTrackerId, orderByComparator, false);
701
702 return array;
703 }
704 catch (Exception e) {
705 throw processException(e);
706 }
707 finally {
708 closeSession(session);
709 }
710 }
711
712 protected UserTrackerPath getByUserTrackerId_PrevAndNext(Session session,
713 UserTrackerPath userTrackerPath, long userTrackerId,
714 OrderByComparator orderByComparator, boolean previous) {
715 StringBundler query = null;
716
717 if (orderByComparator != null) {
718 query = new StringBundler(6 +
719 (orderByComparator.getOrderByFields().length * 6));
720 }
721 else {
722 query = new StringBundler(3);
723 }
724
725 query.append(_SQL_SELECT_USERTRACKERPATH_WHERE);
726
727 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
728
729 if (orderByComparator != null) {
730 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
731
732 if (orderByConditionFields.length > 0) {
733 query.append(WHERE_AND);
734 }
735
736 for (int i = 0; i < orderByConditionFields.length; i++) {
737 query.append(_ORDER_BY_ENTITY_ALIAS);
738 query.append(orderByConditionFields[i]);
739
740 if ((i + 1) < orderByConditionFields.length) {
741 if (orderByComparator.isAscending() ^ previous) {
742 query.append(WHERE_GREATER_THAN_HAS_NEXT);
743 }
744 else {
745 query.append(WHERE_LESSER_THAN_HAS_NEXT);
746 }
747 }
748 else {
749 if (orderByComparator.isAscending() ^ previous) {
750 query.append(WHERE_GREATER_THAN);
751 }
752 else {
753 query.append(WHERE_LESSER_THAN);
754 }
755 }
756 }
757
758 query.append(ORDER_BY_CLAUSE);
759
760 String[] orderByFields = orderByComparator.getOrderByFields();
761
762 for (int i = 0; i < orderByFields.length; i++) {
763 query.append(_ORDER_BY_ENTITY_ALIAS);
764 query.append(orderByFields[i]);
765
766 if ((i + 1) < orderByFields.length) {
767 if (orderByComparator.isAscending() ^ previous) {
768 query.append(ORDER_BY_ASC_HAS_NEXT);
769 }
770 else {
771 query.append(ORDER_BY_DESC_HAS_NEXT);
772 }
773 }
774 else {
775 if (orderByComparator.isAscending() ^ previous) {
776 query.append(ORDER_BY_ASC);
777 }
778 else {
779 query.append(ORDER_BY_DESC);
780 }
781 }
782 }
783 }
784
785 String sql = query.toString();
786
787 Query q = session.createQuery(sql);
788
789 q.setFirstResult(0);
790 q.setMaxResults(2);
791
792 QueryPos qPos = QueryPos.getInstance(q);
793
794 qPos.add(userTrackerId);
795
796 if (orderByComparator != null) {
797 Object[] values = orderByComparator.getOrderByConditionValues(userTrackerPath);
798
799 for (Object value : values) {
800 qPos.add(value);
801 }
802 }
803
804 List<UserTrackerPath> list = q.list();
805
806 if (list.size() == 2) {
807 return list.get(1);
808 }
809 else {
810 return null;
811 }
812 }
813
814
820 public List<UserTrackerPath> findAll() throws SystemException {
821 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
822 }
823
824
836 public List<UserTrackerPath> findAll(int start, int end)
837 throws SystemException {
838 return findAll(start, end, null);
839 }
840
841
854 public List<UserTrackerPath> findAll(int start, int end,
855 OrderByComparator orderByComparator) throws SystemException {
856 FinderPath finderPath = null;
857 Object[] finderArgs = new Object[] { start, end, orderByComparator };
858
859 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
860 (orderByComparator == null)) {
861 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
862 finderArgs = FINDER_ARGS_EMPTY;
863 }
864 else {
865 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
866 finderArgs = new Object[] { start, end, orderByComparator };
867 }
868
869 List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(finderPath,
870 finderArgs, this);
871
872 if (list == null) {
873 StringBundler query = null;
874 String sql = null;
875
876 if (orderByComparator != null) {
877 query = new StringBundler(2 +
878 (orderByComparator.getOrderByFields().length * 3));
879
880 query.append(_SQL_SELECT_USERTRACKERPATH);
881
882 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
883 orderByComparator);
884
885 sql = query.toString();
886 }
887 else {
888 sql = _SQL_SELECT_USERTRACKERPATH;
889 }
890
891 Session session = null;
892
893 try {
894 session = openSession();
895
896 Query q = session.createQuery(sql);
897
898 if (orderByComparator == null) {
899 list = (List<UserTrackerPath>)QueryUtil.list(q,
900 getDialect(), start, end, false);
901
902 Collections.sort(list);
903 }
904 else {
905 list = (List<UserTrackerPath>)QueryUtil.list(q,
906 getDialect(), start, end);
907 }
908 }
909 catch (Exception e) {
910 throw processException(e);
911 }
912 finally {
913 if (list == null) {
914 FinderCacheUtil.removeResult(finderPath, finderArgs);
915 }
916 else {
917 cacheResult(list);
918
919 FinderCacheUtil.putResult(finderPath, finderArgs, list);
920 }
921
922 closeSession(session);
923 }
924 }
925
926 return list;
927 }
928
929
935 public void removeByUserTrackerId(long userTrackerId)
936 throws SystemException {
937 for (UserTrackerPath userTrackerPath : findByUserTrackerId(
938 userTrackerId)) {
939 remove(userTrackerPath);
940 }
941 }
942
943
948 public void removeAll() throws SystemException {
949 for (UserTrackerPath userTrackerPath : findAll()) {
950 remove(userTrackerPath);
951 }
952 }
953
954
961 public int countByUserTrackerId(long userTrackerId)
962 throws SystemException {
963 Object[] finderArgs = new Object[] { userTrackerId };
964
965 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
966 finderArgs, this);
967
968 if (count == null) {
969 StringBundler query = new StringBundler(2);
970
971 query.append(_SQL_COUNT_USERTRACKERPATH_WHERE);
972
973 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
974
975 String sql = query.toString();
976
977 Session session = null;
978
979 try {
980 session = openSession();
981
982 Query q = session.createQuery(sql);
983
984 QueryPos qPos = QueryPos.getInstance(q);
985
986 qPos.add(userTrackerId);
987
988 count = (Long)q.uniqueResult();
989 }
990 catch (Exception e) {
991 throw processException(e);
992 }
993 finally {
994 if (count == null) {
995 count = Long.valueOf(0);
996 }
997
998 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
999 finderArgs, count);
1000
1001 closeSession(session);
1002 }
1003 }
1004
1005 return count.intValue();
1006 }
1007
1008
1014 public int countAll() throws SystemException {
1015 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1016 FINDER_ARGS_EMPTY, this);
1017
1018 if (count == null) {
1019 Session session = null;
1020
1021 try {
1022 session = openSession();
1023
1024 Query q = session.createQuery(_SQL_COUNT_USERTRACKERPATH);
1025
1026 count = (Long)q.uniqueResult();
1027 }
1028 catch (Exception e) {
1029 throw processException(e);
1030 }
1031 finally {
1032 if (count == null) {
1033 count = Long.valueOf(0);
1034 }
1035
1036 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1037 FINDER_ARGS_EMPTY, count);
1038
1039 closeSession(session);
1040 }
1041 }
1042
1043 return count.intValue();
1044 }
1045
1046
1049 public void afterPropertiesSet() {
1050 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1051 com.liferay.portal.util.PropsUtil.get(
1052 "value.object.listener.com.liferay.portal.model.UserTrackerPath")));
1053
1054 if (listenerClassNames.length > 0) {
1055 try {
1056 List<ModelListener<UserTrackerPath>> listenersList = new ArrayList<ModelListener<UserTrackerPath>>();
1057
1058 for (String listenerClassName : listenerClassNames) {
1059 listenersList.add((ModelListener<UserTrackerPath>)InstanceFactory.newInstance(
1060 listenerClassName));
1061 }
1062
1063 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1064 }
1065 catch (Exception e) {
1066 _log.error(e);
1067 }
1068 }
1069 }
1070
1071 public void destroy() {
1072 EntityCacheUtil.removeCache(UserTrackerPathImpl.class.getName());
1073 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1074 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1075 }
1076
1077 @BeanReference(type = AccountPersistence.class)
1078 protected AccountPersistence accountPersistence;
1079 @BeanReference(type = AddressPersistence.class)
1080 protected AddressPersistence addressPersistence;
1081 @BeanReference(type = BrowserTrackerPersistence.class)
1082 protected BrowserTrackerPersistence browserTrackerPersistence;
1083 @BeanReference(type = ClassNamePersistence.class)
1084 protected ClassNamePersistence classNamePersistence;
1085 @BeanReference(type = ClusterGroupPersistence.class)
1086 protected ClusterGroupPersistence clusterGroupPersistence;
1087 @BeanReference(type = CompanyPersistence.class)
1088 protected CompanyPersistence companyPersistence;
1089 @BeanReference(type = ContactPersistence.class)
1090 protected ContactPersistence contactPersistence;
1091 @BeanReference(type = CountryPersistence.class)
1092 protected CountryPersistence countryPersistence;
1093 @BeanReference(type = EmailAddressPersistence.class)
1094 protected EmailAddressPersistence emailAddressPersistence;
1095 @BeanReference(type = GroupPersistence.class)
1096 protected GroupPersistence groupPersistence;
1097 @BeanReference(type = ImagePersistence.class)
1098 protected ImagePersistence imagePersistence;
1099 @BeanReference(type = LayoutPersistence.class)
1100 protected LayoutPersistence layoutPersistence;
1101 @BeanReference(type = LayoutBranchPersistence.class)
1102 protected LayoutBranchPersistence layoutBranchPersistence;
1103 @BeanReference(type = LayoutPrototypePersistence.class)
1104 protected LayoutPrototypePersistence layoutPrototypePersistence;
1105 @BeanReference(type = LayoutRevisionPersistence.class)
1106 protected LayoutRevisionPersistence layoutRevisionPersistence;
1107 @BeanReference(type = LayoutSetPersistence.class)
1108 protected LayoutSetPersistence layoutSetPersistence;
1109 @BeanReference(type = LayoutSetBranchPersistence.class)
1110 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1111 @BeanReference(type = LayoutSetPrototypePersistence.class)
1112 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1113 @BeanReference(type = ListTypePersistence.class)
1114 protected ListTypePersistence listTypePersistence;
1115 @BeanReference(type = LockPersistence.class)
1116 protected LockPersistence lockPersistence;
1117 @BeanReference(type = MembershipRequestPersistence.class)
1118 protected MembershipRequestPersistence membershipRequestPersistence;
1119 @BeanReference(type = OrganizationPersistence.class)
1120 protected OrganizationPersistence organizationPersistence;
1121 @BeanReference(type = OrgGroupPermissionPersistence.class)
1122 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1123 @BeanReference(type = OrgGroupRolePersistence.class)
1124 protected OrgGroupRolePersistence orgGroupRolePersistence;
1125 @BeanReference(type = OrgLaborPersistence.class)
1126 protected OrgLaborPersistence orgLaborPersistence;
1127 @BeanReference(type = PasswordPolicyPersistence.class)
1128 protected PasswordPolicyPersistence passwordPolicyPersistence;
1129 @BeanReference(type = PasswordPolicyRelPersistence.class)
1130 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1131 @BeanReference(type = PasswordTrackerPersistence.class)
1132 protected PasswordTrackerPersistence passwordTrackerPersistence;
1133 @BeanReference(type = PermissionPersistence.class)
1134 protected PermissionPersistence permissionPersistence;
1135 @BeanReference(type = PhonePersistence.class)
1136 protected PhonePersistence phonePersistence;
1137 @BeanReference(type = PluginSettingPersistence.class)
1138 protected PluginSettingPersistence pluginSettingPersistence;
1139 @BeanReference(type = PortalPreferencesPersistence.class)
1140 protected PortalPreferencesPersistence portalPreferencesPersistence;
1141 @BeanReference(type = PortletPersistence.class)
1142 protected PortletPersistence portletPersistence;
1143 @BeanReference(type = PortletItemPersistence.class)
1144 protected PortletItemPersistence portletItemPersistence;
1145 @BeanReference(type = PortletPreferencesPersistence.class)
1146 protected PortletPreferencesPersistence portletPreferencesPersistence;
1147 @BeanReference(type = RegionPersistence.class)
1148 protected RegionPersistence regionPersistence;
1149 @BeanReference(type = ReleasePersistence.class)
1150 protected ReleasePersistence releasePersistence;
1151 @BeanReference(type = RepositoryPersistence.class)
1152 protected RepositoryPersistence repositoryPersistence;
1153 @BeanReference(type = RepositoryEntryPersistence.class)
1154 protected RepositoryEntryPersistence repositoryEntryPersistence;
1155 @BeanReference(type = ResourcePersistence.class)
1156 protected ResourcePersistence resourcePersistence;
1157 @BeanReference(type = ResourceActionPersistence.class)
1158 protected ResourceActionPersistence resourceActionPersistence;
1159 @BeanReference(type = ResourceBlockPersistence.class)
1160 protected ResourceBlockPersistence resourceBlockPersistence;
1161 @BeanReference(type = ResourceBlockPermissionPersistence.class)
1162 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1163 @BeanReference(type = ResourceCodePersistence.class)
1164 protected ResourceCodePersistence resourceCodePersistence;
1165 @BeanReference(type = ResourcePermissionPersistence.class)
1166 protected ResourcePermissionPersistence resourcePermissionPersistence;
1167 @BeanReference(type = ResourceTypePermissionPersistence.class)
1168 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1169 @BeanReference(type = RolePersistence.class)
1170 protected RolePersistence rolePersistence;
1171 @BeanReference(type = ServiceComponentPersistence.class)
1172 protected ServiceComponentPersistence serviceComponentPersistence;
1173 @BeanReference(type = ShardPersistence.class)
1174 protected ShardPersistence shardPersistence;
1175 @BeanReference(type = SubscriptionPersistence.class)
1176 protected SubscriptionPersistence subscriptionPersistence;
1177 @BeanReference(type = TeamPersistence.class)
1178 protected TeamPersistence teamPersistence;
1179 @BeanReference(type = TicketPersistence.class)
1180 protected TicketPersistence ticketPersistence;
1181 @BeanReference(type = UserPersistence.class)
1182 protected UserPersistence userPersistence;
1183 @BeanReference(type = UserGroupPersistence.class)
1184 protected UserGroupPersistence userGroupPersistence;
1185 @BeanReference(type = UserGroupGroupRolePersistence.class)
1186 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1187 @BeanReference(type = UserGroupRolePersistence.class)
1188 protected UserGroupRolePersistence userGroupRolePersistence;
1189 @BeanReference(type = UserIdMapperPersistence.class)
1190 protected UserIdMapperPersistence userIdMapperPersistence;
1191 @BeanReference(type = UserNotificationEventPersistence.class)
1192 protected UserNotificationEventPersistence userNotificationEventPersistence;
1193 @BeanReference(type = UserTrackerPersistence.class)
1194 protected UserTrackerPersistence userTrackerPersistence;
1195 @BeanReference(type = UserTrackerPathPersistence.class)
1196 protected UserTrackerPathPersistence userTrackerPathPersistence;
1197 @BeanReference(type = VirtualHostPersistence.class)
1198 protected VirtualHostPersistence virtualHostPersistence;
1199 @BeanReference(type = WebDAVPropsPersistence.class)
1200 protected WebDAVPropsPersistence webDAVPropsPersistence;
1201 @BeanReference(type = WebsitePersistence.class)
1202 protected WebsitePersistence websitePersistence;
1203 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1204 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1205 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1206 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1207 private static final String _SQL_SELECT_USERTRACKERPATH = "SELECT userTrackerPath FROM UserTrackerPath userTrackerPath";
1208 private static final String _SQL_SELECT_USERTRACKERPATH_WHERE = "SELECT userTrackerPath FROM UserTrackerPath userTrackerPath WHERE ";
1209 private static final String _SQL_COUNT_USERTRACKERPATH = "SELECT COUNT(userTrackerPath) FROM UserTrackerPath userTrackerPath";
1210 private static final String _SQL_COUNT_USERTRACKERPATH_WHERE = "SELECT COUNT(userTrackerPath) FROM UserTrackerPath userTrackerPath WHERE ";
1211 private static final String _FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2 = "userTrackerPath.userTrackerId = ?";
1212 private static final String _ORDER_BY_ENTITY_ALIAS = "userTrackerPath.";
1213 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserTrackerPath exists with the primary key ";
1214 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserTrackerPath exists with the key {";
1215 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1216 private static Log _log = LogFactoryUtil.getLog(UserTrackerPathPersistenceImpl.class);
1217 private static UserTrackerPath _nullUserTrackerPath = new UserTrackerPathImpl() {
1218 @Override
1219 public Object clone() {
1220 return this;
1221 }
1222
1223 @Override
1224 public CacheModel<UserTrackerPath> toCacheModel() {
1225 return _nullUserTrackerPathCacheModel;
1226 }
1227 };
1228
1229 private static CacheModel<UserTrackerPath> _nullUserTrackerPathCacheModel = new CacheModel<UserTrackerPath>() {
1230 public UserTrackerPath toEntityModel() {
1231 return _nullUserTrackerPath;
1232 }
1233 };
1234 }