001
014
015 package com.liferay.portlet.documentlibrary.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.Session;
027 import com.liferay.portal.kernel.exception.SystemException;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.GetterUtil;
031 import com.liferay.portal.kernel.util.InstanceFactory;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.StringBundler;
034 import com.liferay.portal.kernel.util.StringPool;
035 import com.liferay.portal.kernel.util.StringUtil;
036 import com.liferay.portal.model.CacheModel;
037 import com.liferay.portal.model.ModelListener;
038 import com.liferay.portal.service.persistence.BatchSessionUtil;
039 import com.liferay.portal.service.persistence.ResourcePersistence;
040 import com.liferay.portal.service.persistence.UserPersistence;
041 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
042
043 import com.liferay.portlet.documentlibrary.NoSuchFileVersionException;
044 import com.liferay.portlet.documentlibrary.model.DLFileVersion;
045 import com.liferay.portlet.documentlibrary.model.impl.DLFileVersionImpl;
046 import com.liferay.portlet.documentlibrary.model.impl.DLFileVersionModelImpl;
047
048 import java.io.Serializable;
049
050 import java.util.ArrayList;
051 import java.util.Collections;
052 import java.util.List;
053
054
066 public class DLFileVersionPersistenceImpl extends BasePersistenceImpl<DLFileVersion>
067 implements DLFileVersionPersistence {
068
073 public static final String FINDER_CLASS_NAME_ENTITY = DLFileVersionImpl.class.getName();
074 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
075 ".List1";
076 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
077 ".List2";
078 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_FILEENTRYID =
079 new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
080 DLFileVersionModelImpl.FINDER_CACHE_ENABLED,
081 DLFileVersionImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
082 "findByFileEntryId",
083 new String[] {
084 Long.class.getName(),
085
086 "java.lang.Integer", "java.lang.Integer",
087 "com.liferay.portal.kernel.util.OrderByComparator"
088 });
089 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FILEENTRYID =
090 new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
091 DLFileVersionModelImpl.FINDER_CACHE_ENABLED,
092 DLFileVersionImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
093 "findByFileEntryId", new String[] { Long.class.getName() },
094 DLFileVersionModelImpl.FILEENTRYID_COLUMN_BITMASK);
095 public static final FinderPath FINDER_PATH_COUNT_BY_FILEENTRYID = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
096 DLFileVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
097 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByFileEntryId",
098 new String[] { Long.class.getName() });
099 public static final FinderPath FINDER_PATH_FETCH_BY_F_V = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
100 DLFileVersionModelImpl.FINDER_CACHE_ENABLED,
101 DLFileVersionImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByF_V",
102 new String[] { Long.class.getName(), String.class.getName() },
103 DLFileVersionModelImpl.FILEENTRYID_COLUMN_BITMASK |
104 DLFileVersionModelImpl.VERSION_COLUMN_BITMASK);
105 public static final FinderPath FINDER_PATH_COUNT_BY_F_V = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
106 DLFileVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
107 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByF_V",
108 new String[] { Long.class.getName(), String.class.getName() });
109 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_F_S = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
110 DLFileVersionModelImpl.FINDER_CACHE_ENABLED,
111 DLFileVersionImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
112 "findByF_S",
113 new String[] {
114 Long.class.getName(), Integer.class.getName(),
115
116 "java.lang.Integer", "java.lang.Integer",
117 "com.liferay.portal.kernel.util.OrderByComparator"
118 });
119 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_F_S = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
120 DLFileVersionModelImpl.FINDER_CACHE_ENABLED,
121 DLFileVersionImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
122 "findByF_S",
123 new String[] { Long.class.getName(), Integer.class.getName() },
124 DLFileVersionModelImpl.FILEENTRYID_COLUMN_BITMASK |
125 DLFileVersionModelImpl.STATUS_COLUMN_BITMASK);
126 public static final FinderPath FINDER_PATH_COUNT_BY_F_S = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
127 DLFileVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
128 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByF_S",
129 new String[] { Long.class.getName(), Integer.class.getName() });
130 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_F_S = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
131 DLFileVersionModelImpl.FINDER_CACHE_ENABLED,
132 DLFileVersionImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
133 "findByG_F_S",
134 new String[] {
135 Long.class.getName(), Long.class.getName(),
136 Integer.class.getName(),
137
138 "java.lang.Integer", "java.lang.Integer",
139 "com.liferay.portal.kernel.util.OrderByComparator"
140 });
141 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_S = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
142 DLFileVersionModelImpl.FINDER_CACHE_ENABLED,
143 DLFileVersionImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
144 "findByG_F_S",
145 new String[] {
146 Long.class.getName(), Long.class.getName(),
147 Integer.class.getName()
148 },
149 DLFileVersionModelImpl.GROUPID_COLUMN_BITMASK |
150 DLFileVersionModelImpl.FOLDERID_COLUMN_BITMASK |
151 DLFileVersionModelImpl.STATUS_COLUMN_BITMASK);
152 public static final FinderPath FINDER_PATH_COUNT_BY_G_F_S = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
153 DLFileVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
154 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_F_S",
155 new String[] {
156 Long.class.getName(), Long.class.getName(),
157 Integer.class.getName()
158 });
159 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
160 DLFileVersionModelImpl.FINDER_CACHE_ENABLED,
161 DLFileVersionImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
162 "findAll", new String[0]);
163 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
164 DLFileVersionModelImpl.FINDER_CACHE_ENABLED,
165 DLFileVersionImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
166 "findAll", new String[0]);
167 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
168 DLFileVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
169 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
170
171
176 public void cacheResult(DLFileVersion dlFileVersion) {
177 EntityCacheUtil.putResult(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
178 DLFileVersionImpl.class, dlFileVersion.getPrimaryKey(),
179 dlFileVersion);
180
181 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_F_V,
182 new Object[] {
183 Long.valueOf(dlFileVersion.getFileEntryId()),
184
185 dlFileVersion.getVersion()
186 }, dlFileVersion);
187
188 dlFileVersion.resetOriginalValues();
189 }
190
191
196 public void cacheResult(List<DLFileVersion> dlFileVersions) {
197 for (DLFileVersion dlFileVersion : dlFileVersions) {
198 if (EntityCacheUtil.getResult(
199 DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
200 DLFileVersionImpl.class, dlFileVersion.getPrimaryKey()) == null) {
201 cacheResult(dlFileVersion);
202 }
203 else {
204 dlFileVersion.resetOriginalValues();
205 }
206 }
207 }
208
209
216 @Override
217 public void clearCache() {
218 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
219 CacheRegistryUtil.clear(DLFileVersionImpl.class.getName());
220 }
221
222 EntityCacheUtil.clearCache(DLFileVersionImpl.class.getName());
223
224 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
225 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
226 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
227 }
228
229
236 @Override
237 public void clearCache(DLFileVersion dlFileVersion) {
238 EntityCacheUtil.removeResult(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
239 DLFileVersionImpl.class, dlFileVersion.getPrimaryKey());
240
241 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
242 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
243
244 clearUniqueFindersCache(dlFileVersion);
245 }
246
247 @Override
248 public void clearCache(List<DLFileVersion> dlFileVersions) {
249 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
250 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
251
252 for (DLFileVersion dlFileVersion : dlFileVersions) {
253 EntityCacheUtil.removeResult(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
254 DLFileVersionImpl.class, dlFileVersion.getPrimaryKey());
255
256 clearUniqueFindersCache(dlFileVersion);
257 }
258 }
259
260 protected void clearUniqueFindersCache(DLFileVersion dlFileVersion) {
261 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_F_V,
262 new Object[] {
263 Long.valueOf(dlFileVersion.getFileEntryId()),
264
265 dlFileVersion.getVersion()
266 });
267 }
268
269
275 public DLFileVersion create(long fileVersionId) {
276 DLFileVersion dlFileVersion = new DLFileVersionImpl();
277
278 dlFileVersion.setNew(true);
279 dlFileVersion.setPrimaryKey(fileVersionId);
280
281 return dlFileVersion;
282 }
283
284
292 public DLFileVersion remove(long fileVersionId)
293 throws NoSuchFileVersionException, SystemException {
294 return remove(Long.valueOf(fileVersionId));
295 }
296
297
305 @Override
306 public DLFileVersion remove(Serializable primaryKey)
307 throws NoSuchFileVersionException, SystemException {
308 Session session = null;
309
310 try {
311 session = openSession();
312
313 DLFileVersion dlFileVersion = (DLFileVersion)session.get(DLFileVersionImpl.class,
314 primaryKey);
315
316 if (dlFileVersion == null) {
317 if (_log.isWarnEnabled()) {
318 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
319 }
320
321 throw new NoSuchFileVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
322 primaryKey);
323 }
324
325 return remove(dlFileVersion);
326 }
327 catch (NoSuchFileVersionException nsee) {
328 throw nsee;
329 }
330 catch (Exception e) {
331 throw processException(e);
332 }
333 finally {
334 closeSession(session);
335 }
336 }
337
338 @Override
339 protected DLFileVersion removeImpl(DLFileVersion dlFileVersion)
340 throws SystemException {
341 dlFileVersion = toUnwrappedModel(dlFileVersion);
342
343 Session session = null;
344
345 try {
346 session = openSession();
347
348 BatchSessionUtil.delete(session, dlFileVersion);
349 }
350 catch (Exception e) {
351 throw processException(e);
352 }
353 finally {
354 closeSession(session);
355 }
356
357 clearCache(dlFileVersion);
358
359 return dlFileVersion;
360 }
361
362 @Override
363 public DLFileVersion updateImpl(
364 com.liferay.portlet.documentlibrary.model.DLFileVersion dlFileVersion,
365 boolean merge) throws SystemException {
366 dlFileVersion = toUnwrappedModel(dlFileVersion);
367
368 boolean isNew = dlFileVersion.isNew();
369
370 DLFileVersionModelImpl dlFileVersionModelImpl = (DLFileVersionModelImpl)dlFileVersion;
371
372 Session session = null;
373
374 try {
375 session = openSession();
376
377 BatchSessionUtil.update(session, dlFileVersion, merge);
378
379 dlFileVersion.setNew(false);
380 }
381 catch (Exception e) {
382 throw processException(e);
383 }
384 finally {
385 closeSession(session);
386 }
387
388 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
389
390 if (isNew || !DLFileVersionModelImpl.COLUMN_BITMASK_ENABLED) {
391 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
392 }
393
394 else {
395 if ((dlFileVersionModelImpl.getColumnBitmask() &
396 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FILEENTRYID.getColumnBitmask()) != 0) {
397 Object[] args = new Object[] {
398 Long.valueOf(dlFileVersionModelImpl.getOriginalFileEntryId())
399 };
400
401 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FILEENTRYID,
402 args);
403 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FILEENTRYID,
404 args);
405
406 args = new Object[] {
407 Long.valueOf(dlFileVersionModelImpl.getFileEntryId())
408 };
409
410 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FILEENTRYID,
411 args);
412 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FILEENTRYID,
413 args);
414 }
415
416 if ((dlFileVersionModelImpl.getColumnBitmask() &
417 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_F_S.getColumnBitmask()) != 0) {
418 Object[] args = new Object[] {
419 Long.valueOf(dlFileVersionModelImpl.getOriginalFileEntryId()),
420 Integer.valueOf(dlFileVersionModelImpl.getOriginalStatus())
421 };
422
423 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_F_S, args);
424 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_F_S,
425 args);
426
427 args = new Object[] {
428 Long.valueOf(dlFileVersionModelImpl.getFileEntryId()),
429 Integer.valueOf(dlFileVersionModelImpl.getStatus())
430 };
431
432 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_F_S, args);
433 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_F_S,
434 args);
435 }
436
437 if ((dlFileVersionModelImpl.getColumnBitmask() &
438 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_S.getColumnBitmask()) != 0) {
439 Object[] args = new Object[] {
440 Long.valueOf(dlFileVersionModelImpl.getOriginalGroupId()),
441 Long.valueOf(dlFileVersionModelImpl.getOriginalFolderId()),
442 Integer.valueOf(dlFileVersionModelImpl.getOriginalStatus())
443 };
444
445 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_F_S, args);
446 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_S,
447 args);
448
449 args = new Object[] {
450 Long.valueOf(dlFileVersionModelImpl.getGroupId()),
451 Long.valueOf(dlFileVersionModelImpl.getFolderId()),
452 Integer.valueOf(dlFileVersionModelImpl.getStatus())
453 };
454
455 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_F_S, args);
456 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_S,
457 args);
458 }
459 }
460
461 EntityCacheUtil.putResult(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
462 DLFileVersionImpl.class, dlFileVersion.getPrimaryKey(),
463 dlFileVersion);
464
465 if (isNew) {
466 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_F_V,
467 new Object[] {
468 Long.valueOf(dlFileVersion.getFileEntryId()),
469
470 dlFileVersion.getVersion()
471 }, dlFileVersion);
472 }
473 else {
474 if ((dlFileVersionModelImpl.getColumnBitmask() &
475 FINDER_PATH_FETCH_BY_F_V.getColumnBitmask()) != 0) {
476 Object[] args = new Object[] {
477 Long.valueOf(dlFileVersionModelImpl.getOriginalFileEntryId()),
478
479 dlFileVersionModelImpl.getOriginalVersion()
480 };
481
482 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_F_V, args);
483 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_F_V, args);
484
485 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_F_V,
486 new Object[] {
487 Long.valueOf(dlFileVersion.getFileEntryId()),
488
489 dlFileVersion.getVersion()
490 }, dlFileVersion);
491 }
492 }
493
494 return dlFileVersion;
495 }
496
497 protected DLFileVersion toUnwrappedModel(DLFileVersion dlFileVersion) {
498 if (dlFileVersion instanceof DLFileVersionImpl) {
499 return dlFileVersion;
500 }
501
502 DLFileVersionImpl dlFileVersionImpl = new DLFileVersionImpl();
503
504 dlFileVersionImpl.setNew(dlFileVersion.isNew());
505 dlFileVersionImpl.setPrimaryKey(dlFileVersion.getPrimaryKey());
506
507 dlFileVersionImpl.setFileVersionId(dlFileVersion.getFileVersionId());
508 dlFileVersionImpl.setGroupId(dlFileVersion.getGroupId());
509 dlFileVersionImpl.setCompanyId(dlFileVersion.getCompanyId());
510 dlFileVersionImpl.setUserId(dlFileVersion.getUserId());
511 dlFileVersionImpl.setUserName(dlFileVersion.getUserName());
512 dlFileVersionImpl.setCreateDate(dlFileVersion.getCreateDate());
513 dlFileVersionImpl.setModifiedDate(dlFileVersion.getModifiedDate());
514 dlFileVersionImpl.setRepositoryId(dlFileVersion.getRepositoryId());
515 dlFileVersionImpl.setFolderId(dlFileVersion.getFolderId());
516 dlFileVersionImpl.setFileEntryId(dlFileVersion.getFileEntryId());
517 dlFileVersionImpl.setExtension(dlFileVersion.getExtension());
518 dlFileVersionImpl.setMimeType(dlFileVersion.getMimeType());
519 dlFileVersionImpl.setTitle(dlFileVersion.getTitle());
520 dlFileVersionImpl.setDescription(dlFileVersion.getDescription());
521 dlFileVersionImpl.setChangeLog(dlFileVersion.getChangeLog());
522 dlFileVersionImpl.setExtraSettings(dlFileVersion.getExtraSettings());
523 dlFileVersionImpl.setFileEntryTypeId(dlFileVersion.getFileEntryTypeId());
524 dlFileVersionImpl.setVersion(dlFileVersion.getVersion());
525 dlFileVersionImpl.setSize(dlFileVersion.getSize());
526 dlFileVersionImpl.setStatus(dlFileVersion.getStatus());
527 dlFileVersionImpl.setStatusByUserId(dlFileVersion.getStatusByUserId());
528 dlFileVersionImpl.setStatusByUserName(dlFileVersion.getStatusByUserName());
529 dlFileVersionImpl.setStatusDate(dlFileVersion.getStatusDate());
530
531 return dlFileVersionImpl;
532 }
533
534
542 @Override
543 public DLFileVersion findByPrimaryKey(Serializable primaryKey)
544 throws NoSuchModelException, SystemException {
545 return findByPrimaryKey(((Long)primaryKey).longValue());
546 }
547
548
556 public DLFileVersion findByPrimaryKey(long fileVersionId)
557 throws NoSuchFileVersionException, SystemException {
558 DLFileVersion dlFileVersion = fetchByPrimaryKey(fileVersionId);
559
560 if (dlFileVersion == null) {
561 if (_log.isWarnEnabled()) {
562 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + fileVersionId);
563 }
564
565 throw new NoSuchFileVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
566 fileVersionId);
567 }
568
569 return dlFileVersion;
570 }
571
572
579 @Override
580 public DLFileVersion fetchByPrimaryKey(Serializable primaryKey)
581 throws SystemException {
582 return fetchByPrimaryKey(((Long)primaryKey).longValue());
583 }
584
585
592 public DLFileVersion fetchByPrimaryKey(long fileVersionId)
593 throws SystemException {
594 DLFileVersion dlFileVersion = (DLFileVersion)EntityCacheUtil.getResult(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
595 DLFileVersionImpl.class, fileVersionId);
596
597 if (dlFileVersion == _nullDLFileVersion) {
598 return null;
599 }
600
601 if (dlFileVersion == null) {
602 Session session = null;
603
604 boolean hasException = false;
605
606 try {
607 session = openSession();
608
609 dlFileVersion = (DLFileVersion)session.get(DLFileVersionImpl.class,
610 Long.valueOf(fileVersionId));
611 }
612 catch (Exception e) {
613 hasException = true;
614
615 throw processException(e);
616 }
617 finally {
618 if (dlFileVersion != null) {
619 cacheResult(dlFileVersion);
620 }
621 else if (!hasException) {
622 EntityCacheUtil.putResult(DLFileVersionModelImpl.ENTITY_CACHE_ENABLED,
623 DLFileVersionImpl.class, fileVersionId,
624 _nullDLFileVersion);
625 }
626
627 closeSession(session);
628 }
629 }
630
631 return dlFileVersion;
632 }
633
634
641 public List<DLFileVersion> findByFileEntryId(long fileEntryId)
642 throws SystemException {
643 return findByFileEntryId(fileEntryId, QueryUtil.ALL_POS,
644 QueryUtil.ALL_POS, null);
645 }
646
647
660 public List<DLFileVersion> findByFileEntryId(long fileEntryId, int start,
661 int end) throws SystemException {
662 return findByFileEntryId(fileEntryId, start, end, null);
663 }
664
665
679 public List<DLFileVersion> findByFileEntryId(long fileEntryId, int start,
680 int end, OrderByComparator orderByComparator) throws SystemException {
681 FinderPath finderPath = null;
682 Object[] finderArgs = null;
683
684 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
685 (orderByComparator == null)) {
686 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FILEENTRYID;
687 finderArgs = new Object[] { fileEntryId };
688 }
689 else {
690 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_FILEENTRYID;
691 finderArgs = new Object[] { fileEntryId, start, end, orderByComparator };
692 }
693
694 List<DLFileVersion> list = (List<DLFileVersion>)FinderCacheUtil.getResult(finderPath,
695 finderArgs, this);
696
697 if (list == null) {
698 StringBundler query = null;
699
700 if (orderByComparator != null) {
701 query = new StringBundler(3 +
702 (orderByComparator.getOrderByFields().length * 3));
703 }
704 else {
705 query = new StringBundler(3);
706 }
707
708 query.append(_SQL_SELECT_DLFILEVERSION_WHERE);
709
710 query.append(_FINDER_COLUMN_FILEENTRYID_FILEENTRYID_2);
711
712 if (orderByComparator != null) {
713 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
714 orderByComparator);
715 }
716
717 else {
718 query.append(DLFileVersionModelImpl.ORDER_BY_JPQL);
719 }
720
721 String sql = query.toString();
722
723 Session session = null;
724
725 try {
726 session = openSession();
727
728 Query q = session.createQuery(sql);
729
730 QueryPos qPos = QueryPos.getInstance(q);
731
732 qPos.add(fileEntryId);
733
734 list = (List<DLFileVersion>)QueryUtil.list(q, getDialect(),
735 start, end);
736 }
737 catch (Exception e) {
738 throw processException(e);
739 }
740 finally {
741 if (list == null) {
742 FinderCacheUtil.removeResult(finderPath, finderArgs);
743 }
744 else {
745 cacheResult(list);
746
747 FinderCacheUtil.putResult(finderPath, finderArgs, list);
748 }
749
750 closeSession(session);
751 }
752 }
753
754 return list;
755 }
756
757
770 public DLFileVersion findByFileEntryId_First(long fileEntryId,
771 OrderByComparator orderByComparator)
772 throws NoSuchFileVersionException, SystemException {
773 List<DLFileVersion> list = findByFileEntryId(fileEntryId, 0, 1,
774 orderByComparator);
775
776 if (list.isEmpty()) {
777 StringBundler msg = new StringBundler(4);
778
779 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
780
781 msg.append("fileEntryId=");
782 msg.append(fileEntryId);
783
784 msg.append(StringPool.CLOSE_CURLY_BRACE);
785
786 throw new NoSuchFileVersionException(msg.toString());
787 }
788 else {
789 return list.get(0);
790 }
791 }
792
793
806 public DLFileVersion findByFileEntryId_Last(long fileEntryId,
807 OrderByComparator orderByComparator)
808 throws NoSuchFileVersionException, SystemException {
809 int count = countByFileEntryId(fileEntryId);
810
811 List<DLFileVersion> list = findByFileEntryId(fileEntryId, count - 1,
812 count, orderByComparator);
813
814 if (list.isEmpty()) {
815 StringBundler msg = new StringBundler(4);
816
817 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
818
819 msg.append("fileEntryId=");
820 msg.append(fileEntryId);
821
822 msg.append(StringPool.CLOSE_CURLY_BRACE);
823
824 throw new NoSuchFileVersionException(msg.toString());
825 }
826 else {
827 return list.get(0);
828 }
829 }
830
831
845 public DLFileVersion[] findByFileEntryId_PrevAndNext(long fileVersionId,
846 long fileEntryId, OrderByComparator orderByComparator)
847 throws NoSuchFileVersionException, SystemException {
848 DLFileVersion dlFileVersion = findByPrimaryKey(fileVersionId);
849
850 Session session = null;
851
852 try {
853 session = openSession();
854
855 DLFileVersion[] array = new DLFileVersionImpl[3];
856
857 array[0] = getByFileEntryId_PrevAndNext(session, dlFileVersion,
858 fileEntryId, orderByComparator, true);
859
860 array[1] = dlFileVersion;
861
862 array[2] = getByFileEntryId_PrevAndNext(session, dlFileVersion,
863 fileEntryId, orderByComparator, false);
864
865 return array;
866 }
867 catch (Exception e) {
868 throw processException(e);
869 }
870 finally {
871 closeSession(session);
872 }
873 }
874
875 protected DLFileVersion getByFileEntryId_PrevAndNext(Session session,
876 DLFileVersion dlFileVersion, long fileEntryId,
877 OrderByComparator orderByComparator, boolean previous) {
878 StringBundler query = null;
879
880 if (orderByComparator != null) {
881 query = new StringBundler(6 +
882 (orderByComparator.getOrderByFields().length * 6));
883 }
884 else {
885 query = new StringBundler(3);
886 }
887
888 query.append(_SQL_SELECT_DLFILEVERSION_WHERE);
889
890 query.append(_FINDER_COLUMN_FILEENTRYID_FILEENTRYID_2);
891
892 if (orderByComparator != null) {
893 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
894
895 if (orderByConditionFields.length > 0) {
896 query.append(WHERE_AND);
897 }
898
899 for (int i = 0; i < orderByConditionFields.length; i++) {
900 query.append(_ORDER_BY_ENTITY_ALIAS);
901 query.append(orderByConditionFields[i]);
902
903 if ((i + 1) < orderByConditionFields.length) {
904 if (orderByComparator.isAscending() ^ previous) {
905 query.append(WHERE_GREATER_THAN_HAS_NEXT);
906 }
907 else {
908 query.append(WHERE_LESSER_THAN_HAS_NEXT);
909 }
910 }
911 else {
912 if (orderByComparator.isAscending() ^ previous) {
913 query.append(WHERE_GREATER_THAN);
914 }
915 else {
916 query.append(WHERE_LESSER_THAN);
917 }
918 }
919 }
920
921 query.append(ORDER_BY_CLAUSE);
922
923 String[] orderByFields = orderByComparator.getOrderByFields();
924
925 for (int i = 0; i < orderByFields.length; i++) {
926 query.append(_ORDER_BY_ENTITY_ALIAS);
927 query.append(orderByFields[i]);
928
929 if ((i + 1) < orderByFields.length) {
930 if (orderByComparator.isAscending() ^ previous) {
931 query.append(ORDER_BY_ASC_HAS_NEXT);
932 }
933 else {
934 query.append(ORDER_BY_DESC_HAS_NEXT);
935 }
936 }
937 else {
938 if (orderByComparator.isAscending() ^ previous) {
939 query.append(ORDER_BY_ASC);
940 }
941 else {
942 query.append(ORDER_BY_DESC);
943 }
944 }
945 }
946 }
947
948 else {
949 query.append(DLFileVersionModelImpl.ORDER_BY_JPQL);
950 }
951
952 String sql = query.toString();
953
954 Query q = session.createQuery(sql);
955
956 q.setFirstResult(0);
957 q.setMaxResults(2);
958
959 QueryPos qPos = QueryPos.getInstance(q);
960
961 qPos.add(fileEntryId);
962
963 if (orderByComparator != null) {
964 Object[] values = orderByComparator.getOrderByConditionValues(dlFileVersion);
965
966 for (Object value : values) {
967 qPos.add(value);
968 }
969 }
970
971 List<DLFileVersion> list = q.list();
972
973 if (list.size() == 2) {
974 return list.get(1);
975 }
976 else {
977 return null;
978 }
979 }
980
981
990 public DLFileVersion findByF_V(long fileEntryId, String version)
991 throws NoSuchFileVersionException, SystemException {
992 DLFileVersion dlFileVersion = fetchByF_V(fileEntryId, version);
993
994 if (dlFileVersion == null) {
995 StringBundler msg = new StringBundler(6);
996
997 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
998
999 msg.append("fileEntryId=");
1000 msg.append(fileEntryId);
1001
1002 msg.append(", version=");
1003 msg.append(version);
1004
1005 msg.append(StringPool.CLOSE_CURLY_BRACE);
1006
1007 if (_log.isWarnEnabled()) {
1008 _log.warn(msg.toString());
1009 }
1010
1011 throw new NoSuchFileVersionException(msg.toString());
1012 }
1013
1014 return dlFileVersion;
1015 }
1016
1017
1025 public DLFileVersion fetchByF_V(long fileEntryId, String version)
1026 throws SystemException {
1027 return fetchByF_V(fileEntryId, version, true);
1028 }
1029
1030
1039 public DLFileVersion fetchByF_V(long fileEntryId, String version,
1040 boolean retrieveFromCache) throws SystemException {
1041 Object[] finderArgs = new Object[] { fileEntryId, version };
1042
1043 Object result = null;
1044
1045 if (retrieveFromCache) {
1046 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_F_V,
1047 finderArgs, this);
1048 }
1049
1050 if (result == null) {
1051 StringBundler query = new StringBundler(4);
1052
1053 query.append(_SQL_SELECT_DLFILEVERSION_WHERE);
1054
1055 query.append(_FINDER_COLUMN_F_V_FILEENTRYID_2);
1056
1057 if (version == null) {
1058 query.append(_FINDER_COLUMN_F_V_VERSION_1);
1059 }
1060 else {
1061 if (version.equals(StringPool.BLANK)) {
1062 query.append(_FINDER_COLUMN_F_V_VERSION_3);
1063 }
1064 else {
1065 query.append(_FINDER_COLUMN_F_V_VERSION_2);
1066 }
1067 }
1068
1069 query.append(DLFileVersionModelImpl.ORDER_BY_JPQL);
1070
1071 String sql = query.toString();
1072
1073 Session session = null;
1074
1075 try {
1076 session = openSession();
1077
1078 Query q = session.createQuery(sql);
1079
1080 QueryPos qPos = QueryPos.getInstance(q);
1081
1082 qPos.add(fileEntryId);
1083
1084 if (version != null) {
1085 qPos.add(version);
1086 }
1087
1088 List<DLFileVersion> list = q.list();
1089
1090 result = list;
1091
1092 DLFileVersion dlFileVersion = null;
1093
1094 if (list.isEmpty()) {
1095 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_F_V,
1096 finderArgs, list);
1097 }
1098 else {
1099 dlFileVersion = list.get(0);
1100
1101 cacheResult(dlFileVersion);
1102
1103 if ((dlFileVersion.getFileEntryId() != fileEntryId) ||
1104 (dlFileVersion.getVersion() == null) ||
1105 !dlFileVersion.getVersion().equals(version)) {
1106 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_F_V,
1107 finderArgs, dlFileVersion);
1108 }
1109 }
1110
1111 return dlFileVersion;
1112 }
1113 catch (Exception e) {
1114 throw processException(e);
1115 }
1116 finally {
1117 if (result == null) {
1118 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_F_V,
1119 finderArgs);
1120 }
1121
1122 closeSession(session);
1123 }
1124 }
1125 else {
1126 if (result instanceof List<?>) {
1127 return null;
1128 }
1129 else {
1130 return (DLFileVersion)result;
1131 }
1132 }
1133 }
1134
1135
1143 public List<DLFileVersion> findByF_S(long fileEntryId, int status)
1144 throws SystemException {
1145 return findByF_S(fileEntryId, status, QueryUtil.ALL_POS,
1146 QueryUtil.ALL_POS, null);
1147 }
1148
1149
1163 public List<DLFileVersion> findByF_S(long fileEntryId, int status,
1164 int start, int end) throws SystemException {
1165 return findByF_S(fileEntryId, status, start, end, null);
1166 }
1167
1168
1183 public List<DLFileVersion> findByF_S(long fileEntryId, int status,
1184 int start, int end, OrderByComparator orderByComparator)
1185 throws SystemException {
1186 FinderPath finderPath = null;
1187 Object[] finderArgs = null;
1188
1189 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1190 (orderByComparator == null)) {
1191 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_F_S;
1192 finderArgs = new Object[] { fileEntryId, status };
1193 }
1194 else {
1195 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_F_S;
1196 finderArgs = new Object[] {
1197 fileEntryId, status,
1198
1199 start, end, orderByComparator
1200 };
1201 }
1202
1203 List<DLFileVersion> list = (List<DLFileVersion>)FinderCacheUtil.getResult(finderPath,
1204 finderArgs, this);
1205
1206 if (list == null) {
1207 StringBundler query = null;
1208
1209 if (orderByComparator != null) {
1210 query = new StringBundler(4 +
1211 (orderByComparator.getOrderByFields().length * 3));
1212 }
1213 else {
1214 query = new StringBundler(4);
1215 }
1216
1217 query.append(_SQL_SELECT_DLFILEVERSION_WHERE);
1218
1219 query.append(_FINDER_COLUMN_F_S_FILEENTRYID_2);
1220
1221 query.append(_FINDER_COLUMN_F_S_STATUS_2);
1222
1223 if (orderByComparator != null) {
1224 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1225 orderByComparator);
1226 }
1227
1228 else {
1229 query.append(DLFileVersionModelImpl.ORDER_BY_JPQL);
1230 }
1231
1232 String sql = query.toString();
1233
1234 Session session = null;
1235
1236 try {
1237 session = openSession();
1238
1239 Query q = session.createQuery(sql);
1240
1241 QueryPos qPos = QueryPos.getInstance(q);
1242
1243 qPos.add(fileEntryId);
1244
1245 qPos.add(status);
1246
1247 list = (List<DLFileVersion>)QueryUtil.list(q, getDialect(),
1248 start, end);
1249 }
1250 catch (Exception e) {
1251 throw processException(e);
1252 }
1253 finally {
1254 if (list == null) {
1255 FinderCacheUtil.removeResult(finderPath, finderArgs);
1256 }
1257 else {
1258 cacheResult(list);
1259
1260 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1261 }
1262
1263 closeSession(session);
1264 }
1265 }
1266
1267 return list;
1268 }
1269
1270
1284 public DLFileVersion findByF_S_First(long fileEntryId, int status,
1285 OrderByComparator orderByComparator)
1286 throws NoSuchFileVersionException, SystemException {
1287 List<DLFileVersion> list = findByF_S(fileEntryId, status, 0, 1,
1288 orderByComparator);
1289
1290 if (list.isEmpty()) {
1291 StringBundler msg = new StringBundler(6);
1292
1293 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1294
1295 msg.append("fileEntryId=");
1296 msg.append(fileEntryId);
1297
1298 msg.append(", status=");
1299 msg.append(status);
1300
1301 msg.append(StringPool.CLOSE_CURLY_BRACE);
1302
1303 throw new NoSuchFileVersionException(msg.toString());
1304 }
1305 else {
1306 return list.get(0);
1307 }
1308 }
1309
1310
1324 public DLFileVersion findByF_S_Last(long fileEntryId, int status,
1325 OrderByComparator orderByComparator)
1326 throws NoSuchFileVersionException, SystemException {
1327 int count = countByF_S(fileEntryId, status);
1328
1329 List<DLFileVersion> list = findByF_S(fileEntryId, status, count - 1,
1330 count, orderByComparator);
1331
1332 if (list.isEmpty()) {
1333 StringBundler msg = new StringBundler(6);
1334
1335 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1336
1337 msg.append("fileEntryId=");
1338 msg.append(fileEntryId);
1339
1340 msg.append(", status=");
1341 msg.append(status);
1342
1343 msg.append(StringPool.CLOSE_CURLY_BRACE);
1344
1345 throw new NoSuchFileVersionException(msg.toString());
1346 }
1347 else {
1348 return list.get(0);
1349 }
1350 }
1351
1352
1367 public DLFileVersion[] findByF_S_PrevAndNext(long fileVersionId,
1368 long fileEntryId, int status, OrderByComparator orderByComparator)
1369 throws NoSuchFileVersionException, SystemException {
1370 DLFileVersion dlFileVersion = findByPrimaryKey(fileVersionId);
1371
1372 Session session = null;
1373
1374 try {
1375 session = openSession();
1376
1377 DLFileVersion[] array = new DLFileVersionImpl[3];
1378
1379 array[0] = getByF_S_PrevAndNext(session, dlFileVersion,
1380 fileEntryId, status, orderByComparator, true);
1381
1382 array[1] = dlFileVersion;
1383
1384 array[2] = getByF_S_PrevAndNext(session, dlFileVersion,
1385 fileEntryId, status, orderByComparator, false);
1386
1387 return array;
1388 }
1389 catch (Exception e) {
1390 throw processException(e);
1391 }
1392 finally {
1393 closeSession(session);
1394 }
1395 }
1396
1397 protected DLFileVersion getByF_S_PrevAndNext(Session session,
1398 DLFileVersion dlFileVersion, long fileEntryId, int status,
1399 OrderByComparator orderByComparator, boolean previous) {
1400 StringBundler query = null;
1401
1402 if (orderByComparator != null) {
1403 query = new StringBundler(6 +
1404 (orderByComparator.getOrderByFields().length * 6));
1405 }
1406 else {
1407 query = new StringBundler(3);
1408 }
1409
1410 query.append(_SQL_SELECT_DLFILEVERSION_WHERE);
1411
1412 query.append(_FINDER_COLUMN_F_S_FILEENTRYID_2);
1413
1414 query.append(_FINDER_COLUMN_F_S_STATUS_2);
1415
1416 if (orderByComparator != null) {
1417 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1418
1419 if (orderByConditionFields.length > 0) {
1420 query.append(WHERE_AND);
1421 }
1422
1423 for (int i = 0; i < orderByConditionFields.length; i++) {
1424 query.append(_ORDER_BY_ENTITY_ALIAS);
1425 query.append(orderByConditionFields[i]);
1426
1427 if ((i + 1) < orderByConditionFields.length) {
1428 if (orderByComparator.isAscending() ^ previous) {
1429 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1430 }
1431 else {
1432 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1433 }
1434 }
1435 else {
1436 if (orderByComparator.isAscending() ^ previous) {
1437 query.append(WHERE_GREATER_THAN);
1438 }
1439 else {
1440 query.append(WHERE_LESSER_THAN);
1441 }
1442 }
1443 }
1444
1445 query.append(ORDER_BY_CLAUSE);
1446
1447 String[] orderByFields = orderByComparator.getOrderByFields();
1448
1449 for (int i = 0; i < orderByFields.length; i++) {
1450 query.append(_ORDER_BY_ENTITY_ALIAS);
1451 query.append(orderByFields[i]);
1452
1453 if ((i + 1) < orderByFields.length) {
1454 if (orderByComparator.isAscending() ^ previous) {
1455 query.append(ORDER_BY_ASC_HAS_NEXT);
1456 }
1457 else {
1458 query.append(ORDER_BY_DESC_HAS_NEXT);
1459 }
1460 }
1461 else {
1462 if (orderByComparator.isAscending() ^ previous) {
1463 query.append(ORDER_BY_ASC);
1464 }
1465 else {
1466 query.append(ORDER_BY_DESC);
1467 }
1468 }
1469 }
1470 }
1471
1472 else {
1473 query.append(DLFileVersionModelImpl.ORDER_BY_JPQL);
1474 }
1475
1476 String sql = query.toString();
1477
1478 Query q = session.createQuery(sql);
1479
1480 q.setFirstResult(0);
1481 q.setMaxResults(2);
1482
1483 QueryPos qPos = QueryPos.getInstance(q);
1484
1485 qPos.add(fileEntryId);
1486
1487 qPos.add(status);
1488
1489 if (orderByComparator != null) {
1490 Object[] values = orderByComparator.getOrderByConditionValues(dlFileVersion);
1491
1492 for (Object value : values) {
1493 qPos.add(value);
1494 }
1495 }
1496
1497 List<DLFileVersion> list = q.list();
1498
1499 if (list.size() == 2) {
1500 return list.get(1);
1501 }
1502 else {
1503 return null;
1504 }
1505 }
1506
1507
1516 public List<DLFileVersion> findByG_F_S(long groupId, long folderId,
1517 int status) throws SystemException {
1518 return findByG_F_S(groupId, folderId, status, QueryUtil.ALL_POS,
1519 QueryUtil.ALL_POS, null);
1520 }
1521
1522
1537 public List<DLFileVersion> findByG_F_S(long groupId, long folderId,
1538 int status, int start, int end) throws SystemException {
1539 return findByG_F_S(groupId, folderId, status, start, end, null);
1540 }
1541
1542
1558 public List<DLFileVersion> findByG_F_S(long groupId, long folderId,
1559 int status, int start, int end, OrderByComparator orderByComparator)
1560 throws SystemException {
1561 FinderPath finderPath = null;
1562 Object[] finderArgs = null;
1563
1564 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1565 (orderByComparator == null)) {
1566 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_S;
1567 finderArgs = new Object[] { groupId, folderId, status };
1568 }
1569 else {
1570 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_F_S;
1571 finderArgs = new Object[] {
1572 groupId, folderId, status,
1573
1574 start, end, orderByComparator
1575 };
1576 }
1577
1578 List<DLFileVersion> list = (List<DLFileVersion>)FinderCacheUtil.getResult(finderPath,
1579 finderArgs, this);
1580
1581 if (list == null) {
1582 StringBundler query = null;
1583
1584 if (orderByComparator != null) {
1585 query = new StringBundler(5 +
1586 (orderByComparator.getOrderByFields().length * 3));
1587 }
1588 else {
1589 query = new StringBundler(5);
1590 }
1591
1592 query.append(_SQL_SELECT_DLFILEVERSION_WHERE);
1593
1594 query.append(_FINDER_COLUMN_G_F_S_GROUPID_2);
1595
1596 query.append(_FINDER_COLUMN_G_F_S_FOLDERID_2);
1597
1598 query.append(_FINDER_COLUMN_G_F_S_STATUS_2);
1599
1600 if (orderByComparator != null) {
1601 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1602 orderByComparator);
1603 }
1604
1605 else {
1606 query.append(DLFileVersionModelImpl.ORDER_BY_JPQL);
1607 }
1608
1609 String sql = query.toString();
1610
1611 Session session = null;
1612
1613 try {
1614 session = openSession();
1615
1616 Query q = session.createQuery(sql);
1617
1618 QueryPos qPos = QueryPos.getInstance(q);
1619
1620 qPos.add(groupId);
1621
1622 qPos.add(folderId);
1623
1624 qPos.add(status);
1625
1626 list = (List<DLFileVersion>)QueryUtil.list(q, getDialect(),
1627 start, end);
1628 }
1629 catch (Exception e) {
1630 throw processException(e);
1631 }
1632 finally {
1633 if (list == null) {
1634 FinderCacheUtil.removeResult(finderPath, finderArgs);
1635 }
1636 else {
1637 cacheResult(list);
1638
1639 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1640 }
1641
1642 closeSession(session);
1643 }
1644 }
1645
1646 return list;
1647 }
1648
1649
1664 public DLFileVersion findByG_F_S_First(long groupId, long folderId,
1665 int status, OrderByComparator orderByComparator)
1666 throws NoSuchFileVersionException, SystemException {
1667 List<DLFileVersion> list = findByG_F_S(groupId, folderId, status, 0, 1,
1668 orderByComparator);
1669
1670 if (list.isEmpty()) {
1671 StringBundler msg = new StringBundler(8);
1672
1673 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1674
1675 msg.append("groupId=");
1676 msg.append(groupId);
1677
1678 msg.append(", folderId=");
1679 msg.append(folderId);
1680
1681 msg.append(", status=");
1682 msg.append(status);
1683
1684 msg.append(StringPool.CLOSE_CURLY_BRACE);
1685
1686 throw new NoSuchFileVersionException(msg.toString());
1687 }
1688 else {
1689 return list.get(0);
1690 }
1691 }
1692
1693
1708 public DLFileVersion findByG_F_S_Last(long groupId, long folderId,
1709 int status, OrderByComparator orderByComparator)
1710 throws NoSuchFileVersionException, SystemException {
1711 int count = countByG_F_S(groupId, folderId, status);
1712
1713 List<DLFileVersion> list = findByG_F_S(groupId, folderId, status,
1714 count - 1, count, orderByComparator);
1715
1716 if (list.isEmpty()) {
1717 StringBundler msg = new StringBundler(8);
1718
1719 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1720
1721 msg.append("groupId=");
1722 msg.append(groupId);
1723
1724 msg.append(", folderId=");
1725 msg.append(folderId);
1726
1727 msg.append(", status=");
1728 msg.append(status);
1729
1730 msg.append(StringPool.CLOSE_CURLY_BRACE);
1731
1732 throw new NoSuchFileVersionException(msg.toString());
1733 }
1734 else {
1735 return list.get(0);
1736 }
1737 }
1738
1739
1755 public DLFileVersion[] findByG_F_S_PrevAndNext(long fileVersionId,
1756 long groupId, long folderId, int status,
1757 OrderByComparator orderByComparator)
1758 throws NoSuchFileVersionException, SystemException {
1759 DLFileVersion dlFileVersion = findByPrimaryKey(fileVersionId);
1760
1761 Session session = null;
1762
1763 try {
1764 session = openSession();
1765
1766 DLFileVersion[] array = new DLFileVersionImpl[3];
1767
1768 array[0] = getByG_F_S_PrevAndNext(session, dlFileVersion, groupId,
1769 folderId, status, orderByComparator, true);
1770
1771 array[1] = dlFileVersion;
1772
1773 array[2] = getByG_F_S_PrevAndNext(session, dlFileVersion, groupId,
1774 folderId, status, orderByComparator, false);
1775
1776 return array;
1777 }
1778 catch (Exception e) {
1779 throw processException(e);
1780 }
1781 finally {
1782 closeSession(session);
1783 }
1784 }
1785
1786 protected DLFileVersion getByG_F_S_PrevAndNext(Session session,
1787 DLFileVersion dlFileVersion, long groupId, long folderId, int status,
1788 OrderByComparator orderByComparator, boolean previous) {
1789 StringBundler query = null;
1790
1791 if (orderByComparator != null) {
1792 query = new StringBundler(6 +
1793 (orderByComparator.getOrderByFields().length * 6));
1794 }
1795 else {
1796 query = new StringBundler(3);
1797 }
1798
1799 query.append(_SQL_SELECT_DLFILEVERSION_WHERE);
1800
1801 query.append(_FINDER_COLUMN_G_F_S_GROUPID_2);
1802
1803 query.append(_FINDER_COLUMN_G_F_S_FOLDERID_2);
1804
1805 query.append(_FINDER_COLUMN_G_F_S_STATUS_2);
1806
1807 if (orderByComparator != null) {
1808 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1809
1810 if (orderByConditionFields.length > 0) {
1811 query.append(WHERE_AND);
1812 }
1813
1814 for (int i = 0; i < orderByConditionFields.length; i++) {
1815 query.append(_ORDER_BY_ENTITY_ALIAS);
1816 query.append(orderByConditionFields[i]);
1817
1818 if ((i + 1) < orderByConditionFields.length) {
1819 if (orderByComparator.isAscending() ^ previous) {
1820 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1821 }
1822 else {
1823 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1824 }
1825 }
1826 else {
1827 if (orderByComparator.isAscending() ^ previous) {
1828 query.append(WHERE_GREATER_THAN);
1829 }
1830 else {
1831 query.append(WHERE_LESSER_THAN);
1832 }
1833 }
1834 }
1835
1836 query.append(ORDER_BY_CLAUSE);
1837
1838 String[] orderByFields = orderByComparator.getOrderByFields();
1839
1840 for (int i = 0; i < orderByFields.length; i++) {
1841 query.append(_ORDER_BY_ENTITY_ALIAS);
1842 query.append(orderByFields[i]);
1843
1844 if ((i + 1) < orderByFields.length) {
1845 if (orderByComparator.isAscending() ^ previous) {
1846 query.append(ORDER_BY_ASC_HAS_NEXT);
1847 }
1848 else {
1849 query.append(ORDER_BY_DESC_HAS_NEXT);
1850 }
1851 }
1852 else {
1853 if (orderByComparator.isAscending() ^ previous) {
1854 query.append(ORDER_BY_ASC);
1855 }
1856 else {
1857 query.append(ORDER_BY_DESC);
1858 }
1859 }
1860 }
1861 }
1862
1863 else {
1864 query.append(DLFileVersionModelImpl.ORDER_BY_JPQL);
1865 }
1866
1867 String sql = query.toString();
1868
1869 Query q = session.createQuery(sql);
1870
1871 q.setFirstResult(0);
1872 q.setMaxResults(2);
1873
1874 QueryPos qPos = QueryPos.getInstance(q);
1875
1876 qPos.add(groupId);
1877
1878 qPos.add(folderId);
1879
1880 qPos.add(status);
1881
1882 if (orderByComparator != null) {
1883 Object[] values = orderByComparator.getOrderByConditionValues(dlFileVersion);
1884
1885 for (Object value : values) {
1886 qPos.add(value);
1887 }
1888 }
1889
1890 List<DLFileVersion> list = q.list();
1891
1892 if (list.size() == 2) {
1893 return list.get(1);
1894 }
1895 else {
1896 return null;
1897 }
1898 }
1899
1900
1906 public List<DLFileVersion> findAll() throws SystemException {
1907 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1908 }
1909
1910
1922 public List<DLFileVersion> findAll(int start, int end)
1923 throws SystemException {
1924 return findAll(start, end, null);
1925 }
1926
1927
1940 public List<DLFileVersion> findAll(int start, int end,
1941 OrderByComparator orderByComparator) throws SystemException {
1942 FinderPath finderPath = null;
1943 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1944
1945 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1946 (orderByComparator == null)) {
1947 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1948 finderArgs = FINDER_ARGS_EMPTY;
1949 }
1950 else {
1951 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1952 finderArgs = new Object[] { start, end, orderByComparator };
1953 }
1954
1955 List<DLFileVersion> list = (List<DLFileVersion>)FinderCacheUtil.getResult(finderPath,
1956 finderArgs, this);
1957
1958 if (list == null) {
1959 StringBundler query = null;
1960 String sql = null;
1961
1962 if (orderByComparator != null) {
1963 query = new StringBundler(2 +
1964 (orderByComparator.getOrderByFields().length * 3));
1965
1966 query.append(_SQL_SELECT_DLFILEVERSION);
1967
1968 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1969 orderByComparator);
1970
1971 sql = query.toString();
1972 }
1973 else {
1974 sql = _SQL_SELECT_DLFILEVERSION.concat(DLFileVersionModelImpl.ORDER_BY_JPQL);
1975 }
1976
1977 Session session = null;
1978
1979 try {
1980 session = openSession();
1981
1982 Query q = session.createQuery(sql);
1983
1984 if (orderByComparator == null) {
1985 list = (List<DLFileVersion>)QueryUtil.list(q, getDialect(),
1986 start, end, false);
1987
1988 Collections.sort(list);
1989 }
1990 else {
1991 list = (List<DLFileVersion>)QueryUtil.list(q, getDialect(),
1992 start, end);
1993 }
1994 }
1995 catch (Exception e) {
1996 throw processException(e);
1997 }
1998 finally {
1999 if (list == null) {
2000 FinderCacheUtil.removeResult(finderPath, finderArgs);
2001 }
2002 else {
2003 cacheResult(list);
2004
2005 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2006 }
2007
2008 closeSession(session);
2009 }
2010 }
2011
2012 return list;
2013 }
2014
2015
2021 public void removeByFileEntryId(long fileEntryId) throws SystemException {
2022 for (DLFileVersion dlFileVersion : findByFileEntryId(fileEntryId)) {
2023 remove(dlFileVersion);
2024 }
2025 }
2026
2027
2034 public void removeByF_V(long fileEntryId, String version)
2035 throws NoSuchFileVersionException, SystemException {
2036 DLFileVersion dlFileVersion = findByF_V(fileEntryId, version);
2037
2038 remove(dlFileVersion);
2039 }
2040
2041
2048 public void removeByF_S(long fileEntryId, int status)
2049 throws SystemException {
2050 for (DLFileVersion dlFileVersion : findByF_S(fileEntryId, status)) {
2051 remove(dlFileVersion);
2052 }
2053 }
2054
2055
2063 public void removeByG_F_S(long groupId, long folderId, int status)
2064 throws SystemException {
2065 for (DLFileVersion dlFileVersion : findByG_F_S(groupId, folderId, status)) {
2066 remove(dlFileVersion);
2067 }
2068 }
2069
2070
2075 public void removeAll() throws SystemException {
2076 for (DLFileVersion dlFileVersion : findAll()) {
2077 remove(dlFileVersion);
2078 }
2079 }
2080
2081
2088 public int countByFileEntryId(long fileEntryId) throws SystemException {
2089 Object[] finderArgs = new Object[] { fileEntryId };
2090
2091 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FILEENTRYID,
2092 finderArgs, this);
2093
2094 if (count == null) {
2095 StringBundler query = new StringBundler(2);
2096
2097 query.append(_SQL_COUNT_DLFILEVERSION_WHERE);
2098
2099 query.append(_FINDER_COLUMN_FILEENTRYID_FILEENTRYID_2);
2100
2101 String sql = query.toString();
2102
2103 Session session = null;
2104
2105 try {
2106 session = openSession();
2107
2108 Query q = session.createQuery(sql);
2109
2110 QueryPos qPos = QueryPos.getInstance(q);
2111
2112 qPos.add(fileEntryId);
2113
2114 count = (Long)q.uniqueResult();
2115 }
2116 catch (Exception e) {
2117 throw processException(e);
2118 }
2119 finally {
2120 if (count == null) {
2121 count = Long.valueOf(0);
2122 }
2123
2124 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FILEENTRYID,
2125 finderArgs, count);
2126
2127 closeSession(session);
2128 }
2129 }
2130
2131 return count.intValue();
2132 }
2133
2134
2142 public int countByF_V(long fileEntryId, String version)
2143 throws SystemException {
2144 Object[] finderArgs = new Object[] { fileEntryId, version };
2145
2146 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_F_V,
2147 finderArgs, this);
2148
2149 if (count == null) {
2150 StringBundler query = new StringBundler(3);
2151
2152 query.append(_SQL_COUNT_DLFILEVERSION_WHERE);
2153
2154 query.append(_FINDER_COLUMN_F_V_FILEENTRYID_2);
2155
2156 if (version == null) {
2157 query.append(_FINDER_COLUMN_F_V_VERSION_1);
2158 }
2159 else {
2160 if (version.equals(StringPool.BLANK)) {
2161 query.append(_FINDER_COLUMN_F_V_VERSION_3);
2162 }
2163 else {
2164 query.append(_FINDER_COLUMN_F_V_VERSION_2);
2165 }
2166 }
2167
2168 String sql = query.toString();
2169
2170 Session session = null;
2171
2172 try {
2173 session = openSession();
2174
2175 Query q = session.createQuery(sql);
2176
2177 QueryPos qPos = QueryPos.getInstance(q);
2178
2179 qPos.add(fileEntryId);
2180
2181 if (version != null) {
2182 qPos.add(version);
2183 }
2184
2185 count = (Long)q.uniqueResult();
2186 }
2187 catch (Exception e) {
2188 throw processException(e);
2189 }
2190 finally {
2191 if (count == null) {
2192 count = Long.valueOf(0);
2193 }
2194
2195 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_F_V, finderArgs,
2196 count);
2197
2198 closeSession(session);
2199 }
2200 }
2201
2202 return count.intValue();
2203 }
2204
2205
2213 public int countByF_S(long fileEntryId, int status)
2214 throws SystemException {
2215 Object[] finderArgs = new Object[] { fileEntryId, status };
2216
2217 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_F_S,
2218 finderArgs, this);
2219
2220 if (count == null) {
2221 StringBundler query = new StringBundler(3);
2222
2223 query.append(_SQL_COUNT_DLFILEVERSION_WHERE);
2224
2225 query.append(_FINDER_COLUMN_F_S_FILEENTRYID_2);
2226
2227 query.append(_FINDER_COLUMN_F_S_STATUS_2);
2228
2229 String sql = query.toString();
2230
2231 Session session = null;
2232
2233 try {
2234 session = openSession();
2235
2236 Query q = session.createQuery(sql);
2237
2238 QueryPos qPos = QueryPos.getInstance(q);
2239
2240 qPos.add(fileEntryId);
2241
2242 qPos.add(status);
2243
2244 count = (Long)q.uniqueResult();
2245 }
2246 catch (Exception e) {
2247 throw processException(e);
2248 }
2249 finally {
2250 if (count == null) {
2251 count = Long.valueOf(0);
2252 }
2253
2254 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_F_S, finderArgs,
2255 count);
2256
2257 closeSession(session);
2258 }
2259 }
2260
2261 return count.intValue();
2262 }
2263
2264
2273 public int countByG_F_S(long groupId, long folderId, int status)
2274 throws SystemException {
2275 Object[] finderArgs = new Object[] { groupId, folderId, status };
2276
2277 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F_S,
2278 finderArgs, this);
2279
2280 if (count == null) {
2281 StringBundler query = new StringBundler(4);
2282
2283 query.append(_SQL_COUNT_DLFILEVERSION_WHERE);
2284
2285 query.append(_FINDER_COLUMN_G_F_S_GROUPID_2);
2286
2287 query.append(_FINDER_COLUMN_G_F_S_FOLDERID_2);
2288
2289 query.append(_FINDER_COLUMN_G_F_S_STATUS_2);
2290
2291 String sql = query.toString();
2292
2293 Session session = null;
2294
2295 try {
2296 session = openSession();
2297
2298 Query q = session.createQuery(sql);
2299
2300 QueryPos qPos = QueryPos.getInstance(q);
2301
2302 qPos.add(groupId);
2303
2304 qPos.add(folderId);
2305
2306 qPos.add(status);
2307
2308 count = (Long)q.uniqueResult();
2309 }
2310 catch (Exception e) {
2311 throw processException(e);
2312 }
2313 finally {
2314 if (count == null) {
2315 count = Long.valueOf(0);
2316 }
2317
2318 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F_S,
2319 finderArgs, count);
2320
2321 closeSession(session);
2322 }
2323 }
2324
2325 return count.intValue();
2326 }
2327
2328
2334 public int countAll() throws SystemException {
2335 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2336 FINDER_ARGS_EMPTY, this);
2337
2338 if (count == null) {
2339 Session session = null;
2340
2341 try {
2342 session = openSession();
2343
2344 Query q = session.createQuery(_SQL_COUNT_DLFILEVERSION);
2345
2346 count = (Long)q.uniqueResult();
2347 }
2348 catch (Exception e) {
2349 throw processException(e);
2350 }
2351 finally {
2352 if (count == null) {
2353 count = Long.valueOf(0);
2354 }
2355
2356 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2357 FINDER_ARGS_EMPTY, count);
2358
2359 closeSession(session);
2360 }
2361 }
2362
2363 return count.intValue();
2364 }
2365
2366
2369 public void afterPropertiesSet() {
2370 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2371 com.liferay.portal.util.PropsUtil.get(
2372 "value.object.listener.com.liferay.portlet.documentlibrary.model.DLFileVersion")));
2373
2374 if (listenerClassNames.length > 0) {
2375 try {
2376 List<ModelListener<DLFileVersion>> listenersList = new ArrayList<ModelListener<DLFileVersion>>();
2377
2378 for (String listenerClassName : listenerClassNames) {
2379 listenersList.add((ModelListener<DLFileVersion>)InstanceFactory.newInstance(
2380 listenerClassName));
2381 }
2382
2383 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2384 }
2385 catch (Exception e) {
2386 _log.error(e);
2387 }
2388 }
2389 }
2390
2391 public void destroy() {
2392 EntityCacheUtil.removeCache(DLFileVersionImpl.class.getName());
2393 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2394 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2395 }
2396
2397 @BeanReference(type = DLContentPersistence.class)
2398 protected DLContentPersistence dlContentPersistence;
2399 @BeanReference(type = DLFileEntryPersistence.class)
2400 protected DLFileEntryPersistence dlFileEntryPersistence;
2401 @BeanReference(type = DLFileEntryMetadataPersistence.class)
2402 protected DLFileEntryMetadataPersistence dlFileEntryMetadataPersistence;
2403 @BeanReference(type = DLFileEntryTypePersistence.class)
2404 protected DLFileEntryTypePersistence dlFileEntryTypePersistence;
2405 @BeanReference(type = DLFileRankPersistence.class)
2406 protected DLFileRankPersistence dlFileRankPersistence;
2407 @BeanReference(type = DLFileShortcutPersistence.class)
2408 protected DLFileShortcutPersistence dlFileShortcutPersistence;
2409 @BeanReference(type = DLFileVersionPersistence.class)
2410 protected DLFileVersionPersistence dlFileVersionPersistence;
2411 @BeanReference(type = DLFolderPersistence.class)
2412 protected DLFolderPersistence dlFolderPersistence;
2413 @BeanReference(type = DLSyncPersistence.class)
2414 protected DLSyncPersistence dlSyncPersistence;
2415 @BeanReference(type = ResourcePersistence.class)
2416 protected ResourcePersistence resourcePersistence;
2417 @BeanReference(type = UserPersistence.class)
2418 protected UserPersistence userPersistence;
2419 private static final String _SQL_SELECT_DLFILEVERSION = "SELECT dlFileVersion FROM DLFileVersion dlFileVersion";
2420 private static final String _SQL_SELECT_DLFILEVERSION_WHERE = "SELECT dlFileVersion FROM DLFileVersion dlFileVersion WHERE ";
2421 private static final String _SQL_COUNT_DLFILEVERSION = "SELECT COUNT(dlFileVersion) FROM DLFileVersion dlFileVersion";
2422 private static final String _SQL_COUNT_DLFILEVERSION_WHERE = "SELECT COUNT(dlFileVersion) FROM DLFileVersion dlFileVersion WHERE ";
2423 private static final String _FINDER_COLUMN_FILEENTRYID_FILEENTRYID_2 = "dlFileVersion.fileEntryId = ?";
2424 private static final String _FINDER_COLUMN_F_V_FILEENTRYID_2 = "dlFileVersion.fileEntryId = ? AND ";
2425 private static final String _FINDER_COLUMN_F_V_VERSION_1 = "dlFileVersion.version IS NULL";
2426 private static final String _FINDER_COLUMN_F_V_VERSION_2 = "dlFileVersion.version = ?";
2427 private static final String _FINDER_COLUMN_F_V_VERSION_3 = "(dlFileVersion.version IS NULL OR dlFileVersion.version = ?)";
2428 private static final String _FINDER_COLUMN_F_S_FILEENTRYID_2 = "dlFileVersion.fileEntryId = ? AND ";
2429 private static final String _FINDER_COLUMN_F_S_STATUS_2 = "dlFileVersion.status = ?";
2430 private static final String _FINDER_COLUMN_G_F_S_GROUPID_2 = "dlFileVersion.groupId = ? AND ";
2431 private static final String _FINDER_COLUMN_G_F_S_FOLDERID_2 = "dlFileVersion.folderId = ? AND ";
2432 private static final String _FINDER_COLUMN_G_F_S_STATUS_2 = "dlFileVersion.status = ?";
2433 private static final String _ORDER_BY_ENTITY_ALIAS = "dlFileVersion.";
2434 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DLFileVersion exists with the primary key ";
2435 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DLFileVersion exists with the key {";
2436 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2437 private static Log _log = LogFactoryUtil.getLog(DLFileVersionPersistenceImpl.class);
2438 private static DLFileVersion _nullDLFileVersion = new DLFileVersionImpl() {
2439 @Override
2440 public Object clone() {
2441 return this;
2442 }
2443
2444 @Override
2445 public CacheModel<DLFileVersion> toCacheModel() {
2446 return _nullDLFileVersionCacheModel;
2447 }
2448 };
2449
2450 private static CacheModel<DLFileVersion> _nullDLFileVersionCacheModel = new CacheModel<DLFileVersion>() {
2451 public DLFileVersion toEntityModel() {
2452 return _nullDLFileVersion;
2453 }
2454 };
2455 }