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
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) && !list.isEmpty()) {
529 for (UserTrackerPath userTrackerPath : list) {
530 if ((userTrackerId != userTrackerPath.getUserTrackerId())) {
531 list = null;
532
533 break;
534 }
535 }
536 }
537
538 if (list == null) {
539 StringBundler query = null;
540
541 if (orderByComparator != null) {
542 query = new StringBundler(3 +
543 (orderByComparator.getOrderByFields().length * 3));
544 }
545 else {
546 query = new StringBundler(2);
547 }
548
549 query.append(_SQL_SELECT_USERTRACKERPATH_WHERE);
550
551 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
552
553 if (orderByComparator != null) {
554 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
555 orderByComparator);
556 }
557
558 String sql = query.toString();
559
560 Session session = null;
561
562 try {
563 session = openSession();
564
565 Query q = session.createQuery(sql);
566
567 QueryPos qPos = QueryPos.getInstance(q);
568
569 qPos.add(userTrackerId);
570
571 list = (List<UserTrackerPath>)QueryUtil.list(q, getDialect(),
572 start, end);
573 }
574 catch (Exception e) {
575 throw processException(e);
576 }
577 finally {
578 if (list == null) {
579 FinderCacheUtil.removeResult(finderPath, finderArgs);
580 }
581 else {
582 cacheResult(list);
583
584 FinderCacheUtil.putResult(finderPath, finderArgs, list);
585 }
586
587 closeSession(session);
588 }
589 }
590
591 return list;
592 }
593
594
603 public UserTrackerPath findByUserTrackerId_First(long userTrackerId,
604 OrderByComparator orderByComparator)
605 throws NoSuchUserTrackerPathException, SystemException {
606 UserTrackerPath userTrackerPath = fetchByUserTrackerId_First(userTrackerId,
607 orderByComparator);
608
609 if (userTrackerPath != null) {
610 return userTrackerPath;
611 }
612
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
625
633 public UserTrackerPath fetchByUserTrackerId_First(long userTrackerId,
634 OrderByComparator orderByComparator) throws SystemException {
635 List<UserTrackerPath> list = findByUserTrackerId(userTrackerId, 0, 1,
636 orderByComparator);
637
638 if (!list.isEmpty()) {
639 return list.get(0);
640 }
641
642 return null;
643 }
644
645
654 public UserTrackerPath findByUserTrackerId_Last(long userTrackerId,
655 OrderByComparator orderByComparator)
656 throws NoSuchUserTrackerPathException, SystemException {
657 UserTrackerPath userTrackerPath = fetchByUserTrackerId_Last(userTrackerId,
658 orderByComparator);
659
660 if (userTrackerPath != null) {
661 return userTrackerPath;
662 }
663
664 StringBundler msg = new StringBundler(4);
665
666 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
667
668 msg.append("userTrackerId=");
669 msg.append(userTrackerId);
670
671 msg.append(StringPool.CLOSE_CURLY_BRACE);
672
673 throw new NoSuchUserTrackerPathException(msg.toString());
674 }
675
676
684 public UserTrackerPath fetchByUserTrackerId_Last(long userTrackerId,
685 OrderByComparator orderByComparator) throws SystemException {
686 int count = countByUserTrackerId(userTrackerId);
687
688 List<UserTrackerPath> list = findByUserTrackerId(userTrackerId,
689 count - 1, count, orderByComparator);
690
691 if (!list.isEmpty()) {
692 return list.get(0);
693 }
694
695 return null;
696 }
697
698
708 public UserTrackerPath[] findByUserTrackerId_PrevAndNext(
709 long userTrackerPathId, long userTrackerId,
710 OrderByComparator orderByComparator)
711 throws NoSuchUserTrackerPathException, SystemException {
712 UserTrackerPath userTrackerPath = findByPrimaryKey(userTrackerPathId);
713
714 Session session = null;
715
716 try {
717 session = openSession();
718
719 UserTrackerPath[] array = new UserTrackerPathImpl[3];
720
721 array[0] = getByUserTrackerId_PrevAndNext(session, userTrackerPath,
722 userTrackerId, orderByComparator, true);
723
724 array[1] = userTrackerPath;
725
726 array[2] = getByUserTrackerId_PrevAndNext(session, userTrackerPath,
727 userTrackerId, orderByComparator, false);
728
729 return array;
730 }
731 catch (Exception e) {
732 throw processException(e);
733 }
734 finally {
735 closeSession(session);
736 }
737 }
738
739 protected UserTrackerPath getByUserTrackerId_PrevAndNext(Session session,
740 UserTrackerPath userTrackerPath, long userTrackerId,
741 OrderByComparator orderByComparator, boolean previous) {
742 StringBundler query = null;
743
744 if (orderByComparator != null) {
745 query = new StringBundler(6 +
746 (orderByComparator.getOrderByFields().length * 6));
747 }
748 else {
749 query = new StringBundler(3);
750 }
751
752 query.append(_SQL_SELECT_USERTRACKERPATH_WHERE);
753
754 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
755
756 if (orderByComparator != null) {
757 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
758
759 if (orderByConditionFields.length > 0) {
760 query.append(WHERE_AND);
761 }
762
763 for (int i = 0; i < orderByConditionFields.length; i++) {
764 query.append(_ORDER_BY_ENTITY_ALIAS);
765 query.append(orderByConditionFields[i]);
766
767 if ((i + 1) < orderByConditionFields.length) {
768 if (orderByComparator.isAscending() ^ previous) {
769 query.append(WHERE_GREATER_THAN_HAS_NEXT);
770 }
771 else {
772 query.append(WHERE_LESSER_THAN_HAS_NEXT);
773 }
774 }
775 else {
776 if (orderByComparator.isAscending() ^ previous) {
777 query.append(WHERE_GREATER_THAN);
778 }
779 else {
780 query.append(WHERE_LESSER_THAN);
781 }
782 }
783 }
784
785 query.append(ORDER_BY_CLAUSE);
786
787 String[] orderByFields = orderByComparator.getOrderByFields();
788
789 for (int i = 0; i < orderByFields.length; i++) {
790 query.append(_ORDER_BY_ENTITY_ALIAS);
791 query.append(orderByFields[i]);
792
793 if ((i + 1) < orderByFields.length) {
794 if (orderByComparator.isAscending() ^ previous) {
795 query.append(ORDER_BY_ASC_HAS_NEXT);
796 }
797 else {
798 query.append(ORDER_BY_DESC_HAS_NEXT);
799 }
800 }
801 else {
802 if (orderByComparator.isAscending() ^ previous) {
803 query.append(ORDER_BY_ASC);
804 }
805 else {
806 query.append(ORDER_BY_DESC);
807 }
808 }
809 }
810 }
811
812 String sql = query.toString();
813
814 Query q = session.createQuery(sql);
815
816 q.setFirstResult(0);
817 q.setMaxResults(2);
818
819 QueryPos qPos = QueryPos.getInstance(q);
820
821 qPos.add(userTrackerId);
822
823 if (orderByComparator != null) {
824 Object[] values = orderByComparator.getOrderByConditionValues(userTrackerPath);
825
826 for (Object value : values) {
827 qPos.add(value);
828 }
829 }
830
831 List<UserTrackerPath> list = q.list();
832
833 if (list.size() == 2) {
834 return list.get(1);
835 }
836 else {
837 return null;
838 }
839 }
840
841
847 public List<UserTrackerPath> findAll() throws SystemException {
848 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
849 }
850
851
863 public List<UserTrackerPath> findAll(int start, int end)
864 throws SystemException {
865 return findAll(start, end, null);
866 }
867
868
881 public List<UserTrackerPath> findAll(int start, int end,
882 OrderByComparator orderByComparator) throws SystemException {
883 FinderPath finderPath = null;
884 Object[] finderArgs = new Object[] { start, end, orderByComparator };
885
886 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
887 (orderByComparator == null)) {
888 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
889 finderArgs = FINDER_ARGS_EMPTY;
890 }
891 else {
892 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
893 finderArgs = new Object[] { start, end, orderByComparator };
894 }
895
896 List<UserTrackerPath> list = (List<UserTrackerPath>)FinderCacheUtil.getResult(finderPath,
897 finderArgs, this);
898
899 if (list == null) {
900 StringBundler query = null;
901 String sql = null;
902
903 if (orderByComparator != null) {
904 query = new StringBundler(2 +
905 (orderByComparator.getOrderByFields().length * 3));
906
907 query.append(_SQL_SELECT_USERTRACKERPATH);
908
909 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
910 orderByComparator);
911
912 sql = query.toString();
913 }
914 else {
915 sql = _SQL_SELECT_USERTRACKERPATH;
916 }
917
918 Session session = null;
919
920 try {
921 session = openSession();
922
923 Query q = session.createQuery(sql);
924
925 if (orderByComparator == null) {
926 list = (List<UserTrackerPath>)QueryUtil.list(q,
927 getDialect(), start, end, false);
928
929 Collections.sort(list);
930 }
931 else {
932 list = (List<UserTrackerPath>)QueryUtil.list(q,
933 getDialect(), start, end);
934 }
935 }
936 catch (Exception e) {
937 throw processException(e);
938 }
939 finally {
940 if (list == null) {
941 FinderCacheUtil.removeResult(finderPath, finderArgs);
942 }
943 else {
944 cacheResult(list);
945
946 FinderCacheUtil.putResult(finderPath, finderArgs, list);
947 }
948
949 closeSession(session);
950 }
951 }
952
953 return list;
954 }
955
956
962 public void removeByUserTrackerId(long userTrackerId)
963 throws SystemException {
964 for (UserTrackerPath userTrackerPath : findByUserTrackerId(
965 userTrackerId)) {
966 remove(userTrackerPath);
967 }
968 }
969
970
975 public void removeAll() throws SystemException {
976 for (UserTrackerPath userTrackerPath : findAll()) {
977 remove(userTrackerPath);
978 }
979 }
980
981
988 public int countByUserTrackerId(long userTrackerId)
989 throws SystemException {
990 Object[] finderArgs = new Object[] { userTrackerId };
991
992 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
993 finderArgs, this);
994
995 if (count == null) {
996 StringBundler query = new StringBundler(2);
997
998 query.append(_SQL_COUNT_USERTRACKERPATH_WHERE);
999
1000 query.append(_FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2);
1001
1002 String sql = query.toString();
1003
1004 Session session = null;
1005
1006 try {
1007 session = openSession();
1008
1009 Query q = session.createQuery(sql);
1010
1011 QueryPos qPos = QueryPos.getInstance(q);
1012
1013 qPos.add(userTrackerId);
1014
1015 count = (Long)q.uniqueResult();
1016 }
1017 catch (Exception e) {
1018 throw processException(e);
1019 }
1020 finally {
1021 if (count == null) {
1022 count = Long.valueOf(0);
1023 }
1024
1025 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERTRACKERID,
1026 finderArgs, count);
1027
1028 closeSession(session);
1029 }
1030 }
1031
1032 return count.intValue();
1033 }
1034
1035
1041 public int countAll() throws SystemException {
1042 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1043 FINDER_ARGS_EMPTY, this);
1044
1045 if (count == null) {
1046 Session session = null;
1047
1048 try {
1049 session = openSession();
1050
1051 Query q = session.createQuery(_SQL_COUNT_USERTRACKERPATH);
1052
1053 count = (Long)q.uniqueResult();
1054 }
1055 catch (Exception e) {
1056 throw processException(e);
1057 }
1058 finally {
1059 if (count == null) {
1060 count = Long.valueOf(0);
1061 }
1062
1063 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1064 FINDER_ARGS_EMPTY, count);
1065
1066 closeSession(session);
1067 }
1068 }
1069
1070 return count.intValue();
1071 }
1072
1073
1076 public void afterPropertiesSet() {
1077 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1078 com.liferay.portal.util.PropsUtil.get(
1079 "value.object.listener.com.liferay.portal.model.UserTrackerPath")));
1080
1081 if (listenerClassNames.length > 0) {
1082 try {
1083 List<ModelListener<UserTrackerPath>> listenersList = new ArrayList<ModelListener<UserTrackerPath>>();
1084
1085 for (String listenerClassName : listenerClassNames) {
1086 Class<?> clazz = getClass();
1087
1088 listenersList.add((ModelListener<UserTrackerPath>)InstanceFactory.newInstance(
1089 clazz.getClassLoader(), listenerClassName));
1090 }
1091
1092 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1093 }
1094 catch (Exception e) {
1095 _log.error(e);
1096 }
1097 }
1098 }
1099
1100 public void destroy() {
1101 EntityCacheUtil.removeCache(UserTrackerPathImpl.class.getName());
1102 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1103 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1104 }
1105
1106 @BeanReference(type = AccountPersistence.class)
1107 protected AccountPersistence accountPersistence;
1108 @BeanReference(type = AddressPersistence.class)
1109 protected AddressPersistence addressPersistence;
1110 @BeanReference(type = BrowserTrackerPersistence.class)
1111 protected BrowserTrackerPersistence browserTrackerPersistence;
1112 @BeanReference(type = ClassNamePersistence.class)
1113 protected ClassNamePersistence classNamePersistence;
1114 @BeanReference(type = ClusterGroupPersistence.class)
1115 protected ClusterGroupPersistence clusterGroupPersistence;
1116 @BeanReference(type = CompanyPersistence.class)
1117 protected CompanyPersistence companyPersistence;
1118 @BeanReference(type = ContactPersistence.class)
1119 protected ContactPersistence contactPersistence;
1120 @BeanReference(type = CountryPersistence.class)
1121 protected CountryPersistence countryPersistence;
1122 @BeanReference(type = EmailAddressPersistence.class)
1123 protected EmailAddressPersistence emailAddressPersistence;
1124 @BeanReference(type = GroupPersistence.class)
1125 protected GroupPersistence groupPersistence;
1126 @BeanReference(type = ImagePersistence.class)
1127 protected ImagePersistence imagePersistence;
1128 @BeanReference(type = LayoutPersistence.class)
1129 protected LayoutPersistence layoutPersistence;
1130 @BeanReference(type = LayoutBranchPersistence.class)
1131 protected LayoutBranchPersistence layoutBranchPersistence;
1132 @BeanReference(type = LayoutPrototypePersistence.class)
1133 protected LayoutPrototypePersistence layoutPrototypePersistence;
1134 @BeanReference(type = LayoutRevisionPersistence.class)
1135 protected LayoutRevisionPersistence layoutRevisionPersistence;
1136 @BeanReference(type = LayoutSetPersistence.class)
1137 protected LayoutSetPersistence layoutSetPersistence;
1138 @BeanReference(type = LayoutSetBranchPersistence.class)
1139 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1140 @BeanReference(type = LayoutSetPrototypePersistence.class)
1141 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1142 @BeanReference(type = ListTypePersistence.class)
1143 protected ListTypePersistence listTypePersistence;
1144 @BeanReference(type = LockPersistence.class)
1145 protected LockPersistence lockPersistence;
1146 @BeanReference(type = MembershipRequestPersistence.class)
1147 protected MembershipRequestPersistence membershipRequestPersistence;
1148 @BeanReference(type = OrganizationPersistence.class)
1149 protected OrganizationPersistence organizationPersistence;
1150 @BeanReference(type = OrgGroupPermissionPersistence.class)
1151 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1152 @BeanReference(type = OrgGroupRolePersistence.class)
1153 protected OrgGroupRolePersistence orgGroupRolePersistence;
1154 @BeanReference(type = OrgLaborPersistence.class)
1155 protected OrgLaborPersistence orgLaborPersistence;
1156 @BeanReference(type = PasswordPolicyPersistence.class)
1157 protected PasswordPolicyPersistence passwordPolicyPersistence;
1158 @BeanReference(type = PasswordPolicyRelPersistence.class)
1159 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1160 @BeanReference(type = PasswordTrackerPersistence.class)
1161 protected PasswordTrackerPersistence passwordTrackerPersistence;
1162 @BeanReference(type = PermissionPersistence.class)
1163 protected PermissionPersistence permissionPersistence;
1164 @BeanReference(type = PhonePersistence.class)
1165 protected PhonePersistence phonePersistence;
1166 @BeanReference(type = PluginSettingPersistence.class)
1167 protected PluginSettingPersistence pluginSettingPersistence;
1168 @BeanReference(type = PortalPreferencesPersistence.class)
1169 protected PortalPreferencesPersistence portalPreferencesPersistence;
1170 @BeanReference(type = PortletPersistence.class)
1171 protected PortletPersistence portletPersistence;
1172 @BeanReference(type = PortletItemPersistence.class)
1173 protected PortletItemPersistence portletItemPersistence;
1174 @BeanReference(type = PortletPreferencesPersistence.class)
1175 protected PortletPreferencesPersistence portletPreferencesPersistence;
1176 @BeanReference(type = RegionPersistence.class)
1177 protected RegionPersistence regionPersistence;
1178 @BeanReference(type = ReleasePersistence.class)
1179 protected ReleasePersistence releasePersistence;
1180 @BeanReference(type = RepositoryPersistence.class)
1181 protected RepositoryPersistence repositoryPersistence;
1182 @BeanReference(type = RepositoryEntryPersistence.class)
1183 protected RepositoryEntryPersistence repositoryEntryPersistence;
1184 @BeanReference(type = ResourcePersistence.class)
1185 protected ResourcePersistence resourcePersistence;
1186 @BeanReference(type = ResourceActionPersistence.class)
1187 protected ResourceActionPersistence resourceActionPersistence;
1188 @BeanReference(type = ResourceBlockPersistence.class)
1189 protected ResourceBlockPersistence resourceBlockPersistence;
1190 @BeanReference(type = ResourceBlockPermissionPersistence.class)
1191 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1192 @BeanReference(type = ResourceCodePersistence.class)
1193 protected ResourceCodePersistence resourceCodePersistence;
1194 @BeanReference(type = ResourcePermissionPersistence.class)
1195 protected ResourcePermissionPersistence resourcePermissionPersistence;
1196 @BeanReference(type = ResourceTypePermissionPersistence.class)
1197 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1198 @BeanReference(type = RolePersistence.class)
1199 protected RolePersistence rolePersistence;
1200 @BeanReference(type = ServiceComponentPersistence.class)
1201 protected ServiceComponentPersistence serviceComponentPersistence;
1202 @BeanReference(type = ShardPersistence.class)
1203 protected ShardPersistence shardPersistence;
1204 @BeanReference(type = SubscriptionPersistence.class)
1205 protected SubscriptionPersistence subscriptionPersistence;
1206 @BeanReference(type = TeamPersistence.class)
1207 protected TeamPersistence teamPersistence;
1208 @BeanReference(type = TicketPersistence.class)
1209 protected TicketPersistence ticketPersistence;
1210 @BeanReference(type = UserPersistence.class)
1211 protected UserPersistence userPersistence;
1212 @BeanReference(type = UserGroupPersistence.class)
1213 protected UserGroupPersistence userGroupPersistence;
1214 @BeanReference(type = UserGroupGroupRolePersistence.class)
1215 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1216 @BeanReference(type = UserGroupRolePersistence.class)
1217 protected UserGroupRolePersistence userGroupRolePersistence;
1218 @BeanReference(type = UserIdMapperPersistence.class)
1219 protected UserIdMapperPersistence userIdMapperPersistence;
1220 @BeanReference(type = UserNotificationEventPersistence.class)
1221 protected UserNotificationEventPersistence userNotificationEventPersistence;
1222 @BeanReference(type = UserTrackerPersistence.class)
1223 protected UserTrackerPersistence userTrackerPersistence;
1224 @BeanReference(type = UserTrackerPathPersistence.class)
1225 protected UserTrackerPathPersistence userTrackerPathPersistence;
1226 @BeanReference(type = VirtualHostPersistence.class)
1227 protected VirtualHostPersistence virtualHostPersistence;
1228 @BeanReference(type = WebDAVPropsPersistence.class)
1229 protected WebDAVPropsPersistence webDAVPropsPersistence;
1230 @BeanReference(type = WebsitePersistence.class)
1231 protected WebsitePersistence websitePersistence;
1232 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1233 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1234 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1235 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1236 private static final String _SQL_SELECT_USERTRACKERPATH = "SELECT userTrackerPath FROM UserTrackerPath userTrackerPath";
1237 private static final String _SQL_SELECT_USERTRACKERPATH_WHERE = "SELECT userTrackerPath FROM UserTrackerPath userTrackerPath WHERE ";
1238 private static final String _SQL_COUNT_USERTRACKERPATH = "SELECT COUNT(userTrackerPath) FROM UserTrackerPath userTrackerPath";
1239 private static final String _SQL_COUNT_USERTRACKERPATH_WHERE = "SELECT COUNT(userTrackerPath) FROM UserTrackerPath userTrackerPath WHERE ";
1240 private static final String _FINDER_COLUMN_USERTRACKERID_USERTRACKERID_2 = "userTrackerPath.userTrackerId = ?";
1241 private static final String _ORDER_BY_ENTITY_ALIAS = "userTrackerPath.";
1242 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserTrackerPath exists with the primary key ";
1243 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserTrackerPath exists with the key {";
1244 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1245 private static Log _log = LogFactoryUtil.getLog(UserTrackerPathPersistenceImpl.class);
1246 private static UserTrackerPath _nullUserTrackerPath = new UserTrackerPathImpl() {
1247 @Override
1248 public Object clone() {
1249 return this;
1250 }
1251
1252 @Override
1253 public CacheModel<UserTrackerPath> toCacheModel() {
1254 return _nullUserTrackerPathCacheModel;
1255 }
1256 };
1257
1258 private static CacheModel<UserTrackerPath> _nullUserTrackerPathCacheModel = new CacheModel<UserTrackerPath>() {
1259 public UserTrackerPath toEntityModel() {
1260 return _nullUserTrackerPath;
1261 }
1262 };
1263 }