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 @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
312 else {
313 if ((userTrackerPathModelImpl.getColumnBitmask() &
314 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID.getColumnBitmask()) != 0) {
315 Object[] args = new Object[] {
316 Long.valueOf(userTrackerPathModelImpl.getOriginalUserTrackerId())
317 };
318
319 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
320 args);
321 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID,
322 args);
323
324 args = new Object[] {
325 Long.valueOf(userTrackerPathModelImpl.getUserTrackerId())
326 };
327
328 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
329 args);
330 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID,
331 args);
332 }
333 }
334
335 EntityCacheUtil.putResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
336 UserTrackerPathImpl.class, userTrackerPath.getPrimaryKey(),
337 userTrackerPath);
338
339 return userTrackerPath;
340 }
341
342 protected UserTrackerPath toUnwrappedModel(UserTrackerPath userTrackerPath) {
343 if (userTrackerPath instanceof UserTrackerPathImpl) {
344 return userTrackerPath;
345 }
346
347 UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
348
349 userTrackerPathImpl.setNew(userTrackerPath.isNew());
350 userTrackerPathImpl.setPrimaryKey(userTrackerPath.getPrimaryKey());
351
352 userTrackerPathImpl.setUserTrackerPathId(userTrackerPath.getUserTrackerPathId());
353 userTrackerPathImpl.setUserTrackerId(userTrackerPath.getUserTrackerId());
354 userTrackerPathImpl.setPath(userTrackerPath.getPath());
355 userTrackerPathImpl.setPathDate(userTrackerPath.getPathDate());
356
357 return userTrackerPathImpl;
358 }
359
360
368 @Override
369 public UserTrackerPath findByPrimaryKey(Serializable primaryKey)
370 throws NoSuchModelException, SystemException {
371 return findByPrimaryKey(((Long)primaryKey).longValue());
372 }
373
374
382 public UserTrackerPath findByPrimaryKey(long userTrackerPathId)
383 throws NoSuchUserTrackerPathException, SystemException {
384 UserTrackerPath userTrackerPath = fetchByPrimaryKey(userTrackerPathId);
385
386 if (userTrackerPath == null) {
387 if (_log.isWarnEnabled()) {
388 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userTrackerPathId);
389 }
390
391 throw new NoSuchUserTrackerPathException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
392 userTrackerPathId);
393 }
394
395 return userTrackerPath;
396 }
397
398
405 @Override
406 public UserTrackerPath fetchByPrimaryKey(Serializable primaryKey)
407 throws SystemException {
408 return fetchByPrimaryKey(((Long)primaryKey).longValue());
409 }
410
411
418 public UserTrackerPath fetchByPrimaryKey(long userTrackerPathId)
419 throws SystemException {
420 UserTrackerPath userTrackerPath = (UserTrackerPath)EntityCacheUtil.getResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
421 UserTrackerPathImpl.class, userTrackerPathId);
422
423 if (userTrackerPath == _nullUserTrackerPath) {
424 return null;
425 }
426
427 if (userTrackerPath == null) {
428 Session session = null;
429
430 boolean hasException = false;
431
432 try {
433 session = openSession();
434
435 userTrackerPath = (UserTrackerPath)session.get(UserTrackerPathImpl.class,
436 Long.valueOf(userTrackerPathId));
437 }
438 catch (Exception e) {
439 hasException = true;
440
441 throw processException(e);
442 }
443 finally {
444 if (userTrackerPath != null) {
445 cacheResult(userTrackerPath);
446 }
447 else if (!hasException) {
448 EntityCacheUtil.putResult(UserTrackerPathModelImpl.ENTITY_CACHE_ENABLED,
449 UserTrackerPathImpl.class, userTrackerPathId,
450 _nullUserTrackerPath);
451 }
452
453 closeSession(session);
454 }
455 }
456
457 return userTrackerPath;
458 }
459
460
467 public List<UserTrackerPath> findByUserTrackerId(long userTrackerId)
468 throws SystemException {
469 return findByUserTrackerId(userTrackerId, QueryUtil.ALL_POS,
470 QueryUtil.ALL_POS, null);
471 }
472
473
486 public List<UserTrackerPath> findByUserTrackerId(long userTrackerId,
487 int start, int end) throws SystemException {
488 return findByUserTrackerId(userTrackerId, start, end, null);
489 }
490
491
505 public List<UserTrackerPath> findByUserTrackerId(long userTrackerId,
506 int start, int end, OrderByComparator orderByComparator)
507 throws SystemException {
508 FinderPath finderPath = null;
509 Object[] finderArgs = null;
510
511 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
512 (orderByComparator == null)) {
513 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERTRACKERID;
514 finderArgs = new Object[] { userTrackerId };
515 }
516 else {
517 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERTRACKERID;
518 finderArgs = new Object[] {
519 userTrackerId,
520
521 start, end, orderByComparator
522 };
523 }
524
525 List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(finderPath,
526 finderArgs, this);
527
528 if (list == null) {
529 StringBundler query = null;
530
531 if (orderByComparator != null) {
532 query = new StringBundler(3 +
533 (orderByComparator.getOrderByFields().length * 3));
534 }
535 else {
536 query = new StringBundler(2);
537 }
538
539 query.append(_SQL_SELECT_USERTRACKERPATH_WHERE);
540
541 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
542
543 if (orderByComparator != null) {
544 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
545 orderByComparator);
546 }
547
548 String sql = query.toString();
549
550 Session session = null;
551
552 try {
553 session = openSession();
554
555 Query q = session.createQuery(sql);
556
557 QueryPos qPos = QueryPos.getInstance(q);
558
559 qPos.add(userTrackerId);
560
561 list = (List<UserTrackerPath>)QueryUtil.list(q, getDialect(),
562 start, end);
563 }
564 catch (Exception e) {
565 throw processException(e);
566 }
567 finally {
568 if (list == null) {
569 FinderCacheUtil.removeResult(finderPath, finderArgs);
570 }
571 else {
572 cacheResult(list);
573
574 FinderCacheUtil.putResult(finderPath, finderArgs, list);
575 }
576
577 closeSession(session);
578 }
579 }
580
581 return list;
582 }
583
584
597 public UserTrackerPath findByUserTrackerId_First(long userTrackerId,
598 OrderByComparator orderByComparator)
599 throws NoSuchUserTrackerPathException, SystemException {
600 List<UserTrackerPath> list = findByUserTrackerId(userTrackerId, 0, 1,
601 orderByComparator);
602
603 if (list.isEmpty()) {
604 StringBundler msg = new StringBundler(4);
605
606 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
607
608 msg.append("userTrackerId=");
609 msg.append(userTrackerId);
610
611 msg.append(StringPool.CLOSE_CURLY_BRACE);
612
613 throw new NoSuchUserTrackerPathException(msg.toString());
614 }
615 else {
616 return list.get(0);
617 }
618 }
619
620
633 public UserTrackerPath findByUserTrackerId_Last(long userTrackerId,
634 OrderByComparator orderByComparator)
635 throws NoSuchUserTrackerPathException, SystemException {
636 int count = countByUserTrackerId(userTrackerId);
637
638 List<UserTrackerPath> list = findByUserTrackerId(userTrackerId,
639 count - 1, count, orderByComparator);
640
641 if (list.isEmpty()) {
642 StringBundler msg = new StringBundler(4);
643
644 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
645
646 msg.append("userTrackerId=");
647 msg.append(userTrackerId);
648
649 msg.append(StringPool.CLOSE_CURLY_BRACE);
650
651 throw new NoSuchUserTrackerPathException(msg.toString());
652 }
653 else {
654 return list.get(0);
655 }
656 }
657
658
672 public UserTrackerPath[] findByUserTrackerId_PrevAndNext(
673 long userTrackerPathId, long userTrackerId,
674 OrderByComparator orderByComparator)
675 throws NoSuchUserTrackerPathException, SystemException {
676 UserTrackerPath userTrackerPath = findByPrimaryKey(userTrackerPathId);
677
678 Session session = null;
679
680 try {
681 session = openSession();
682
683 UserTrackerPath[] array = new UserTrackerPathImpl[3];
684
685 array[0] = getByUserTrackerId_PrevAndNext(session, userTrackerPath,
686 userTrackerId, orderByComparator, true);
687
688 array[1] = userTrackerPath;
689
690 array[2] = getByUserTrackerId_PrevAndNext(session, userTrackerPath,
691 userTrackerId, orderByComparator, false);
692
693 return array;
694 }
695 catch (Exception e) {
696 throw processException(e);
697 }
698 finally {
699 closeSession(session);
700 }
701 }
702
703 protected UserTrackerPath getByUserTrackerId_PrevAndNext(Session session,
704 UserTrackerPath userTrackerPath, long userTrackerId,
705 OrderByComparator orderByComparator, boolean previous) {
706 StringBundler query = null;
707
708 if (orderByComparator != null) {
709 query = new StringBundler(6 +
710 (orderByComparator.getOrderByFields().length * 6));
711 }
712 else {
713 query = new StringBundler(3);
714 }
715
716 query.append(_SQL_SELECT_USERTRACKERPATH_WHERE);
717
718 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
719
720 if (orderByComparator != null) {
721 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
722
723 if (orderByConditionFields.length > 0) {
724 query.append(WHERE_AND);
725 }
726
727 for (int i = 0; i < orderByConditionFields.length; i++) {
728 query.append(_ORDER_BY_ENTITY_ALIAS);
729 query.append(orderByConditionFields[i]);
730
731 if ((i + 1) < orderByConditionFields.length) {
732 if (orderByComparator.isAscending() ^ previous) {
733 query.append(WHERE_GREATER_THAN_HAS_NEXT);
734 }
735 else {
736 query.append(WHERE_LESSER_THAN_HAS_NEXT);
737 }
738 }
739 else {
740 if (orderByComparator.isAscending() ^ previous) {
741 query.append(WHERE_GREATER_THAN);
742 }
743 else {
744 query.append(WHERE_LESSER_THAN);
745 }
746 }
747 }
748
749 query.append(ORDER_BY_CLAUSE);
750
751 String[] orderByFields = orderByComparator.getOrderByFields();
752
753 for (int i = 0; i < orderByFields.length; i++) {
754 query.append(_ORDER_BY_ENTITY_ALIAS);
755 query.append(orderByFields[i]);
756
757 if ((i + 1) < orderByFields.length) {
758 if (orderByComparator.isAscending() ^ previous) {
759 query.append(ORDER_BY_ASC_HAS_NEXT);
760 }
761 else {
762 query.append(ORDER_BY_DESC_HAS_NEXT);
763 }
764 }
765 else {
766 if (orderByComparator.isAscending() ^ previous) {
767 query.append(ORDER_BY_ASC);
768 }
769 else {
770 query.append(ORDER_BY_DESC);
771 }
772 }
773 }
774 }
775
776 String sql = query.toString();
777
778 Query q = session.createQuery(sql);
779
780 q.setFirstResult(0);
781 q.setMaxResults(2);
782
783 QueryPos qPos = QueryPos.getInstance(q);
784
785 qPos.add(userTrackerId);
786
787 if (orderByComparator != null) {
788 Object[] values = orderByComparator.getOrderByConditionValues(userTrackerPath);
789
790 for (Object value : values) {
791 qPos.add(value);
792 }
793 }
794
795 List<UserTrackerPath> list = q.list();
796
797 if (list.size() == 2) {
798 return list.get(1);
799 }
800 else {
801 return null;
802 }
803 }
804
805
811 public List<UserTrackerPath> findAll() throws SystemException {
812 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
813 }
814
815
827 public List<UserTrackerPath> findAll(int start, int end)
828 throws SystemException {
829 return findAll(start, end, null);
830 }
831
832
845 public List<UserTrackerPath> findAll(int start, int end,
846 OrderByComparator orderByComparator) throws SystemException {
847 FinderPath finderPath = null;
848 Object[] finderArgs = new Object[] { start, end, orderByComparator };
849
850 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
851 (orderByComparator == null)) {
852 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
853 finderArgs = FINDER_ARGS_EMPTY;
854 }
855 else {
856 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
857 finderArgs = new Object[] { start, end, orderByComparator };
858 }
859
860 List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(finderPath,
861 finderArgs, this);
862
863 if (list == null) {
864 StringBundler query = null;
865 String sql = null;
866
867 if (orderByComparator != null) {
868 query = new StringBundler(2 +
869 (orderByComparator.getOrderByFields().length * 3));
870
871 query.append(_SQL_SELECT_USERTRACKERPATH);
872
873 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
874 orderByComparator);
875
876 sql = query.toString();
877 }
878 else {
879 sql = _SQL_SELECT_USERTRACKERPATH;
880 }
881
882 Session session = null;
883
884 try {
885 session = openSession();
886
887 Query q = session.createQuery(sql);
888
889 if (orderByComparator == null) {
890 list = (List<UserTrackerPath>)QueryUtil.list(q,
891 getDialect(), start, end, false);
892
893 Collections.sort(list);
894 }
895 else {
896 list = (List<UserTrackerPath>)QueryUtil.list(q,
897 getDialect(), start, end);
898 }
899 }
900 catch (Exception e) {
901 throw processException(e);
902 }
903 finally {
904 if (list == null) {
905 FinderCacheUtil.removeResult(finderPath, finderArgs);
906 }
907 else {
908 cacheResult(list);
909
910 FinderCacheUtil.putResult(finderPath, finderArgs, list);
911 }
912
913 closeSession(session);
914 }
915 }
916
917 return list;
918 }
919
920
926 public void removeByUserTrackerId(long userTrackerId)
927 throws SystemException {
928 for (UserTrackerPath userTrackerPath : findByUserTrackerId(
929 userTrackerId)) {
930 remove(userTrackerPath);
931 }
932 }
933
934
939 public void removeAll() throws SystemException {
940 for (UserTrackerPath userTrackerPath : findAll()) {
941 remove(userTrackerPath);
942 }
943 }
944
945
952 public int countByUserTrackerId(long userTrackerId)
953 throws SystemException {
954 Object[] finderArgs = new Object[] { userTrackerId };
955
956 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
957 finderArgs, this);
958
959 if (count == null) {
960 StringBundler query = new StringBundler(2);
961
962 query.append(_SQL_COUNT_USERTRACKERPATH_WHERE);
963
964 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
965
966 String sql = query.toString();
967
968 Session session = null;
969
970 try {
971 session = openSession();
972
973 Query q = session.createQuery(sql);
974
975 QueryPos qPos = QueryPos.getInstance(q);
976
977 qPos.add(userTrackerId);
978
979 count = (Long)q.uniqueResult();
980 }
981 catch (Exception e) {
982 throw processException(e);
983 }
984 finally {
985 if (count == null) {
986 count = Long.valueOf(0);
987 }
988
989 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
990 finderArgs, count);
991
992 closeSession(session);
993 }
994 }
995
996 return count.intValue();
997 }
998
999
1005 public int countAll() throws SystemException {
1006 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1007 FINDER_ARGS_EMPTY, this);
1008
1009 if (count == null) {
1010 Session session = null;
1011
1012 try {
1013 session = openSession();
1014
1015 Query q = session.createQuery(_SQL_COUNT_USERTRACKERPATH);
1016
1017 count = (Long)q.uniqueResult();
1018 }
1019 catch (Exception e) {
1020 throw processException(e);
1021 }
1022 finally {
1023 if (count == null) {
1024 count = Long.valueOf(0);
1025 }
1026
1027 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1028 FINDER_ARGS_EMPTY, count);
1029
1030 closeSession(session);
1031 }
1032 }
1033
1034 return count.intValue();
1035 }
1036
1037
1040 public void afterPropertiesSet() {
1041 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1042 com.liferay.portal.util.PropsUtil.get(
1043 "value.object.listener.com.liferay.portal.model.UserTrackerPath")));
1044
1045 if (listenerClassNames.length > 0) {
1046 try {
1047 List<ModelListener<UserTrackerPath>> listenersList = new ArrayList<ModelListener<UserTrackerPath>>();
1048
1049 for (String listenerClassName : listenerClassNames) {
1050 listenersList.add((ModelListener<UserTrackerPath>)InstanceFactory.newInstance(
1051 listenerClassName));
1052 }
1053
1054 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1055 }
1056 catch (Exception e) {
1057 _log.error(e);
1058 }
1059 }
1060 }
1061
1062 public void destroy() {
1063 EntityCacheUtil.removeCache(UserTrackerPathImpl.class.getName());
1064 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1065 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1066 }
1067
1068 @BeanReference(type = AccountPersistence.class)
1069 protected AccountPersistence accountPersistence;
1070 @BeanReference(type = AddressPersistence.class)
1071 protected AddressPersistence addressPersistence;
1072 @BeanReference(type = BrowserTrackerPersistence.class)
1073 protected BrowserTrackerPersistence browserTrackerPersistence;
1074 @BeanReference(type = ClassNamePersistence.class)
1075 protected ClassNamePersistence classNamePersistence;
1076 @BeanReference(type = ClusterGroupPersistence.class)
1077 protected ClusterGroupPersistence clusterGroupPersistence;
1078 @BeanReference(type = CompanyPersistence.class)
1079 protected CompanyPersistence companyPersistence;
1080 @BeanReference(type = ContactPersistence.class)
1081 protected ContactPersistence contactPersistence;
1082 @BeanReference(type = CountryPersistence.class)
1083 protected CountryPersistence countryPersistence;
1084 @BeanReference(type = EmailAddressPersistence.class)
1085 protected EmailAddressPersistence emailAddressPersistence;
1086 @BeanReference(type = GroupPersistence.class)
1087 protected GroupPersistence groupPersistence;
1088 @BeanReference(type = ImagePersistence.class)
1089 protected ImagePersistence imagePersistence;
1090 @BeanReference(type = LayoutPersistence.class)
1091 protected LayoutPersistence layoutPersistence;
1092 @BeanReference(type = LayoutBranchPersistence.class)
1093 protected LayoutBranchPersistence layoutBranchPersistence;
1094 @BeanReference(type = LayoutPrototypePersistence.class)
1095 protected LayoutPrototypePersistence layoutPrototypePersistence;
1096 @BeanReference(type = LayoutRevisionPersistence.class)
1097 protected LayoutRevisionPersistence layoutRevisionPersistence;
1098 @BeanReference(type = LayoutSetPersistence.class)
1099 protected LayoutSetPersistence layoutSetPersistence;
1100 @BeanReference(type = LayoutSetBranchPersistence.class)
1101 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1102 @BeanReference(type = LayoutSetPrototypePersistence.class)
1103 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1104 @BeanReference(type = ListTypePersistence.class)
1105 protected ListTypePersistence listTypePersistence;
1106 @BeanReference(type = LockPersistence.class)
1107 protected LockPersistence lockPersistence;
1108 @BeanReference(type = MembershipRequestPersistence.class)
1109 protected MembershipRequestPersistence membershipRequestPersistence;
1110 @BeanReference(type = OrganizationPersistence.class)
1111 protected OrganizationPersistence organizationPersistence;
1112 @BeanReference(type = OrgGroupPermissionPersistence.class)
1113 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1114 @BeanReference(type = OrgGroupRolePersistence.class)
1115 protected OrgGroupRolePersistence orgGroupRolePersistence;
1116 @BeanReference(type = OrgLaborPersistence.class)
1117 protected OrgLaborPersistence orgLaborPersistence;
1118 @BeanReference(type = PasswordPolicyPersistence.class)
1119 protected PasswordPolicyPersistence passwordPolicyPersistence;
1120 @BeanReference(type = PasswordPolicyRelPersistence.class)
1121 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1122 @BeanReference(type = PasswordTrackerPersistence.class)
1123 protected PasswordTrackerPersistence passwordTrackerPersistence;
1124 @BeanReference(type = PermissionPersistence.class)
1125 protected PermissionPersistence permissionPersistence;
1126 @BeanReference(type = PhonePersistence.class)
1127 protected PhonePersistence phonePersistence;
1128 @BeanReference(type = PluginSettingPersistence.class)
1129 protected PluginSettingPersistence pluginSettingPersistence;
1130 @BeanReference(type = PortalPreferencesPersistence.class)
1131 protected PortalPreferencesPersistence portalPreferencesPersistence;
1132 @BeanReference(type = PortletPersistence.class)
1133 protected PortletPersistence portletPersistence;
1134 @BeanReference(type = PortletItemPersistence.class)
1135 protected PortletItemPersistence portletItemPersistence;
1136 @BeanReference(type = PortletPreferencesPersistence.class)
1137 protected PortletPreferencesPersistence portletPreferencesPersistence;
1138 @BeanReference(type = RegionPersistence.class)
1139 protected RegionPersistence regionPersistence;
1140 @BeanReference(type = ReleasePersistence.class)
1141 protected ReleasePersistence releasePersistence;
1142 @BeanReference(type = RepositoryPersistence.class)
1143 protected RepositoryPersistence repositoryPersistence;
1144 @BeanReference(type = RepositoryEntryPersistence.class)
1145 protected RepositoryEntryPersistence repositoryEntryPersistence;
1146 @BeanReference(type = ResourcePersistence.class)
1147 protected ResourcePersistence resourcePersistence;
1148 @BeanReference(type = ResourceActionPersistence.class)
1149 protected ResourceActionPersistence resourceActionPersistence;
1150 @BeanReference(type = ResourceBlockPersistence.class)
1151 protected ResourceBlockPersistence resourceBlockPersistence;
1152 @BeanReference(type = ResourceBlockPermissionPersistence.class)
1153 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1154 @BeanReference(type = ResourceCodePersistence.class)
1155 protected ResourceCodePersistence resourceCodePersistence;
1156 @BeanReference(type = ResourcePermissionPersistence.class)
1157 protected ResourcePermissionPersistence resourcePermissionPersistence;
1158 @BeanReference(type = ResourceTypePermissionPersistence.class)
1159 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1160 @BeanReference(type = RolePersistence.class)
1161 protected RolePersistence rolePersistence;
1162 @BeanReference(type = ServiceComponentPersistence.class)
1163 protected ServiceComponentPersistence serviceComponentPersistence;
1164 @BeanReference(type = ShardPersistence.class)
1165 protected ShardPersistence shardPersistence;
1166 @BeanReference(type = SubscriptionPersistence.class)
1167 protected SubscriptionPersistence subscriptionPersistence;
1168 @BeanReference(type = TeamPersistence.class)
1169 protected TeamPersistence teamPersistence;
1170 @BeanReference(type = TicketPersistence.class)
1171 protected TicketPersistence ticketPersistence;
1172 @BeanReference(type = UserPersistence.class)
1173 protected UserPersistence userPersistence;
1174 @BeanReference(type = UserGroupPersistence.class)
1175 protected UserGroupPersistence userGroupPersistence;
1176 @BeanReference(type = UserGroupGroupRolePersistence.class)
1177 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1178 @BeanReference(type = UserGroupRolePersistence.class)
1179 protected UserGroupRolePersistence userGroupRolePersistence;
1180 @BeanReference(type = UserIdMapperPersistence.class)
1181 protected UserIdMapperPersistence userIdMapperPersistence;
1182 @BeanReference(type = UserNotificationEventPersistence.class)
1183 protected UserNotificationEventPersistence userNotificationEventPersistence;
1184 @BeanReference(type = UserTrackerPersistence.class)
1185 protected UserTrackerPersistence userTrackerPersistence;
1186 @BeanReference(type = UserTrackerPathPersistence.class)
1187 protected UserTrackerPathPersistence userTrackerPathPersistence;
1188 @BeanReference(type = VirtualHostPersistence.class)
1189 protected VirtualHostPersistence virtualHostPersistence;
1190 @BeanReference(type = WebDAVPropsPersistence.class)
1191 protected WebDAVPropsPersistence webDAVPropsPersistence;
1192 @BeanReference(type = WebsitePersistence.class)
1193 protected WebsitePersistence websitePersistence;
1194 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1195 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1196 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1197 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1198 private static final String _SQL_SELECT_USERTRACKERPATH = "SELECT userTrackerPath FROM UserTrackerPath userTrackerPath";
1199 private static final String _SQL_SELECT_USERTRACKERPATH_WHERE = "SELECT userTrackerPath FROM UserTrackerPath userTrackerPath WHERE ";
1200 private static final String _SQL_COUNT_USERTRACKERPATH = "SELECT COUNT(userTrackerPath) FROM UserTrackerPath userTrackerPath";
1201 private static final String _SQL_COUNT_USERTRACKERPATH_WHERE = "SELECT COUNT(userTrackerPath) FROM UserTrackerPath userTrackerPath WHERE ";
1202 private static final String _FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2 = "userTrackerPath.userTrackerId = ?";
1203 private static final String _ORDER_BY_ENTITY_ALIAS = "userTrackerPath.";
1204 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserTrackerPath exists with the primary key ";
1205 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserTrackerPath exists with the key {";
1206 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1207 private static Log _log = LogFactoryUtil.getLog(UserTrackerPathPersistenceImpl.class);
1208 private static UserTrackerPath _nullUserTrackerPath = new UserTrackerPathImpl() {
1209 @Override
1210 public Object clone() {
1211 return this;
1212 }
1213
1214 @Override
1215 public CacheModel<UserTrackerPath> toCacheModel() {
1216 return _nullUserTrackerPathCacheModel;
1217 }
1218 };
1219
1220 private static CacheModel<UserTrackerPath> _nullUserTrackerPathCacheModel = new CacheModel<UserTrackerPath>() {
1221 public UserTrackerPath toEntityModel() {
1222 return _nullUserTrackerPath;
1223 }
1224 };
1225 }