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_WITH_PAGINATION_COUNT_BY_C_R_LIKEP =
137 new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
138 DLContentModelImpl.FINDER_CACHE_ENABLED, Long.class,
139 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByC_R_LikeP",
140 new String[] {
141 Long.class.getName(), Long.class.getName(),
142 String.class.getName()
143 });
144 public static final FinderPath FINDER_PATH_FETCH_BY_C_R_P_V = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
145 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
146 FINDER_CLASS_NAME_ENTITY, "fetchByC_R_P_V",
147 new String[] {
148 Long.class.getName(), Long.class.getName(),
149 String.class.getName(), String.class.getName()
150 },
151 DLContentModelImpl.COMPANYID_COLUMN_BITMASK |
152 DLContentModelImpl.REPOSITORYID_COLUMN_BITMASK |
153 DLContentModelImpl.PATH_COLUMN_BITMASK |
154 DLContentModelImpl.VERSION_COLUMN_BITMASK);
155 public static final FinderPath FINDER_PATH_COUNT_BY_C_R_P_V = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
156 DLContentModelImpl.FINDER_CACHE_ENABLED, Long.class,
157 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_R_P_V",
158 new String[] {
159 Long.class.getName(), Long.class.getName(),
160 String.class.getName(), String.class.getName()
161 });
162 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
163 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
164 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
165 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
166 DLContentModelImpl.FINDER_CACHE_ENABLED, DLContentImpl.class,
167 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
168 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DLContentModelImpl.ENTITY_CACHE_ENABLED,
169 DLContentModelImpl.FINDER_CACHE_ENABLED, Long.class,
170 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
171
172
177 public void cacheResult(DLContent dlContent) {
178 EntityCacheUtil.putResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
179 DLContentImpl.class, dlContent.getPrimaryKey(), dlContent);
180
181 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R_P_V,
182 new Object[] {
183 Long.valueOf(dlContent.getCompanyId()),
184 Long.valueOf(dlContent.getRepositoryId()),
185
186 dlContent.getPath(),
187
188 dlContent.getVersion()
189 }, dlContent);
190
191 dlContent.resetOriginalValues();
192 }
193
194
199 public void cacheResult(List<DLContent> dlContents) {
200 for (DLContent dlContent : dlContents) {
201 if (EntityCacheUtil.getResult(
202 DLContentModelImpl.ENTITY_CACHE_ENABLED,
203 DLContentImpl.class, dlContent.getPrimaryKey()) == null) {
204 cacheResult(dlContent);
205 }
206 else {
207 dlContent.resetOriginalValues();
208 }
209 }
210 }
211
212
219 @Override
220 public void clearCache() {
221 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
222 CacheRegistryUtil.clear(DLContentImpl.class.getName());
223 }
224
225 EntityCacheUtil.clearCache(DLContentImpl.class.getName());
226
227 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
228 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
229 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
230 }
231
232
239 @Override
240 public void clearCache(DLContent dlContent) {
241 EntityCacheUtil.removeResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
242 DLContentImpl.class, dlContent.getPrimaryKey());
243
244 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
245 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
246
247 clearUniqueFindersCache(dlContent);
248 }
249
250 @Override
251 public void clearCache(List<DLContent> dlContents) {
252 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
253 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
254
255 for (DLContent dlContent : dlContents) {
256 EntityCacheUtil.removeResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
257 DLContentImpl.class, dlContent.getPrimaryKey());
258
259 clearUniqueFindersCache(dlContent);
260 }
261 }
262
263 protected void clearUniqueFindersCache(DLContent dlContent) {
264 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R_P_V,
265 new Object[] {
266 Long.valueOf(dlContent.getCompanyId()),
267 Long.valueOf(dlContent.getRepositoryId()),
268
269 dlContent.getPath(),
270
271 dlContent.getVersion()
272 });
273 }
274
275
281 public DLContent create(long contentId) {
282 DLContent dlContent = new DLContentImpl();
283
284 dlContent.setNew(true);
285 dlContent.setPrimaryKey(contentId);
286
287 return dlContent;
288 }
289
290
298 public DLContent remove(long contentId)
299 throws NoSuchContentException, SystemException {
300 return remove(Long.valueOf(contentId));
301 }
302
303
311 @Override
312 public DLContent remove(Serializable primaryKey)
313 throws NoSuchContentException, SystemException {
314 Session session = null;
315
316 try {
317 session = openSession();
318
319 DLContent dlContent = (DLContent)session.get(DLContentImpl.class,
320 primaryKey);
321
322 if (dlContent == null) {
323 if (_log.isWarnEnabled()) {
324 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
325 }
326
327 throw new NoSuchContentException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
328 primaryKey);
329 }
330
331 return remove(dlContent);
332 }
333 catch (NoSuchContentException nsee) {
334 throw nsee;
335 }
336 catch (Exception e) {
337 throw processException(e);
338 }
339 finally {
340 closeSession(session);
341 }
342 }
343
344 @Override
345 protected DLContent removeImpl(DLContent dlContent)
346 throws SystemException {
347 dlContent = toUnwrappedModel(dlContent);
348
349 Session session = null;
350
351 try {
352 session = openSession();
353
354 BatchSessionUtil.delete(session, dlContent);
355 }
356 catch (Exception e) {
357 throw processException(e);
358 }
359 finally {
360 closeSession(session);
361 }
362
363 clearCache(dlContent);
364
365 return dlContent;
366 }
367
368 @Override
369 public DLContent updateImpl(
370 com.liferay.portlet.documentlibrary.model.DLContent dlContent,
371 boolean merge) throws SystemException {
372 dlContent = toUnwrappedModel(dlContent);
373
374 boolean isNew = dlContent.isNew();
375
376 DLContentModelImpl dlContentModelImpl = (DLContentModelImpl)dlContent;
377
378 Session session = null;
379
380 try {
381 session = openSession();
382
383 BatchSessionUtil.update(session, dlContent, merge);
384
385 dlContent.setNew(false);
386
387 session.flush();
388 session.clear();
389 }
390 catch (Exception e) {
391 throw processException(e);
392 }
393 finally {
394 closeSession(session);
395 }
396
397 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
398
399 if (isNew || !DLContentModelImpl.COLUMN_BITMASK_ENABLED) {
400 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
401 }
402
403 else {
404 if ((dlContentModelImpl.getColumnBitmask() &
405 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R.getColumnBitmask()) != 0) {
406 Object[] args = new Object[] {
407 Long.valueOf(dlContentModelImpl.getOriginalCompanyId()),
408 Long.valueOf(dlContentModelImpl.getOriginalRepositoryId())
409 };
410
411 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R, args);
412 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R,
413 args);
414
415 args = new Object[] {
416 Long.valueOf(dlContentModelImpl.getCompanyId()),
417 Long.valueOf(dlContentModelImpl.getRepositoryId())
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
425 if ((dlContentModelImpl.getColumnBitmask() &
426 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_P.getColumnBitmask()) != 0) {
427 Object[] args = new Object[] {
428 Long.valueOf(dlContentModelImpl.getOriginalCompanyId()),
429 Long.valueOf(dlContentModelImpl.getOriginalRepositoryId()),
430
431 dlContentModelImpl.getOriginalPath()
432 };
433
434 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R_P, args);
435 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_P,
436 args);
437
438 args = new Object[] {
439 Long.valueOf(dlContentModelImpl.getCompanyId()),
440 Long.valueOf(dlContentModelImpl.getRepositoryId()),
441
442 dlContentModelImpl.getPath()
443 };
444
445 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R_P, args);
446 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_P,
447 args);
448 }
449 }
450
451 EntityCacheUtil.putResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
452 DLContentImpl.class, dlContent.getPrimaryKey(), dlContent);
453
454 if (isNew) {
455 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R_P_V,
456 new Object[] {
457 Long.valueOf(dlContent.getCompanyId()),
458 Long.valueOf(dlContent.getRepositoryId()),
459
460 dlContent.getPath(),
461
462 dlContent.getVersion()
463 }, dlContent);
464 }
465 else {
466 if ((dlContentModelImpl.getColumnBitmask() &
467 FINDER_PATH_FETCH_BY_C_R_P_V.getColumnBitmask()) != 0) {
468 Object[] args = new Object[] {
469 Long.valueOf(dlContentModelImpl.getOriginalCompanyId()),
470 Long.valueOf(dlContentModelImpl.getOriginalRepositoryId()),
471
472 dlContentModelImpl.getOriginalPath(),
473
474 dlContentModelImpl.getOriginalVersion()
475 };
476
477 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R_P_V, args);
478
479 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R_P_V, args);
480
481 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R_P_V,
482 new Object[] {
483 Long.valueOf(dlContent.getCompanyId()),
484 Long.valueOf(dlContent.getRepositoryId()),
485
486 dlContent.getPath(),
487
488 dlContent.getVersion()
489 }, dlContent);
490 }
491 }
492
493 dlContent.resetOriginalValues();
494
495 return dlContent;
496 }
497
498 protected DLContent toUnwrappedModel(DLContent dlContent) {
499 if (dlContent instanceof DLContentImpl) {
500 return dlContent;
501 }
502
503 DLContentImpl dlContentImpl = new DLContentImpl();
504
505 dlContentImpl.setNew(dlContent.isNew());
506 dlContentImpl.setPrimaryKey(dlContent.getPrimaryKey());
507
508 dlContentImpl.setContentId(dlContent.getContentId());
509 dlContentImpl.setGroupId(dlContent.getGroupId());
510 dlContentImpl.setCompanyId(dlContent.getCompanyId());
511 dlContentImpl.setRepositoryId(dlContent.getRepositoryId());
512 dlContentImpl.setPath(dlContent.getPath());
513 dlContentImpl.setVersion(dlContent.getVersion());
514 dlContentImpl.setData(dlContent.getData());
515 dlContentImpl.setSize(dlContent.getSize());
516
517 return dlContentImpl;
518 }
519
520
528 @Override
529 public DLContent findByPrimaryKey(Serializable primaryKey)
530 throws NoSuchModelException, SystemException {
531 return findByPrimaryKey(((Long)primaryKey).longValue());
532 }
533
534
542 public DLContent findByPrimaryKey(long contentId)
543 throws NoSuchContentException, SystemException {
544 DLContent dlContent = fetchByPrimaryKey(contentId);
545
546 if (dlContent == null) {
547 if (_log.isWarnEnabled()) {
548 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + contentId);
549 }
550
551 throw new NoSuchContentException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
552 contentId);
553 }
554
555 return dlContent;
556 }
557
558
565 @Override
566 public DLContent fetchByPrimaryKey(Serializable primaryKey)
567 throws SystemException {
568 return fetchByPrimaryKey(((Long)primaryKey).longValue());
569 }
570
571
578 public DLContent fetchByPrimaryKey(long contentId)
579 throws SystemException {
580 DLContent dlContent = (DLContent)EntityCacheUtil.getResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
581 DLContentImpl.class, contentId);
582
583 if (dlContent == _nullDLContent) {
584 return null;
585 }
586
587 if (dlContent == null) {
588 Session session = null;
589
590 boolean hasException = false;
591
592 try {
593 session = openSession();
594
595 dlContent = (DLContent)session.get(DLContentImpl.class,
596 Long.valueOf(contentId));
597 }
598 catch (Exception e) {
599 hasException = true;
600
601 throw processException(e);
602 }
603 finally {
604 if (dlContent != null) {
605 cacheResult(dlContent);
606 }
607 else if (!hasException) {
608 EntityCacheUtil.putResult(DLContentModelImpl.ENTITY_CACHE_ENABLED,
609 DLContentImpl.class, contentId, _nullDLContent);
610 }
611
612 closeSession(session);
613 }
614 }
615
616 return dlContent;
617 }
618
619
627 public List<DLContent> findByC_R(long companyId, long repositoryId)
628 throws SystemException {
629 return findByC_R(companyId, repositoryId, QueryUtil.ALL_POS,
630 QueryUtil.ALL_POS, null);
631 }
632
633
647 public List<DLContent> findByC_R(long companyId, long repositoryId,
648 int start, int end) throws SystemException {
649 return findByC_R(companyId, repositoryId, start, end, null);
650 }
651
652
667 public List<DLContent> findByC_R(long companyId, long repositoryId,
668 int start, int end, OrderByComparator orderByComparator)
669 throws SystemException {
670 FinderPath finderPath = null;
671 Object[] finderArgs = null;
672
673 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
674 (orderByComparator == null)) {
675 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R;
676 finderArgs = new Object[] { companyId, repositoryId };
677 }
678 else {
679 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_R;
680 finderArgs = new Object[] {
681 companyId, repositoryId,
682
683 start, end, orderByComparator
684 };
685 }
686
687 List<DLContent> list = (List<DLContent>)FinderCacheUtil.getResult(finderPath,
688 finderArgs, this);
689
690 if ((list != null) && !list.isEmpty()) {
691 for (DLContent dlContent : list) {
692 if ((companyId != dlContent.getCompanyId()) ||
693 (repositoryId != dlContent.getRepositoryId())) {
694 list = null;
695
696 break;
697 }
698 }
699 }
700
701 if (list == null) {
702 StringBundler query = null;
703
704 if (orderByComparator != null) {
705 query = new StringBundler(4 +
706 (orderByComparator.getOrderByFields().length * 3));
707 }
708 else {
709 query = new StringBundler(4);
710 }
711
712 query.append(_SQL_SELECT_DLCONTENT_WHERE);
713
714 query.append(_FINDER_COLUMN_C_R_COMPANYID_2);
715
716 query.append(_FINDER_COLUMN_C_R_REPOSITORYID_2);
717
718 if (orderByComparator != null) {
719 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
720 orderByComparator);
721 }
722
723 else {
724 query.append(DLContentModelImpl.ORDER_BY_JPQL);
725 }
726
727 String sql = query.toString();
728
729 Session session = null;
730
731 try {
732 session = openSession();
733
734 Query q = session.createQuery(sql);
735
736 QueryPos qPos = QueryPos.getInstance(q);
737
738 qPos.add(companyId);
739
740 qPos.add(repositoryId);
741
742 list = (List<DLContent>)QueryUtil.list(q, getDialect(), start,
743 end);
744 }
745 catch (Exception e) {
746 throw processException(e);
747 }
748 finally {
749 if (list == null) {
750 FinderCacheUtil.removeResult(finderPath, finderArgs);
751 }
752 else {
753 cacheResult(list);
754
755 FinderCacheUtil.putResult(finderPath, finderArgs, list);
756 }
757
758 closeSession(session);
759 }
760 }
761
762 return list;
763 }
764
765
775 public DLContent findByC_R_First(long companyId, long repositoryId,
776 OrderByComparator orderByComparator)
777 throws NoSuchContentException, SystemException {
778 DLContent dlContent = fetchByC_R_First(companyId, repositoryId,
779 orderByComparator);
780
781 if (dlContent != null) {
782 return dlContent;
783 }
784
785 StringBundler msg = new StringBundler(6);
786
787 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
788
789 msg.append("companyId=");
790 msg.append(companyId);
791
792 msg.append(", repositoryId=");
793 msg.append(repositoryId);
794
795 msg.append(StringPool.CLOSE_CURLY_BRACE);
796
797 throw new NoSuchContentException(msg.toString());
798 }
799
800
809 public DLContent fetchByC_R_First(long companyId, long repositoryId,
810 OrderByComparator orderByComparator) throws SystemException {
811 List<DLContent> list = findByC_R(companyId, repositoryId, 0, 1,
812 orderByComparator);
813
814 if (!list.isEmpty()) {
815 return list.get(0);
816 }
817
818 return null;
819 }
820
821
831 public DLContent findByC_R_Last(long companyId, long repositoryId,
832 OrderByComparator orderByComparator)
833 throws NoSuchContentException, SystemException {
834 DLContent dlContent = fetchByC_R_Last(companyId, repositoryId,
835 orderByComparator);
836
837 if (dlContent != null) {
838 return dlContent;
839 }
840
841 StringBundler msg = new StringBundler(6);
842
843 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
844
845 msg.append("companyId=");
846 msg.append(companyId);
847
848 msg.append(", repositoryId=");
849 msg.append(repositoryId);
850
851 msg.append(StringPool.CLOSE_CURLY_BRACE);
852
853 throw new NoSuchContentException(msg.toString());
854 }
855
856
865 public DLContent fetchByC_R_Last(long companyId, long repositoryId,
866 OrderByComparator orderByComparator) throws SystemException {
867 int count = countByC_R(companyId, repositoryId);
868
869 List<DLContent> list = findByC_R(companyId, repositoryId, count - 1,
870 count, orderByComparator);
871
872 if (!list.isEmpty()) {
873 return list.get(0);
874 }
875
876 return null;
877 }
878
879
890 public DLContent[] findByC_R_PrevAndNext(long contentId, long companyId,
891 long repositoryId, OrderByComparator orderByComparator)
892 throws NoSuchContentException, SystemException {
893 DLContent dlContent = findByPrimaryKey(contentId);
894
895 Session session = null;
896
897 try {
898 session = openSession();
899
900 DLContent[] array = new DLContentImpl[3];
901
902 array[0] = getByC_R_PrevAndNext(session, dlContent, companyId,
903 repositoryId, orderByComparator, true);
904
905 array[1] = dlContent;
906
907 array[2] = getByC_R_PrevAndNext(session, dlContent, companyId,
908 repositoryId, orderByComparator, false);
909
910 return array;
911 }
912 catch (Exception e) {
913 throw processException(e);
914 }
915 finally {
916 closeSession(session);
917 }
918 }
919
920 protected DLContent getByC_R_PrevAndNext(Session session,
921 DLContent dlContent, long companyId, long repositoryId,
922 OrderByComparator orderByComparator, boolean previous) {
923 StringBundler query = null;
924
925 if (orderByComparator != null) {
926 query = new StringBundler(6 +
927 (orderByComparator.getOrderByFields().length * 6));
928 }
929 else {
930 query = new StringBundler(3);
931 }
932
933 query.append(_SQL_SELECT_DLCONTENT_WHERE);
934
935 query.append(_FINDER_COLUMN_C_R_COMPANYID_2);
936
937 query.append(_FINDER_COLUMN_C_R_REPOSITORYID_2);
938
939 if (orderByComparator != null) {
940 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
941
942 if (orderByConditionFields.length > 0) {
943 query.append(WHERE_AND);
944 }
945
946 for (int i = 0; i < orderByConditionFields.length; i++) {
947 query.append(_ORDER_BY_ENTITY_ALIAS);
948 query.append(orderByConditionFields[i]);
949
950 if ((i + 1) < orderByConditionFields.length) {
951 if (orderByComparator.isAscending() ^ previous) {
952 query.append(WHERE_GREATER_THAN_HAS_NEXT);
953 }
954 else {
955 query.append(WHERE_LESSER_THAN_HAS_NEXT);
956 }
957 }
958 else {
959 if (orderByComparator.isAscending() ^ previous) {
960 query.append(WHERE_GREATER_THAN);
961 }
962 else {
963 query.append(WHERE_LESSER_THAN);
964 }
965 }
966 }
967
968 query.append(ORDER_BY_CLAUSE);
969
970 String[] orderByFields = orderByComparator.getOrderByFields();
971
972 for (int i = 0; i < orderByFields.length; i++) {
973 query.append(_ORDER_BY_ENTITY_ALIAS);
974 query.append(orderByFields[i]);
975
976 if ((i + 1) < orderByFields.length) {
977 if (orderByComparator.isAscending() ^ previous) {
978 query.append(ORDER_BY_ASC_HAS_NEXT);
979 }
980 else {
981 query.append(ORDER_BY_DESC_HAS_NEXT);
982 }
983 }
984 else {
985 if (orderByComparator.isAscending() ^ previous) {
986 query.append(ORDER_BY_ASC);
987 }
988 else {
989 query.append(ORDER_BY_DESC);
990 }
991 }
992 }
993 }
994
995 else {
996 query.append(DLContentModelImpl.ORDER_BY_JPQL);
997 }
998
999 String sql = query.toString();
1000
1001 Query q = session.createQuery(sql);
1002
1003 q.setFirstResult(0);
1004 q.setMaxResults(2);
1005
1006 QueryPos qPos = QueryPos.getInstance(q);
1007
1008 qPos.add(companyId);
1009
1010 qPos.add(repositoryId);
1011
1012 if (orderByComparator != null) {
1013 Object[] values = orderByComparator.getOrderByConditionValues(dlContent);
1014
1015 for (Object value : values) {
1016 qPos.add(value);
1017 }
1018 }
1019
1020 List<DLContent> list = q.list();
1021
1022 if (list.size() == 2) {
1023 return list.get(1);
1024 }
1025 else {
1026 return null;
1027 }
1028 }
1029
1030
1039 public List<DLContent> findByC_R_P(long companyId, long repositoryId,
1040 String path) throws SystemException {
1041 return findByC_R_P(companyId, repositoryId, path, QueryUtil.ALL_POS,
1042 QueryUtil.ALL_POS, null);
1043 }
1044
1045
1060 public List<DLContent> findByC_R_P(long companyId, long repositoryId,
1061 String path, int start, int end) throws SystemException {
1062 return findByC_R_P(companyId, repositoryId, path, start, end, null);
1063 }
1064
1065
1081 public List<DLContent> findByC_R_P(long companyId, long repositoryId,
1082 String path, int start, int end, OrderByComparator orderByComparator)
1083 throws SystemException {
1084 FinderPath finderPath = null;
1085 Object[] finderArgs = null;
1086
1087 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1088 (orderByComparator == null)) {
1089 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_R_P;
1090 finderArgs = new Object[] { companyId, repositoryId, path };
1091 }
1092 else {
1093 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_R_P;
1094 finderArgs = new Object[] {
1095 companyId, repositoryId, path,
1096
1097 start, end, orderByComparator
1098 };
1099 }
1100
1101 List<DLContent> list = (List<DLContent>)FinderCacheUtil.getResult(finderPath,
1102 finderArgs, this);
1103
1104 if ((list != null) && !list.isEmpty()) {
1105 for (DLContent dlContent : list) {
1106 if ((companyId != dlContent.getCompanyId()) ||
1107 (repositoryId != dlContent.getRepositoryId()) ||
1108 !Validator.equals(path, dlContent.getPath())) {
1109 list = null;
1110
1111 break;
1112 }
1113 }
1114 }
1115
1116 if (list == null) {
1117 StringBundler query = null;
1118
1119 if (orderByComparator != null) {
1120 query = new StringBundler(5 +
1121 (orderByComparator.getOrderByFields().length * 3));
1122 }
1123 else {
1124 query = new StringBundler(5);
1125 }
1126
1127 query.append(_SQL_SELECT_DLCONTENT_WHERE);
1128
1129 query.append(_FINDER_COLUMN_C_R_P_COMPANYID_2);
1130
1131 query.append(_FINDER_COLUMN_C_R_P_REPOSITORYID_2);
1132
1133 if (path == null) {
1134 query.append(_FINDER_COLUMN_C_R_P_PATH_1);
1135 }
1136 else {
1137 if (path.equals(StringPool.BLANK)) {
1138 query.append(_FINDER_COLUMN_C_R_P_PATH_3);
1139 }
1140 else {
1141 query.append(_FINDER_COLUMN_C_R_P_PATH_2);
1142 }
1143 }
1144
1145 if (orderByComparator != null) {
1146 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1147 orderByComparator);
1148 }
1149
1150 else {
1151 query.append(DLContentModelImpl.ORDER_BY_JPQL);
1152 }
1153
1154 String sql = query.toString();
1155
1156 Session session = null;
1157
1158 try {
1159 session = openSession();
1160
1161 Query q = session.createQuery(sql);
1162
1163 QueryPos qPos = QueryPos.getInstance(q);
1164
1165 qPos.add(companyId);
1166
1167 qPos.add(repositoryId);
1168
1169 if (path != null) {
1170 qPos.add(path);
1171 }
1172
1173 list = (List<DLContent>)QueryUtil.list(q, getDialect(), start,
1174 end);
1175 }
1176 catch (Exception e) {
1177 throw processException(e);
1178 }
1179 finally {
1180 if (list == null) {
1181 FinderCacheUtil.removeResult(finderPath, finderArgs);
1182 }
1183 else {
1184 cacheResult(list);
1185
1186 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1187 }
1188
1189 closeSession(session);
1190 }
1191 }
1192
1193 return list;
1194 }
1195
1196
1207 public DLContent findByC_R_P_First(long companyId, long repositoryId,
1208 String path, OrderByComparator orderByComparator)
1209 throws NoSuchContentException, SystemException {
1210 DLContent dlContent = fetchByC_R_P_First(companyId, repositoryId, path,
1211 orderByComparator);
1212
1213 if (dlContent != null) {
1214 return dlContent;
1215 }
1216
1217 StringBundler msg = new StringBundler(8);
1218
1219 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1220
1221 msg.append("companyId=");
1222 msg.append(companyId);
1223
1224 msg.append(", repositoryId=");
1225 msg.append(repositoryId);
1226
1227 msg.append(", path=");
1228 msg.append(path);
1229
1230 msg.append(StringPool.CLOSE_CURLY_BRACE);
1231
1232 throw new NoSuchContentException(msg.toString());
1233 }
1234
1235
1245 public DLContent fetchByC_R_P_First(long companyId, long repositoryId,
1246 String path, OrderByComparator orderByComparator)
1247 throws SystemException {
1248 List<DLContent> list = findByC_R_P(companyId, repositoryId, path, 0, 1,
1249 orderByComparator);
1250
1251 if (!list.isEmpty()) {
1252 return list.get(0);
1253 }
1254
1255 return null;
1256 }
1257
1258
1269 public DLContent findByC_R_P_Last(long companyId, long repositoryId,
1270 String path, OrderByComparator orderByComparator)
1271 throws NoSuchContentException, SystemException {
1272 DLContent dlContent = fetchByC_R_P_Last(companyId, repositoryId, path,
1273 orderByComparator);
1274
1275 if (dlContent != null) {
1276 return dlContent;
1277 }
1278
1279 StringBundler msg = new StringBundler(8);
1280
1281 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1282
1283 msg.append("companyId=");
1284 msg.append(companyId);
1285
1286 msg.append(", repositoryId=");
1287 msg.append(repositoryId);
1288
1289 msg.append(", path=");
1290 msg.append(path);
1291
1292 msg.append(StringPool.CLOSE_CURLY_BRACE);
1293
1294 throw new NoSuchContentException(msg.toString());
1295 }
1296
1297
1307 public DLContent fetchByC_R_P_Last(long companyId, long repositoryId,
1308 String path, OrderByComparator orderByComparator)
1309 throws SystemException {
1310 int count = countByC_R_P(companyId, repositoryId, path);
1311
1312 List<DLContent> list = findByC_R_P(companyId, repositoryId, path,
1313 count - 1, count, orderByComparator);
1314
1315 if (!list.isEmpty()) {
1316 return list.get(0);
1317 }
1318
1319 return null;
1320 }
1321
1322
1334 public DLContent[] findByC_R_P_PrevAndNext(long contentId, long companyId,
1335 long repositoryId, String path, OrderByComparator orderByComparator)
1336 throws NoSuchContentException, SystemException {
1337 DLContent dlContent = findByPrimaryKey(contentId);
1338
1339 Session session = null;
1340
1341 try {
1342 session = openSession();
1343
1344 DLContent[] array = new DLContentImpl[3];
1345
1346 array[0] = getByC_R_P_PrevAndNext(session, dlContent, companyId,
1347 repositoryId, path, orderByComparator, true);
1348
1349 array[1] = dlContent;
1350
1351 array[2] = getByC_R_P_PrevAndNext(session, dlContent, companyId,
1352 repositoryId, path, orderByComparator, false);
1353
1354 return array;
1355 }
1356 catch (Exception e) {
1357 throw processException(e);
1358 }
1359 finally {
1360 closeSession(session);
1361 }
1362 }
1363
1364 protected DLContent getByC_R_P_PrevAndNext(Session session,
1365 DLContent dlContent, long companyId, long repositoryId, String path,
1366 OrderByComparator orderByComparator, boolean previous) {
1367 StringBundler query = null;
1368
1369 if (orderByComparator != null) {
1370 query = new StringBundler(6 +
1371 (orderByComparator.getOrderByFields().length * 6));
1372 }
1373 else {
1374 query = new StringBundler(3);
1375 }
1376
1377 query.append(_SQL_SELECT_DLCONTENT_WHERE);
1378
1379 query.append(_FINDER_COLUMN_C_R_P_COMPANYID_2);
1380
1381 query.append(_FINDER_COLUMN_C_R_P_REPOSITORYID_2);
1382
1383 if (path == null) {
1384 query.append(_FINDER_COLUMN_C_R_P_PATH_1);
1385 }
1386 else {
1387 if (path.equals(StringPool.BLANK)) {
1388 query.append(_FINDER_COLUMN_C_R_P_PATH_3);
1389 }
1390 else {
1391 query.append(_FINDER_COLUMN_C_R_P_PATH_2);
1392 }
1393 }
1394
1395 if (orderByComparator != null) {
1396 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1397
1398 if (orderByConditionFields.length > 0) {
1399 query.append(WHERE_AND);
1400 }
1401
1402 for (int i = 0; i < orderByConditionFields.length; i++) {
1403 query.append(_ORDER_BY_ENTITY_ALIAS);
1404 query.append(orderByConditionFields[i]);
1405
1406 if ((i + 1) < orderByConditionFields.length) {
1407 if (orderByComparator.isAscending() ^ previous) {
1408 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1409 }
1410 else {
1411 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1412 }
1413 }
1414 else {
1415 if (orderByComparator.isAscending() ^ previous) {
1416 query.append(WHERE_GREATER_THAN);
1417 }
1418 else {
1419 query.append(WHERE_LESSER_THAN);
1420 }
1421 }
1422 }
1423
1424 query.append(ORDER_BY_CLAUSE);
1425
1426 String[] orderByFields = orderByComparator.getOrderByFields();
1427
1428 for (int i = 0; i < orderByFields.length; i++) {
1429 query.append(_ORDER_BY_ENTITY_ALIAS);
1430 query.append(orderByFields[i]);
1431
1432 if ((i + 1) < orderByFields.length) {
1433 if (orderByComparator.isAscending() ^ previous) {
1434 query.append(ORDER_BY_ASC_HAS_NEXT);
1435 }
1436 else {
1437 query.append(ORDER_BY_DESC_HAS_NEXT);
1438 }
1439 }
1440 else {
1441 if (orderByComparator.isAscending() ^ previous) {
1442 query.append(ORDER_BY_ASC);
1443 }
1444 else {
1445 query.append(ORDER_BY_DESC);
1446 }
1447 }
1448 }
1449 }
1450
1451 else {
1452 query.append(DLContentModelImpl.ORDER_BY_JPQL);
1453 }
1454
1455 String sql = query.toString();
1456
1457 Query q = session.createQuery(sql);
1458
1459 q.setFirstResult(0);
1460 q.setMaxResults(2);
1461
1462 QueryPos qPos = QueryPos.getInstance(q);
1463
1464 qPos.add(companyId);
1465
1466 qPos.add(repositoryId);
1467
1468 if (path != null) {
1469 qPos.add(path);
1470 }
1471
1472 if (orderByComparator != null) {
1473 Object[] values = orderByComparator.getOrderByConditionValues(dlContent);
1474
1475 for (Object value : values) {
1476 qPos.add(value);
1477 }
1478 }
1479
1480 List<DLContent> list = q.list();
1481
1482 if (list.size() == 2) {
1483 return list.get(1);
1484 }
1485 else {
1486 return null;
1487 }
1488 }
1489
1490
1499 public List<DLContent> findByC_R_LikeP(long companyId, long repositoryId,
1500 String path) throws SystemException {
1501 return findByC_R_LikeP(companyId, repositoryId, path,
1502 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1503 }
1504
1505
1520 public List<DLContent> findByC_R_LikeP(long companyId, long repositoryId,
1521 String path, int start, int end) throws SystemException {
1522 return findByC_R_LikeP(companyId, repositoryId, path, start, end, null);
1523 }
1524
1525
1541 public List<DLContent> findByC_R_LikeP(long companyId, long repositoryId,
1542 String path, int start, int end, OrderByComparator orderByComparator)
1543 throws SystemException {
1544 FinderPath finderPath = null;
1545 Object[] finderArgs = null;
1546
1547 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_R_LIKEP;
1548 finderArgs = new Object[] {
1549 companyId, repositoryId, path,
1550
1551 start, end, orderByComparator
1552 };
1553
1554 List<DLContent> list = (List<DLContent>)FinderCacheUtil.getResult(finderPath,
1555 finderArgs, this);
1556
1557 if ((list != null) && !list.isEmpty()) {
1558 for (DLContent dlContent : list) {
1559 if ((companyId != dlContent.getCompanyId()) ||
1560 (repositoryId != dlContent.getRepositoryId()) ||
1561 !Validator.equals(path, dlContent.getPath())) {
1562 list = null;
1563
1564 break;
1565 }
1566 }
1567 }
1568
1569 if (list == null) {
1570 StringBundler query = null;
1571
1572 if (orderByComparator != null) {
1573 query = new StringBundler(5 +
1574 (orderByComparator.getOrderByFields().length * 3));
1575 }
1576 else {
1577 query = new StringBundler(5);
1578 }
1579
1580 query.append(_SQL_SELECT_DLCONTENT_WHERE);
1581
1582 query.append(_FINDER_COLUMN_C_R_LIKEP_COMPANYID_2);
1583
1584 query.append(_FINDER_COLUMN_C_R_LIKEP_REPOSITORYID_2);
1585
1586 if (path == null) {
1587 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_1);
1588 }
1589 else {
1590 if (path.equals(StringPool.BLANK)) {
1591 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_3);
1592 }
1593 else {
1594 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_2);
1595 }
1596 }
1597
1598 if (orderByComparator != null) {
1599 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1600 orderByComparator);
1601 }
1602
1603 else {
1604 query.append(DLContentModelImpl.ORDER_BY_JPQL);
1605 }
1606
1607 String sql = query.toString();
1608
1609 Session session = null;
1610
1611 try {
1612 session = openSession();
1613
1614 Query q = session.createQuery(sql);
1615
1616 QueryPos qPos = QueryPos.getInstance(q);
1617
1618 qPos.add(companyId);
1619
1620 qPos.add(repositoryId);
1621
1622 if (path != null) {
1623 qPos.add(path);
1624 }
1625
1626 list = (List<DLContent>)QueryUtil.list(q, getDialect(), start,
1627 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
1660 public DLContent findByC_R_LikeP_First(long companyId, long repositoryId,
1661 String path, OrderByComparator orderByComparator)
1662 throws NoSuchContentException, SystemException {
1663 DLContent dlContent = fetchByC_R_LikeP_First(companyId, repositoryId,
1664 path, orderByComparator);
1665
1666 if (dlContent != null) {
1667 return dlContent;
1668 }
1669
1670 StringBundler msg = new StringBundler(8);
1671
1672 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1673
1674 msg.append("companyId=");
1675 msg.append(companyId);
1676
1677 msg.append(", repositoryId=");
1678 msg.append(repositoryId);
1679
1680 msg.append(", path=");
1681 msg.append(path);
1682
1683 msg.append(StringPool.CLOSE_CURLY_BRACE);
1684
1685 throw new NoSuchContentException(msg.toString());
1686 }
1687
1688
1698 public DLContent fetchByC_R_LikeP_First(long companyId, long repositoryId,
1699 String path, OrderByComparator orderByComparator)
1700 throws SystemException {
1701 List<DLContent> list = findByC_R_LikeP(companyId, repositoryId, path,
1702 0, 1, orderByComparator);
1703
1704 if (!list.isEmpty()) {
1705 return list.get(0);
1706 }
1707
1708 return null;
1709 }
1710
1711
1722 public DLContent findByC_R_LikeP_Last(long companyId, long repositoryId,
1723 String path, OrderByComparator orderByComparator)
1724 throws NoSuchContentException, SystemException {
1725 DLContent dlContent = fetchByC_R_LikeP_Last(companyId, repositoryId,
1726 path, orderByComparator);
1727
1728 if (dlContent != null) {
1729 return dlContent;
1730 }
1731
1732 StringBundler msg = new StringBundler(8);
1733
1734 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1735
1736 msg.append("companyId=");
1737 msg.append(companyId);
1738
1739 msg.append(", repositoryId=");
1740 msg.append(repositoryId);
1741
1742 msg.append(", path=");
1743 msg.append(path);
1744
1745 msg.append(StringPool.CLOSE_CURLY_BRACE);
1746
1747 throw new NoSuchContentException(msg.toString());
1748 }
1749
1750
1760 public DLContent fetchByC_R_LikeP_Last(long companyId, long repositoryId,
1761 String path, OrderByComparator orderByComparator)
1762 throws SystemException {
1763 int count = countByC_R_LikeP(companyId, repositoryId, path);
1764
1765 List<DLContent> list = findByC_R_LikeP(companyId, repositoryId, path,
1766 count - 1, count, orderByComparator);
1767
1768 if (!list.isEmpty()) {
1769 return list.get(0);
1770 }
1771
1772 return null;
1773 }
1774
1775
1787 public DLContent[] findByC_R_LikeP_PrevAndNext(long contentId,
1788 long companyId, long repositoryId, String path,
1789 OrderByComparator orderByComparator)
1790 throws NoSuchContentException, SystemException {
1791 DLContent dlContent = findByPrimaryKey(contentId);
1792
1793 Session session = null;
1794
1795 try {
1796 session = openSession();
1797
1798 DLContent[] array = new DLContentImpl[3];
1799
1800 array[0] = getByC_R_LikeP_PrevAndNext(session, dlContent,
1801 companyId, repositoryId, path, orderByComparator, true);
1802
1803 array[1] = dlContent;
1804
1805 array[2] = getByC_R_LikeP_PrevAndNext(session, dlContent,
1806 companyId, repositoryId, path, orderByComparator, false);
1807
1808 return array;
1809 }
1810 catch (Exception e) {
1811 throw processException(e);
1812 }
1813 finally {
1814 closeSession(session);
1815 }
1816 }
1817
1818 protected DLContent getByC_R_LikeP_PrevAndNext(Session session,
1819 DLContent dlContent, long companyId, long repositoryId, String path,
1820 OrderByComparator orderByComparator, boolean previous) {
1821 StringBundler query = null;
1822
1823 if (orderByComparator != null) {
1824 query = new StringBundler(6 +
1825 (orderByComparator.getOrderByFields().length * 6));
1826 }
1827 else {
1828 query = new StringBundler(3);
1829 }
1830
1831 query.append(_SQL_SELECT_DLCONTENT_WHERE);
1832
1833 query.append(_FINDER_COLUMN_C_R_LIKEP_COMPANYID_2);
1834
1835 query.append(_FINDER_COLUMN_C_R_LIKEP_REPOSITORYID_2);
1836
1837 if (path == null) {
1838 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_1);
1839 }
1840 else {
1841 if (path.equals(StringPool.BLANK)) {
1842 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_3);
1843 }
1844 else {
1845 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_2);
1846 }
1847 }
1848
1849 if (orderByComparator != null) {
1850 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1851
1852 if (orderByConditionFields.length > 0) {
1853 query.append(WHERE_AND);
1854 }
1855
1856 for (int i = 0; i < orderByConditionFields.length; i++) {
1857 query.append(_ORDER_BY_ENTITY_ALIAS);
1858 query.append(orderByConditionFields[i]);
1859
1860 if ((i + 1) < orderByConditionFields.length) {
1861 if (orderByComparator.isAscending() ^ previous) {
1862 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1863 }
1864 else {
1865 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1866 }
1867 }
1868 else {
1869 if (orderByComparator.isAscending() ^ previous) {
1870 query.append(WHERE_GREATER_THAN);
1871 }
1872 else {
1873 query.append(WHERE_LESSER_THAN);
1874 }
1875 }
1876 }
1877
1878 query.append(ORDER_BY_CLAUSE);
1879
1880 String[] orderByFields = orderByComparator.getOrderByFields();
1881
1882 for (int i = 0; i < orderByFields.length; i++) {
1883 query.append(_ORDER_BY_ENTITY_ALIAS);
1884 query.append(orderByFields[i]);
1885
1886 if ((i + 1) < orderByFields.length) {
1887 if (orderByComparator.isAscending() ^ previous) {
1888 query.append(ORDER_BY_ASC_HAS_NEXT);
1889 }
1890 else {
1891 query.append(ORDER_BY_DESC_HAS_NEXT);
1892 }
1893 }
1894 else {
1895 if (orderByComparator.isAscending() ^ previous) {
1896 query.append(ORDER_BY_ASC);
1897 }
1898 else {
1899 query.append(ORDER_BY_DESC);
1900 }
1901 }
1902 }
1903 }
1904
1905 else {
1906 query.append(DLContentModelImpl.ORDER_BY_JPQL);
1907 }
1908
1909 String sql = query.toString();
1910
1911 Query q = session.createQuery(sql);
1912
1913 q.setFirstResult(0);
1914 q.setMaxResults(2);
1915
1916 QueryPos qPos = QueryPos.getInstance(q);
1917
1918 qPos.add(companyId);
1919
1920 qPos.add(repositoryId);
1921
1922 if (path != null) {
1923 qPos.add(path);
1924 }
1925
1926 if (orderByComparator != null) {
1927 Object[] values = orderByComparator.getOrderByConditionValues(dlContent);
1928
1929 for (Object value : values) {
1930 qPos.add(value);
1931 }
1932 }
1933
1934 List<DLContent> list = q.list();
1935
1936 if (list.size() == 2) {
1937 return list.get(1);
1938 }
1939 else {
1940 return null;
1941 }
1942 }
1943
1944
1955 public DLContent findByC_R_P_V(long companyId, long repositoryId,
1956 String path, String version)
1957 throws NoSuchContentException, SystemException {
1958 DLContent dlContent = fetchByC_R_P_V(companyId, repositoryId, path,
1959 version);
1960
1961 if (dlContent == null) {
1962 StringBundler msg = new StringBundler(10);
1963
1964 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1965
1966 msg.append("companyId=");
1967 msg.append(companyId);
1968
1969 msg.append(", repositoryId=");
1970 msg.append(repositoryId);
1971
1972 msg.append(", path=");
1973 msg.append(path);
1974
1975 msg.append(", version=");
1976 msg.append(version);
1977
1978 msg.append(StringPool.CLOSE_CURLY_BRACE);
1979
1980 if (_log.isWarnEnabled()) {
1981 _log.warn(msg.toString());
1982 }
1983
1984 throw new NoSuchContentException(msg.toString());
1985 }
1986
1987 return dlContent;
1988 }
1989
1990
2000 public DLContent fetchByC_R_P_V(long companyId, long repositoryId,
2001 String path, String version) throws SystemException {
2002 return fetchByC_R_P_V(companyId, repositoryId, path, version, true);
2003 }
2004
2005
2016 public DLContent fetchByC_R_P_V(long companyId, long repositoryId,
2017 String path, String version, boolean retrieveFromCache)
2018 throws SystemException {
2019 Object[] finderArgs = new Object[] {
2020 companyId, repositoryId, path, version
2021 };
2022
2023 Object result = null;
2024
2025 if (retrieveFromCache) {
2026 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_R_P_V,
2027 finderArgs, this);
2028 }
2029
2030 if (result instanceof DLContent) {
2031 DLContent dlContent = (DLContent)result;
2032
2033 if ((companyId != dlContent.getCompanyId()) ||
2034 (repositoryId != dlContent.getRepositoryId()) ||
2035 !Validator.equals(path, dlContent.getPath()) ||
2036 !Validator.equals(version, dlContent.getVersion())) {
2037 result = null;
2038 }
2039 }
2040
2041 if (result == null) {
2042 StringBundler query = new StringBundler(6);
2043
2044 query.append(_SQL_SELECT_DLCONTENT_WHERE);
2045
2046 query.append(_FINDER_COLUMN_C_R_P_V_COMPANYID_2);
2047
2048 query.append(_FINDER_COLUMN_C_R_P_V_REPOSITORYID_2);
2049
2050 if (path == null) {
2051 query.append(_FINDER_COLUMN_C_R_P_V_PATH_1);
2052 }
2053 else {
2054 if (path.equals(StringPool.BLANK)) {
2055 query.append(_FINDER_COLUMN_C_R_P_V_PATH_3);
2056 }
2057 else {
2058 query.append(_FINDER_COLUMN_C_R_P_V_PATH_2);
2059 }
2060 }
2061
2062 if (version == null) {
2063 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_1);
2064 }
2065 else {
2066 if (version.equals(StringPool.BLANK)) {
2067 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_3);
2068 }
2069 else {
2070 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_2);
2071 }
2072 }
2073
2074 query.append(DLContentModelImpl.ORDER_BY_JPQL);
2075
2076 String sql = query.toString();
2077
2078 Session session = null;
2079
2080 try {
2081 session = openSession();
2082
2083 Query q = session.createQuery(sql);
2084
2085 QueryPos qPos = QueryPos.getInstance(q);
2086
2087 qPos.add(companyId);
2088
2089 qPos.add(repositoryId);
2090
2091 if (path != null) {
2092 qPos.add(path);
2093 }
2094
2095 if (version != null) {
2096 qPos.add(version);
2097 }
2098
2099 List<DLContent> list = q.list();
2100
2101 result = list;
2102
2103 DLContent dlContent = null;
2104
2105 if (list.isEmpty()) {
2106 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R_P_V,
2107 finderArgs, list);
2108 }
2109 else {
2110 dlContent = list.get(0);
2111
2112 cacheResult(dlContent);
2113
2114 if ((dlContent.getCompanyId() != companyId) ||
2115 (dlContent.getRepositoryId() != repositoryId) ||
2116 (dlContent.getPath() == null) ||
2117 !dlContent.getPath().equals(path) ||
2118 (dlContent.getVersion() == null) ||
2119 !dlContent.getVersion().equals(version)) {
2120 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R_P_V,
2121 finderArgs, dlContent);
2122 }
2123 }
2124
2125 return dlContent;
2126 }
2127 catch (Exception e) {
2128 throw processException(e);
2129 }
2130 finally {
2131 if (result == null) {
2132 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R_P_V,
2133 finderArgs);
2134 }
2135
2136 closeSession(session);
2137 }
2138 }
2139 else {
2140 if (result instanceof List<?>) {
2141 return null;
2142 }
2143 else {
2144 return (DLContent)result;
2145 }
2146 }
2147 }
2148
2149
2155 public List<DLContent> findAll() throws SystemException {
2156 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2157 }
2158
2159
2171 public List<DLContent> findAll(int start, int end)
2172 throws SystemException {
2173 return findAll(start, end, null);
2174 }
2175
2176
2189 public List<DLContent> findAll(int start, int end,
2190 OrderByComparator orderByComparator) throws SystemException {
2191 FinderPath finderPath = null;
2192 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2193
2194 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2195 (orderByComparator == null)) {
2196 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2197 finderArgs = FINDER_ARGS_EMPTY;
2198 }
2199 else {
2200 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2201 finderArgs = new Object[] { start, end, orderByComparator };
2202 }
2203
2204 List<DLContent> list = (List<DLContent>)FinderCacheUtil.getResult(finderPath,
2205 finderArgs, this);
2206
2207 if (list == null) {
2208 StringBundler query = null;
2209 String sql = null;
2210
2211 if (orderByComparator != null) {
2212 query = new StringBundler(2 +
2213 (orderByComparator.getOrderByFields().length * 3));
2214
2215 query.append(_SQL_SELECT_DLCONTENT);
2216
2217 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2218 orderByComparator);
2219
2220 sql = query.toString();
2221 }
2222 else {
2223 sql = _SQL_SELECT_DLCONTENT.concat(DLContentModelImpl.ORDER_BY_JPQL);
2224 }
2225
2226 Session session = null;
2227
2228 try {
2229 session = openSession();
2230
2231 Query q = session.createQuery(sql);
2232
2233 if (orderByComparator == null) {
2234 list = (List<DLContent>)QueryUtil.list(q, getDialect(),
2235 start, end, false);
2236
2237 Collections.sort(list);
2238 }
2239 else {
2240 list = (List<DLContent>)QueryUtil.list(q, getDialect(),
2241 start, end);
2242 }
2243 }
2244 catch (Exception e) {
2245 throw processException(e);
2246 }
2247 finally {
2248 if (list == null) {
2249 FinderCacheUtil.removeResult(finderPath, finderArgs);
2250 }
2251 else {
2252 cacheResult(list);
2253
2254 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2255 }
2256
2257 closeSession(session);
2258 }
2259 }
2260
2261 return list;
2262 }
2263
2264
2271 public void removeByC_R(long companyId, long repositoryId)
2272 throws SystemException {
2273 for (DLContent dlContent : findByC_R(companyId, repositoryId)) {
2274 remove(dlContent);
2275 }
2276 }
2277
2278
2286 public void removeByC_R_P(long companyId, long repositoryId, String path)
2287 throws SystemException {
2288 for (DLContent dlContent : findByC_R_P(companyId, repositoryId, path)) {
2289 remove(dlContent);
2290 }
2291 }
2292
2293
2301 public void removeByC_R_LikeP(long companyId, long repositoryId, String path)
2302 throws SystemException {
2303 for (DLContent dlContent : findByC_R_LikeP(companyId, repositoryId, path)) {
2304 remove(dlContent);
2305 }
2306 }
2307
2308
2318 public DLContent removeByC_R_P_V(long companyId, long repositoryId,
2319 String path, String version)
2320 throws NoSuchContentException, SystemException {
2321 DLContent dlContent = findByC_R_P_V(companyId, repositoryId, path,
2322 version);
2323
2324 return remove(dlContent);
2325 }
2326
2327
2332 public void removeAll() throws SystemException {
2333 for (DLContent dlContent : findAll()) {
2334 remove(dlContent);
2335 }
2336 }
2337
2338
2346 public int countByC_R(long companyId, long repositoryId)
2347 throws SystemException {
2348 Object[] finderArgs = new Object[] { companyId, repositoryId };
2349
2350 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_R,
2351 finderArgs, this);
2352
2353 if (count == null) {
2354 StringBundler query = new StringBundler(3);
2355
2356 query.append(_SQL_COUNT_DLCONTENT_WHERE);
2357
2358 query.append(_FINDER_COLUMN_C_R_COMPANYID_2);
2359
2360 query.append(_FINDER_COLUMN_C_R_REPOSITORYID_2);
2361
2362 String sql = query.toString();
2363
2364 Session session = null;
2365
2366 try {
2367 session = openSession();
2368
2369 Query q = session.createQuery(sql);
2370
2371 QueryPos qPos = QueryPos.getInstance(q);
2372
2373 qPos.add(companyId);
2374
2375 qPos.add(repositoryId);
2376
2377 count = (Long)q.uniqueResult();
2378 }
2379 catch (Exception e) {
2380 throw processException(e);
2381 }
2382 finally {
2383 if (count == null) {
2384 count = Long.valueOf(0);
2385 }
2386
2387 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_R, finderArgs,
2388 count);
2389
2390 closeSession(session);
2391 }
2392 }
2393
2394 return count.intValue();
2395 }
2396
2397
2406 public int countByC_R_P(long companyId, long repositoryId, String path)
2407 throws SystemException {
2408 Object[] finderArgs = new Object[] { companyId, repositoryId, path };
2409
2410 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_R_P,
2411 finderArgs, this);
2412
2413 if (count == null) {
2414 StringBundler query = new StringBundler(4);
2415
2416 query.append(_SQL_COUNT_DLCONTENT_WHERE);
2417
2418 query.append(_FINDER_COLUMN_C_R_P_COMPANYID_2);
2419
2420 query.append(_FINDER_COLUMN_C_R_P_REPOSITORYID_2);
2421
2422 if (path == null) {
2423 query.append(_FINDER_COLUMN_C_R_P_PATH_1);
2424 }
2425 else {
2426 if (path.equals(StringPool.BLANK)) {
2427 query.append(_FINDER_COLUMN_C_R_P_PATH_3);
2428 }
2429 else {
2430 query.append(_FINDER_COLUMN_C_R_P_PATH_2);
2431 }
2432 }
2433
2434 String sql = query.toString();
2435
2436 Session session = null;
2437
2438 try {
2439 session = openSession();
2440
2441 Query q = session.createQuery(sql);
2442
2443 QueryPos qPos = QueryPos.getInstance(q);
2444
2445 qPos.add(companyId);
2446
2447 qPos.add(repositoryId);
2448
2449 if (path != null) {
2450 qPos.add(path);
2451 }
2452
2453 count = (Long)q.uniqueResult();
2454 }
2455 catch (Exception e) {
2456 throw processException(e);
2457 }
2458 finally {
2459 if (count == null) {
2460 count = Long.valueOf(0);
2461 }
2462
2463 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_R_P,
2464 finderArgs, count);
2465
2466 closeSession(session);
2467 }
2468 }
2469
2470 return count.intValue();
2471 }
2472
2473
2482 public int countByC_R_LikeP(long companyId, long repositoryId, String path)
2483 throws SystemException {
2484 Object[] finderArgs = new Object[] { companyId, repositoryId, path };
2485
2486 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_R_LIKEP,
2487 finderArgs, this);
2488
2489 if (count == null) {
2490 StringBundler query = new StringBundler(4);
2491
2492 query.append(_SQL_COUNT_DLCONTENT_WHERE);
2493
2494 query.append(_FINDER_COLUMN_C_R_LIKEP_COMPANYID_2);
2495
2496 query.append(_FINDER_COLUMN_C_R_LIKEP_REPOSITORYID_2);
2497
2498 if (path == null) {
2499 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_1);
2500 }
2501 else {
2502 if (path.equals(StringPool.BLANK)) {
2503 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_3);
2504 }
2505 else {
2506 query.append(_FINDER_COLUMN_C_R_LIKEP_PATH_2);
2507 }
2508 }
2509
2510 String sql = query.toString();
2511
2512 Session session = null;
2513
2514 try {
2515 session = openSession();
2516
2517 Query q = session.createQuery(sql);
2518
2519 QueryPos qPos = QueryPos.getInstance(q);
2520
2521 qPos.add(companyId);
2522
2523 qPos.add(repositoryId);
2524
2525 if (path != null) {
2526 qPos.add(path);
2527 }
2528
2529 count = (Long)q.uniqueResult();
2530 }
2531 catch (Exception e) {
2532 throw processException(e);
2533 }
2534 finally {
2535 if (count == null) {
2536 count = Long.valueOf(0);
2537 }
2538
2539 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_R_LIKEP,
2540 finderArgs, count);
2541
2542 closeSession(session);
2543 }
2544 }
2545
2546 return count.intValue();
2547 }
2548
2549
2559 public int countByC_R_P_V(long companyId, long repositoryId, String path,
2560 String version) throws SystemException {
2561 Object[] finderArgs = new Object[] {
2562 companyId, repositoryId, path, version
2563 };
2564
2565 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_R_P_V,
2566 finderArgs, this);
2567
2568 if (count == null) {
2569 StringBundler query = new StringBundler(5);
2570
2571 query.append(_SQL_COUNT_DLCONTENT_WHERE);
2572
2573 query.append(_FINDER_COLUMN_C_R_P_V_COMPANYID_2);
2574
2575 query.append(_FINDER_COLUMN_C_R_P_V_REPOSITORYID_2);
2576
2577 if (path == null) {
2578 query.append(_FINDER_COLUMN_C_R_P_V_PATH_1);
2579 }
2580 else {
2581 if (path.equals(StringPool.BLANK)) {
2582 query.append(_FINDER_COLUMN_C_R_P_V_PATH_3);
2583 }
2584 else {
2585 query.append(_FINDER_COLUMN_C_R_P_V_PATH_2);
2586 }
2587 }
2588
2589 if (version == null) {
2590 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_1);
2591 }
2592 else {
2593 if (version.equals(StringPool.BLANK)) {
2594 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_3);
2595 }
2596 else {
2597 query.append(_FINDER_COLUMN_C_R_P_V_VERSION_2);
2598 }
2599 }
2600
2601 String sql = query.toString();
2602
2603 Session session = null;
2604
2605 try {
2606 session = openSession();
2607
2608 Query q = session.createQuery(sql);
2609
2610 QueryPos qPos = QueryPos.getInstance(q);
2611
2612 qPos.add(companyId);
2613
2614 qPos.add(repositoryId);
2615
2616 if (path != null) {
2617 qPos.add(path);
2618 }
2619
2620 if (version != null) {
2621 qPos.add(version);
2622 }
2623
2624 count = (Long)q.uniqueResult();
2625 }
2626 catch (Exception e) {
2627 throw processException(e);
2628 }
2629 finally {
2630 if (count == null) {
2631 count = Long.valueOf(0);
2632 }
2633
2634 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_R_P_V,
2635 finderArgs, count);
2636
2637 closeSession(session);
2638 }
2639 }
2640
2641 return count.intValue();
2642 }
2643
2644
2650 public int countAll() throws SystemException {
2651 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2652 FINDER_ARGS_EMPTY, this);
2653
2654 if (count == null) {
2655 Session session = null;
2656
2657 try {
2658 session = openSession();
2659
2660 Query q = session.createQuery(_SQL_COUNT_DLCONTENT);
2661
2662 count = (Long)q.uniqueResult();
2663 }
2664 catch (Exception e) {
2665 throw processException(e);
2666 }
2667 finally {
2668 if (count == null) {
2669 count = Long.valueOf(0);
2670 }
2671
2672 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2673 FINDER_ARGS_EMPTY, count);
2674
2675 closeSession(session);
2676 }
2677 }
2678
2679 return count.intValue();
2680 }
2681
2682
2685 public void afterPropertiesSet() {
2686 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2687 com.liferay.portal.util.PropsUtil.get(
2688 "value.object.listener.com.liferay.portlet.documentlibrary.model.DLContent")));
2689
2690 if (listenerClassNames.length > 0) {
2691 try {
2692 List<ModelListener<DLContent>> listenersList = new ArrayList<ModelListener<DLContent>>();
2693
2694 for (String listenerClassName : listenerClassNames) {
2695 listenersList.add((ModelListener<DLContent>)InstanceFactory.newInstance(
2696 listenerClassName));
2697 }
2698
2699 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2700 }
2701 catch (Exception e) {
2702 _log.error(e);
2703 }
2704 }
2705 }
2706
2707 public void destroy() {
2708 EntityCacheUtil.removeCache(DLContentImpl.class.getName());
2709 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2710 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2711 }
2712
2713 @BeanReference(type = DLContentPersistence.class)
2714 protected DLContentPersistence dlContentPersistence;
2715 @BeanReference(type = DLFileEntryPersistence.class)
2716 protected DLFileEntryPersistence dlFileEntryPersistence;
2717 @BeanReference(type = DLFileEntryMetadataPersistence.class)
2718 protected DLFileEntryMetadataPersistence dlFileEntryMetadataPersistence;
2719 @BeanReference(type = DLFileEntryTypePersistence.class)
2720 protected DLFileEntryTypePersistence dlFileEntryTypePersistence;
2721 @BeanReference(type = DLFileRankPersistence.class)
2722 protected DLFileRankPersistence dlFileRankPersistence;
2723 @BeanReference(type = DLFileShortcutPersistence.class)
2724 protected DLFileShortcutPersistence dlFileShortcutPersistence;
2725 @BeanReference(type = DLFileVersionPersistence.class)
2726 protected DLFileVersionPersistence dlFileVersionPersistence;
2727 @BeanReference(type = DLFolderPersistence.class)
2728 protected DLFolderPersistence dlFolderPersistence;
2729 @BeanReference(type = DLSyncPersistence.class)
2730 protected DLSyncPersistence dlSyncPersistence;
2731 @BeanReference(type = ResourcePersistence.class)
2732 protected ResourcePersistence resourcePersistence;
2733 @BeanReference(type = UserPersistence.class)
2734 protected UserPersistence userPersistence;
2735 private static final String _SQL_SELECT_DLCONTENT = "SELECT dlContent FROM DLContent dlContent";
2736 private static final String _SQL_SELECT_DLCONTENT_WHERE = "SELECT dlContent FROM DLContent dlContent WHERE ";
2737 private static final String _SQL_COUNT_DLCONTENT = "SELECT COUNT(dlContent) FROM DLContent dlContent";
2738 private static final String _SQL_COUNT_DLCONTENT_WHERE = "SELECT COUNT(dlContent) FROM DLContent dlContent WHERE ";
2739 private static final String _FINDER_COLUMN_C_R_COMPANYID_2 = "dlContent.companyId = ? AND ";
2740 private static final String _FINDER_COLUMN_C_R_REPOSITORYID_2 = "dlContent.repositoryId = ?";
2741 private static final String _FINDER_COLUMN_C_R_P_COMPANYID_2 = "dlContent.companyId = ? AND ";
2742 private static final String _FINDER_COLUMN_C_R_P_REPOSITORYID_2 = "dlContent.repositoryId = ? AND ";
2743 private static final String _FINDER_COLUMN_C_R_P_PATH_1 = "dlContent.path IS NULL";
2744 private static final String _FINDER_COLUMN_C_R_P_PATH_2 = "dlContent.path = ?";
2745 private static final String _FINDER_COLUMN_C_R_P_PATH_3 = "(dlContent.path IS NULL OR dlContent.path = ?)";
2746 private static final String _FINDER_COLUMN_C_R_LIKEP_COMPANYID_2 = "dlContent.companyId = ? AND ";
2747 private static final String _FINDER_COLUMN_C_R_LIKEP_REPOSITORYID_2 = "dlContent.repositoryId = ? AND ";
2748 private static final String _FINDER_COLUMN_C_R_LIKEP_PATH_1 = "dlContent.path LIKE NULL";
2749 private static final String _FINDER_COLUMN_C_R_LIKEP_PATH_2 = "dlContent.path LIKE ?";
2750 private static final String _FINDER_COLUMN_C_R_LIKEP_PATH_3 = "(dlContent.path IS NULL OR dlContent.path LIKE ?)";
2751 private static final String _FINDER_COLUMN_C_R_P_V_COMPANYID_2 = "dlContent.companyId = ? AND ";
2752 private static final String _FINDER_COLUMN_C_R_P_V_REPOSITORYID_2 = "dlContent.repositoryId = ? AND ";
2753 private static final String _FINDER_COLUMN_C_R_P_V_PATH_1 = "dlContent.path IS NULL AND ";
2754 private static final String _FINDER_COLUMN_C_R_P_V_PATH_2 = "dlContent.path = ? AND ";
2755 private static final String _FINDER_COLUMN_C_R_P_V_PATH_3 = "(dlContent.path IS NULL OR dlContent.path = ?) AND ";
2756 private static final String _FINDER_COLUMN_C_R_P_V_VERSION_1 = "dlContent.version IS NULL";
2757 private static final String _FINDER_COLUMN_C_R_P_V_VERSION_2 = "dlContent.version = ?";
2758 private static final String _FINDER_COLUMN_C_R_P_V_VERSION_3 = "(dlContent.version IS NULL OR dlContent.version = ?)";
2759 private static final String _ORDER_BY_ENTITY_ALIAS = "dlContent.";
2760 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DLContent exists with the primary key ";
2761 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DLContent exists with the key {";
2762 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2763 private static Log _log = LogFactoryUtil.getLog(DLContentPersistenceImpl.class);
2764 private static DLContent _nullDLContent = new DLContentImpl() {
2765 @Override
2766 public Object clone() {
2767 return this;
2768 }
2769
2770 @Override
2771 public CacheModel<DLContent> toCacheModel() {
2772 return _nullDLContentCacheModel;
2773 }
2774 };
2775
2776 private static CacheModel<DLContent> _nullDLContentCacheModel = new CacheModel<DLContent>() {
2777 public DLContent toEntityModel() {
2778 return _nullDLContent;
2779 }
2780 };
2781 }