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.kernel.util.Validator;
037 import com.liferay.portal.model.CacheModel;
038 import com.liferay.portal.model.ModelListener;
039 import com.liferay.portal.service.persistence.BatchSessionUtil;
040 import com.liferay.portal.service.persistence.ResourcePersistence;
041 import com.liferay.portal.service.persistence.UserPersistence;
042 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043
044 import com.liferay.portlet.documentlibrary.NoSuchContentException;
045 import com.liferay.portlet.documentlibrary.model.DLContent;
046 import com.liferay.portlet.documentlibrary.model.impl.DLContentImpl;
047 import com.liferay.portlet.documentlibrary.model.impl.DLContentModelImpl;
048
049 import java.io.Serializable;
050
051 import java.util.ArrayList;
052 import java.util.Collections;
053 import java.util.List;
054
055
067 public class DLContentPersistenceImpl extends BasePersistenceImpl<DLContent>
068 implements DLContentPersistence {
069
074 public static final String FINDER_CLASS_NAME_ENTITY = DLContentImpl.class.getName();
075 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
076 ".List1";
077 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
078 ".List2";
079 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_R = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
080 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
081 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_R",
082 new String[] {
083 Long.class.getName(), Long.class.getName(),
084
085 "java.lang.Integer", "java.lang.Integer",
086 "com.liferay.portal.kernel.util.OrderByComparator"
087 });
088 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
089 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
090 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_R",
091 new String[] { Long.class.getName(), Long.class.getName() },
092 DLContentModelImpl.COMPANYID_COLUMN_BITMASK |
093 DLContentModelImpl.REPOSITORYID_COLUMN_BITMASK);
094 public static final FinderPath FINDER_PATH_COUNT_BY_C_R = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
095 DLContentModelImpl.FINDER_CACHE_ENABLED, Long.class,
096 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_R",
097 new String[] { Long.class.getName(), Long.class.getName() });
098 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_R_P = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
099 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
100 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_R_P",
101 new String[] {
102 Long.class.getName(), Long.class.getName(),
103 String.class.getName(),
104
105 "java.lang.Integer", "java.lang.Integer",
106 "com.liferay.portal.kernel.util.OrderByComparator"
107 });
108 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_P = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
109 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
110 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_R_P",
111 new String[] {
112 Long.class.getName(), Long.class.getName(),
113 String.class.getName()
114 },
115 DLContentModelImpl.COMPANYID_COLUMN_BITMASK |
116 DLContentModelImpl.REPOSITORYID_COLUMN_BITMASK |
117 DLContentModelImpl.PATH_COLUMN_BITMASK);
118 public static final FinderPath FINDER_PATH_COUNT_BY_C_R_P = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
119 DLContentModelImpl.FINDER_CACHE_ENABLED, Long.class,
120 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_R_P",
121 new String[] {
122 Long.class.getName(), Long.class.getName(),
123 String.class.getName()
124 });
125 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_R_LIKEP =
126 new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
127 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
128 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_R_LikeP",
129 new String[] {
130 Long.class.getName(), Long.class.getName(),
131 String.class.getName(),
132
133 "java.lang.Integer", "java.lang.Integer",
134 "com.liferay.portal.kernel.util.OrderByComparator"
135 });
136 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_LIKEP =
137 new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
138 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
139 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_R_LikeP",
140 new String[] {
141 Long.class.getName(), Long.class.getName(),
142 String.class.getName()
143 },
144 DLContentModelImpl.COMPANYID_COLUMN_BITMASK |
145 DLContentModelImpl.REPOSITORYID_COLUMN_BITMASK |
146 DLContentModelImpl.PATH_COLUMN_BITMASK);
147 public static final FinderPath FINDER_PATH_COUNT_BY_C_R_LIKEP = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
148 DLContentModelImpl.FINDER_CACHE_ENABLED, Long.class,
149 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_R_LikeP",
150 new String[] {
151 Long.class.getName(), Long.class.getName(),
152 String.class.getName()
153 });
154 public static final FinderPath FINDER_PATH_FETCH_BY_C_R_P_V = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
155 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
156 FINDER_CLASS_NAME_ENTITY, "fetchByC_R_P_V",
157 new String[] {
158 Long.class.getName(), Long.class.getName(),
159 String.class.getName(), String.class.getName()
160 },
161 DLContentModelImpl.COMPANYID_COLUMN_BITMASK |
162 DLContentModelImpl.REPOSITORYID_COLUMN_BITMASK |
163 DLContentModelImpl.PATH_COLUMN_BITMASK |
164 DLContentModelImpl.VERSION_COLUMN_BITMASK);
165 public static final FinderPath FINDER_PATH_COUNT_BY_C_R_P_V = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
166 DLContentModelImpl.FINDER_CACHE_ENABLED, Long.class,
167 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_R_P_V",
168 new String[] {
169 Long.class.getName(), Long.class.getName(),
170 String.class.getName(), String.class.getName()
171 });
172 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
173 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
174 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
175 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
176 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
177 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
178 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
179 DLContentModelImpl.FINDER_CACHE_ENABLED, Long.class,
180 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
181
182
187 public void cacheResult(DLContent dlContent) {
188 EntityCacheUtil.putResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
189 DLContentImpl.class, dlContent.getPrimaryKey(), dlContent);
190
191 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R_P_V,
192 new Object[] {
193 Long.valueOf(dlContent.getCompanyId()),
194 Long.valueOf(dlContent.getRepositoryId()),
195
196 dlContent.getPath(),
197
198 dlContent.getVersion()
199 }, dlContent);
200
201 dlContent.resetOriginalValues();
202 }
203
204
209 public void cacheResult(List<DLContent> dlContents) {
210 for (DLContent dlContent : dlContents) {
211 if (EntityCacheUtil.getResult(
212 DLContentModelImpl.ENTITY_CACHE_ENABLED,
213 DLContentImpl.class, dlContent.getPrimaryKey()) == null) {
214 cacheResult(dlContent);
215 }
216 else {
217 dlContent.resetOriginalValues();
218 }
219 }
220 }
221
222
229 @Override
230 public void clearCache() {
231 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
232 CacheRegistryUtil.clear(DLContentImpl.class.getName());
233 }
234
235 EntityCacheUtil.clearCache(DLContentImpl.class.getName());
236
237 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
238 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
239 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
240 }
241
242
249 @Override
250 public void clearCache(DLContent dlContent) {
251 EntityCacheUtil.removeResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
252 DLContentImpl.class, dlContent.getPrimaryKey());
253
254 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
255 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
256
257 clearUniqueFindersCache(dlContent);
258 }
259
260 @Override
261 public void clearCache(List<DLContent> dlContents) {
262 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
263 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
264
265 for (DLContent dlContent : dlContents) {
266 EntityCacheUtil.removeResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
267 DLContentImpl.class, dlContent.getPrimaryKey());
268
269 clearUniqueFindersCache(dlContent);
270 }
271 }
272
273 protected void clearUniqueFindersCache(DLContent dlContent) {
274 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R_P_V,
275 new Object[] {
276 Long.valueOf(dlContent.getCompanyId()),
277 Long.valueOf(dlContent.getRepositoryId()),
278
279 dlContent.getPath(),
280
281 dlContent.getVersion()
282 });
283 }
284
285
291 public DLContent create(long contentId) {
292 DLContent dlContent = new DLContentImpl();
293
294 dlContent.setNew(true);
295 dlContent.setPrimaryKey(contentId);
296
297 return dlContent;
298 }
299
300
308 public DLContent remove(long contentId)
309 throws NoSuchContentException, SystemException {
310 return remove(Long.valueOf(contentId));
311 }
312
313
321 @Override
322 public DLContent remove(Serializable primaryKey)
323 throws NoSuchContentException, SystemException {
324 Session session = null;
325
326 try {
327 session = openSession();
328
329 DLContent dlContent = (DLContent)session.get(DLContentImpl.class,
330 primaryKey);
331
332 if (dlContent == null) {
333 if (_log.isWarnEnabled()) {
334 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
335 }
336
337 throw new NoSuchContentException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
338 primaryKey);
339 }
340
341 return remove(dlContent);
342 }
343 catch (NoSuchContentException nsee) {
344 throw nsee;
345 }
346 catch (Exception e) {
347 throw processException(e);
348 }
349 finally {
350 closeSession(session);
351 }
352 }
353
354 @Override
355 protected DLContent removeImpl(DLContent dlContent)
356 throws SystemException {
357 dlContent = toUnwrappedModel(dlContent);
358
359 Session session = null;
360
361 try {
362 session = openSession();
363
364 BatchSessionUtil.delete(session, dlContent);
365 }
366 catch (Exception e) {
367 throw processException(e);
368 }
369 finally {
370 closeSession(session);
371 }
372
373 clearCache(dlContent);
374
375 return dlContent;
376 }
377
378 @Override
379 public DLContent updateImpl(
380 com.liferay.portlet.documentlibrary.model.DLContent dlContent,
381 boolean merge) throws SystemException {
382 dlContent = toUnwrappedModel(dlContent);
383
384 boolean isNew = dlContent.isNew();
385
386 DLContentModelImpl dlContentModelImpl = (DLContentModelImpl)dlContent;
387
388 Session session = null;
389
390 try {
391 session = openSession();
392
393 BatchSessionUtil.update(session, dlContent, merge);
394
395 dlContent.setNew(false);
396
397 session.flush();
398 session.clear();
399 }
400 catch (Exception e) {
401 throw processException(e);
402 }
403 finally {
404 closeSession(session);
405 }
406
407 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
408
409 if (isNew || !DLContentModelImpl.COLUMN_BITMASK_ENABLED) {
410 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
411 }
412 else {
413 if ((dlContentModelImpl.getColumnBitmask() &
414 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R.getColumnBitmask()) != 0) {
415 Object[] args = new Object[] {
416 Long.valueOf(dlContentModelImpl.getOriginalCompanyId()),
417 Long.valueOf(dlContentModelImpl.getOriginalRepositoryId())
418 };
419
420 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R, args);
421 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R,
422 args);
423
424 args = new Object[] {
425 Long.valueOf(dlContentModelImpl.getCompanyId()),
426 Long.valueOf(dlContentModelImpl.getRepositoryId())
427 };
428
429 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R, args);
430 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R,
431 args);
432 }
433
434 if ((dlContentModelImpl.getColumnBitmask() &
435 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_P.getColumnBitmask()) != 0) {
436 Object[] args = new Object[] {
437 Long.valueOf(dlContentModelImpl.getOriginalCompanyId()),
438 Long.valueOf(dlContentModelImpl.getOriginalRepositoryId()),
439
440 dlContentModelImpl.getOriginalPath()
441 };
442
443 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R_P, args);
444 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_P,
445 args);
446
447 args = new Object[] {
448 Long.valueOf(dlContentModelImpl.getCompanyId()),
449 Long.valueOf(dlContentModelImpl.getRepositoryId()),
450
451 dlContentModelImpl.getPath()
452 };
453
454 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R_P, args);
455 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_P,
456 args);
457 }
458
459 if ((dlContentModelImpl.getColumnBitmask() &
460 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_LIKEP.getColumnBitmask()) != 0) {
461 Object[] args = new Object[] {
462 Long.valueOf(dlContentModelImpl.getOriginalCompanyId()),
463 Long.valueOf(dlContentModelImpl.getOriginalRepositoryId()),
464
465 dlContentModelImpl.getOriginalPath()
466 };
467
468 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R_LIKEP,
469 args);
470 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_LIKEP,
471 args);
472
473 args = new Object[] {
474 Long.valueOf(dlContentModelImpl.getCompanyId()),
475 Long.valueOf(dlContentModelImpl.getRepositoryId()),
476
477 dlContentModelImpl.getPath()
478 };
479
480 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R_LIKEP,
481 args);
482 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_LIKEP,
483 args);
484 }
485 }
486
487 EntityCacheUtil.putResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
488 DLContentImpl.class, dlContent.getPrimaryKey(), dlContent);
489
490 if (isNew) {
491 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R_P_V,
492 new Object[] {
493 Long.valueOf(dlContent.getCompanyId()),
494 Long.valueOf(dlContent.getRepositoryId()),
495
496 dlContent.getPath(),
497
498 dlContent.getVersion()
499 }, dlContent);
500 }
501 else {
502 if ((dlContentModelImpl.getColumnBitmask() &
503 FINDER_PATH_FETCH_BY_C_R_P_V.getColumnBitmask()) != 0) {
504 Object[] args = new Object[] {
505 Long.valueOf(dlContentModelImpl.getOriginalCompanyId()),
506 Long.valueOf(dlContentModelImpl.getOriginalRepositoryId()),
507
508 dlContentModelImpl.getOriginalPath(),
509
510 dlContentModelImpl.getOriginalVersion()
511 };
512
513 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R_P_V, args);
514 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R_P_V, args);
515
516 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R_P_V,
517 new Object[] {
518 Long.valueOf(dlContent.getCompanyId()),
519 Long.valueOf(dlContent.getRepositoryId()),
520
521 dlContent.getPath(),
522
523 dlContent.getVersion()
524 }, dlContent);
525 }
526 }
527
528 dlContent.resetOriginalValues();
529
530 return dlContent;
531 }
532
533 protected DLContent toUnwrappedModel(DLContent dlContent) {
534 if (dlContent instanceof DLContentImpl) {
535 return dlContent;
536 }
537
538 DLContentImpl dlContentImpl = new DLContentImpl();
539
540 dlContentImpl.setNew(dlContent.isNew());
541 dlContentImpl.setPrimaryKey(dlContent.getPrimaryKey());
542
543 dlContentImpl.setContentId(dlContent.getContentId());
544 dlContentImpl.setGroupId(dlContent.getGroupId());
545 dlContentImpl.setCompanyId(dlContent.getCompanyId());
546 dlContentImpl.setRepositoryId(dlContent.getRepositoryId());
547 dlContentImpl.setPath(dlContent.getPath());
548 dlContentImpl.setVersion(dlContent.getVersion());
549 dlContentImpl.setData(dlContent.getData());
550 dlContentImpl.setSize(dlContent.getSize());
551
552 return dlContentImpl;
553 }
554
555
563 @Override
564 public DLContent findByPrimaryKey(Serializable primaryKey)
565 throws NoSuchModelException, SystemException {
566 return findByPrimaryKey(((Long)primaryKey).longValue());
567 }
568
569
577 public DLContent findByPrimaryKey(long contentId)
578 throws NoSuchContentException, SystemException {
579 DLContent dlContent = fetchByPrimaryKey(contentId);
580
581 if (dlContent == null) {
582 if (_log.isWarnEnabled()) {
583 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + contentId);
584 }
585
586 throw new NoSuchContentException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
587 contentId);
588 }
589
590 return dlContent;
591 }
592
593
600 @Override
601 public DLContent fetchByPrimaryKey(Serializable primaryKey)
602 throws SystemException {
603 return fetchByPrimaryKey(((Long)primaryKey).longValue());
604 }
605
606
613 public DLContent fetchByPrimaryKey(long contentId)
614 throws SystemException {
615 DLContent dlContent = (DLContent)EntityCacheUtil.getResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
616 DLContentImpl.class, contentId);
617
618 if (dlContent == _nullDLContent) {
619 return null;
620 }
621
622 if (dlContent == null) {
623 Session session = null;
624
625 boolean hasException = false;
626
627 try {
628 session = openSession();
629
630 dlContent = (DLContent)session.get(DLContentImpl.class,
631 Long.valueOf(contentId));
632 }
633 catch (Exception e) {
634 hasException = true;
635
636 throw processException(e);
637 }
638 finally {
639 if (dlContent != null) {
640 cacheResult(dlContent);
641 }
642 else if (!hasException) {
643 EntityCacheUtil.putResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
644 DLContentImpl.class, contentId, _nullDLContent);
645 }
646
647 closeSession(session);
648 }
649 }
650
651 return dlContent;
652 }
653
654
662 public List<DLContent> findByC_R(long companyId, long repositoryId)
663 throws SystemException {
664 return findByC_R(companyId, repositoryId, QueryUtil.ALL_POS,
665 QueryUtil.ALL_POS, null);
666 }
667
668
682 public List<DLContent> findByC_R(long companyId, long repositoryId,
683 int start, int end) throws SystemException {
684 return findByC_R(companyId, repositoryId, start, end, null);
685 }
686
687
702 public List<DLContent> findByC_R(long companyId, long repositoryId,
703 int start, int end, OrderByComparator orderByComparator)
704 throws SystemException {
705 FinderPath finderPath = null;
706 Object[] finderArgs = null;
707
708 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
709 (orderByComparator == null)) {
710 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R;
711 finderArgs = new Object[] { companyId, repositoryId };
712 }
713 else {
714 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_R;
715 finderArgs = new Object[] {
716 companyId, repositoryId,
717
718 start, end, orderByComparator
719 };
720 }
721
722 List<DLContent> list = (List<DLContent>)FinderCacheUtil.getResult(finderPath,
723 finderArgs, this);
724
725 if ((list != null) && !list.isEmpty()) {
726 for (DLContent dlContent : list) {
727 if ((companyId != dlContent.getCompanyId()) ||
728 (repositoryId != dlContent.getRepositoryId())) {
729 list = null;
730
731 break;
732 }
733 }
734 }
735
736 if (list == null) {
737 StringBundler query = null;
738
739 if (orderByComparator != null) {
740 query = new StringBundler(4 +
741 (orderByComparator.getOrderByFields().length * 3));
742 }
743 else {
744 query = new StringBundler(4);
745 }
746
747 query.append(_SQL_SELECT_DLCONTENT_WHERE);
748
749 query.append(_FINDER_COLUMN_C_R_COMPANYID_2);
750
751 query.append(_FINDER_COLUMN_C_R_REPOSITORYID_2);
752
753 if (orderByComparator != null) {
754 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
755 orderByComparator);
756 }
757
758 else {
759 query.append(DLContentModelImpl.ORDER_BY_JPQL);
760 }
761
762 String sql = query.toString();
763
764 Session session = null;
765
766 try {
767 session = openSession();
768
769 Query q = session.createQuery(sql);
770
771 QueryPos qPos = QueryPos.getInstance(q);
772
773 qPos.add(companyId);
774
775 qPos.add(repositoryId);
776
777 list = (List<DLContent>)QueryUtil.list(q, getDialect(), start,
778 end);
779 }
780 catch (Exception e) {
781 throw processException(e);
782 }
783 finally {
784 if (list == null) {
785 FinderCacheUtil.removeResult(finderPath, finderArgs);
786 }
787 else {
788 cacheResult(list);
789
790 FinderCacheUtil.putResult(finderPath, finderArgs, list);
791 }
792
793 closeSession(session);
794 }
795 }
796
797 return list;
798 }
799
800
814 public DLContent findByC_R_First(long companyId, long repositoryId,
815 OrderByComparator orderByComparator)
816 throws NoSuchContentException, SystemException {
817 List<DLContent> list = findByC_R(companyId, repositoryId, 0, 1,
818 orderByComparator);
819
820 if (list.isEmpty()) {
821 StringBundler msg = new StringBundler(6);
822
823 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
824
825 msg.append("companyId=");
826 msg.append(companyId);
827
828 msg.append(", repositoryId=");
829 msg.append(repositoryId);
830
831 msg.append(StringPool.CLOSE_CURLY_BRACE);
832
833 throw new NoSuchContentException(msg.toString());
834 }
835 else {
836 return list.get(0);
837 }
838 }
839
840
854 public DLContent findByC_R_Last(long companyId, long repositoryId,
855 OrderByComparator orderByComparator)
856 throws NoSuchContentException, SystemException {
857 int count = countByC_R(companyId, repositoryId);
858
859 List<DLContent> list = findByC_R(companyId, repositoryId, count - 1,
860 count, orderByComparator);
861
862 if (list.isEmpty()) {
863 StringBundler msg = new StringBundler(6);
864
865 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
866
867 msg.append("companyId=");
868 msg.append(companyId);
869
870 msg.append(", repositoryId=");
871 msg.append(repositoryId);
872
873 msg.append(StringPool.CLOSE_CURLY_BRACE);
874
875 throw new NoSuchContentException(msg.toString());
876 }
877 else {
878 return list.get(0);
879 }
880 }
881
882
897 public DLContent[] findByC_R_PrevAndNext(long contentId, long companyId,
898 long repositoryId, OrderByComparator orderByComparator)
899 throws NoSuchContentException, SystemException {
900 DLContent dlContent = findByPrimaryKey(contentId);
901
902 Session session = null;
903
904 try {
905 session = openSession();
906
907 DLContent[] array = new DLContentImpl[3];
908
909 array[0] = getByC_R_PrevAndNext(session, dlContent, companyId,
910 repositoryId, orderByComparator, true);
911
912 array[1] = dlContent;
913
914 array[2] = getByC_R_PrevAndNext(session, dlContent, companyId,
915 repositoryId, orderByComparator, false);
916
917 return array;
918 }
919 catch (Exception e) {
920 throw processException(e);
921 }
922 finally {
923 closeSession(session);
924 }
925 }
926
927 protected DLContent getByC_R_PrevAndNext(Session session,
928 DLContent dlContent, long companyId, long repositoryId,
929 OrderByComparator orderByComparator, boolean previous) {
930 StringBundler query = null;
931
932 if (orderByComparator != null) {
933 query = new StringBundler(6 +
934 (orderByComparator.getOrderByFields().length * 6));
935 }
936 else {
937 query = new StringBundler(3);
938 }
939
940 query.append(_SQL_SELECT_DLCONTENT_WHERE);
941
942 query.append(_FINDER_COLUMN_C_R_COMPANYID_2);
943
944 query.append(_FINDER_COLUMN_C_R_REPOSITORYID_2);
945
946 if (orderByComparator != null) {
947 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
948
949 if (orderByConditionFields.length > 0) {
950 query.append(WHERE_AND);
951 }
952
953 for (int i = 0; i < orderByConditionFields.length; i++) {
954 query.append(_ORDER_BY_ENTITY_ALIAS);
955 query.append(orderByConditionFields[i]);
956
957 if ((i + 1) < orderByConditionFields.length) {
958 if (orderByComparator.isAscending() ^ previous) {
959 query.append(WHERE_GREATER_THAN_HAS_NEXT);
960 }
961 else {
962 query.append(WHERE_LESSER_THAN_HAS_NEXT);
963 }
964 }
965 else {
966 if (orderByComparator.isAscending() ^ previous) {
967 query.append(WHERE_GREATER_THAN);
968 }
969 else {
970 query.append(WHERE_LESSER_THAN);
971 }
972 }
973 }
974
975 query.append(ORDER_BY_CLAUSE);
976
977 String[] orderByFields = orderByComparator.getOrderByFields();
978
979 for (int i = 0; i < orderByFields.length; i++) {
980 query.append(_ORDER_BY_ENTITY_ALIAS);
981 query.append(orderByFields[i]);
982
983 if ((i + 1) < orderByFields.length) {
984 if (orderByComparator.isAscending() ^ previous) {
985 query.append(ORDER_BY_ASC_HAS_NEXT);
986 }
987 else {
988 query.append(ORDER_BY_DESC_HAS_NEXT);
989 }
990 }
991 else {
992 if (orderByComparator.isAscending() ^ previous) {
993 query.append(ORDER_BY_ASC);
994 }
995 else {
996 query.append(ORDER_BY_DESC);
997 }
998 }
999 }
1000 }
1001
1002 else {
1003 query.append(DLContentModelImpl.ORDER_BY_JPQL);
1004 }
1005
1006 String sql = query.toString();
1007
1008 Query q = session.createQuery(sql);
1009
1010 q.setFirstResult(0);
1011 q.setMaxResults(2);
1012
1013 QueryPos qPos = QueryPos.getInstance(q);
1014
1015 qPos.add(companyId);
1016
1017 qPos.add(repositoryId);
1018
1019 if (orderByComparator != null) {
1020 Object[] values = orderByComparator.getOrderByConditionValues(dlContent);
1021
1022 for (Object value : values) {
1023 qPos.add(value);
1024 }
1025 }
1026
1027 List<DLContent> list = q.list();
1028
1029 if (list.size() == 2) {
1030 return list.get(1);
1031 }
1032 else {
1033 return null;
1034 }
1035 }
1036
1037
1046 public List<DLContent> findByC_R_P(long companyId, long repositoryId,
1047 String path) throws SystemException {
1048 return findByC_R_P(companyId, repositoryId, path, QueryUtil.ALL_POS,
1049 QueryUtil.ALL_POS, null);
1050 }
1051
1052
1067 public List<DLContent> findByC_R_P(long companyId, long repositoryId,
1068 String path, int start, int end) throws SystemException {
1069 return findByC_R_P(companyId, repositoryId, path, start, end, null);
1070 }
1071
1072
1088 public List<DLContent> findByC_R_P(long companyId, long repositoryId,
1089 String path, int start, int end, OrderByComparator orderByComparator)
1090 throws SystemException {
1091 FinderPath finderPath = null;
1092 Object[] finderArgs = null;
1093
1094 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1095 (orderByComparator == null)) {
1096 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_P;
1097 finderArgs = new Object[] { companyId, repositoryId, path };
1098 }
1099 else {
1100 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_R_P;
1101 finderArgs = new Object[] {
1102 companyId, repositoryId, path,
1103
1104 start, end, orderByComparator
1105 };
1106 }
1107
1108 List<DLContent> list = (List<DLContent>)FinderCacheUtil.getResult(finderPath,
1109 finderArgs, this);
1110
1111 if ((list != null) && !list.isEmpty()) {
1112 for (DLContent dlContent : list) {
1113 if ((companyId != dlContent.getCompanyId()) ||
1114 (repositoryId != dlContent.getRepositoryId()) ||
1115 !Validator.equals(path, dlContent.getPath())) {
1116 list = null;
1117
1118 break;
1119 }
1120 }
1121 }
1122
1123 if (list == null) {
1124 StringBundler query = null;
1125
1126 if (orderByComparator != null) {
1127 query = new StringBundler(5 +
1128 (orderByComparator.getOrderByFields().length * 3));
1129 }
1130 else {
1131 query = new StringBundler(5);
1132 }
1133
1134 query.append(_SQL_SELECT_DLCONTENT_WHERE);
1135
1136 query.append(_FINDER_COLUMN_C_R_P_COMPANYID_2);
1137
1138 query.append(_FINDER_COLUMN_C_R_P_REPOSITORYID_2);
1139
1140 if (path == null) {
1141 query.append(_FINDER_COLUMN_C_R_P_PATH_1);
1142 }
1143 else {
1144 if (path.equals(StringPool.BLANK)) {
1145 query.append(_FINDER_COLUMN_C_R_P_PATH_3);
1146 }
1147 else {
1148 query.append(_FINDER_COLUMN_C_R_P_PATH_2);
1149 }
1150 }
1151
1152 if (orderByComparator != null) {
1153 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1154 orderByComparator);
1155 }
1156
1157 else {
1158 query.append(DLContentModelImpl.ORDER_BY_JPQL);
1159 }
1160
1161 String sql = query.toString();
1162
1163 Session session = null;
1164
1165 try {
1166 session = openSession();
1167
1168 Query q = session.createQuery(sql);
1169
1170 QueryPos qPos = QueryPos.getInstance(q);
1171
1172 qPos.add(companyId);
1173
1174 qPos.add(repositoryId);
1175
1176 if (path != null) {
1177 qPos.add(path);
1178 }
1179
1180 list = (List<DLContent>)QueryUtil.list(q, getDialect(), start,
1181 end);
1182 }
1183 catch (Exception e) {
1184 throw processException(e);
1185 }
1186 finally {
1187 if (list == null) {
1188 FinderCacheUtil.removeResult(finderPath, finderArgs);
1189 }
1190 else {
1191 cacheResult(list);
1192
1193 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1194 }
1195
1196 closeSession(session);
1197 }
1198 }
1199
1200 return list;
1201 }
1202
1203
1218 public DLContent findByC_R_P_First(long companyId, long repositoryId,
1219 String path, OrderByComparator orderByComparator)
1220 throws NoSuchContentException, SystemException {
1221 List<DLContent> list = findByC_R_P(companyId, repositoryId, path, 0, 1,
1222 orderByComparator);
1223
1224 if (list.isEmpty()) {
1225 StringBundler msg = new StringBundler(8);
1226
1227 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1228
1229 msg.append("companyId=");
1230 msg.append(companyId);
1231
1232 msg.append(", repositoryId=");
1233 msg.append(repositoryId);
1234
1235 msg.append(", path=");
1236 msg.append(path);
1237
1238 msg.append(StringPool.CLOSE_CURLY_BRACE);
1239
1240 throw new NoSuchContentException(msg.toString());
1241 }
1242 else {
1243 return list.get(0);
1244 }
1245 }
1246
1247
1262 public DLContent findByC_R_P_Last(long companyId, long repositoryId,
1263 String path, OrderByComparator orderByComparator)
1264 throws NoSuchContentException, SystemException {
1265 int count = countByC_R_P(companyId, repositoryId, path);
1266
1267 List<DLContent> list = findByC_R_P(companyId, repositoryId, path,
1268 count - 1, count, orderByComparator);
1269
1270 if (list.isEmpty()) {
1271 StringBundler msg = new StringBundler(8);
1272
1273 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1274
1275 msg.append("companyId=");
1276 msg.append(companyId);
1277
1278 msg.append(", repositoryId=");
1279 msg.append(repositoryId);
1280
1281 msg.append(", path=");
1282 msg.append(path);
1283
1284 msg.append(StringPool.CLOSE_CURLY_BRACE);
1285
1286 throw new NoSuchContentException(msg.toString());
1287 }
1288 else {
1289 return list.get(0);
1290 }
1291 }
1292
1293
1309 public DLContent[] findByC_R_P_PrevAndNext(long contentId, long companyId,
1310 long repositoryId, String path, OrderByComparator orderByComparator)
1311 throws NoSuchContentException, SystemException {
1312 DLContent dlContent = findByPrimaryKey(contentId);
1313
1314 Session session = null;
1315
1316 try {
1317 session = openSession();
1318
1319 DLContent[] array = new DLContentImpl[3];
1320
1321 array[0] = getByC_R_P_PrevAndNext(session, dlContent, companyId,
1322 repositoryId, path, orderByComparator, true);
1323
1324 array[1] = dlContent;
1325
1326 array[2] = getByC_R_P_PrevAndNext(session, dlContent, companyId,
1327 repositoryId, path, orderByComparator, false);
1328
1329 return array;
1330 }
1331 catch (Exception e) {
1332 throw processException(e);
1333 }
1334 finally {
1335 closeSession(session);
1336 }
1337 }
1338
1339 protected DLContent getByC_R_P_PrevAndNext(Session session,
1340 DLContent dlContent, long companyId, long repositoryId, String path,
1341 OrderByComparator orderByComparator, boolean previous) {
1342 StringBundler query = null;
1343
1344 if (orderByComparator != null) {
1345 query = new StringBundler(6 +
1346 (orderByComparator.getOrderByFields().length * 6));
1347 }
1348 else {
1349 query = new StringBundler(3);
1350 }
1351
1352 query.append(_SQL_SELECT_DLCONTENT_WHERE);
1353
1354 query.append(_FINDER_COLUMN_C_R_P_COMPANYID_2);
1355
1356 query.append(_FINDER_COLUMN_C_R_P_REPOSITORYID_2);
1357
1358 if (path == null) {
1359 query.append(_FINDER_COLUMN_C_R_P_PATH_1);
1360 }
1361 else {
1362 if (path.equals(StringPool.BLANK)) {
1363 query.append(_FINDER_COLUMN_C_R_P_PATH_3);
1364 }
1365 else {
1366 query.append(_FINDER_COLUMN_C_R_P_PATH_2);
1367 }
1368 }
1369
1370 if (orderByComparator != null) {
1371 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1372
1373 if (orderByConditionFields.length > 0) {
1374 query.append(WHERE_AND);
1375 }
1376
1377 for (int i = 0; i < orderByConditionFields.length; i++) {
1378 query.append(_ORDER_BY_ENTITY_ALIAS);
1379 query.append(orderByConditionFields[i]);
1380
1381 if ((i + 1) < orderByConditionFields.length) {
1382 if (orderByComparator.isAscending() ^ previous) {
1383 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1384 }
1385 else {
1386 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1387 }
1388 }
1389 else {
1390 if (orderByComparator.isAscending() ^ previous) {
1391 query.append(WHERE_GREATER_THAN);
1392 }
1393 else {
1394 query.append(WHERE_LESSER_THAN);
1395 }
1396 }
1397 }
1398
1399 query.append(ORDER_BY_CLAUSE);
1400
1401 String[] orderByFields = orderByComparator.getOrderByFields();
1402
1403 for (int i = 0; i < orderByFields.length; i++) {
1404 query.append(_ORDER_BY_ENTITY_ALIAS);
1405 query.append(orderByFields[i]);
1406
1407 if ((i + 1) < orderByFields.length) {
1408 if (orderByComparator.isAscending() ^ previous) {
1409 query.append(ORDER_BY_ASC_HAS_NEXT);
1410 }
1411 else {
1412 query.append(ORDER_BY_DESC_HAS_NEXT);
1413 }
1414 }
1415 else {
1416 if (orderByComparator.isAscending() ^ previous) {
1417 query.append(ORDER_BY_ASC);
1418 }
1419 else {
1420 query.append(ORDER_BY_DESC);
1421 }
1422 }
1423 }
1424 }
1425
1426 else {
1427 query.append(DLContentModelImpl.ORDER_BY_JPQL);
1428 }
1429
1430 String sql = query.toString();
1431
1432 Query q = session.createQuery(sql);
1433
1434 q.setFirstResult(0);
1435 q.setMaxResults(2);
1436
1437 QueryPos qPos = QueryPos.getInstance(q);
1438
1439 qPos.add(companyId);
1440
1441 qPos.add(repositoryId);
1442
1443 if (path != null) {
1444 qPos.add(path);
1445 }
1446
1447 if (orderByComparator != null) {
1448 Object[] values = orderByComparator.getOrderByConditionValues(dlContent);
1449
1450 for (Object value : values) {
1451 qPos.add(value);
1452 }
1453 }
1454
1455 List<DLContent> list = q.list();
1456
1457 if (list.size() == 2) {
1458 return list.get(1);
1459 }
1460 else {
1461 return null;
1462 }
1463 }
1464
1465
1474 public List<DLContent> findByC_R_LikeP(long companyId, long repositoryId,
1475 String path) throws SystemException {
1476 return findByC_R_LikeP(companyId, repositoryId, path,
1477 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1478 }
1479
1480
1495 public List<DLContent> findByC_R_LikeP(long companyId, long repositoryId,
1496 String path, int start, int end) throws SystemException {
1497 return findByC_R_LikeP(companyId, repositoryId, path, start, end, null);
1498 }
1499
1500
1516 public List<DLContent> findByC_R_LikeP(long companyId, long repositoryId,
1517 String path, int start, int end, OrderByComparator orderByComparator)
1518 throws SystemException {
1519 FinderPath finderPath = null;
1520 Object[] finderArgs = null;
1521
1522 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1523 (orderByComparator == null)) {
1524 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_LIKEP;
1525 finderArgs = new Object[] { companyId, repositoryId, path };
1526 }
1527 else {
1528 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_R_LIKEP;
1529 finderArgs = new Object[] {
1530 companyId, repositoryId, path,
1531
1532 start, end, orderByComparator
1533 };
1534 }
1535
1536 List<DLContent> list = (List<DLContent>)FinderCacheUtil.getResult(finderPath,
1537 finderArgs, this);
1538
1539 if ((list != null) && !list.isEmpty()) {
1540 for (DLContent dlContent : list) {
1541 if ((companyId != dlContent.getCompanyId()) ||
1542 (repositoryId != dlContent.getRepositoryId()) ||
1543 !Validator.equals(path, dlContent.getPath())) {
1544 list = null;
1545
1546 break;
1547 }
1548 }
1549 }
1550
1551 if (list == null) {
1552 StringBundler query = null;
1553
1554 if (orderByComparator != null) {
1555 query = new StringBundler(5 +
1556 (orderByComparator.getOrderByFields().length * 3));
1557 }
1558 else {
1559 query = new StringBundler(5);
1560 }
1561
1562 query.append(_SQL_SELECT_DLCONTENT_WHERE);
1563
1564 query.append(_FINDER_COLUMN_C_R_LIKEP_COMPANYID_2);
1565
1566 query.append(_FINDER_COLUMN_C_R_LIKEP_REPOSITORYID_2);
1567
1568 if (path == null) {
1569 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_1);
1570 }
1571 else {
1572 if (path.equals(StringPool.BLANK)) {
1573 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_3);
1574 }
1575 else {
1576 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_2);
1577 }
1578 }
1579
1580 if (orderByComparator != null) {
1581 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1582 orderByComparator);
1583 }
1584
1585 else {
1586 query.append(DLContentModelImpl.ORDER_BY_JPQL);
1587 }
1588
1589 String sql = query.toString();
1590
1591 Session session = null;
1592
1593 try {
1594 session = openSession();
1595
1596 Query q = session.createQuery(sql);
1597
1598 QueryPos qPos = QueryPos.getInstance(q);
1599
1600 qPos.add(companyId);
1601
1602 qPos.add(repositoryId);
1603
1604 if (path != null) {
1605 qPos.add(path);
1606 }
1607
1608 list = (List<DLContent>)QueryUtil.list(q, getDialect(), start,
1609 end);
1610 }
1611 catch (Exception e) {
1612 throw processException(e);
1613 }
1614 finally {
1615 if (list == null) {
1616 FinderCacheUtil.removeResult(finderPath, finderArgs);
1617 }
1618 else {
1619 cacheResult(list);
1620
1621 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1622 }
1623
1624 closeSession(session);
1625 }
1626 }
1627
1628 return list;
1629 }
1630
1631
1646 public DLContent findByC_R_LikeP_First(long companyId, long repositoryId,
1647 String path, OrderByComparator orderByComparator)
1648 throws NoSuchContentException, SystemException {
1649 List<DLContent> list = findByC_R_LikeP(companyId, repositoryId, path,
1650 0, 1, orderByComparator);
1651
1652 if (list.isEmpty()) {
1653 StringBundler msg = new StringBundler(8);
1654
1655 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1656
1657 msg.append("companyId=");
1658 msg.append(companyId);
1659
1660 msg.append(", repositoryId=");
1661 msg.append(repositoryId);
1662
1663 msg.append(", path=");
1664 msg.append(path);
1665
1666 msg.append(StringPool.CLOSE_CURLY_BRACE);
1667
1668 throw new NoSuchContentException(msg.toString());
1669 }
1670 else {
1671 return list.get(0);
1672 }
1673 }
1674
1675
1690 public DLContent findByC_R_LikeP_Last(long companyId, long repositoryId,
1691 String path, OrderByComparator orderByComparator)
1692 throws NoSuchContentException, SystemException {
1693 int count = countByC_R_LikeP(companyId, repositoryId, path);
1694
1695 List<DLContent> list = findByC_R_LikeP(companyId, repositoryId, path,
1696 count - 1, count, orderByComparator);
1697
1698 if (list.isEmpty()) {
1699 StringBundler msg = new StringBundler(8);
1700
1701 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1702
1703 msg.append("companyId=");
1704 msg.append(companyId);
1705
1706 msg.append(", repositoryId=");
1707 msg.append(repositoryId);
1708
1709 msg.append(", path=");
1710 msg.append(path);
1711
1712 msg.append(StringPool.CLOSE_CURLY_BRACE);
1713
1714 throw new NoSuchContentException(msg.toString());
1715 }
1716 else {
1717 return list.get(0);
1718 }
1719 }
1720
1721
1737 public DLContent[] findByC_R_LikeP_PrevAndNext(long contentId,
1738 long companyId, long repositoryId, String path,
1739 OrderByComparator orderByComparator)
1740 throws NoSuchContentException, SystemException {
1741 DLContent dlContent = findByPrimaryKey(contentId);
1742
1743 Session session = null;
1744
1745 try {
1746 session = openSession();
1747
1748 DLContent[] array = new DLContentImpl[3];
1749
1750 array[0] = getByC_R_LikeP_PrevAndNext(session, dlContent,
1751 companyId, repositoryId, path, orderByComparator, true);
1752
1753 array[1] = dlContent;
1754
1755 array[2] = getByC_R_LikeP_PrevAndNext(session, dlContent,
1756 companyId, repositoryId, path, orderByComparator, false);
1757
1758 return array;
1759 }
1760 catch (Exception e) {
1761 throw processException(e);
1762 }
1763 finally {
1764 closeSession(session);
1765 }
1766 }
1767
1768 protected DLContent getByC_R_LikeP_PrevAndNext(Session session,
1769 DLContent dlContent, long companyId, long repositoryId, String path,
1770 OrderByComparator orderByComparator, boolean previous) {
1771 StringBundler query = null;
1772
1773 if (orderByComparator != null) {
1774 query = new StringBundler(6 +
1775 (orderByComparator.getOrderByFields().length * 6));
1776 }
1777 else {
1778 query = new StringBundler(3);
1779 }
1780
1781 query.append(_SQL_SELECT_DLCONTENT_WHERE);
1782
1783 query.append(_FINDER_COLUMN_C_R_LIKEP_COMPANYID_2);
1784
1785 query.append(_FINDER_COLUMN_C_R_LIKEP_REPOSITORYID_2);
1786
1787 if (path == null) {
1788 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_1);
1789 }
1790 else {
1791 if (path.equals(StringPool.BLANK)) {
1792 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_3);
1793 }
1794 else {
1795 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_2);
1796 }
1797 }
1798
1799 if (orderByComparator != null) {
1800 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1801
1802 if (orderByConditionFields.length > 0) {
1803 query.append(WHERE_AND);
1804 }
1805
1806 for (int i = 0; i < orderByConditionFields.length; i++) {
1807 query.append(_ORDER_BY_ENTITY_ALIAS);
1808 query.append(orderByConditionFields[i]);
1809
1810 if ((i + 1) < orderByConditionFields.length) {
1811 if (orderByComparator.isAscending() ^ previous) {
1812 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1813 }
1814 else {
1815 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1816 }
1817 }
1818 else {
1819 if (orderByComparator.isAscending() ^ previous) {
1820 query.append(WHERE_GREATER_THAN);
1821 }
1822 else {
1823 query.append(WHERE_LESSER_THAN);
1824 }
1825 }
1826 }
1827
1828 query.append(ORDER_BY_CLAUSE);
1829
1830 String[] orderByFields = orderByComparator.getOrderByFields();
1831
1832 for (int i = 0; i < orderByFields.length; i++) {
1833 query.append(_ORDER_BY_ENTITY_ALIAS);
1834 query.append(orderByFields[i]);
1835
1836 if ((i + 1) < orderByFields.length) {
1837 if (orderByComparator.isAscending() ^ previous) {
1838 query.append(ORDER_BY_ASC_HAS_NEXT);
1839 }
1840 else {
1841 query.append(ORDER_BY_DESC_HAS_NEXT);
1842 }
1843 }
1844 else {
1845 if (orderByComparator.isAscending() ^ previous) {
1846 query.append(ORDER_BY_ASC);
1847 }
1848 else {
1849 query.append(ORDER_BY_DESC);
1850 }
1851 }
1852 }
1853 }
1854
1855 else {
1856 query.append(DLContentModelImpl.ORDER_BY_JPQL);
1857 }
1858
1859 String sql = query.toString();
1860
1861 Query q = session.createQuery(sql);
1862
1863 q.setFirstResult(0);
1864 q.setMaxResults(2);
1865
1866 QueryPos qPos = QueryPos.getInstance(q);
1867
1868 qPos.add(companyId);
1869
1870 qPos.add(repositoryId);
1871
1872 if (path != null) {
1873 qPos.add(path);
1874 }
1875
1876 if (orderByComparator != null) {
1877 Object[] values = orderByComparator.getOrderByConditionValues(dlContent);
1878
1879 for (Object value : values) {
1880 qPos.add(value);
1881 }
1882 }
1883
1884 List<DLContent> list = q.list();
1885
1886 if (list.size() == 2) {
1887 return list.get(1);
1888 }
1889 else {
1890 return null;
1891 }
1892 }
1893
1894
1905 public DLContent findByC_R_P_V(long companyId, long repositoryId,
1906 String path, String version)
1907 throws NoSuchContentException, SystemException {
1908 DLContent dlContent = fetchByC_R_P_V(companyId, repositoryId, path,
1909 version);
1910
1911 if (dlContent == null) {
1912 StringBundler msg = new StringBundler(10);
1913
1914 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1915
1916 msg.append("companyId=");
1917 msg.append(companyId);
1918
1919 msg.append(", repositoryId=");
1920 msg.append(repositoryId);
1921
1922 msg.append(", path=");
1923 msg.append(path);
1924
1925 msg.append(", version=");
1926 msg.append(version);
1927
1928 msg.append(StringPool.CLOSE_CURLY_BRACE);
1929
1930 if (_log.isWarnEnabled()) {
1931 _log.warn(msg.toString());
1932 }
1933
1934 throw new NoSuchContentException(msg.toString());
1935 }
1936
1937 return dlContent;
1938 }
1939
1940
1950 public DLContent fetchByC_R_P_V(long companyId, long repositoryId,
1951 String path, String version) throws SystemException {
1952 return fetchByC_R_P_V(companyId, repositoryId, path, version, true);
1953 }
1954
1955
1966 public DLContent fetchByC_R_P_V(long companyId, long repositoryId,
1967 String path, String version, boolean retrieveFromCache)
1968 throws SystemException {
1969 Object[] finderArgs = new Object[] {
1970 companyId, repositoryId, path, version
1971 };
1972
1973 Object result = null;
1974
1975 if (retrieveFromCache) {
1976 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_R_P_V,
1977 finderArgs, this);
1978 }
1979
1980 if (result instanceof DLContent) {
1981 DLContent dlContent = (DLContent)result;
1982
1983 if ((companyId != dlContent.getCompanyId()) ||
1984 (repositoryId != dlContent.getRepositoryId()) ||
1985 !Validator.equals(path, dlContent.getPath()) ||
1986 !Validator.equals(version, dlContent.getVersion())) {
1987 result = null;
1988 }
1989 }
1990
1991 if (result == null) {
1992 StringBundler query = new StringBundler(6);
1993
1994 query.append(_SQL_SELECT_DLCONTENT_WHERE);
1995
1996 query.append(_FINDER_COLUMN_C_R_P_V_COMPANYID_2);
1997
1998 query.append(_FINDER_COLUMN_C_R_P_V_REPOSITORYID_2);
1999
2000 if (path == null) {
2001 query.append(_FINDER_COLUMN_C_R_P_V_PATH_1);
2002 }
2003 else {
2004 if (path.equals(StringPool.BLANK)) {
2005 query.append(_FINDER_COLUMN_C_R_P_V_PATH_3);
2006 }
2007 else {
2008 query.append(_FINDER_COLUMN_C_R_P_V_PATH_2);
2009 }
2010 }
2011
2012 if (version == null) {
2013 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_1);
2014 }
2015 else {
2016 if (version.equals(StringPool.BLANK)) {
2017 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_3);
2018 }
2019 else {
2020 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_2);
2021 }
2022 }
2023
2024 query.append(DLContentModelImpl.ORDER_BY_JPQL);
2025
2026 String sql = query.toString();
2027
2028 Session session = null;
2029
2030 try {
2031 session = openSession();
2032
2033 Query q = session.createQuery(sql);
2034
2035 QueryPos qPos = QueryPos.getInstance(q);
2036
2037 qPos.add(companyId);
2038
2039 qPos.add(repositoryId);
2040
2041 if (path != null) {
2042 qPos.add(path);
2043 }
2044
2045 if (version != null) {
2046 qPos.add(version);
2047 }
2048
2049 List<DLContent> list = q.list();
2050
2051 result = list;
2052
2053 DLContent dlContent = null;
2054
2055 if (list.isEmpty()) {
2056 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R_P_V,
2057 finderArgs, list);
2058 }
2059 else {
2060 dlContent = list.get(0);
2061
2062 cacheResult(dlContent);
2063
2064 if ((dlContent.getCompanyId() != companyId) ||
2065 (dlContent.getRepositoryId() != repositoryId) ||
2066 (dlContent.getPath() == null) ||
2067 !dlContent.getPath().equals(path) ||
2068 (dlContent.getVersion() == null) ||
2069 !dlContent.getVersion().equals(version)) {
2070 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R_P_V,
2071 finderArgs, dlContent);
2072 }
2073 }
2074
2075 return dlContent;
2076 }
2077 catch (Exception e) {
2078 throw processException(e);
2079 }
2080 finally {
2081 if (result == null) {
2082 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R_P_V,
2083 finderArgs);
2084 }
2085
2086 closeSession(session);
2087 }
2088 }
2089 else {
2090 if (result instanceof List<?>) {
2091 return null;
2092 }
2093 else {
2094 return (DLContent)result;
2095 }
2096 }
2097 }
2098
2099
2105 public List<DLContent> findAll() throws SystemException {
2106 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2107 }
2108
2109
2121 public List<DLContent> findAll(int start, int end)
2122 throws SystemException {
2123 return findAll(start, end, null);
2124 }
2125
2126
2139 public List<DLContent> findAll(int start, int end,
2140 OrderByComparator orderByComparator) throws SystemException {
2141 FinderPath finderPath = null;
2142 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2143
2144 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2145 (orderByComparator == null)) {
2146 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2147 finderArgs = FINDER_ARGS_EMPTY;
2148 }
2149 else {
2150 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2151 finderArgs = new Object[] { start, end, orderByComparator };
2152 }
2153
2154 List<DLContent> list = (List<DLContent>)FinderCacheUtil.getResult(finderPath,
2155 finderArgs, this);
2156
2157 if (list == null) {
2158 StringBundler query = null;
2159 String sql = null;
2160
2161 if (orderByComparator != null) {
2162 query = new StringBundler(2 +
2163 (orderByComparator.getOrderByFields().length * 3));
2164
2165 query.append(_SQL_SELECT_DLCONTENT);
2166
2167 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2168 orderByComparator);
2169
2170 sql = query.toString();
2171 }
2172 else {
2173 sql = _SQL_SELECT_DLCONTENT.concat(DLContentModelImpl.ORDER_BY_JPQL);
2174 }
2175
2176 Session session = null;
2177
2178 try {
2179 session = openSession();
2180
2181 Query q = session.createQuery(sql);
2182
2183 if (orderByComparator == null) {
2184 list = (List<DLContent>)QueryUtil.list(q, getDialect(),
2185 start, end, false);
2186
2187 Collections.sort(list);
2188 }
2189 else {
2190 list = (List<DLContent>)QueryUtil.list(q, getDialect(),
2191 start, end);
2192 }
2193 }
2194 catch (Exception e) {
2195 throw processException(e);
2196 }
2197 finally {
2198 if (list == null) {
2199 FinderCacheUtil.removeResult(finderPath, finderArgs);
2200 }
2201 else {
2202 cacheResult(list);
2203
2204 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2205 }
2206
2207 closeSession(session);
2208 }
2209 }
2210
2211 return list;
2212 }
2213
2214
2221 public void removeByC_R(long companyId, long repositoryId)
2222 throws SystemException {
2223 for (DLContent dlContent : findByC_R(companyId, repositoryId)) {
2224 remove(dlContent);
2225 }
2226 }
2227
2228
2236 public void removeByC_R_P(long companyId, long repositoryId, String path)
2237 throws SystemException {
2238 for (DLContent dlContent : findByC_R_P(companyId, repositoryId, path)) {
2239 remove(dlContent);
2240 }
2241 }
2242
2243
2251 public void removeByC_R_LikeP(long companyId, long repositoryId, String path)
2252 throws SystemException {
2253 for (DLContent dlContent : findByC_R_LikeP(companyId, repositoryId, path)) {
2254 remove(dlContent);
2255 }
2256 }
2257
2258
2267 public void removeByC_R_P_V(long companyId, long repositoryId, String path,
2268 String version) throws NoSuchContentException, SystemException {
2269 DLContent dlContent = findByC_R_P_V(companyId, repositoryId, path,
2270 version);
2271
2272 remove(dlContent);
2273 }
2274
2275
2280 public void removeAll() throws SystemException {
2281 for (DLContent dlContent : findAll()) {
2282 remove(dlContent);
2283 }
2284 }
2285
2286
2294 public int countByC_R(long companyId, long repositoryId)
2295 throws SystemException {
2296 Object[] finderArgs = new Object[] { companyId, repositoryId };
2297
2298 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_R,
2299 finderArgs, this);
2300
2301 if (count == null) {
2302 StringBundler query = new StringBundler(3);
2303
2304 query.append(_SQL_COUNT_DLCONTENT_WHERE);
2305
2306 query.append(_FINDER_COLUMN_C_R_COMPANYID_2);
2307
2308 query.append(_FINDER_COLUMN_C_R_REPOSITORYID_2);
2309
2310 String sql = query.toString();
2311
2312 Session session = null;
2313
2314 try {
2315 session = openSession();
2316
2317 Query q = session.createQuery(sql);
2318
2319 QueryPos qPos = QueryPos.getInstance(q);
2320
2321 qPos.add(companyId);
2322
2323 qPos.add(repositoryId);
2324
2325 count = (Long)q.uniqueResult();
2326 }
2327 catch (Exception e) {
2328 throw processException(e);
2329 }
2330 finally {
2331 if (count == null) {
2332 count = Long.valueOf(0);
2333 }
2334
2335 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_R, finderArgs,
2336 count);
2337
2338 closeSession(session);
2339 }
2340 }
2341
2342 return count.intValue();
2343 }
2344
2345
2354 public int countByC_R_P(long companyId, long repositoryId, String path)
2355 throws SystemException {
2356 Object[] finderArgs = new Object[] { companyId, repositoryId, path };
2357
2358 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_R_P,
2359 finderArgs, this);
2360
2361 if (count == null) {
2362 StringBundler query = new StringBundler(4);
2363
2364 query.append(_SQL_COUNT_DLCONTENT_WHERE);
2365
2366 query.append(_FINDER_COLUMN_C_R_P_COMPANYID_2);
2367
2368 query.append(_FINDER_COLUMN_C_R_P_REPOSITORYID_2);
2369
2370 if (path == null) {
2371 query.append(_FINDER_COLUMN_C_R_P_PATH_1);
2372 }
2373 else {
2374 if (path.equals(StringPool.BLANK)) {
2375 query.append(_FINDER_COLUMN_C_R_P_PATH_3);
2376 }
2377 else {
2378 query.append(_FINDER_COLUMN_C_R_P_PATH_2);
2379 }
2380 }
2381
2382 String sql = query.toString();
2383
2384 Session session = null;
2385
2386 try {
2387 session = openSession();
2388
2389 Query q = session.createQuery(sql);
2390
2391 QueryPos qPos = QueryPos.getInstance(q);
2392
2393 qPos.add(companyId);
2394
2395 qPos.add(repositoryId);
2396
2397 if (path != null) {
2398 qPos.add(path);
2399 }
2400
2401 count = (Long)q.uniqueResult();
2402 }
2403 catch (Exception e) {
2404 throw processException(e);
2405 }
2406 finally {
2407 if (count == null) {
2408 count = Long.valueOf(0);
2409 }
2410
2411 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_R_P,
2412 finderArgs, count);
2413
2414 closeSession(session);
2415 }
2416 }
2417
2418 return count.intValue();
2419 }
2420
2421
2430 public int countByC_R_LikeP(long companyId, long repositoryId, String path)
2431 throws SystemException {
2432 Object[] finderArgs = new Object[] { companyId, repositoryId, path };
2433
2434 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_R_LIKEP,
2435 finderArgs, this);
2436
2437 if (count == null) {
2438 StringBundler query = new StringBundler(4);
2439
2440 query.append(_SQL_COUNT_DLCONTENT_WHERE);
2441
2442 query.append(_FINDER_COLUMN_C_R_LIKEP_COMPANYID_2);
2443
2444 query.append(_FINDER_COLUMN_C_R_LIKEP_REPOSITORYID_2);
2445
2446 if (path == null) {
2447 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_1);
2448 }
2449 else {
2450 if (path.equals(StringPool.BLANK)) {
2451 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_3);
2452 }
2453 else {
2454 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_2);
2455 }
2456 }
2457
2458 String sql = query.toString();
2459
2460 Session session = null;
2461
2462 try {
2463 session = openSession();
2464
2465 Query q = session.createQuery(sql);
2466
2467 QueryPos qPos = QueryPos.getInstance(q);
2468
2469 qPos.add(companyId);
2470
2471 qPos.add(repositoryId);
2472
2473 if (path != null) {
2474 qPos.add(path);
2475 }
2476
2477 count = (Long)q.uniqueResult();
2478 }
2479 catch (Exception e) {
2480 throw processException(e);
2481 }
2482 finally {
2483 if (count == null) {
2484 count = Long.valueOf(0);
2485 }
2486
2487 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_R_LIKEP,
2488 finderArgs, count);
2489
2490 closeSession(session);
2491 }
2492 }
2493
2494 return count.intValue();
2495 }
2496
2497
2507 public int countByC_R_P_V(long companyId, long repositoryId, String path,
2508 String version) throws SystemException {
2509 Object[] finderArgs = new Object[] {
2510 companyId, repositoryId, path, version
2511 };
2512
2513 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_R_P_V,
2514 finderArgs, this);
2515
2516 if (count == null) {
2517 StringBundler query = new StringBundler(5);
2518
2519 query.append(_SQL_COUNT_DLCONTENT_WHERE);
2520
2521 query.append(_FINDER_COLUMN_C_R_P_V_COMPANYID_2);
2522
2523 query.append(_FINDER_COLUMN_C_R_P_V_REPOSITORYID_2);
2524
2525 if (path == null) {
2526 query.append(_FINDER_COLUMN_C_R_P_V_PATH_1);
2527 }
2528 else {
2529 if (path.equals(StringPool.BLANK)) {
2530 query.append(_FINDER_COLUMN_C_R_P_V_PATH_3);
2531 }
2532 else {
2533 query.append(_FINDER_COLUMN_C_R_P_V_PATH_2);
2534 }
2535 }
2536
2537 if (version == null) {
2538 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_1);
2539 }
2540 else {
2541 if (version.equals(StringPool.BLANK)) {
2542 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_3);
2543 }
2544 else {
2545 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_2);
2546 }
2547 }
2548
2549 String sql = query.toString();
2550
2551 Session session = null;
2552
2553 try {
2554 session = openSession();
2555
2556 Query q = session.createQuery(sql);
2557
2558 QueryPos qPos = QueryPos.getInstance(q);
2559
2560 qPos.add(companyId);
2561
2562 qPos.add(repositoryId);
2563
2564 if (path != null) {
2565 qPos.add(path);
2566 }
2567
2568 if (version != null) {
2569 qPos.add(version);
2570 }
2571
2572 count = (Long)q.uniqueResult();
2573 }
2574 catch (Exception e) {
2575 throw processException(e);
2576 }
2577 finally {
2578 if (count == null) {
2579 count = Long.valueOf(0);
2580 }
2581
2582 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_R_P_V,
2583 finderArgs, count);
2584
2585 closeSession(session);
2586 }
2587 }
2588
2589 return count.intValue();
2590 }
2591
2592
2598 public int countAll() throws SystemException {
2599 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2600 FINDER_ARGS_EMPTY, this);
2601
2602 if (count == null) {
2603 Session session = null;
2604
2605 try {
2606 session = openSession();
2607
2608 Query q = session.createQuery(_SQL_COUNT_DLCONTENT);
2609
2610 count = (Long)q.uniqueResult();
2611 }
2612 catch (Exception e) {
2613 throw processException(e);
2614 }
2615 finally {
2616 if (count == null) {
2617 count = Long.valueOf(0);
2618 }
2619
2620 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2621 FINDER_ARGS_EMPTY, count);
2622
2623 closeSession(session);
2624 }
2625 }
2626
2627 return count.intValue();
2628 }
2629
2630
2633 public void afterPropertiesSet() {
2634 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2635 com.liferay.portal.util.PropsUtil.get(
2636 "value.object.listener.com.liferay.portlet.documentlibrary.model.DLContent")));
2637
2638 if (listenerClassNames.length > 0) {
2639 try {
2640 List<ModelListener<DLContent>> listenersList = new ArrayList<ModelListener<DLContent>>();
2641
2642 for (String listenerClassName : listenerClassNames) {
2643 listenersList.add((ModelListener<DLContent>)InstanceFactory.newInstance(
2644 listenerClassName));
2645 }
2646
2647 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2648 }
2649 catch (Exception e) {
2650 _log.error(e);
2651 }
2652 }
2653 }
2654
2655 public void destroy() {
2656 EntityCacheUtil.removeCache(DLContentImpl.class.getName());
2657 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2658 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2659 }
2660
2661 @BeanReference(type = DLContentPersistence.class)
2662 protected DLContentPersistence dlContentPersistence;
2663 @BeanReference(type = DLFileEntryPersistence.class)
2664 protected DLFileEntryPersistence dlFileEntryPersistence;
2665 @BeanReference(type = DLFileEntryMetadataPersistence.class)
2666 protected DLFileEntryMetadataPersistence dlFileEntryMetadataPersistence;
2667 @BeanReference(type = DLFileEntryTypePersistence.class)
2668 protected DLFileEntryTypePersistence dlFileEntryTypePersistence;
2669 @BeanReference(type = DLFileRankPersistence.class)
2670 protected DLFileRankPersistence dlFileRankPersistence;
2671 @BeanReference(type = DLFileShortcutPersistence.class)
2672 protected DLFileShortcutPersistence dlFileShortcutPersistence;
2673 @BeanReference(type = DLFileVersionPersistence.class)
2674 protected DLFileVersionPersistence dlFileVersionPersistence;
2675 @BeanReference(type = DLFolderPersistence.class)
2676 protected DLFolderPersistence dlFolderPersistence;
2677 @BeanReference(type = DLSyncPersistence.class)
2678 protected DLSyncPersistence dlSyncPersistence;
2679 @BeanReference(type = ResourcePersistence.class)
2680 protected ResourcePersistence resourcePersistence;
2681 @BeanReference(type = UserPersistence.class)
2682 protected UserPersistence userPersistence;
2683 private static final String _SQL_SELECT_DLCONTENT = "SELECT dlContent FROM DLContent dlContent";
2684 private static final String _SQL_SELECT_DLCONTENT_WHERE = "SELECT dlContent FROM DLContent dlContent WHERE ";
2685 private static final String _SQL_COUNT_DLCONTENT = "SELECT COUNT(dlContent) FROM DLContent dlContent";
2686 private static final String _SQL_COUNT_DLCONTENT_WHERE = "SELECT COUNT(dlContent) FROM DLContent dlContent WHERE ";
2687 private static final String _FINDER_COLUMN_C_R_COMPANYID_2 = "dlContent.companyId = ? AND ";
2688 private static final String _FINDER_COLUMN_C_R_REPOSITORYID_2 = "dlContent.repositoryId = ?";
2689 private static final String _FINDER_COLUMN_C_R_P_COMPANYID_2 = "dlContent.companyId = ? AND ";
2690 private static final String _FINDER_COLUMN_C_R_P_REPOSITORYID_2 = "dlContent.repositoryId = ? AND ";
2691 private static final String _FINDER_COLUMN_C_R_P_PATH_1 = "dlContent.path IS NULL";
2692 private static final String _FINDER_COLUMN_C_R_P_PATH_2 = "dlContent.path = ?";
2693 private static final String _FINDER_COLUMN_C_R_P_PATH_3 = "(dlContent.path IS NULL OR dlContent.path = ?)";
2694 private static final String _FINDER_COLUMN_C_R_LIKEP_COMPANYID_2 = "dlContent.companyId = ? AND ";
2695 private static final String _FINDER_COLUMN_C_R_LIKEP_REPOSITORYID_2 = "dlContent.repositoryId = ? AND ";
2696 private static final String _FINDER_COLUMN_C_R_LIKEP_PATH_1 = "dlContent.path LIKE NULL";
2697 private static final String _FINDER_COLUMN_C_R_LIKEP_PATH_2 = "dlContent.path LIKE ?";
2698 private static final String _FINDER_COLUMN_C_R_LIKEP_PATH_3 = "(dlContent.path IS NULL OR dlContent.path LIKE ?)";
2699 private static final String _FINDER_COLUMN_C_R_P_V_COMPANYID_2 = "dlContent.companyId = ? AND ";
2700 private static final String _FINDER_COLUMN_C_R_P_V_REPOSITORYID_2 = "dlContent.repositoryId = ? AND ";
2701 private static final String _FINDER_COLUMN_C_R_P_V_PATH_1 = "dlContent.path IS NULL AND ";
2702 private static final String _FINDER_COLUMN_C_R_P_V_PATH_2 = "dlContent.path = ? AND ";
2703 private static final String _FINDER_COLUMN_C_R_P_V_PATH_3 = "(dlContent.path IS NULL OR dlContent.path = ?) AND ";
2704 private static final String _FINDER_COLUMN_C_R_P_V_VERSION_1 = "dlContent.version IS NULL";
2705 private static final String _FINDER_COLUMN_C_R_P_V_VERSION_2 = "dlContent.version = ?";
2706 private static final String _FINDER_COLUMN_C_R_P_V_VERSION_3 = "(dlContent.version IS NULL OR dlContent.version = ?)";
2707 private static final String _ORDER_BY_ENTITY_ALIAS = "dlContent.";
2708 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DLContent exists with the primary key ";
2709 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DLContent exists with the key {";
2710 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2711 private static Log _log = LogFactoryUtil.getLog(DLContentPersistenceImpl.class);
2712 private static DLContent _nullDLContent = new DLContentImpl() {
2713 @Override
2714 public Object clone() {
2715 return this;
2716 }
2717
2718 @Override
2719 public CacheModel<DLContent> toCacheModel() {
2720 return _nullDLContentCacheModel;
2721 }
2722 };
2723
2724 private static CacheModel<DLContent> _nullDLContentCacheModel = new CacheModel<DLContent>() {
2725 public DLContent toEntityModel() {
2726 return _nullDLContent;
2727 }
2728 };
2729 }