001
014
015 package com.liferay.portlet.trash.service.persistence;
016
017 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
018 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
019 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
020 import com.liferay.portal.kernel.dao.orm.FinderPath;
021 import com.liferay.portal.kernel.dao.orm.Query;
022 import com.liferay.portal.kernel.dao.orm.QueryPos;
023 import com.liferay.portal.kernel.dao.orm.QueryUtil;
024 import com.liferay.portal.kernel.dao.orm.Session;
025 import com.liferay.portal.kernel.exception.SystemException;
026 import com.liferay.portal.kernel.log.Log;
027 import com.liferay.portal.kernel.log.LogFactoryUtil;
028 import com.liferay.portal.kernel.util.GetterUtil;
029 import com.liferay.portal.kernel.util.InstanceFactory;
030 import com.liferay.portal.kernel.util.OrderByComparator;
031 import com.liferay.portal.kernel.util.StringBundler;
032 import com.liferay.portal.kernel.util.StringPool;
033 import com.liferay.portal.kernel.util.StringUtil;
034 import com.liferay.portal.kernel.util.UnmodifiableList;
035 import com.liferay.portal.model.CacheModel;
036 import com.liferay.portal.model.ModelListener;
037 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
038
039 import com.liferay.portlet.trash.NoSuchVersionException;
040 import com.liferay.portlet.trash.model.TrashVersion;
041 import com.liferay.portlet.trash.model.impl.TrashVersionImpl;
042 import com.liferay.portlet.trash.model.impl.TrashVersionModelImpl;
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 TrashVersionPersistenceImpl extends BasePersistenceImpl<TrashVersion>
063 implements TrashVersionPersistence {
064
069 public static final String FINDER_CLASS_NAME_ENTITY = TrashVersionImpl.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_ALL = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
075 TrashVersionModelImpl.FINDER_CACHE_ENABLED, TrashVersionImpl.class,
076 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
077 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
078 TrashVersionModelImpl.FINDER_CACHE_ENABLED, TrashVersionImpl.class,
079 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
080 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
081 TrashVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
082 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
083 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ENTRYID = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
084 TrashVersionModelImpl.FINDER_CACHE_ENABLED, TrashVersionImpl.class,
085 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByEntryId",
086 new String[] {
087 Long.class.getName(),
088
089 Integer.class.getName(), Integer.class.getName(),
090 OrderByComparator.class.getName()
091 });
092 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTRYID =
093 new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
094 TrashVersionModelImpl.FINDER_CACHE_ENABLED, TrashVersionImpl.class,
095 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByEntryId",
096 new String[] { Long.class.getName() },
097 TrashVersionModelImpl.ENTRYID_COLUMN_BITMASK);
098 public static final FinderPath FINDER_PATH_COUNT_BY_ENTRYID = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
099 TrashVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
100 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByEntryId",
101 new String[] { Long.class.getName() });
102
103
110 @Override
111 public List<TrashVersion> findByEntryId(long entryId)
112 throws SystemException {
113 return findByEntryId(entryId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
114 }
115
116
129 @Override
130 public List<TrashVersion> findByEntryId(long entryId, int start, int end)
131 throws SystemException {
132 return findByEntryId(entryId, start, end, null);
133 }
134
135
149 @Override
150 public List<TrashVersion> findByEntryId(long entryId, int start, int end,
151 OrderByComparator orderByComparator) throws SystemException {
152 boolean pagination = true;
153 FinderPath finderPath = null;
154 Object[] finderArgs = null;
155
156 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
157 (orderByComparator == null)) {
158 pagination = false;
159 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTRYID;
160 finderArgs = new Object[] { entryId };
161 }
162 else {
163 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ENTRYID;
164 finderArgs = new Object[] { entryId, start, end, orderByComparator };
165 }
166
167 List<TrashVersion> list = (List<TrashVersion>)FinderCacheUtil.getResult(finderPath,
168 finderArgs, this);
169
170 if ((list != null) && !list.isEmpty()) {
171 for (TrashVersion trashVersion : list) {
172 if ((entryId != trashVersion.getEntryId())) {
173 list = null;
174
175 break;
176 }
177 }
178 }
179
180 if (list == null) {
181 StringBundler query = null;
182
183 if (orderByComparator != null) {
184 query = new StringBundler(3 +
185 (orderByComparator.getOrderByFields().length * 3));
186 }
187 else {
188 query = new StringBundler(3);
189 }
190
191 query.append(_SQL_SELECT_TRASHVERSION_WHERE);
192
193 query.append(_FINDER_COLUMN_ENTRYID_ENTRYID_2);
194
195 if (orderByComparator != null) {
196 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
197 orderByComparator);
198 }
199 else
200 if (pagination) {
201 query.append(TrashVersionModelImpl.ORDER_BY_JPQL);
202 }
203
204 String sql = query.toString();
205
206 Session session = null;
207
208 try {
209 session = openSession();
210
211 Query q = session.createQuery(sql);
212
213 QueryPos qPos = QueryPos.getInstance(q);
214
215 qPos.add(entryId);
216
217 if (!pagination) {
218 list = (List<TrashVersion>)QueryUtil.list(q, getDialect(),
219 start, end, false);
220
221 Collections.sort(list);
222
223 list = new UnmodifiableList<TrashVersion>(list);
224 }
225 else {
226 list = (List<TrashVersion>)QueryUtil.list(q, getDialect(),
227 start, end);
228 }
229
230 cacheResult(list);
231
232 FinderCacheUtil.putResult(finderPath, finderArgs, list);
233 }
234 catch (Exception e) {
235 FinderCacheUtil.removeResult(finderPath, finderArgs);
236
237 throw processException(e);
238 }
239 finally {
240 closeSession(session);
241 }
242 }
243
244 return list;
245 }
246
247
256 @Override
257 public TrashVersion findByEntryId_First(long entryId,
258 OrderByComparator orderByComparator)
259 throws NoSuchVersionException, SystemException {
260 TrashVersion trashVersion = fetchByEntryId_First(entryId,
261 orderByComparator);
262
263 if (trashVersion != null) {
264 return trashVersion;
265 }
266
267 StringBundler msg = new StringBundler(4);
268
269 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
270
271 msg.append("entryId=");
272 msg.append(entryId);
273
274 msg.append(StringPool.CLOSE_CURLY_BRACE);
275
276 throw new NoSuchVersionException(msg.toString());
277 }
278
279
287 @Override
288 public TrashVersion fetchByEntryId_First(long entryId,
289 OrderByComparator orderByComparator) throws SystemException {
290 List<TrashVersion> list = findByEntryId(entryId, 0, 1, orderByComparator);
291
292 if (!list.isEmpty()) {
293 return list.get(0);
294 }
295
296 return null;
297 }
298
299
308 @Override
309 public TrashVersion findByEntryId_Last(long entryId,
310 OrderByComparator orderByComparator)
311 throws NoSuchVersionException, SystemException {
312 TrashVersion trashVersion = fetchByEntryId_Last(entryId,
313 orderByComparator);
314
315 if (trashVersion != null) {
316 return trashVersion;
317 }
318
319 StringBundler msg = new StringBundler(4);
320
321 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
322
323 msg.append("entryId=");
324 msg.append(entryId);
325
326 msg.append(StringPool.CLOSE_CURLY_BRACE);
327
328 throw new NoSuchVersionException(msg.toString());
329 }
330
331
339 @Override
340 public TrashVersion fetchByEntryId_Last(long entryId,
341 OrderByComparator orderByComparator) throws SystemException {
342 int count = countByEntryId(entryId);
343
344 if (count == 0) {
345 return null;
346 }
347
348 List<TrashVersion> list = findByEntryId(entryId, count - 1, count,
349 orderByComparator);
350
351 if (!list.isEmpty()) {
352 return list.get(0);
353 }
354
355 return null;
356 }
357
358
368 @Override
369 public TrashVersion[] findByEntryId_PrevAndNext(long versionId,
370 long entryId, OrderByComparator orderByComparator)
371 throws NoSuchVersionException, SystemException {
372 TrashVersion trashVersion = findByPrimaryKey(versionId);
373
374 Session session = null;
375
376 try {
377 session = openSession();
378
379 TrashVersion[] array = new TrashVersionImpl[3];
380
381 array[0] = getByEntryId_PrevAndNext(session, trashVersion, entryId,
382 orderByComparator, true);
383
384 array[1] = trashVersion;
385
386 array[2] = getByEntryId_PrevAndNext(session, trashVersion, entryId,
387 orderByComparator, false);
388
389 return array;
390 }
391 catch (Exception e) {
392 throw processException(e);
393 }
394 finally {
395 closeSession(session);
396 }
397 }
398
399 protected TrashVersion getByEntryId_PrevAndNext(Session session,
400 TrashVersion trashVersion, long entryId,
401 OrderByComparator orderByComparator, boolean previous) {
402 StringBundler query = null;
403
404 if (orderByComparator != null) {
405 query = new StringBundler(6 +
406 (orderByComparator.getOrderByFields().length * 6));
407 }
408 else {
409 query = new StringBundler(3);
410 }
411
412 query.append(_SQL_SELECT_TRASHVERSION_WHERE);
413
414 query.append(_FINDER_COLUMN_ENTRYID_ENTRYID_2);
415
416 if (orderByComparator != null) {
417 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
418
419 if (orderByConditionFields.length > 0) {
420 query.append(WHERE_AND);
421 }
422
423 for (int i = 0; i < orderByConditionFields.length; i++) {
424 query.append(_ORDER_BY_ENTITY_ALIAS);
425 query.append(orderByConditionFields[i]);
426
427 if ((i + 1) < orderByConditionFields.length) {
428 if (orderByComparator.isAscending() ^ previous) {
429 query.append(WHERE_GREATER_THAN_HAS_NEXT);
430 }
431 else {
432 query.append(WHERE_LESSER_THAN_HAS_NEXT);
433 }
434 }
435 else {
436 if (orderByComparator.isAscending() ^ previous) {
437 query.append(WHERE_GREATER_THAN);
438 }
439 else {
440 query.append(WHERE_LESSER_THAN);
441 }
442 }
443 }
444
445 query.append(ORDER_BY_CLAUSE);
446
447 String[] orderByFields = orderByComparator.getOrderByFields();
448
449 for (int i = 0; i < orderByFields.length; i++) {
450 query.append(_ORDER_BY_ENTITY_ALIAS);
451 query.append(orderByFields[i]);
452
453 if ((i + 1) < orderByFields.length) {
454 if (orderByComparator.isAscending() ^ previous) {
455 query.append(ORDER_BY_ASC_HAS_NEXT);
456 }
457 else {
458 query.append(ORDER_BY_DESC_HAS_NEXT);
459 }
460 }
461 else {
462 if (orderByComparator.isAscending() ^ previous) {
463 query.append(ORDER_BY_ASC);
464 }
465 else {
466 query.append(ORDER_BY_DESC);
467 }
468 }
469 }
470 }
471 else {
472 query.append(TrashVersionModelImpl.ORDER_BY_JPQL);
473 }
474
475 String sql = query.toString();
476
477 Query q = session.createQuery(sql);
478
479 q.setFirstResult(0);
480 q.setMaxResults(2);
481
482 QueryPos qPos = QueryPos.getInstance(q);
483
484 qPos.add(entryId);
485
486 if (orderByComparator != null) {
487 Object[] values = orderByComparator.getOrderByConditionValues(trashVersion);
488
489 for (Object value : values) {
490 qPos.add(value);
491 }
492 }
493
494 List<TrashVersion> list = q.list();
495
496 if (list.size() == 2) {
497 return list.get(1);
498 }
499 else {
500 return null;
501 }
502 }
503
504
510 @Override
511 public void removeByEntryId(long entryId) throws SystemException {
512 for (TrashVersion trashVersion : findByEntryId(entryId,
513 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
514 remove(trashVersion);
515 }
516 }
517
518
525 @Override
526 public int countByEntryId(long entryId) throws SystemException {
527 FinderPath finderPath = FINDER_PATH_COUNT_BY_ENTRYID;
528
529 Object[] finderArgs = new Object[] { entryId };
530
531 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
532 this);
533
534 if (count == null) {
535 StringBundler query = new StringBundler(2);
536
537 query.append(_SQL_COUNT_TRASHVERSION_WHERE);
538
539 query.append(_FINDER_COLUMN_ENTRYID_ENTRYID_2);
540
541 String sql = query.toString();
542
543 Session session = null;
544
545 try {
546 session = openSession();
547
548 Query q = session.createQuery(sql);
549
550 QueryPos qPos = QueryPos.getInstance(q);
551
552 qPos.add(entryId);
553
554 count = (Long)q.uniqueResult();
555
556 FinderCacheUtil.putResult(finderPath, finderArgs, count);
557 }
558 catch (Exception e) {
559 FinderCacheUtil.removeResult(finderPath, finderArgs);
560
561 throw processException(e);
562 }
563 finally {
564 closeSession(session);
565 }
566 }
567
568 return count.intValue();
569 }
570
571 private static final String _FINDER_COLUMN_ENTRYID_ENTRYID_2 = "trashVersion.entryId = ?";
572 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_E_C = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
573 TrashVersionModelImpl.FINDER_CACHE_ENABLED, TrashVersionImpl.class,
574 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByE_C",
575 new String[] {
576 Long.class.getName(), Long.class.getName(),
577
578 Integer.class.getName(), Integer.class.getName(),
579 OrderByComparator.class.getName()
580 });
581 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E_C = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
582 TrashVersionModelImpl.FINDER_CACHE_ENABLED, TrashVersionImpl.class,
583 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByE_C",
584 new String[] { Long.class.getName(), Long.class.getName() },
585 TrashVersionModelImpl.ENTRYID_COLUMN_BITMASK |
586 TrashVersionModelImpl.CLASSNAMEID_COLUMN_BITMASK);
587 public static final FinderPath FINDER_PATH_COUNT_BY_E_C = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
588 TrashVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
589 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByE_C",
590 new String[] { Long.class.getName(), Long.class.getName() });
591
592
600 @Override
601 public List<TrashVersion> findByE_C(long entryId, long classNameId)
602 throws SystemException {
603 return findByE_C(entryId, classNameId, QueryUtil.ALL_POS,
604 QueryUtil.ALL_POS, null);
605 }
606
607
621 @Override
622 public List<TrashVersion> findByE_C(long entryId, long classNameId,
623 int start, int end) throws SystemException {
624 return findByE_C(entryId, classNameId, start, end, null);
625 }
626
627
642 @Override
643 public List<TrashVersion> findByE_C(long entryId, long classNameId,
644 int start, int end, OrderByComparator orderByComparator)
645 throws SystemException {
646 boolean pagination = true;
647 FinderPath finderPath = null;
648 Object[] finderArgs = null;
649
650 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
651 (orderByComparator == null)) {
652 pagination = false;
653 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E_C;
654 finderArgs = new Object[] { entryId, classNameId };
655 }
656 else {
657 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_E_C;
658 finderArgs = new Object[] {
659 entryId, classNameId,
660
661 start, end, orderByComparator
662 };
663 }
664
665 List<TrashVersion> list = (List<TrashVersion>)FinderCacheUtil.getResult(finderPath,
666 finderArgs, this);
667
668 if ((list != null) && !list.isEmpty()) {
669 for (TrashVersion trashVersion : list) {
670 if ((entryId != trashVersion.getEntryId()) ||
671 (classNameId != trashVersion.getClassNameId())) {
672 list = null;
673
674 break;
675 }
676 }
677 }
678
679 if (list == null) {
680 StringBundler query = null;
681
682 if (orderByComparator != null) {
683 query = new StringBundler(4 +
684 (orderByComparator.getOrderByFields().length * 3));
685 }
686 else {
687 query = new StringBundler(4);
688 }
689
690 query.append(_SQL_SELECT_TRASHVERSION_WHERE);
691
692 query.append(_FINDER_COLUMN_E_C_ENTRYID_2);
693
694 query.append(_FINDER_COLUMN_E_C_CLASSNAMEID_2);
695
696 if (orderByComparator != null) {
697 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
698 orderByComparator);
699 }
700 else
701 if (pagination) {
702 query.append(TrashVersionModelImpl.ORDER_BY_JPQL);
703 }
704
705 String sql = query.toString();
706
707 Session session = null;
708
709 try {
710 session = openSession();
711
712 Query q = session.createQuery(sql);
713
714 QueryPos qPos = QueryPos.getInstance(q);
715
716 qPos.add(entryId);
717
718 qPos.add(classNameId);
719
720 if (!pagination) {
721 list = (List<TrashVersion>)QueryUtil.list(q, getDialect(),
722 start, end, false);
723
724 Collections.sort(list);
725
726 list = new UnmodifiableList<TrashVersion>(list);
727 }
728 else {
729 list = (List<TrashVersion>)QueryUtil.list(q, getDialect(),
730 start, end);
731 }
732
733 cacheResult(list);
734
735 FinderCacheUtil.putResult(finderPath, finderArgs, list);
736 }
737 catch (Exception e) {
738 FinderCacheUtil.removeResult(finderPath, finderArgs);
739
740 throw processException(e);
741 }
742 finally {
743 closeSession(session);
744 }
745 }
746
747 return list;
748 }
749
750
760 @Override
761 public TrashVersion findByE_C_First(long entryId, long classNameId,
762 OrderByComparator orderByComparator)
763 throws NoSuchVersionException, SystemException {
764 TrashVersion trashVersion = fetchByE_C_First(entryId, classNameId,
765 orderByComparator);
766
767 if (trashVersion != null) {
768 return trashVersion;
769 }
770
771 StringBundler msg = new StringBundler(6);
772
773 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
774
775 msg.append("entryId=");
776 msg.append(entryId);
777
778 msg.append(", classNameId=");
779 msg.append(classNameId);
780
781 msg.append(StringPool.CLOSE_CURLY_BRACE);
782
783 throw new NoSuchVersionException(msg.toString());
784 }
785
786
795 @Override
796 public TrashVersion fetchByE_C_First(long entryId, long classNameId,
797 OrderByComparator orderByComparator) throws SystemException {
798 List<TrashVersion> list = findByE_C(entryId, classNameId, 0, 1,
799 orderByComparator);
800
801 if (!list.isEmpty()) {
802 return list.get(0);
803 }
804
805 return null;
806 }
807
808
818 @Override
819 public TrashVersion findByE_C_Last(long entryId, long classNameId,
820 OrderByComparator orderByComparator)
821 throws NoSuchVersionException, SystemException {
822 TrashVersion trashVersion = fetchByE_C_Last(entryId, classNameId,
823 orderByComparator);
824
825 if (trashVersion != null) {
826 return trashVersion;
827 }
828
829 StringBundler msg = new StringBundler(6);
830
831 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
832
833 msg.append("entryId=");
834 msg.append(entryId);
835
836 msg.append(", classNameId=");
837 msg.append(classNameId);
838
839 msg.append(StringPool.CLOSE_CURLY_BRACE);
840
841 throw new NoSuchVersionException(msg.toString());
842 }
843
844
853 @Override
854 public TrashVersion fetchByE_C_Last(long entryId, long classNameId,
855 OrderByComparator orderByComparator) throws SystemException {
856 int count = countByE_C(entryId, classNameId);
857
858 if (count == 0) {
859 return null;
860 }
861
862 List<TrashVersion> list = findByE_C(entryId, classNameId, count - 1,
863 count, orderByComparator);
864
865 if (!list.isEmpty()) {
866 return list.get(0);
867 }
868
869 return null;
870 }
871
872
883 @Override
884 public TrashVersion[] findByE_C_PrevAndNext(long versionId, long entryId,
885 long classNameId, OrderByComparator orderByComparator)
886 throws NoSuchVersionException, SystemException {
887 TrashVersion trashVersion = findByPrimaryKey(versionId);
888
889 Session session = null;
890
891 try {
892 session = openSession();
893
894 TrashVersion[] array = new TrashVersionImpl[3];
895
896 array[0] = getByE_C_PrevAndNext(session, trashVersion, entryId,
897 classNameId, orderByComparator, true);
898
899 array[1] = trashVersion;
900
901 array[2] = getByE_C_PrevAndNext(session, trashVersion, entryId,
902 classNameId, orderByComparator, false);
903
904 return array;
905 }
906 catch (Exception e) {
907 throw processException(e);
908 }
909 finally {
910 closeSession(session);
911 }
912 }
913
914 protected TrashVersion getByE_C_PrevAndNext(Session session,
915 TrashVersion trashVersion, long entryId, long classNameId,
916 OrderByComparator orderByComparator, boolean previous) {
917 StringBundler query = null;
918
919 if (orderByComparator != null) {
920 query = new StringBundler(6 +
921 (orderByComparator.getOrderByFields().length * 6));
922 }
923 else {
924 query = new StringBundler(3);
925 }
926
927 query.append(_SQL_SELECT_TRASHVERSION_WHERE);
928
929 query.append(_FINDER_COLUMN_E_C_ENTRYID_2);
930
931 query.append(_FINDER_COLUMN_E_C_CLASSNAMEID_2);
932
933 if (orderByComparator != null) {
934 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
935
936 if (orderByConditionFields.length > 0) {
937 query.append(WHERE_AND);
938 }
939
940 for (int i = 0; i < orderByConditionFields.length; i++) {
941 query.append(_ORDER_BY_ENTITY_ALIAS);
942 query.append(orderByConditionFields[i]);
943
944 if ((i + 1) < orderByConditionFields.length) {
945 if (orderByComparator.isAscending() ^ previous) {
946 query.append(WHERE_GREATER_THAN_HAS_NEXT);
947 }
948 else {
949 query.append(WHERE_LESSER_THAN_HAS_NEXT);
950 }
951 }
952 else {
953 if (orderByComparator.isAscending() ^ previous) {
954 query.append(WHERE_GREATER_THAN);
955 }
956 else {
957 query.append(WHERE_LESSER_THAN);
958 }
959 }
960 }
961
962 query.append(ORDER_BY_CLAUSE);
963
964 String[] orderByFields = orderByComparator.getOrderByFields();
965
966 for (int i = 0; i < orderByFields.length; i++) {
967 query.append(_ORDER_BY_ENTITY_ALIAS);
968 query.append(orderByFields[i]);
969
970 if ((i + 1) < orderByFields.length) {
971 if (orderByComparator.isAscending() ^ previous) {
972 query.append(ORDER_BY_ASC_HAS_NEXT);
973 }
974 else {
975 query.append(ORDER_BY_DESC_HAS_NEXT);
976 }
977 }
978 else {
979 if (orderByComparator.isAscending() ^ previous) {
980 query.append(ORDER_BY_ASC);
981 }
982 else {
983 query.append(ORDER_BY_DESC);
984 }
985 }
986 }
987 }
988 else {
989 query.append(TrashVersionModelImpl.ORDER_BY_JPQL);
990 }
991
992 String sql = query.toString();
993
994 Query q = session.createQuery(sql);
995
996 q.setFirstResult(0);
997 q.setMaxResults(2);
998
999 QueryPos qPos = QueryPos.getInstance(q);
1000
1001 qPos.add(entryId);
1002
1003 qPos.add(classNameId);
1004
1005 if (orderByComparator != null) {
1006 Object[] values = orderByComparator.getOrderByConditionValues(trashVersion);
1007
1008 for (Object value : values) {
1009 qPos.add(value);
1010 }
1011 }
1012
1013 List<TrashVersion> list = q.list();
1014
1015 if (list.size() == 2) {
1016 return list.get(1);
1017 }
1018 else {
1019 return null;
1020 }
1021 }
1022
1023
1030 @Override
1031 public void removeByE_C(long entryId, long classNameId)
1032 throws SystemException {
1033 for (TrashVersion trashVersion : findByE_C(entryId, classNameId,
1034 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1035 remove(trashVersion);
1036 }
1037 }
1038
1039
1047 @Override
1048 public int countByE_C(long entryId, long classNameId)
1049 throws SystemException {
1050 FinderPath finderPath = FINDER_PATH_COUNT_BY_E_C;
1051
1052 Object[] finderArgs = new Object[] { entryId, classNameId };
1053
1054 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
1055 this);
1056
1057 if (count == null) {
1058 StringBundler query = new StringBundler(3);
1059
1060 query.append(_SQL_COUNT_TRASHVERSION_WHERE);
1061
1062 query.append(_FINDER_COLUMN_E_C_ENTRYID_2);
1063
1064 query.append(_FINDER_COLUMN_E_C_CLASSNAMEID_2);
1065
1066 String sql = query.toString();
1067
1068 Session session = null;
1069
1070 try {
1071 session = openSession();
1072
1073 Query q = session.createQuery(sql);
1074
1075 QueryPos qPos = QueryPos.getInstance(q);
1076
1077 qPos.add(entryId);
1078
1079 qPos.add(classNameId);
1080
1081 count = (Long)q.uniqueResult();
1082
1083 FinderCacheUtil.putResult(finderPath, finderArgs, count);
1084 }
1085 catch (Exception e) {
1086 FinderCacheUtil.removeResult(finderPath, finderArgs);
1087
1088 throw processException(e);
1089 }
1090 finally {
1091 closeSession(session);
1092 }
1093 }
1094
1095 return count.intValue();
1096 }
1097
1098 private static final String _FINDER_COLUMN_E_C_ENTRYID_2 = "trashVersion.entryId = ? AND ";
1099 private static final String _FINDER_COLUMN_E_C_CLASSNAMEID_2 = "trashVersion.classNameId = ?";
1100 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
1101 TrashVersionModelImpl.FINDER_CACHE_ENABLED, TrashVersionImpl.class,
1102 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C",
1103 new String[] {
1104 Long.class.getName(), Long.class.getName(),
1105
1106 Integer.class.getName(), Integer.class.getName(),
1107 OrderByComparator.class.getName()
1108 });
1109 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
1110 TrashVersionModelImpl.FINDER_CACHE_ENABLED, TrashVersionImpl.class,
1111 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C",
1112 new String[] { Long.class.getName(), Long.class.getName() },
1113 TrashVersionModelImpl.CLASSNAMEID_COLUMN_BITMASK |
1114 TrashVersionModelImpl.CLASSPK_COLUMN_BITMASK);
1115 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
1116 TrashVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
1117 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
1118 new String[] { Long.class.getName(), Long.class.getName() });
1119
1120
1128 @Override
1129 public List<TrashVersion> findByC_C(long classNameId, long classPK)
1130 throws SystemException {
1131 return findByC_C(classNameId, classPK, QueryUtil.ALL_POS,
1132 QueryUtil.ALL_POS, null);
1133 }
1134
1135
1149 @Override
1150 public List<TrashVersion> findByC_C(long classNameId, long classPK,
1151 int start, int end) throws SystemException {
1152 return findByC_C(classNameId, classPK, start, end, null);
1153 }
1154
1155
1170 @Override
1171 public List<TrashVersion> findByC_C(long classNameId, long classPK,
1172 int start, int end, OrderByComparator orderByComparator)
1173 throws SystemException {
1174 boolean pagination = true;
1175 FinderPath finderPath = null;
1176 Object[] finderArgs = null;
1177
1178 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1179 (orderByComparator == null)) {
1180 pagination = false;
1181 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C;
1182 finderArgs = new Object[] { classNameId, classPK };
1183 }
1184 else {
1185 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C;
1186 finderArgs = new Object[] {
1187 classNameId, classPK,
1188
1189 start, end, orderByComparator
1190 };
1191 }
1192
1193 List<TrashVersion> list = (List<TrashVersion>)FinderCacheUtil.getResult(finderPath,
1194 finderArgs, this);
1195
1196 if ((list != null) && !list.isEmpty()) {
1197 for (TrashVersion trashVersion : list) {
1198 if ((classNameId != trashVersion.getClassNameId()) ||
1199 (classPK != trashVersion.getClassPK())) {
1200 list = null;
1201
1202 break;
1203 }
1204 }
1205 }
1206
1207 if (list == null) {
1208 StringBundler query = null;
1209
1210 if (orderByComparator != null) {
1211 query = new StringBundler(4 +
1212 (orderByComparator.getOrderByFields().length * 3));
1213 }
1214 else {
1215 query = new StringBundler(4);
1216 }
1217
1218 query.append(_SQL_SELECT_TRASHVERSION_WHERE);
1219
1220 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1221
1222 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1223
1224 if (orderByComparator != null) {
1225 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1226 orderByComparator);
1227 }
1228 else
1229 if (pagination) {
1230 query.append(TrashVersionModelImpl.ORDER_BY_JPQL);
1231 }
1232
1233 String sql = query.toString();
1234
1235 Session session = null;
1236
1237 try {
1238 session = openSession();
1239
1240 Query q = session.createQuery(sql);
1241
1242 QueryPos qPos = QueryPos.getInstance(q);
1243
1244 qPos.add(classNameId);
1245
1246 qPos.add(classPK);
1247
1248 if (!pagination) {
1249 list = (List<TrashVersion>)QueryUtil.list(q, getDialect(),
1250 start, end, false);
1251
1252 Collections.sort(list);
1253
1254 list = new UnmodifiableList<TrashVersion>(list);
1255 }
1256 else {
1257 list = (List<TrashVersion>)QueryUtil.list(q, getDialect(),
1258 start, end);
1259 }
1260
1261 cacheResult(list);
1262
1263 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1264 }
1265 catch (Exception e) {
1266 FinderCacheUtil.removeResult(finderPath, finderArgs);
1267
1268 throw processException(e);
1269 }
1270 finally {
1271 closeSession(session);
1272 }
1273 }
1274
1275 return list;
1276 }
1277
1278
1288 @Override
1289 public TrashVersion findByC_C_First(long classNameId, long classPK,
1290 OrderByComparator orderByComparator)
1291 throws NoSuchVersionException, SystemException {
1292 TrashVersion trashVersion = fetchByC_C_First(classNameId, classPK,
1293 orderByComparator);
1294
1295 if (trashVersion != null) {
1296 return trashVersion;
1297 }
1298
1299 StringBundler msg = new StringBundler(6);
1300
1301 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1302
1303 msg.append("classNameId=");
1304 msg.append(classNameId);
1305
1306 msg.append(", classPK=");
1307 msg.append(classPK);
1308
1309 msg.append(StringPool.CLOSE_CURLY_BRACE);
1310
1311 throw new NoSuchVersionException(msg.toString());
1312 }
1313
1314
1323 @Override
1324 public TrashVersion fetchByC_C_First(long classNameId, long classPK,
1325 OrderByComparator orderByComparator) throws SystemException {
1326 List<TrashVersion> list = findByC_C(classNameId, classPK, 0, 1,
1327 orderByComparator);
1328
1329 if (!list.isEmpty()) {
1330 return list.get(0);
1331 }
1332
1333 return null;
1334 }
1335
1336
1346 @Override
1347 public TrashVersion findByC_C_Last(long classNameId, long classPK,
1348 OrderByComparator orderByComparator)
1349 throws NoSuchVersionException, SystemException {
1350 TrashVersion trashVersion = fetchByC_C_Last(classNameId, classPK,
1351 orderByComparator);
1352
1353 if (trashVersion != null) {
1354 return trashVersion;
1355 }
1356
1357 StringBundler msg = new StringBundler(6);
1358
1359 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1360
1361 msg.append("classNameId=");
1362 msg.append(classNameId);
1363
1364 msg.append(", classPK=");
1365 msg.append(classPK);
1366
1367 msg.append(StringPool.CLOSE_CURLY_BRACE);
1368
1369 throw new NoSuchVersionException(msg.toString());
1370 }
1371
1372
1381 @Override
1382 public TrashVersion fetchByC_C_Last(long classNameId, long classPK,
1383 OrderByComparator orderByComparator) throws SystemException {
1384 int count = countByC_C(classNameId, classPK);
1385
1386 if (count == 0) {
1387 return null;
1388 }
1389
1390 List<TrashVersion> list = findByC_C(classNameId, classPK, count - 1,
1391 count, orderByComparator);
1392
1393 if (!list.isEmpty()) {
1394 return list.get(0);
1395 }
1396
1397 return null;
1398 }
1399
1400
1411 @Override
1412 public TrashVersion[] findByC_C_PrevAndNext(long versionId,
1413 long classNameId, long classPK, OrderByComparator orderByComparator)
1414 throws NoSuchVersionException, SystemException {
1415 TrashVersion trashVersion = findByPrimaryKey(versionId);
1416
1417 Session session = null;
1418
1419 try {
1420 session = openSession();
1421
1422 TrashVersion[] array = new TrashVersionImpl[3];
1423
1424 array[0] = getByC_C_PrevAndNext(session, trashVersion, classNameId,
1425 classPK, orderByComparator, true);
1426
1427 array[1] = trashVersion;
1428
1429 array[2] = getByC_C_PrevAndNext(session, trashVersion, classNameId,
1430 classPK, orderByComparator, false);
1431
1432 return array;
1433 }
1434 catch (Exception e) {
1435 throw processException(e);
1436 }
1437 finally {
1438 closeSession(session);
1439 }
1440 }
1441
1442 protected TrashVersion getByC_C_PrevAndNext(Session session,
1443 TrashVersion trashVersion, long classNameId, long classPK,
1444 OrderByComparator orderByComparator, boolean previous) {
1445 StringBundler query = null;
1446
1447 if (orderByComparator != null) {
1448 query = new StringBundler(6 +
1449 (orderByComparator.getOrderByFields().length * 6));
1450 }
1451 else {
1452 query = new StringBundler(3);
1453 }
1454
1455 query.append(_SQL_SELECT_TRASHVERSION_WHERE);
1456
1457 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1458
1459 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1460
1461 if (orderByComparator != null) {
1462 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1463
1464 if (orderByConditionFields.length > 0) {
1465 query.append(WHERE_AND);
1466 }
1467
1468 for (int i = 0; i < orderByConditionFields.length; i++) {
1469 query.append(_ORDER_BY_ENTITY_ALIAS);
1470 query.append(orderByConditionFields[i]);
1471
1472 if ((i + 1) < orderByConditionFields.length) {
1473 if (orderByComparator.isAscending() ^ previous) {
1474 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1475 }
1476 else {
1477 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1478 }
1479 }
1480 else {
1481 if (orderByComparator.isAscending() ^ previous) {
1482 query.append(WHERE_GREATER_THAN);
1483 }
1484 else {
1485 query.append(WHERE_LESSER_THAN);
1486 }
1487 }
1488 }
1489
1490 query.append(ORDER_BY_CLAUSE);
1491
1492 String[] orderByFields = orderByComparator.getOrderByFields();
1493
1494 for (int i = 0; i < orderByFields.length; i++) {
1495 query.append(_ORDER_BY_ENTITY_ALIAS);
1496 query.append(orderByFields[i]);
1497
1498 if ((i + 1) < orderByFields.length) {
1499 if (orderByComparator.isAscending() ^ previous) {
1500 query.append(ORDER_BY_ASC_HAS_NEXT);
1501 }
1502 else {
1503 query.append(ORDER_BY_DESC_HAS_NEXT);
1504 }
1505 }
1506 else {
1507 if (orderByComparator.isAscending() ^ previous) {
1508 query.append(ORDER_BY_ASC);
1509 }
1510 else {
1511 query.append(ORDER_BY_DESC);
1512 }
1513 }
1514 }
1515 }
1516 else {
1517 query.append(TrashVersionModelImpl.ORDER_BY_JPQL);
1518 }
1519
1520 String sql = query.toString();
1521
1522 Query q = session.createQuery(sql);
1523
1524 q.setFirstResult(0);
1525 q.setMaxResults(2);
1526
1527 QueryPos qPos = QueryPos.getInstance(q);
1528
1529 qPos.add(classNameId);
1530
1531 qPos.add(classPK);
1532
1533 if (orderByComparator != null) {
1534 Object[] values = orderByComparator.getOrderByConditionValues(trashVersion);
1535
1536 for (Object value : values) {
1537 qPos.add(value);
1538 }
1539 }
1540
1541 List<TrashVersion> list = q.list();
1542
1543 if (list.size() == 2) {
1544 return list.get(1);
1545 }
1546 else {
1547 return null;
1548 }
1549 }
1550
1551
1558 @Override
1559 public void removeByC_C(long classNameId, long classPK)
1560 throws SystemException {
1561 for (TrashVersion trashVersion : findByC_C(classNameId, classPK,
1562 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1563 remove(trashVersion);
1564 }
1565 }
1566
1567
1575 @Override
1576 public int countByC_C(long classNameId, long classPK)
1577 throws SystemException {
1578 FinderPath finderPath = FINDER_PATH_COUNT_BY_C_C;
1579
1580 Object[] finderArgs = new Object[] { classNameId, classPK };
1581
1582 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
1583 this);
1584
1585 if (count == null) {
1586 StringBundler query = new StringBundler(3);
1587
1588 query.append(_SQL_COUNT_TRASHVERSION_WHERE);
1589
1590 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1591
1592 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1593
1594 String sql = query.toString();
1595
1596 Session session = null;
1597
1598 try {
1599 session = openSession();
1600
1601 Query q = session.createQuery(sql);
1602
1603 QueryPos qPos = QueryPos.getInstance(q);
1604
1605 qPos.add(classNameId);
1606
1607 qPos.add(classPK);
1608
1609 count = (Long)q.uniqueResult();
1610
1611 FinderCacheUtil.putResult(finderPath, finderArgs, count);
1612 }
1613 catch (Exception e) {
1614 FinderCacheUtil.removeResult(finderPath, finderArgs);
1615
1616 throw processException(e);
1617 }
1618 finally {
1619 closeSession(session);
1620 }
1621 }
1622
1623 return count.intValue();
1624 }
1625
1626 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "trashVersion.classNameId = ? AND ";
1627 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "trashVersion.classPK = ?";
1628 public static final FinderPath FINDER_PATH_FETCH_BY_E_C_C = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
1629 TrashVersionModelImpl.FINDER_CACHE_ENABLED, TrashVersionImpl.class,
1630 FINDER_CLASS_NAME_ENTITY, "fetchByE_C_C",
1631 new String[] {
1632 Long.class.getName(), Long.class.getName(), Long.class.getName()
1633 },
1634 TrashVersionModelImpl.ENTRYID_COLUMN_BITMASK |
1635 TrashVersionModelImpl.CLASSNAMEID_COLUMN_BITMASK |
1636 TrashVersionModelImpl.CLASSPK_COLUMN_BITMASK);
1637 public static final FinderPath FINDER_PATH_COUNT_BY_E_C_C = new FinderPath(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
1638 TrashVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
1639 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByE_C_C",
1640 new String[] {
1641 Long.class.getName(), Long.class.getName(), Long.class.getName()
1642 });
1643
1644
1654 @Override
1655 public TrashVersion findByE_C_C(long entryId, long classNameId, long classPK)
1656 throws NoSuchVersionException, SystemException {
1657 TrashVersion trashVersion = fetchByE_C_C(entryId, classNameId, classPK);
1658
1659 if (trashVersion == null) {
1660 StringBundler msg = new StringBundler(8);
1661
1662 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1663
1664 msg.append("entryId=");
1665 msg.append(entryId);
1666
1667 msg.append(", classNameId=");
1668 msg.append(classNameId);
1669
1670 msg.append(", classPK=");
1671 msg.append(classPK);
1672
1673 msg.append(StringPool.CLOSE_CURLY_BRACE);
1674
1675 if (_log.isWarnEnabled()) {
1676 _log.warn(msg.toString());
1677 }
1678
1679 throw new NoSuchVersionException(msg.toString());
1680 }
1681
1682 return trashVersion;
1683 }
1684
1685
1694 @Override
1695 public TrashVersion fetchByE_C_C(long entryId, long classNameId,
1696 long classPK) throws SystemException {
1697 return fetchByE_C_C(entryId, classNameId, classPK, true);
1698 }
1699
1700
1710 @Override
1711 public TrashVersion fetchByE_C_C(long entryId, long classNameId,
1712 long classPK, boolean retrieveFromCache) throws SystemException {
1713 Object[] finderArgs = new Object[] { entryId, classNameId, classPK };
1714
1715 Object result = null;
1716
1717 if (retrieveFromCache) {
1718 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_E_C_C,
1719 finderArgs, this);
1720 }
1721
1722 if (result instanceof TrashVersion) {
1723 TrashVersion trashVersion = (TrashVersion)result;
1724
1725 if ((entryId != trashVersion.getEntryId()) ||
1726 (classNameId != trashVersion.getClassNameId()) ||
1727 (classPK != trashVersion.getClassPK())) {
1728 result = null;
1729 }
1730 }
1731
1732 if (result == null) {
1733 StringBundler query = new StringBundler(5);
1734
1735 query.append(_SQL_SELECT_TRASHVERSION_WHERE);
1736
1737 query.append(_FINDER_COLUMN_E_C_C_ENTRYID_2);
1738
1739 query.append(_FINDER_COLUMN_E_C_C_CLASSNAMEID_2);
1740
1741 query.append(_FINDER_COLUMN_E_C_C_CLASSPK_2);
1742
1743 String sql = query.toString();
1744
1745 Session session = null;
1746
1747 try {
1748 session = openSession();
1749
1750 Query q = session.createQuery(sql);
1751
1752 QueryPos qPos = QueryPos.getInstance(q);
1753
1754 qPos.add(entryId);
1755
1756 qPos.add(classNameId);
1757
1758 qPos.add(classPK);
1759
1760 List<TrashVersion> list = q.list();
1761
1762 if (list.isEmpty()) {
1763 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_C_C,
1764 finderArgs, list);
1765 }
1766 else {
1767 TrashVersion trashVersion = list.get(0);
1768
1769 result = trashVersion;
1770
1771 cacheResult(trashVersion);
1772
1773 if ((trashVersion.getEntryId() != entryId) ||
1774 (trashVersion.getClassNameId() != classNameId) ||
1775 (trashVersion.getClassPK() != classPK)) {
1776 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_C_C,
1777 finderArgs, trashVersion);
1778 }
1779 }
1780 }
1781 catch (Exception e) {
1782 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_E_C_C,
1783 finderArgs);
1784
1785 throw processException(e);
1786 }
1787 finally {
1788 closeSession(session);
1789 }
1790 }
1791
1792 if (result instanceof List<?>) {
1793 return null;
1794 }
1795 else {
1796 return (TrashVersion)result;
1797 }
1798 }
1799
1800
1809 @Override
1810 public TrashVersion removeByE_C_C(long entryId, long classNameId,
1811 long classPK) throws NoSuchVersionException, SystemException {
1812 TrashVersion trashVersion = findByE_C_C(entryId, classNameId, classPK);
1813
1814 return remove(trashVersion);
1815 }
1816
1817
1826 @Override
1827 public int countByE_C_C(long entryId, long classNameId, long classPK)
1828 throws SystemException {
1829 FinderPath finderPath = FINDER_PATH_COUNT_BY_E_C_C;
1830
1831 Object[] finderArgs = new Object[] { entryId, classNameId, classPK };
1832
1833 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
1834 this);
1835
1836 if (count == null) {
1837 StringBundler query = new StringBundler(4);
1838
1839 query.append(_SQL_COUNT_TRASHVERSION_WHERE);
1840
1841 query.append(_FINDER_COLUMN_E_C_C_ENTRYID_2);
1842
1843 query.append(_FINDER_COLUMN_E_C_C_CLASSNAMEID_2);
1844
1845 query.append(_FINDER_COLUMN_E_C_C_CLASSPK_2);
1846
1847 String sql = query.toString();
1848
1849 Session session = null;
1850
1851 try {
1852 session = openSession();
1853
1854 Query q = session.createQuery(sql);
1855
1856 QueryPos qPos = QueryPos.getInstance(q);
1857
1858 qPos.add(entryId);
1859
1860 qPos.add(classNameId);
1861
1862 qPos.add(classPK);
1863
1864 count = (Long)q.uniqueResult();
1865
1866 FinderCacheUtil.putResult(finderPath, finderArgs, count);
1867 }
1868 catch (Exception e) {
1869 FinderCacheUtil.removeResult(finderPath, finderArgs);
1870
1871 throw processException(e);
1872 }
1873 finally {
1874 closeSession(session);
1875 }
1876 }
1877
1878 return count.intValue();
1879 }
1880
1881 private static final String _FINDER_COLUMN_E_C_C_ENTRYID_2 = "trashVersion.entryId = ? AND ";
1882 private static final String _FINDER_COLUMN_E_C_C_CLASSNAMEID_2 = "trashVersion.classNameId = ? AND ";
1883 private static final String _FINDER_COLUMN_E_C_C_CLASSPK_2 = "trashVersion.classPK = ?";
1884
1885 public TrashVersionPersistenceImpl() {
1886 setModelClass(TrashVersion.class);
1887 }
1888
1889
1894 @Override
1895 public void cacheResult(TrashVersion trashVersion) {
1896 EntityCacheUtil.putResult(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
1897 TrashVersionImpl.class, trashVersion.getPrimaryKey(), trashVersion);
1898
1899 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_C_C,
1900 new Object[] {
1901 trashVersion.getEntryId(), trashVersion.getClassNameId(),
1902 trashVersion.getClassPK()
1903 }, trashVersion);
1904
1905 trashVersion.resetOriginalValues();
1906 }
1907
1908
1913 @Override
1914 public void cacheResult(List<TrashVersion> trashVersions) {
1915 for (TrashVersion trashVersion : trashVersions) {
1916 if (EntityCacheUtil.getResult(
1917 TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
1918 TrashVersionImpl.class, trashVersion.getPrimaryKey()) == null) {
1919 cacheResult(trashVersion);
1920 }
1921 else {
1922 trashVersion.resetOriginalValues();
1923 }
1924 }
1925 }
1926
1927
1934 @Override
1935 public void clearCache() {
1936 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
1937 CacheRegistryUtil.clear(TrashVersionImpl.class.getName());
1938 }
1939
1940 EntityCacheUtil.clearCache(TrashVersionImpl.class.getName());
1941
1942 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
1943 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1944 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1945 }
1946
1947
1954 @Override
1955 public void clearCache(TrashVersion trashVersion) {
1956 EntityCacheUtil.removeResult(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
1957 TrashVersionImpl.class, trashVersion.getPrimaryKey());
1958
1959 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1960 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1961
1962 clearUniqueFindersCache(trashVersion);
1963 }
1964
1965 @Override
1966 public void clearCache(List<TrashVersion> trashVersions) {
1967 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1968 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1969
1970 for (TrashVersion trashVersion : trashVersions) {
1971 EntityCacheUtil.removeResult(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
1972 TrashVersionImpl.class, trashVersion.getPrimaryKey());
1973
1974 clearUniqueFindersCache(trashVersion);
1975 }
1976 }
1977
1978 protected void cacheUniqueFindersCache(TrashVersion trashVersion) {
1979 if (trashVersion.isNew()) {
1980 Object[] args = new Object[] {
1981 trashVersion.getEntryId(), trashVersion.getClassNameId(),
1982 trashVersion.getClassPK()
1983 };
1984
1985 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_E_C_C, args,
1986 Long.valueOf(1));
1987 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_C_C, args,
1988 trashVersion);
1989 }
1990 else {
1991 TrashVersionModelImpl trashVersionModelImpl = (TrashVersionModelImpl)trashVersion;
1992
1993 if ((trashVersionModelImpl.getColumnBitmask() &
1994 FINDER_PATH_FETCH_BY_E_C_C.getColumnBitmask()) != 0) {
1995 Object[] args = new Object[] {
1996 trashVersion.getEntryId(), trashVersion.getClassNameId(),
1997 trashVersion.getClassPK()
1998 };
1999
2000 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_E_C_C, args,
2001 Long.valueOf(1));
2002 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_C_C, args,
2003 trashVersion);
2004 }
2005 }
2006 }
2007
2008 protected void clearUniqueFindersCache(TrashVersion trashVersion) {
2009 TrashVersionModelImpl trashVersionModelImpl = (TrashVersionModelImpl)trashVersion;
2010
2011 Object[] args = new Object[] {
2012 trashVersion.getEntryId(), trashVersion.getClassNameId(),
2013 trashVersion.getClassPK()
2014 };
2015
2016 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E_C_C, args);
2017 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_E_C_C, args);
2018
2019 if ((trashVersionModelImpl.getColumnBitmask() &
2020 FINDER_PATH_FETCH_BY_E_C_C.getColumnBitmask()) != 0) {
2021 args = new Object[] {
2022 trashVersionModelImpl.getOriginalEntryId(),
2023 trashVersionModelImpl.getOriginalClassNameId(),
2024 trashVersionModelImpl.getOriginalClassPK()
2025 };
2026
2027 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E_C_C, args);
2028 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_E_C_C, args);
2029 }
2030 }
2031
2032
2038 @Override
2039 public TrashVersion create(long versionId) {
2040 TrashVersion trashVersion = new TrashVersionImpl();
2041
2042 trashVersion.setNew(true);
2043 trashVersion.setPrimaryKey(versionId);
2044
2045 return trashVersion;
2046 }
2047
2048
2056 @Override
2057 public TrashVersion remove(long versionId)
2058 throws NoSuchVersionException, SystemException {
2059 return remove((Serializable)versionId);
2060 }
2061
2062
2070 @Override
2071 public TrashVersion remove(Serializable primaryKey)
2072 throws NoSuchVersionException, SystemException {
2073 Session session = null;
2074
2075 try {
2076 session = openSession();
2077
2078 TrashVersion trashVersion = (TrashVersion)session.get(TrashVersionImpl.class,
2079 primaryKey);
2080
2081 if (trashVersion == null) {
2082 if (_log.isWarnEnabled()) {
2083 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
2084 }
2085
2086 throw new NoSuchVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
2087 primaryKey);
2088 }
2089
2090 return remove(trashVersion);
2091 }
2092 catch (NoSuchVersionException nsee) {
2093 throw nsee;
2094 }
2095 catch (Exception e) {
2096 throw processException(e);
2097 }
2098 finally {
2099 closeSession(session);
2100 }
2101 }
2102
2103 @Override
2104 protected TrashVersion removeImpl(TrashVersion trashVersion)
2105 throws SystemException {
2106 trashVersion = toUnwrappedModel(trashVersion);
2107
2108 Session session = null;
2109
2110 try {
2111 session = openSession();
2112
2113 if (!session.contains(trashVersion)) {
2114 trashVersion = (TrashVersion)session.get(TrashVersionImpl.class,
2115 trashVersion.getPrimaryKeyObj());
2116 }
2117
2118 if (trashVersion != null) {
2119 session.delete(trashVersion);
2120 }
2121 }
2122 catch (Exception e) {
2123 throw processException(e);
2124 }
2125 finally {
2126 closeSession(session);
2127 }
2128
2129 if (trashVersion != null) {
2130 clearCache(trashVersion);
2131 }
2132
2133 return trashVersion;
2134 }
2135
2136 @Override
2137 public TrashVersion updateImpl(
2138 com.liferay.portlet.trash.model.TrashVersion trashVersion)
2139 throws SystemException {
2140 trashVersion = toUnwrappedModel(trashVersion);
2141
2142 boolean isNew = trashVersion.isNew();
2143
2144 TrashVersionModelImpl trashVersionModelImpl = (TrashVersionModelImpl)trashVersion;
2145
2146 Session session = null;
2147
2148 try {
2149 session = openSession();
2150
2151 if (trashVersion.isNew()) {
2152 session.save(trashVersion);
2153
2154 trashVersion.setNew(false);
2155 }
2156 else {
2157 session.merge(trashVersion);
2158 }
2159 }
2160 catch (Exception e) {
2161 throw processException(e);
2162 }
2163 finally {
2164 closeSession(session);
2165 }
2166
2167 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2168
2169 if (isNew || !TrashVersionModelImpl.COLUMN_BITMASK_ENABLED) {
2170 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2171 }
2172
2173 else {
2174 if ((trashVersionModelImpl.getColumnBitmask() &
2175 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTRYID.getColumnBitmask()) != 0) {
2176 Object[] args = new Object[] {
2177 trashVersionModelImpl.getOriginalEntryId()
2178 };
2179
2180 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ENTRYID, args);
2181 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTRYID,
2182 args);
2183
2184 args = new Object[] { trashVersionModelImpl.getEntryId() };
2185
2186 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ENTRYID, args);
2187 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTRYID,
2188 args);
2189 }
2190
2191 if ((trashVersionModelImpl.getColumnBitmask() &
2192 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E_C.getColumnBitmask()) != 0) {
2193 Object[] args = new Object[] {
2194 trashVersionModelImpl.getOriginalEntryId(),
2195 trashVersionModelImpl.getOriginalClassNameId()
2196 };
2197
2198 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E_C, args);
2199 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E_C,
2200 args);
2201
2202 args = new Object[] {
2203 trashVersionModelImpl.getEntryId(),
2204 trashVersionModelImpl.getClassNameId()
2205 };
2206
2207 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E_C, args);
2208 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E_C,
2209 args);
2210 }
2211
2212 if ((trashVersionModelImpl.getColumnBitmask() &
2213 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C.getColumnBitmask()) != 0) {
2214 Object[] args = new Object[] {
2215 trashVersionModelImpl.getOriginalClassNameId(),
2216 trashVersionModelImpl.getOriginalClassPK()
2217 };
2218
2219 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
2220 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
2221 args);
2222
2223 args = new Object[] {
2224 trashVersionModelImpl.getClassNameId(),
2225 trashVersionModelImpl.getClassPK()
2226 };
2227
2228 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
2229 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
2230 args);
2231 }
2232 }
2233
2234 EntityCacheUtil.putResult(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
2235 TrashVersionImpl.class, trashVersion.getPrimaryKey(), trashVersion);
2236
2237 clearUniqueFindersCache(trashVersion);
2238 cacheUniqueFindersCache(trashVersion);
2239
2240 return trashVersion;
2241 }
2242
2243 protected TrashVersion toUnwrappedModel(TrashVersion trashVersion) {
2244 if (trashVersion instanceof TrashVersionImpl) {
2245 return trashVersion;
2246 }
2247
2248 TrashVersionImpl trashVersionImpl = new TrashVersionImpl();
2249
2250 trashVersionImpl.setNew(trashVersion.isNew());
2251 trashVersionImpl.setPrimaryKey(trashVersion.getPrimaryKey());
2252
2253 trashVersionImpl.setVersionId(trashVersion.getVersionId());
2254 trashVersionImpl.setEntryId(trashVersion.getEntryId());
2255 trashVersionImpl.setClassNameId(trashVersion.getClassNameId());
2256 trashVersionImpl.setClassPK(trashVersion.getClassPK());
2257 trashVersionImpl.setTypeSettings(trashVersion.getTypeSettings());
2258 trashVersionImpl.setStatus(trashVersion.getStatus());
2259
2260 return trashVersionImpl;
2261 }
2262
2263
2271 @Override
2272 public TrashVersion findByPrimaryKey(Serializable primaryKey)
2273 throws NoSuchVersionException, SystemException {
2274 TrashVersion trashVersion = fetchByPrimaryKey(primaryKey);
2275
2276 if (trashVersion == null) {
2277 if (_log.isWarnEnabled()) {
2278 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
2279 }
2280
2281 throw new NoSuchVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
2282 primaryKey);
2283 }
2284
2285 return trashVersion;
2286 }
2287
2288
2296 @Override
2297 public TrashVersion findByPrimaryKey(long versionId)
2298 throws NoSuchVersionException, SystemException {
2299 return findByPrimaryKey((Serializable)versionId);
2300 }
2301
2302
2309 @Override
2310 public TrashVersion fetchByPrimaryKey(Serializable primaryKey)
2311 throws SystemException {
2312 TrashVersion trashVersion = (TrashVersion)EntityCacheUtil.getResult(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
2313 TrashVersionImpl.class, primaryKey);
2314
2315 if (trashVersion == _nullTrashVersion) {
2316 return null;
2317 }
2318
2319 if (trashVersion == null) {
2320 Session session = null;
2321
2322 try {
2323 session = openSession();
2324
2325 trashVersion = (TrashVersion)session.get(TrashVersionImpl.class,
2326 primaryKey);
2327
2328 if (trashVersion != null) {
2329 cacheResult(trashVersion);
2330 }
2331 else {
2332 EntityCacheUtil.putResult(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
2333 TrashVersionImpl.class, primaryKey, _nullTrashVersion);
2334 }
2335 }
2336 catch (Exception e) {
2337 EntityCacheUtil.removeResult(TrashVersionModelImpl.ENTITY_CACHE_ENABLED,
2338 TrashVersionImpl.class, primaryKey);
2339
2340 throw processException(e);
2341 }
2342 finally {
2343 closeSession(session);
2344 }
2345 }
2346
2347 return trashVersion;
2348 }
2349
2350
2357 @Override
2358 public TrashVersion fetchByPrimaryKey(long versionId)
2359 throws SystemException {
2360 return fetchByPrimaryKey((Serializable)versionId);
2361 }
2362
2363
2369 @Override
2370 public List<TrashVersion> findAll() throws SystemException {
2371 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2372 }
2373
2374
2386 @Override
2387 public List<TrashVersion> findAll(int start, int end)
2388 throws SystemException {
2389 return findAll(start, end, null);
2390 }
2391
2392
2405 @Override
2406 public List<TrashVersion> findAll(int start, int end,
2407 OrderByComparator orderByComparator) throws SystemException {
2408 boolean pagination = true;
2409 FinderPath finderPath = null;
2410 Object[] finderArgs = null;
2411
2412 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2413 (orderByComparator == null)) {
2414 pagination = false;
2415 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2416 finderArgs = FINDER_ARGS_EMPTY;
2417 }
2418 else {
2419 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2420 finderArgs = new Object[] { start, end, orderByComparator };
2421 }
2422
2423 List<TrashVersion> list = (List<TrashVersion>)FinderCacheUtil.getResult(finderPath,
2424 finderArgs, this);
2425
2426 if (list == null) {
2427 StringBundler query = null;
2428 String sql = null;
2429
2430 if (orderByComparator != null) {
2431 query = new StringBundler(2 +
2432 (orderByComparator.getOrderByFields().length * 3));
2433
2434 query.append(_SQL_SELECT_TRASHVERSION);
2435
2436 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2437 orderByComparator);
2438
2439 sql = query.toString();
2440 }
2441 else {
2442 sql = _SQL_SELECT_TRASHVERSION;
2443
2444 if (pagination) {
2445 sql = sql.concat(TrashVersionModelImpl.ORDER_BY_JPQL);
2446 }
2447 }
2448
2449 Session session = null;
2450
2451 try {
2452 session = openSession();
2453
2454 Query q = session.createQuery(sql);
2455
2456 if (!pagination) {
2457 list = (List<TrashVersion>)QueryUtil.list(q, getDialect(),
2458 start, end, false);
2459
2460 Collections.sort(list);
2461
2462 list = new UnmodifiableList<TrashVersion>(list);
2463 }
2464 else {
2465 list = (List<TrashVersion>)QueryUtil.list(q, getDialect(),
2466 start, end);
2467 }
2468
2469 cacheResult(list);
2470
2471 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2472 }
2473 catch (Exception e) {
2474 FinderCacheUtil.removeResult(finderPath, finderArgs);
2475
2476 throw processException(e);
2477 }
2478 finally {
2479 closeSession(session);
2480 }
2481 }
2482
2483 return list;
2484 }
2485
2486
2491 @Override
2492 public void removeAll() throws SystemException {
2493 for (TrashVersion trashVersion : findAll()) {
2494 remove(trashVersion);
2495 }
2496 }
2497
2498
2504 @Override
2505 public int countAll() throws SystemException {
2506 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2507 FINDER_ARGS_EMPTY, this);
2508
2509 if (count == null) {
2510 Session session = null;
2511
2512 try {
2513 session = openSession();
2514
2515 Query q = session.createQuery(_SQL_COUNT_TRASHVERSION);
2516
2517 count = (Long)q.uniqueResult();
2518
2519 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2520 FINDER_ARGS_EMPTY, count);
2521 }
2522 catch (Exception e) {
2523 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
2524 FINDER_ARGS_EMPTY);
2525
2526 throw processException(e);
2527 }
2528 finally {
2529 closeSession(session);
2530 }
2531 }
2532
2533 return count.intValue();
2534 }
2535
2536
2539 public void afterPropertiesSet() {
2540 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2541 com.liferay.portal.util.PropsUtil.get(
2542 "value.object.listener.com.liferay.portlet.trash.model.TrashVersion")));
2543
2544 if (listenerClassNames.length > 0) {
2545 try {
2546 List<ModelListener<TrashVersion>> listenersList = new ArrayList<ModelListener<TrashVersion>>();
2547
2548 for (String listenerClassName : listenerClassNames) {
2549 listenersList.add((ModelListener<TrashVersion>)InstanceFactory.newInstance(
2550 getClassLoader(), listenerClassName));
2551 }
2552
2553 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2554 }
2555 catch (Exception e) {
2556 _log.error(e);
2557 }
2558 }
2559 }
2560
2561 public void destroy() {
2562 EntityCacheUtil.removeCache(TrashVersionImpl.class.getName());
2563 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2564 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2565 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2566 }
2567
2568 private static final String _SQL_SELECT_TRASHVERSION = "SELECT trashVersion FROM TrashVersion trashVersion";
2569 private static final String _SQL_SELECT_TRASHVERSION_WHERE = "SELECT trashVersion FROM TrashVersion trashVersion WHERE ";
2570 private static final String _SQL_COUNT_TRASHVERSION = "SELECT COUNT(trashVersion) FROM TrashVersion trashVersion";
2571 private static final String _SQL_COUNT_TRASHVERSION_WHERE = "SELECT COUNT(trashVersion) FROM TrashVersion trashVersion WHERE ";
2572 private static final String _ORDER_BY_ENTITY_ALIAS = "trashVersion.";
2573 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No TrashVersion exists with the primary key ";
2574 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No TrashVersion exists with the key {";
2575 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2576 private static Log _log = LogFactoryUtil.getLog(TrashVersionPersistenceImpl.class);
2577 private static TrashVersion _nullTrashVersion = new TrashVersionImpl() {
2578 @Override
2579 public Object clone() {
2580 return this;
2581 }
2582
2583 @Override
2584 public CacheModel<TrashVersion> toCacheModel() {
2585 return _nullTrashVersionCacheModel;
2586 }
2587 };
2588
2589 private static CacheModel<TrashVersion> _nullTrashVersionCacheModel = new CacheModel<TrashVersion>() {
2590 @Override
2591 public TrashVersion toEntityModel() {
2592 return _nullTrashVersion;
2593 }
2594 };
2595 }