001
014
015 package com.liferay.portlet.documentlibrary.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.annotation.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.SQLQuery;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.kernel.util.Validator;
038 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
039 import com.liferay.portal.model.ModelListener;
040 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
041 import com.liferay.portal.service.persistence.BatchSessionUtil;
042 import com.liferay.portal.service.persistence.GroupPersistence;
043 import com.liferay.portal.service.persistence.LayoutPersistence;
044 import com.liferay.portal.service.persistence.LockPersistence;
045 import com.liferay.portal.service.persistence.ResourcePersistence;
046 import com.liferay.portal.service.persistence.UserPersistence;
047 import com.liferay.portal.service.persistence.WebDAVPropsPersistence;
048 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
049
050 import com.liferay.portlet.documentlibrary.NoSuchFolderException;
051 import com.liferay.portlet.documentlibrary.model.DLFolder;
052 import com.liferay.portlet.documentlibrary.model.impl.DLFolderImpl;
053 import com.liferay.portlet.documentlibrary.model.impl.DLFolderModelImpl;
054 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
055
056 import java.io.Serializable;
057
058 import java.util.ArrayList;
059 import java.util.Collections;
060 import java.util.List;
061
062
078 public class DLFolderPersistenceImpl extends BasePersistenceImpl<DLFolder>
079 implements DLFolderPersistence {
080 public static final String FINDER_CLASS_NAME_ENTITY = DLFolderImpl.class.getName();
081 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
082 ".List";
083 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
084 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
085 "findByUuid",
086 new String[] {
087 String.class.getName(),
088
089 "java.lang.Integer", "java.lang.Integer",
090 "com.liferay.portal.kernel.util.OrderByComparator"
091 });
092 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
093 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
094 "countByUuid", new String[] { String.class.getName() });
095 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
096 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
097 "fetchByUUID_G",
098 new String[] { String.class.getName(), Long.class.getName() });
099 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
100 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
101 "countByUUID_G",
102 new String[] { String.class.getName(), Long.class.getName() });
103 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
104 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
105 "findByGroupId",
106 new String[] {
107 Long.class.getName(),
108
109 "java.lang.Integer", "java.lang.Integer",
110 "com.liferay.portal.kernel.util.OrderByComparator"
111 });
112 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
113 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
114 "countByGroupId", new String[] { Long.class.getName() });
115 public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
116 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
117 "findByCompanyId",
118 new String[] {
119 Long.class.getName(),
120
121 "java.lang.Integer", "java.lang.Integer",
122 "com.liferay.portal.kernel.util.OrderByComparator"
123 });
124 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
125 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
126 "countByCompanyId", new String[] { Long.class.getName() });
127 public static final FinderPath FINDER_PATH_FIND_BY_G_P = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
128 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
129 "findByG_P",
130 new String[] {
131 Long.class.getName(), Long.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_COUNT_BY_G_P = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
137 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
138 "countByG_P",
139 new String[] { Long.class.getName(), Long.class.getName() });
140 public static final FinderPath FINDER_PATH_FIND_BY_P_N = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
141 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
142 "findByP_N",
143 new String[] {
144 Long.class.getName(), String.class.getName(),
145
146 "java.lang.Integer", "java.lang.Integer",
147 "com.liferay.portal.kernel.util.OrderByComparator"
148 });
149 public static final FinderPath FINDER_PATH_COUNT_BY_P_N = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
150 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
151 "countByP_N",
152 new String[] { Long.class.getName(), String.class.getName() });
153 public static final FinderPath FINDER_PATH_FETCH_BY_G_P_N = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
154 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
155 "fetchByG_P_N",
156 new String[] {
157 Long.class.getName(), Long.class.getName(),
158 String.class.getName()
159 });
160 public static final FinderPath FINDER_PATH_COUNT_BY_G_P_N = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
161 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
162 "countByG_P_N",
163 new String[] {
164 Long.class.getName(), Long.class.getName(),
165 String.class.getName()
166 });
167 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
168 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
169 "findAll", new String[0]);
170 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
171 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
172 "countAll", new String[0]);
173
174
179 public void cacheResult(DLFolder dlFolder) {
180 EntityCacheUtil.putResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
181 DLFolderImpl.class, dlFolder.getPrimaryKey(), dlFolder);
182
183 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
184 new Object[] { dlFolder.getUuid(), new Long(dlFolder.getGroupId()) },
185 dlFolder);
186
187 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
188 new Object[] {
189 new Long(dlFolder.getGroupId()),
190 new Long(dlFolder.getParentFolderId()),
191
192 dlFolder.getName()
193 }, dlFolder);
194 }
195
196
201 public void cacheResult(List<DLFolder> dlFolders) {
202 for (DLFolder dlFolder : dlFolders) {
203 if (EntityCacheUtil.getResult(
204 DLFolderModelImpl.ENTITY_CACHE_ENABLED,
205 DLFolderImpl.class, dlFolder.getPrimaryKey(), this) == null) {
206 cacheResult(dlFolder);
207 }
208 }
209 }
210
211
218 public void clearCache() {
219 CacheRegistryUtil.clear(DLFolderImpl.class.getName());
220 EntityCacheUtil.clearCache(DLFolderImpl.class.getName());
221 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
222 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
223 }
224
225
232 public void clearCache(DLFolder dlFolder) {
233 EntityCacheUtil.removeResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
234 DLFolderImpl.class, dlFolder.getPrimaryKey());
235
236 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
237 new Object[] { dlFolder.getUuid(), new Long(dlFolder.getGroupId()) });
238
239 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
240 new Object[] {
241 new Long(dlFolder.getGroupId()),
242 new Long(dlFolder.getParentFolderId()),
243
244 dlFolder.getName()
245 });
246 }
247
248
254 public DLFolder create(long folderId) {
255 DLFolder dlFolder = new DLFolderImpl();
256
257 dlFolder.setNew(true);
258 dlFolder.setPrimaryKey(folderId);
259
260 String uuid = PortalUUIDUtil.generate();
261
262 dlFolder.setUuid(uuid);
263
264 return dlFolder;
265 }
266
267
275 public DLFolder remove(Serializable primaryKey)
276 throws NoSuchModelException, SystemException {
277 return remove(((Long)primaryKey).longValue());
278 }
279
280
288 public DLFolder remove(long folderId)
289 throws NoSuchFolderException, SystemException {
290 Session session = null;
291
292 try {
293 session = openSession();
294
295 DLFolder dlFolder = (DLFolder)session.get(DLFolderImpl.class,
296 new Long(folderId));
297
298 if (dlFolder == null) {
299 if (_log.isWarnEnabled()) {
300 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + folderId);
301 }
302
303 throw new NoSuchFolderException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
304 folderId);
305 }
306
307 return remove(dlFolder);
308 }
309 catch (NoSuchFolderException nsee) {
310 throw nsee;
311 }
312 catch (Exception e) {
313 throw processException(e);
314 }
315 finally {
316 closeSession(session);
317 }
318 }
319
320 protected DLFolder removeImpl(DLFolder dlFolder) throws SystemException {
321 dlFolder = toUnwrappedModel(dlFolder);
322
323 Session session = null;
324
325 try {
326 session = openSession();
327
328 if (dlFolder.isCachedModel() || BatchSessionUtil.isEnabled()) {
329 Object staleObject = session.get(DLFolderImpl.class,
330 dlFolder.getPrimaryKeyObj());
331
332 if (staleObject != null) {
333 session.evict(staleObject);
334 }
335 }
336
337 session.delete(dlFolder);
338
339 session.flush();
340 }
341 catch (Exception e) {
342 throw processException(e);
343 }
344 finally {
345 closeSession(session);
346 }
347
348 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
349
350 DLFolderModelImpl dlFolderModelImpl = (DLFolderModelImpl)dlFolder;
351
352 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
353 new Object[] {
354 dlFolderModelImpl.getOriginalUuid(),
355 new Long(dlFolderModelImpl.getOriginalGroupId())
356 });
357
358 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
359 new Object[] {
360 new Long(dlFolderModelImpl.getOriginalGroupId()),
361 new Long(dlFolderModelImpl.getOriginalParentFolderId()),
362
363 dlFolderModelImpl.getOriginalName()
364 });
365
366 EntityCacheUtil.removeResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
367 DLFolderImpl.class, dlFolder.getPrimaryKey());
368
369 return dlFolder;
370 }
371
372 public DLFolder updateImpl(
373 com.liferay.portlet.documentlibrary.model.DLFolder dlFolder,
374 boolean merge) throws SystemException {
375 dlFolder = toUnwrappedModel(dlFolder);
376
377 boolean isNew = dlFolder.isNew();
378
379 DLFolderModelImpl dlFolderModelImpl = (DLFolderModelImpl)dlFolder;
380
381 if (Validator.isNull(dlFolder.getUuid())) {
382 String uuid = PortalUUIDUtil.generate();
383
384 dlFolder.setUuid(uuid);
385 }
386
387 Session session = null;
388
389 try {
390 session = openSession();
391
392 BatchSessionUtil.update(session, dlFolder, merge);
393
394 dlFolder.setNew(false);
395 }
396 catch (Exception e) {
397 throw processException(e);
398 }
399 finally {
400 closeSession(session);
401 }
402
403 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
404
405 EntityCacheUtil.putResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
406 DLFolderImpl.class, dlFolder.getPrimaryKey(), dlFolder);
407
408 if (!isNew &&
409 (!Validator.equals(dlFolder.getUuid(),
410 dlFolderModelImpl.getOriginalUuid()) ||
411 (dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()))) {
412 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
413 new Object[] {
414 dlFolderModelImpl.getOriginalUuid(),
415 new Long(dlFolderModelImpl.getOriginalGroupId())
416 });
417 }
418
419 if (isNew ||
420 (!Validator.equals(dlFolder.getUuid(),
421 dlFolderModelImpl.getOriginalUuid()) ||
422 (dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()))) {
423 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
424 new Object[] { dlFolder.getUuid(), new Long(
425 dlFolder.getGroupId()) }, dlFolder);
426 }
427
428 if (!isNew &&
429 ((dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()) ||
430 (dlFolder.getParentFolderId() != dlFolderModelImpl.getOriginalParentFolderId()) ||
431 !Validator.equals(dlFolder.getName(),
432 dlFolderModelImpl.getOriginalName()))) {
433 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
434 new Object[] {
435 new Long(dlFolderModelImpl.getOriginalGroupId()),
436 new Long(dlFolderModelImpl.getOriginalParentFolderId()),
437
438 dlFolderModelImpl.getOriginalName()
439 });
440 }
441
442 if (isNew ||
443 ((dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()) ||
444 (dlFolder.getParentFolderId() != dlFolderModelImpl.getOriginalParentFolderId()) ||
445 !Validator.equals(dlFolder.getName(),
446 dlFolderModelImpl.getOriginalName()))) {
447 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
448 new Object[] {
449 new Long(dlFolder.getGroupId()),
450 new Long(dlFolder.getParentFolderId()),
451
452 dlFolder.getName()
453 }, dlFolder);
454 }
455
456 return dlFolder;
457 }
458
459 protected DLFolder toUnwrappedModel(DLFolder dlFolder) {
460 if (dlFolder instanceof DLFolderImpl) {
461 return dlFolder;
462 }
463
464 DLFolderImpl dlFolderImpl = new DLFolderImpl();
465
466 dlFolderImpl.setNew(dlFolder.isNew());
467 dlFolderImpl.setPrimaryKey(dlFolder.getPrimaryKey());
468
469 dlFolderImpl.setUuid(dlFolder.getUuid());
470 dlFolderImpl.setFolderId(dlFolder.getFolderId());
471 dlFolderImpl.setGroupId(dlFolder.getGroupId());
472 dlFolderImpl.setCompanyId(dlFolder.getCompanyId());
473 dlFolderImpl.setUserId(dlFolder.getUserId());
474 dlFolderImpl.setUserName(dlFolder.getUserName());
475 dlFolderImpl.setCreateDate(dlFolder.getCreateDate());
476 dlFolderImpl.setModifiedDate(dlFolder.getModifiedDate());
477 dlFolderImpl.setParentFolderId(dlFolder.getParentFolderId());
478 dlFolderImpl.setName(dlFolder.getName());
479 dlFolderImpl.setDescription(dlFolder.getDescription());
480 dlFolderImpl.setLastPostDate(dlFolder.getLastPostDate());
481
482 return dlFolderImpl;
483 }
484
485
493 public DLFolder findByPrimaryKey(Serializable primaryKey)
494 throws NoSuchModelException, SystemException {
495 return findByPrimaryKey(((Long)primaryKey).longValue());
496 }
497
498
506 public DLFolder findByPrimaryKey(long folderId)
507 throws NoSuchFolderException, SystemException {
508 DLFolder dlFolder = fetchByPrimaryKey(folderId);
509
510 if (dlFolder == null) {
511 if (_log.isWarnEnabled()) {
512 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + folderId);
513 }
514
515 throw new NoSuchFolderException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
516 folderId);
517 }
518
519 return dlFolder;
520 }
521
522
529 public DLFolder fetchByPrimaryKey(Serializable primaryKey)
530 throws SystemException {
531 return fetchByPrimaryKey(((Long)primaryKey).longValue());
532 }
533
534
541 public DLFolder fetchByPrimaryKey(long folderId) throws SystemException {
542 DLFolder dlFolder = (DLFolder)EntityCacheUtil.getResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
543 DLFolderImpl.class, folderId, this);
544
545 if (dlFolder == null) {
546 Session session = null;
547
548 try {
549 session = openSession();
550
551 dlFolder = (DLFolder)session.get(DLFolderImpl.class,
552 new Long(folderId));
553 }
554 catch (Exception e) {
555 throw processException(e);
556 }
557 finally {
558 if (dlFolder != null) {
559 cacheResult(dlFolder);
560 }
561
562 closeSession(session);
563 }
564 }
565
566 return dlFolder;
567 }
568
569
576 public List<DLFolder> findByUuid(String uuid) throws SystemException {
577 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
578 }
579
580
593 public List<DLFolder> findByUuid(String uuid, int start, int end)
594 throws SystemException {
595 return findByUuid(uuid, start, end, null);
596 }
597
598
612 public List<DLFolder> findByUuid(String uuid, int start, int end,
613 OrderByComparator orderByComparator) throws SystemException {
614 Object[] finderArgs = new Object[] {
615 uuid,
616
617 String.valueOf(start), String.valueOf(end),
618 String.valueOf(orderByComparator)
619 };
620
621 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
622 finderArgs, this);
623
624 if (list == null) {
625 Session session = null;
626
627 try {
628 session = openSession();
629
630 StringBundler query = null;
631
632 if (orderByComparator != null) {
633 query = new StringBundler(3 +
634 (orderByComparator.getOrderByFields().length * 3));
635 }
636 else {
637 query = new StringBundler(3);
638 }
639
640 query.append(_SQL_SELECT_DLFOLDER_WHERE);
641
642 if (uuid == null) {
643 query.append(_FINDER_COLUMN_UUID_UUID_1);
644 }
645 else {
646 if (uuid.equals(StringPool.BLANK)) {
647 query.append(_FINDER_COLUMN_UUID_UUID_3);
648 }
649 else {
650 query.append(_FINDER_COLUMN_UUID_UUID_2);
651 }
652 }
653
654 if (orderByComparator != null) {
655 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
656 orderByComparator);
657 }
658
659 else {
660 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
661 }
662
663 String sql = query.toString();
664
665 Query q = session.createQuery(sql);
666
667 QueryPos qPos = QueryPos.getInstance(q);
668
669 if (uuid != null) {
670 qPos.add(uuid);
671 }
672
673 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
674 end);
675 }
676 catch (Exception e) {
677 throw processException(e);
678 }
679 finally {
680 if (list == null) {
681 list = new ArrayList<DLFolder>();
682 }
683
684 cacheResult(list);
685
686 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
687 list);
688
689 closeSession(session);
690 }
691 }
692
693 return list;
694 }
695
696
709 public DLFolder findByUuid_First(String uuid,
710 OrderByComparator orderByComparator)
711 throws NoSuchFolderException, SystemException {
712 List<DLFolder> list = findByUuid(uuid, 0, 1, orderByComparator);
713
714 if (list.isEmpty()) {
715 StringBundler msg = new StringBundler(4);
716
717 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
718
719 msg.append("uuid=");
720 msg.append(uuid);
721
722 msg.append(StringPool.CLOSE_CURLY_BRACE);
723
724 throw new NoSuchFolderException(msg.toString());
725 }
726 else {
727 return list.get(0);
728 }
729 }
730
731
744 public DLFolder findByUuid_Last(String uuid,
745 OrderByComparator orderByComparator)
746 throws NoSuchFolderException, SystemException {
747 int count = countByUuid(uuid);
748
749 List<DLFolder> list = findByUuid(uuid, count - 1, count,
750 orderByComparator);
751
752 if (list.isEmpty()) {
753 StringBundler msg = new StringBundler(4);
754
755 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
756
757 msg.append("uuid=");
758 msg.append(uuid);
759
760 msg.append(StringPool.CLOSE_CURLY_BRACE);
761
762 throw new NoSuchFolderException(msg.toString());
763 }
764 else {
765 return list.get(0);
766 }
767 }
768
769
783 public DLFolder[] findByUuid_PrevAndNext(long folderId, String uuid,
784 OrderByComparator orderByComparator)
785 throws NoSuchFolderException, SystemException {
786 DLFolder dlFolder = findByPrimaryKey(folderId);
787
788 Session session = null;
789
790 try {
791 session = openSession();
792
793 DLFolder[] array = new DLFolderImpl[3];
794
795 array[0] = getByUuid_PrevAndNext(session, dlFolder, uuid,
796 orderByComparator, true);
797
798 array[1] = dlFolder;
799
800 array[2] = getByUuid_PrevAndNext(session, dlFolder, uuid,
801 orderByComparator, false);
802
803 return array;
804 }
805 catch (Exception e) {
806 throw processException(e);
807 }
808 finally {
809 closeSession(session);
810 }
811 }
812
813 protected DLFolder getByUuid_PrevAndNext(Session session,
814 DLFolder dlFolder, String uuid, OrderByComparator orderByComparator,
815 boolean previous) {
816 StringBundler query = null;
817
818 if (orderByComparator != null) {
819 query = new StringBundler(6 +
820 (orderByComparator.getOrderByFields().length * 6));
821 }
822 else {
823 query = new StringBundler(3);
824 }
825
826 query.append(_SQL_SELECT_DLFOLDER_WHERE);
827
828 if (uuid == null) {
829 query.append(_FINDER_COLUMN_UUID_UUID_1);
830 }
831 else {
832 if (uuid.equals(StringPool.BLANK)) {
833 query.append(_FINDER_COLUMN_UUID_UUID_3);
834 }
835 else {
836 query.append(_FINDER_COLUMN_UUID_UUID_2);
837 }
838 }
839
840 if (orderByComparator != null) {
841 String[] orderByFields = orderByComparator.getOrderByFields();
842
843 if (orderByFields.length > 0) {
844 query.append(WHERE_AND);
845 }
846
847 for (int i = 0; i < orderByFields.length; i++) {
848 query.append(_ORDER_BY_ENTITY_ALIAS);
849 query.append(orderByFields[i]);
850
851 if ((i + 1) < orderByFields.length) {
852 if (orderByComparator.isAscending() ^ previous) {
853 query.append(WHERE_GREATER_THAN_HAS_NEXT);
854 }
855 else {
856 query.append(WHERE_LESSER_THAN_HAS_NEXT);
857 }
858 }
859 else {
860 if (orderByComparator.isAscending() ^ previous) {
861 query.append(WHERE_GREATER_THAN);
862 }
863 else {
864 query.append(WHERE_LESSER_THAN);
865 }
866 }
867 }
868
869 query.append(ORDER_BY_CLAUSE);
870
871 for (int i = 0; i < orderByFields.length; i++) {
872 query.append(_ORDER_BY_ENTITY_ALIAS);
873 query.append(orderByFields[i]);
874
875 if ((i + 1) < orderByFields.length) {
876 if (orderByComparator.isAscending() ^ previous) {
877 query.append(ORDER_BY_ASC_HAS_NEXT);
878 }
879 else {
880 query.append(ORDER_BY_DESC_HAS_NEXT);
881 }
882 }
883 else {
884 if (orderByComparator.isAscending() ^ previous) {
885 query.append(ORDER_BY_ASC);
886 }
887 else {
888 query.append(ORDER_BY_DESC);
889 }
890 }
891 }
892 }
893
894 else {
895 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
896 }
897
898 String sql = query.toString();
899
900 Query q = session.createQuery(sql);
901
902 q.setFirstResult(0);
903 q.setMaxResults(2);
904
905 QueryPos qPos = QueryPos.getInstance(q);
906
907 if (uuid != null) {
908 qPos.add(uuid);
909 }
910
911 if (orderByComparator != null) {
912 Object[] values = orderByComparator.getOrderByValues(dlFolder);
913
914 for (Object value : values) {
915 qPos.add(value);
916 }
917 }
918
919 List<DLFolder> list = q.list();
920
921 if (list.size() == 2) {
922 return list.get(1);
923 }
924 else {
925 return null;
926 }
927 }
928
929
938 public DLFolder findByUUID_G(String uuid, long groupId)
939 throws NoSuchFolderException, SystemException {
940 DLFolder dlFolder = fetchByUUID_G(uuid, groupId);
941
942 if (dlFolder == null) {
943 StringBundler msg = new StringBundler(6);
944
945 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
946
947 msg.append("uuid=");
948 msg.append(uuid);
949
950 msg.append(", groupId=");
951 msg.append(groupId);
952
953 msg.append(StringPool.CLOSE_CURLY_BRACE);
954
955 if (_log.isWarnEnabled()) {
956 _log.warn(msg.toString());
957 }
958
959 throw new NoSuchFolderException(msg.toString());
960 }
961
962 return dlFolder;
963 }
964
965
973 public DLFolder fetchByUUID_G(String uuid, long groupId)
974 throws SystemException {
975 return fetchByUUID_G(uuid, groupId, true);
976 }
977
978
986 public DLFolder fetchByUUID_G(String uuid, long groupId,
987 boolean retrieveFromCache) throws SystemException {
988 Object[] finderArgs = new Object[] { uuid, groupId };
989
990 Object result = null;
991
992 if (retrieveFromCache) {
993 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
994 finderArgs, this);
995 }
996
997 if (result == null) {
998 Session session = null;
999
1000 try {
1001 session = openSession();
1002
1003 StringBundler query = new StringBundler(4);
1004
1005 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1006
1007 if (uuid == null) {
1008 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1009 }
1010 else {
1011 if (uuid.equals(StringPool.BLANK)) {
1012 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1013 }
1014 else {
1015 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1016 }
1017 }
1018
1019 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1020
1021 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1022
1023 String sql = query.toString();
1024
1025 Query q = session.createQuery(sql);
1026
1027 QueryPos qPos = QueryPos.getInstance(q);
1028
1029 if (uuid != null) {
1030 qPos.add(uuid);
1031 }
1032
1033 qPos.add(groupId);
1034
1035 List<DLFolder> list = q.list();
1036
1037 result = list;
1038
1039 DLFolder dlFolder = null;
1040
1041 if (list.isEmpty()) {
1042 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1043 finderArgs, list);
1044 }
1045 else {
1046 dlFolder = list.get(0);
1047
1048 cacheResult(dlFolder);
1049
1050 if ((dlFolder.getUuid() == null) ||
1051 !dlFolder.getUuid().equals(uuid) ||
1052 (dlFolder.getGroupId() != groupId)) {
1053 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1054 finderArgs, dlFolder);
1055 }
1056 }
1057
1058 return dlFolder;
1059 }
1060 catch (Exception e) {
1061 throw processException(e);
1062 }
1063 finally {
1064 if (result == null) {
1065 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1066 finderArgs, new ArrayList<DLFolder>());
1067 }
1068
1069 closeSession(session);
1070 }
1071 }
1072 else {
1073 if (result instanceof List<?>) {
1074 return null;
1075 }
1076 else {
1077 return (DLFolder)result;
1078 }
1079 }
1080 }
1081
1082
1089 public List<DLFolder> findByGroupId(long groupId) throws SystemException {
1090 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1091 }
1092
1093
1106 public List<DLFolder> findByGroupId(long groupId, int start, int end)
1107 throws SystemException {
1108 return findByGroupId(groupId, start, end, null);
1109 }
1110
1111
1125 public List<DLFolder> findByGroupId(long groupId, int start, int end,
1126 OrderByComparator orderByComparator) throws SystemException {
1127 Object[] finderArgs = new Object[] {
1128 groupId,
1129
1130 String.valueOf(start), String.valueOf(end),
1131 String.valueOf(orderByComparator)
1132 };
1133
1134 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1135 finderArgs, this);
1136
1137 if (list == null) {
1138 Session session = null;
1139
1140 try {
1141 session = openSession();
1142
1143 StringBundler query = null;
1144
1145 if (orderByComparator != null) {
1146 query = new StringBundler(3 +
1147 (orderByComparator.getOrderByFields().length * 3));
1148 }
1149 else {
1150 query = new StringBundler(3);
1151 }
1152
1153 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1154
1155 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1156
1157 if (orderByComparator != null) {
1158 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1159 orderByComparator);
1160 }
1161
1162 else {
1163 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1164 }
1165
1166 String sql = query.toString();
1167
1168 Query q = session.createQuery(sql);
1169
1170 QueryPos qPos = QueryPos.getInstance(q);
1171
1172 qPos.add(groupId);
1173
1174 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1175 end);
1176 }
1177 catch (Exception e) {
1178 throw processException(e);
1179 }
1180 finally {
1181 if (list == null) {
1182 list = new ArrayList<DLFolder>();
1183 }
1184
1185 cacheResult(list);
1186
1187 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1188 finderArgs, list);
1189
1190 closeSession(session);
1191 }
1192 }
1193
1194 return list;
1195 }
1196
1197
1210 public DLFolder findByGroupId_First(long groupId,
1211 OrderByComparator orderByComparator)
1212 throws NoSuchFolderException, SystemException {
1213 List<DLFolder> list = findByGroupId(groupId, 0, 1, orderByComparator);
1214
1215 if (list.isEmpty()) {
1216 StringBundler msg = new StringBundler(4);
1217
1218 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1219
1220 msg.append("groupId=");
1221 msg.append(groupId);
1222
1223 msg.append(StringPool.CLOSE_CURLY_BRACE);
1224
1225 throw new NoSuchFolderException(msg.toString());
1226 }
1227 else {
1228 return list.get(0);
1229 }
1230 }
1231
1232
1245 public DLFolder findByGroupId_Last(long groupId,
1246 OrderByComparator orderByComparator)
1247 throws NoSuchFolderException, SystemException {
1248 int count = countByGroupId(groupId);
1249
1250 List<DLFolder> list = findByGroupId(groupId, count - 1, count,
1251 orderByComparator);
1252
1253 if (list.isEmpty()) {
1254 StringBundler msg = new StringBundler(4);
1255
1256 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1257
1258 msg.append("groupId=");
1259 msg.append(groupId);
1260
1261 msg.append(StringPool.CLOSE_CURLY_BRACE);
1262
1263 throw new NoSuchFolderException(msg.toString());
1264 }
1265 else {
1266 return list.get(0);
1267 }
1268 }
1269
1270
1284 public DLFolder[] findByGroupId_PrevAndNext(long folderId, long groupId,
1285 OrderByComparator orderByComparator)
1286 throws NoSuchFolderException, SystemException {
1287 DLFolder dlFolder = findByPrimaryKey(folderId);
1288
1289 Session session = null;
1290
1291 try {
1292 session = openSession();
1293
1294 DLFolder[] array = new DLFolderImpl[3];
1295
1296 array[0] = getByGroupId_PrevAndNext(session, dlFolder, groupId,
1297 orderByComparator, true);
1298
1299 array[1] = dlFolder;
1300
1301 array[2] = getByGroupId_PrevAndNext(session, dlFolder, groupId,
1302 orderByComparator, false);
1303
1304 return array;
1305 }
1306 catch (Exception e) {
1307 throw processException(e);
1308 }
1309 finally {
1310 closeSession(session);
1311 }
1312 }
1313
1314 protected DLFolder getByGroupId_PrevAndNext(Session session,
1315 DLFolder dlFolder, long groupId, OrderByComparator orderByComparator,
1316 boolean previous) {
1317 StringBundler query = null;
1318
1319 if (orderByComparator != null) {
1320 query = new StringBundler(6 +
1321 (orderByComparator.getOrderByFields().length * 6));
1322 }
1323 else {
1324 query = new StringBundler(3);
1325 }
1326
1327 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1328
1329 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1330
1331 if (orderByComparator != null) {
1332 String[] orderByFields = orderByComparator.getOrderByFields();
1333
1334 if (orderByFields.length > 0) {
1335 query.append(WHERE_AND);
1336 }
1337
1338 for (int i = 0; i < orderByFields.length; i++) {
1339 query.append(_ORDER_BY_ENTITY_ALIAS);
1340 query.append(orderByFields[i]);
1341
1342 if ((i + 1) < orderByFields.length) {
1343 if (orderByComparator.isAscending() ^ previous) {
1344 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1345 }
1346 else {
1347 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1348 }
1349 }
1350 else {
1351 if (orderByComparator.isAscending() ^ previous) {
1352 query.append(WHERE_GREATER_THAN);
1353 }
1354 else {
1355 query.append(WHERE_LESSER_THAN);
1356 }
1357 }
1358 }
1359
1360 query.append(ORDER_BY_CLAUSE);
1361
1362 for (int i = 0; i < orderByFields.length; i++) {
1363 query.append(_ORDER_BY_ENTITY_ALIAS);
1364 query.append(orderByFields[i]);
1365
1366 if ((i + 1) < orderByFields.length) {
1367 if (orderByComparator.isAscending() ^ previous) {
1368 query.append(ORDER_BY_ASC_HAS_NEXT);
1369 }
1370 else {
1371 query.append(ORDER_BY_DESC_HAS_NEXT);
1372 }
1373 }
1374 else {
1375 if (orderByComparator.isAscending() ^ previous) {
1376 query.append(ORDER_BY_ASC);
1377 }
1378 else {
1379 query.append(ORDER_BY_DESC);
1380 }
1381 }
1382 }
1383 }
1384
1385 else {
1386 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1387 }
1388
1389 String sql = query.toString();
1390
1391 Query q = session.createQuery(sql);
1392
1393 q.setFirstResult(0);
1394 q.setMaxResults(2);
1395
1396 QueryPos qPos = QueryPos.getInstance(q);
1397
1398 qPos.add(groupId);
1399
1400 if (orderByComparator != null) {
1401 Object[] values = orderByComparator.getOrderByValues(dlFolder);
1402
1403 for (Object value : values) {
1404 qPos.add(value);
1405 }
1406 }
1407
1408 List<DLFolder> list = q.list();
1409
1410 if (list.size() == 2) {
1411 return list.get(1);
1412 }
1413 else {
1414 return null;
1415 }
1416 }
1417
1418
1425 public List<DLFolder> filterFindByGroupId(long groupId)
1426 throws SystemException {
1427 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1428 QueryUtil.ALL_POS, null);
1429 }
1430
1431
1444 public List<DLFolder> filterFindByGroupId(long groupId, int start, int end)
1445 throws SystemException {
1446 return filterFindByGroupId(groupId, start, end, null);
1447 }
1448
1449
1463 public List<DLFolder> filterFindByGroupId(long groupId, int start, int end,
1464 OrderByComparator orderByComparator) throws SystemException {
1465 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1466 return findByGroupId(groupId, start, end, orderByComparator);
1467 }
1468
1469 Session session = null;
1470
1471 try {
1472 session = openSession();
1473
1474 StringBundler query = null;
1475
1476 if (orderByComparator != null) {
1477 query = new StringBundler(3 +
1478 (orderByComparator.getOrderByFields().length * 3));
1479 }
1480 else {
1481 query = new StringBundler(3);
1482 }
1483
1484 query.append(_FILTER_SQL_SELECT_DLFOLDER_WHERE);
1485
1486 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1487
1488 if (orderByComparator != null) {
1489 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1490 orderByComparator);
1491 }
1492
1493 else {
1494 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1495 }
1496
1497 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1498 DLFolder.class.getName(), _FILTER_COLUMN_PK,
1499 _FILTER_COLUMN_USERID, groupId);
1500
1501 SQLQuery q = session.createSQLQuery(sql);
1502
1503 q.addEntity(_FILTER_ENTITY_ALIAS, DLFolderImpl.class);
1504
1505 QueryPos qPos = QueryPos.getInstance(q);
1506
1507 qPos.add(groupId);
1508
1509 return (List<DLFolder>)QueryUtil.list(q, getDialect(), start, end);
1510 }
1511 catch (Exception e) {
1512 throw processException(e);
1513 }
1514 finally {
1515 closeSession(session);
1516 }
1517 }
1518
1519
1526 public List<DLFolder> findByCompanyId(long companyId)
1527 throws SystemException {
1528 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1529 null);
1530 }
1531
1532
1545 public List<DLFolder> findByCompanyId(long companyId, int start, int end)
1546 throws SystemException {
1547 return findByCompanyId(companyId, start, end, null);
1548 }
1549
1550
1564 public List<DLFolder> findByCompanyId(long companyId, int start, int end,
1565 OrderByComparator orderByComparator) throws SystemException {
1566 Object[] finderArgs = new Object[] {
1567 companyId,
1568
1569 String.valueOf(start), String.valueOf(end),
1570 String.valueOf(orderByComparator)
1571 };
1572
1573 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1574 finderArgs, this);
1575
1576 if (list == null) {
1577 Session session = null;
1578
1579 try {
1580 session = openSession();
1581
1582 StringBundler query = null;
1583
1584 if (orderByComparator != null) {
1585 query = new StringBundler(3 +
1586 (orderByComparator.getOrderByFields().length * 3));
1587 }
1588 else {
1589 query = new StringBundler(3);
1590 }
1591
1592 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1593
1594 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1595
1596 if (orderByComparator != null) {
1597 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1598 orderByComparator);
1599 }
1600
1601 else {
1602 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1603 }
1604
1605 String sql = query.toString();
1606
1607 Query q = session.createQuery(sql);
1608
1609 QueryPos qPos = QueryPos.getInstance(q);
1610
1611 qPos.add(companyId);
1612
1613 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1614 end);
1615 }
1616 catch (Exception e) {
1617 throw processException(e);
1618 }
1619 finally {
1620 if (list == null) {
1621 list = new ArrayList<DLFolder>();
1622 }
1623
1624 cacheResult(list);
1625
1626 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1627 finderArgs, list);
1628
1629 closeSession(session);
1630 }
1631 }
1632
1633 return list;
1634 }
1635
1636
1649 public DLFolder findByCompanyId_First(long companyId,
1650 OrderByComparator orderByComparator)
1651 throws NoSuchFolderException, SystemException {
1652 List<DLFolder> list = findByCompanyId(companyId, 0, 1, orderByComparator);
1653
1654 if (list.isEmpty()) {
1655 StringBundler msg = new StringBundler(4);
1656
1657 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1658
1659 msg.append("companyId=");
1660 msg.append(companyId);
1661
1662 msg.append(StringPool.CLOSE_CURLY_BRACE);
1663
1664 throw new NoSuchFolderException(msg.toString());
1665 }
1666 else {
1667 return list.get(0);
1668 }
1669 }
1670
1671
1684 public DLFolder findByCompanyId_Last(long companyId,
1685 OrderByComparator orderByComparator)
1686 throws NoSuchFolderException, SystemException {
1687 int count = countByCompanyId(companyId);
1688
1689 List<DLFolder> list = findByCompanyId(companyId, count - 1, count,
1690 orderByComparator);
1691
1692 if (list.isEmpty()) {
1693 StringBundler msg = new StringBundler(4);
1694
1695 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1696
1697 msg.append("companyId=");
1698 msg.append(companyId);
1699
1700 msg.append(StringPool.CLOSE_CURLY_BRACE);
1701
1702 throw new NoSuchFolderException(msg.toString());
1703 }
1704 else {
1705 return list.get(0);
1706 }
1707 }
1708
1709
1723 public DLFolder[] findByCompanyId_PrevAndNext(long folderId,
1724 long companyId, OrderByComparator orderByComparator)
1725 throws NoSuchFolderException, SystemException {
1726 DLFolder dlFolder = findByPrimaryKey(folderId);
1727
1728 Session session = null;
1729
1730 try {
1731 session = openSession();
1732
1733 DLFolder[] array = new DLFolderImpl[3];
1734
1735 array[0] = getByCompanyId_PrevAndNext(session, dlFolder, companyId,
1736 orderByComparator, true);
1737
1738 array[1] = dlFolder;
1739
1740 array[2] = getByCompanyId_PrevAndNext(session, dlFolder, companyId,
1741 orderByComparator, false);
1742
1743 return array;
1744 }
1745 catch (Exception e) {
1746 throw processException(e);
1747 }
1748 finally {
1749 closeSession(session);
1750 }
1751 }
1752
1753 protected DLFolder getByCompanyId_PrevAndNext(Session session,
1754 DLFolder dlFolder, long companyId, OrderByComparator orderByComparator,
1755 boolean previous) {
1756 StringBundler query = null;
1757
1758 if (orderByComparator != null) {
1759 query = new StringBundler(6 +
1760 (orderByComparator.getOrderByFields().length * 6));
1761 }
1762 else {
1763 query = new StringBundler(3);
1764 }
1765
1766 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1767
1768 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1769
1770 if (orderByComparator != null) {
1771 String[] orderByFields = orderByComparator.getOrderByFields();
1772
1773 if (orderByFields.length > 0) {
1774 query.append(WHERE_AND);
1775 }
1776
1777 for (int i = 0; i < orderByFields.length; i++) {
1778 query.append(_ORDER_BY_ENTITY_ALIAS);
1779 query.append(orderByFields[i]);
1780
1781 if ((i + 1) < orderByFields.length) {
1782 if (orderByComparator.isAscending() ^ previous) {
1783 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1784 }
1785 else {
1786 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1787 }
1788 }
1789 else {
1790 if (orderByComparator.isAscending() ^ previous) {
1791 query.append(WHERE_GREATER_THAN);
1792 }
1793 else {
1794 query.append(WHERE_LESSER_THAN);
1795 }
1796 }
1797 }
1798
1799 query.append(ORDER_BY_CLAUSE);
1800
1801 for (int i = 0; i < orderByFields.length; i++) {
1802 query.append(_ORDER_BY_ENTITY_ALIAS);
1803 query.append(orderByFields[i]);
1804
1805 if ((i + 1) < orderByFields.length) {
1806 if (orderByComparator.isAscending() ^ previous) {
1807 query.append(ORDER_BY_ASC_HAS_NEXT);
1808 }
1809 else {
1810 query.append(ORDER_BY_DESC_HAS_NEXT);
1811 }
1812 }
1813 else {
1814 if (orderByComparator.isAscending() ^ previous) {
1815 query.append(ORDER_BY_ASC);
1816 }
1817 else {
1818 query.append(ORDER_BY_DESC);
1819 }
1820 }
1821 }
1822 }
1823
1824 else {
1825 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1826 }
1827
1828 String sql = query.toString();
1829
1830 Query q = session.createQuery(sql);
1831
1832 q.setFirstResult(0);
1833 q.setMaxResults(2);
1834
1835 QueryPos qPos = QueryPos.getInstance(q);
1836
1837 qPos.add(companyId);
1838
1839 if (orderByComparator != null) {
1840 Object[] values = orderByComparator.getOrderByValues(dlFolder);
1841
1842 for (Object value : values) {
1843 qPos.add(value);
1844 }
1845 }
1846
1847 List<DLFolder> list = q.list();
1848
1849 if (list.size() == 2) {
1850 return list.get(1);
1851 }
1852 else {
1853 return null;
1854 }
1855 }
1856
1857
1865 public List<DLFolder> findByG_P(long groupId, long parentFolderId)
1866 throws SystemException {
1867 return findByG_P(groupId, parentFolderId, QueryUtil.ALL_POS,
1868 QueryUtil.ALL_POS, null);
1869 }
1870
1871
1885 public List<DLFolder> findByG_P(long groupId, long parentFolderId,
1886 int start, int end) throws SystemException {
1887 return findByG_P(groupId, parentFolderId, start, end, null);
1888 }
1889
1890
1905 public List<DLFolder> findByG_P(long groupId, long parentFolderId,
1906 int start, int end, OrderByComparator orderByComparator)
1907 throws SystemException {
1908 Object[] finderArgs = new Object[] {
1909 groupId, parentFolderId,
1910
1911 String.valueOf(start), String.valueOf(end),
1912 String.valueOf(orderByComparator)
1913 };
1914
1915 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_P,
1916 finderArgs, this);
1917
1918 if (list == null) {
1919 Session session = null;
1920
1921 try {
1922 session = openSession();
1923
1924 StringBundler query = null;
1925
1926 if (orderByComparator != null) {
1927 query = new StringBundler(4 +
1928 (orderByComparator.getOrderByFields().length * 3));
1929 }
1930 else {
1931 query = new StringBundler(4);
1932 }
1933
1934 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1935
1936 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1937
1938 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
1939
1940 if (orderByComparator != null) {
1941 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1942 orderByComparator);
1943 }
1944
1945 else {
1946 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1947 }
1948
1949 String sql = query.toString();
1950
1951 Query q = session.createQuery(sql);
1952
1953 QueryPos qPos = QueryPos.getInstance(q);
1954
1955 qPos.add(groupId);
1956
1957 qPos.add(parentFolderId);
1958
1959 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1960 end);
1961 }
1962 catch (Exception e) {
1963 throw processException(e);
1964 }
1965 finally {
1966 if (list == null) {
1967 list = new ArrayList<DLFolder>();
1968 }
1969
1970 cacheResult(list);
1971
1972 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_P, finderArgs,
1973 list);
1974
1975 closeSession(session);
1976 }
1977 }
1978
1979 return list;
1980 }
1981
1982
1996 public DLFolder findByG_P_First(long groupId, long parentFolderId,
1997 OrderByComparator orderByComparator)
1998 throws NoSuchFolderException, SystemException {
1999 List<DLFolder> list = findByG_P(groupId, parentFolderId, 0, 1,
2000 orderByComparator);
2001
2002 if (list.isEmpty()) {
2003 StringBundler msg = new StringBundler(6);
2004
2005 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2006
2007 msg.append("groupId=");
2008 msg.append(groupId);
2009
2010 msg.append(", parentFolderId=");
2011 msg.append(parentFolderId);
2012
2013 msg.append(StringPool.CLOSE_CURLY_BRACE);
2014
2015 throw new NoSuchFolderException(msg.toString());
2016 }
2017 else {
2018 return list.get(0);
2019 }
2020 }
2021
2022
2036 public DLFolder findByG_P_Last(long groupId, long parentFolderId,
2037 OrderByComparator orderByComparator)
2038 throws NoSuchFolderException, SystemException {
2039 int count = countByG_P(groupId, parentFolderId);
2040
2041 List<DLFolder> list = findByG_P(groupId, parentFolderId, count - 1,
2042 count, orderByComparator);
2043
2044 if (list.isEmpty()) {
2045 StringBundler msg = new StringBundler(6);
2046
2047 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2048
2049 msg.append("groupId=");
2050 msg.append(groupId);
2051
2052 msg.append(", parentFolderId=");
2053 msg.append(parentFolderId);
2054
2055 msg.append(StringPool.CLOSE_CURLY_BRACE);
2056
2057 throw new NoSuchFolderException(msg.toString());
2058 }
2059 else {
2060 return list.get(0);
2061 }
2062 }
2063
2064
2079 public DLFolder[] findByG_P_PrevAndNext(long folderId, long groupId,
2080 long parentFolderId, OrderByComparator orderByComparator)
2081 throws NoSuchFolderException, SystemException {
2082 DLFolder dlFolder = findByPrimaryKey(folderId);
2083
2084 Session session = null;
2085
2086 try {
2087 session = openSession();
2088
2089 DLFolder[] array = new DLFolderImpl[3];
2090
2091 array[0] = getByG_P_PrevAndNext(session, dlFolder, groupId,
2092 parentFolderId, orderByComparator, true);
2093
2094 array[1] = dlFolder;
2095
2096 array[2] = getByG_P_PrevAndNext(session, dlFolder, groupId,
2097 parentFolderId, orderByComparator, false);
2098
2099 return array;
2100 }
2101 catch (Exception e) {
2102 throw processException(e);
2103 }
2104 finally {
2105 closeSession(session);
2106 }
2107 }
2108
2109 protected DLFolder getByG_P_PrevAndNext(Session session, DLFolder dlFolder,
2110 long groupId, long parentFolderId, OrderByComparator orderByComparator,
2111 boolean previous) {
2112 StringBundler query = null;
2113
2114 if (orderByComparator != null) {
2115 query = new StringBundler(6 +
2116 (orderByComparator.getOrderByFields().length * 6));
2117 }
2118 else {
2119 query = new StringBundler(3);
2120 }
2121
2122 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2123
2124 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
2125
2126 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
2127
2128 if (orderByComparator != null) {
2129 String[] orderByFields = orderByComparator.getOrderByFields();
2130
2131 if (orderByFields.length > 0) {
2132 query.append(WHERE_AND);
2133 }
2134
2135 for (int i = 0; i < orderByFields.length; i++) {
2136 query.append(_ORDER_BY_ENTITY_ALIAS);
2137 query.append(orderByFields[i]);
2138
2139 if ((i + 1) < orderByFields.length) {
2140 if (orderByComparator.isAscending() ^ previous) {
2141 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2142 }
2143 else {
2144 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2145 }
2146 }
2147 else {
2148 if (orderByComparator.isAscending() ^ previous) {
2149 query.append(WHERE_GREATER_THAN);
2150 }
2151 else {
2152 query.append(WHERE_LESSER_THAN);
2153 }
2154 }
2155 }
2156
2157 query.append(ORDER_BY_CLAUSE);
2158
2159 for (int i = 0; i < orderByFields.length; i++) {
2160 query.append(_ORDER_BY_ENTITY_ALIAS);
2161 query.append(orderByFields[i]);
2162
2163 if ((i + 1) < orderByFields.length) {
2164 if (orderByComparator.isAscending() ^ previous) {
2165 query.append(ORDER_BY_ASC_HAS_NEXT);
2166 }
2167 else {
2168 query.append(ORDER_BY_DESC_HAS_NEXT);
2169 }
2170 }
2171 else {
2172 if (orderByComparator.isAscending() ^ previous) {
2173 query.append(ORDER_BY_ASC);
2174 }
2175 else {
2176 query.append(ORDER_BY_DESC);
2177 }
2178 }
2179 }
2180 }
2181
2182 else {
2183 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2184 }
2185
2186 String sql = query.toString();
2187
2188 Query q = session.createQuery(sql);
2189
2190 q.setFirstResult(0);
2191 q.setMaxResults(2);
2192
2193 QueryPos qPos = QueryPos.getInstance(q);
2194
2195 qPos.add(groupId);
2196
2197 qPos.add(parentFolderId);
2198
2199 if (orderByComparator != null) {
2200 Object[] values = orderByComparator.getOrderByValues(dlFolder);
2201
2202 for (Object value : values) {
2203 qPos.add(value);
2204 }
2205 }
2206
2207 List<DLFolder> list = q.list();
2208
2209 if (list.size() == 2) {
2210 return list.get(1);
2211 }
2212 else {
2213 return null;
2214 }
2215 }
2216
2217
2225 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId)
2226 throws SystemException {
2227 return filterFindByG_P(groupId, parentFolderId, QueryUtil.ALL_POS,
2228 QueryUtil.ALL_POS, null);
2229 }
2230
2231
2245 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId,
2246 int start, int end) throws SystemException {
2247 return filterFindByG_P(groupId, parentFolderId, start, end, null);
2248 }
2249
2250
2265 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId,
2266 int start, int end, OrderByComparator orderByComparator)
2267 throws SystemException {
2268 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2269 return findByG_P(groupId, parentFolderId, start, end,
2270 orderByComparator);
2271 }
2272
2273 Session session = null;
2274
2275 try {
2276 session = openSession();
2277
2278 StringBundler query = null;
2279
2280 if (orderByComparator != null) {
2281 query = new StringBundler(4 +
2282 (orderByComparator.getOrderByFields().length * 3));
2283 }
2284 else {
2285 query = new StringBundler(4);
2286 }
2287
2288 query.append(_FILTER_SQL_SELECT_DLFOLDER_WHERE);
2289
2290 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
2291
2292 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
2293
2294 if (orderByComparator != null) {
2295 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2296 orderByComparator);
2297 }
2298
2299 else {
2300 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2301 }
2302
2303 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2304 DLFolder.class.getName(), _FILTER_COLUMN_PK,
2305 _FILTER_COLUMN_USERID, groupId);
2306
2307 SQLQuery q = session.createSQLQuery(sql);
2308
2309 q.addEntity(_FILTER_ENTITY_ALIAS, DLFolderImpl.class);
2310
2311 QueryPos qPos = QueryPos.getInstance(q);
2312
2313 qPos.add(groupId);
2314
2315 qPos.add(parentFolderId);
2316
2317 return (List<DLFolder>)QueryUtil.list(q, getDialect(), start, end);
2318 }
2319 catch (Exception e) {
2320 throw processException(e);
2321 }
2322 finally {
2323 closeSession(session);
2324 }
2325 }
2326
2327
2335 public List<DLFolder> findByP_N(long parentFolderId, String name)
2336 throws SystemException {
2337 return findByP_N(parentFolderId, name, QueryUtil.ALL_POS,
2338 QueryUtil.ALL_POS, null);
2339 }
2340
2341
2355 public List<DLFolder> findByP_N(long parentFolderId, String name,
2356 int start, int end) throws SystemException {
2357 return findByP_N(parentFolderId, name, start, end, null);
2358 }
2359
2360
2375 public List<DLFolder> findByP_N(long parentFolderId, String name,
2376 int start, int end, OrderByComparator orderByComparator)
2377 throws SystemException {
2378 Object[] finderArgs = new Object[] {
2379 parentFolderId, name,
2380
2381 String.valueOf(start), String.valueOf(end),
2382 String.valueOf(orderByComparator)
2383 };
2384
2385 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_P_N,
2386 finderArgs, this);
2387
2388 if (list == null) {
2389 Session session = null;
2390
2391 try {
2392 session = openSession();
2393
2394 StringBundler query = null;
2395
2396 if (orderByComparator != null) {
2397 query = new StringBundler(4 +
2398 (orderByComparator.getOrderByFields().length * 3));
2399 }
2400 else {
2401 query = new StringBundler(4);
2402 }
2403
2404 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2405
2406 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
2407
2408 if (name == null) {
2409 query.append(_FINDER_COLUMN_P_N_NAME_1);
2410 }
2411 else {
2412 if (name.equals(StringPool.BLANK)) {
2413 query.append(_FINDER_COLUMN_P_N_NAME_3);
2414 }
2415 else {
2416 query.append(_FINDER_COLUMN_P_N_NAME_2);
2417 }
2418 }
2419
2420 if (orderByComparator != null) {
2421 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2422 orderByComparator);
2423 }
2424
2425 else {
2426 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2427 }
2428
2429 String sql = query.toString();
2430
2431 Query q = session.createQuery(sql);
2432
2433 QueryPos qPos = QueryPos.getInstance(q);
2434
2435 qPos.add(parentFolderId);
2436
2437 if (name != null) {
2438 qPos.add(name);
2439 }
2440
2441 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
2442 end);
2443 }
2444 catch (Exception e) {
2445 throw processException(e);
2446 }
2447 finally {
2448 if (list == null) {
2449 list = new ArrayList<DLFolder>();
2450 }
2451
2452 cacheResult(list);
2453
2454 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_P_N, finderArgs,
2455 list);
2456
2457 closeSession(session);
2458 }
2459 }
2460
2461 return list;
2462 }
2463
2464
2478 public DLFolder findByP_N_First(long parentFolderId, String name,
2479 OrderByComparator orderByComparator)
2480 throws NoSuchFolderException, SystemException {
2481 List<DLFolder> list = findByP_N(parentFolderId, name, 0, 1,
2482 orderByComparator);
2483
2484 if (list.isEmpty()) {
2485 StringBundler msg = new StringBundler(6);
2486
2487 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2488
2489 msg.append("parentFolderId=");
2490 msg.append(parentFolderId);
2491
2492 msg.append(", name=");
2493 msg.append(name);
2494
2495 msg.append(StringPool.CLOSE_CURLY_BRACE);
2496
2497 throw new NoSuchFolderException(msg.toString());
2498 }
2499 else {
2500 return list.get(0);
2501 }
2502 }
2503
2504
2518 public DLFolder findByP_N_Last(long parentFolderId, String name,
2519 OrderByComparator orderByComparator)
2520 throws NoSuchFolderException, SystemException {
2521 int count = countByP_N(parentFolderId, name);
2522
2523 List<DLFolder> list = findByP_N(parentFolderId, name, count - 1, count,
2524 orderByComparator);
2525
2526 if (list.isEmpty()) {
2527 StringBundler msg = new StringBundler(6);
2528
2529 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2530
2531 msg.append("parentFolderId=");
2532 msg.append(parentFolderId);
2533
2534 msg.append(", name=");
2535 msg.append(name);
2536
2537 msg.append(StringPool.CLOSE_CURLY_BRACE);
2538
2539 throw new NoSuchFolderException(msg.toString());
2540 }
2541 else {
2542 return list.get(0);
2543 }
2544 }
2545
2546
2561 public DLFolder[] findByP_N_PrevAndNext(long folderId, long parentFolderId,
2562 String name, OrderByComparator orderByComparator)
2563 throws NoSuchFolderException, SystemException {
2564 DLFolder dlFolder = findByPrimaryKey(folderId);
2565
2566 Session session = null;
2567
2568 try {
2569 session = openSession();
2570
2571 DLFolder[] array = new DLFolderImpl[3];
2572
2573 array[0] = getByP_N_PrevAndNext(session, dlFolder, parentFolderId,
2574 name, orderByComparator, true);
2575
2576 array[1] = dlFolder;
2577
2578 array[2] = getByP_N_PrevAndNext(session, dlFolder, parentFolderId,
2579 name, orderByComparator, false);
2580
2581 return array;
2582 }
2583 catch (Exception e) {
2584 throw processException(e);
2585 }
2586 finally {
2587 closeSession(session);
2588 }
2589 }
2590
2591 protected DLFolder getByP_N_PrevAndNext(Session session, DLFolder dlFolder,
2592 long parentFolderId, String name, OrderByComparator orderByComparator,
2593 boolean previous) {
2594 StringBundler query = null;
2595
2596 if (orderByComparator != null) {
2597 query = new StringBundler(6 +
2598 (orderByComparator.getOrderByFields().length * 6));
2599 }
2600 else {
2601 query = new StringBundler(3);
2602 }
2603
2604 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2605
2606 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
2607
2608 if (name == null) {
2609 query.append(_FINDER_COLUMN_P_N_NAME_1);
2610 }
2611 else {
2612 if (name.equals(StringPool.BLANK)) {
2613 query.append(_FINDER_COLUMN_P_N_NAME_3);
2614 }
2615 else {
2616 query.append(_FINDER_COLUMN_P_N_NAME_2);
2617 }
2618 }
2619
2620 if (orderByComparator != null) {
2621 String[] orderByFields = orderByComparator.getOrderByFields();
2622
2623 if (orderByFields.length > 0) {
2624 query.append(WHERE_AND);
2625 }
2626
2627 for (int i = 0; i < orderByFields.length; i++) {
2628 query.append(_ORDER_BY_ENTITY_ALIAS);
2629 query.append(orderByFields[i]);
2630
2631 if ((i + 1) < orderByFields.length) {
2632 if (orderByComparator.isAscending() ^ previous) {
2633 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2634 }
2635 else {
2636 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2637 }
2638 }
2639 else {
2640 if (orderByComparator.isAscending() ^ previous) {
2641 query.append(WHERE_GREATER_THAN);
2642 }
2643 else {
2644 query.append(WHERE_LESSER_THAN);
2645 }
2646 }
2647 }
2648
2649 query.append(ORDER_BY_CLAUSE);
2650
2651 for (int i = 0; i < orderByFields.length; i++) {
2652 query.append(_ORDER_BY_ENTITY_ALIAS);
2653 query.append(orderByFields[i]);
2654
2655 if ((i + 1) < orderByFields.length) {
2656 if (orderByComparator.isAscending() ^ previous) {
2657 query.append(ORDER_BY_ASC_HAS_NEXT);
2658 }
2659 else {
2660 query.append(ORDER_BY_DESC_HAS_NEXT);
2661 }
2662 }
2663 else {
2664 if (orderByComparator.isAscending() ^ previous) {
2665 query.append(ORDER_BY_ASC);
2666 }
2667 else {
2668 query.append(ORDER_BY_DESC);
2669 }
2670 }
2671 }
2672 }
2673
2674 else {
2675 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2676 }
2677
2678 String sql = query.toString();
2679
2680 Query q = session.createQuery(sql);
2681
2682 q.setFirstResult(0);
2683 q.setMaxResults(2);
2684
2685 QueryPos qPos = QueryPos.getInstance(q);
2686
2687 qPos.add(parentFolderId);
2688
2689 if (name != null) {
2690 qPos.add(name);
2691 }
2692
2693 if (orderByComparator != null) {
2694 Object[] values = orderByComparator.getOrderByValues(dlFolder);
2695
2696 for (Object value : values) {
2697 qPos.add(value);
2698 }
2699 }
2700
2701 List<DLFolder> list = q.list();
2702
2703 if (list.size() == 2) {
2704 return list.get(1);
2705 }
2706 else {
2707 return null;
2708 }
2709 }
2710
2711
2721 public DLFolder findByG_P_N(long groupId, long parentFolderId, String name)
2722 throws NoSuchFolderException, SystemException {
2723 DLFolder dlFolder = fetchByG_P_N(groupId, parentFolderId, name);
2724
2725 if (dlFolder == null) {
2726 StringBundler msg = new StringBundler(8);
2727
2728 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2729
2730 msg.append("groupId=");
2731 msg.append(groupId);
2732
2733 msg.append(", parentFolderId=");
2734 msg.append(parentFolderId);
2735
2736 msg.append(", name=");
2737 msg.append(name);
2738
2739 msg.append(StringPool.CLOSE_CURLY_BRACE);
2740
2741 if (_log.isWarnEnabled()) {
2742 _log.warn(msg.toString());
2743 }
2744
2745 throw new NoSuchFolderException(msg.toString());
2746 }
2747
2748 return dlFolder;
2749 }
2750
2751
2760 public DLFolder fetchByG_P_N(long groupId, long parentFolderId, String name)
2761 throws SystemException {
2762 return fetchByG_P_N(groupId, parentFolderId, name, true);
2763 }
2764
2765
2774 public DLFolder fetchByG_P_N(long groupId, long parentFolderId,
2775 String name, boolean retrieveFromCache) throws SystemException {
2776 Object[] finderArgs = new Object[] { groupId, parentFolderId, name };
2777
2778 Object result = null;
2779
2780 if (retrieveFromCache) {
2781 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_P_N,
2782 finderArgs, this);
2783 }
2784
2785 if (result == null) {
2786 Session session = null;
2787
2788 try {
2789 session = openSession();
2790
2791 StringBundler query = new StringBundler(5);
2792
2793 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2794
2795 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
2796
2797 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
2798
2799 if (name == null) {
2800 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
2801 }
2802 else {
2803 if (name.equals(StringPool.BLANK)) {
2804 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
2805 }
2806 else {
2807 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
2808 }
2809 }
2810
2811 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2812
2813 String sql = query.toString();
2814
2815 Query q = session.createQuery(sql);
2816
2817 QueryPos qPos = QueryPos.getInstance(q);
2818
2819 qPos.add(groupId);
2820
2821 qPos.add(parentFolderId);
2822
2823 if (name != null) {
2824 qPos.add(name);
2825 }
2826
2827 List<DLFolder> list = q.list();
2828
2829 result = list;
2830
2831 DLFolder dlFolder = null;
2832
2833 if (list.isEmpty()) {
2834 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2835 finderArgs, list);
2836 }
2837 else {
2838 dlFolder = list.get(0);
2839
2840 cacheResult(dlFolder);
2841
2842 if ((dlFolder.getGroupId() != groupId) ||
2843 (dlFolder.getParentFolderId() != parentFolderId) ||
2844 (dlFolder.getName() == null) ||
2845 !dlFolder.getName().equals(name)) {
2846 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2847 finderArgs, dlFolder);
2848 }
2849 }
2850
2851 return dlFolder;
2852 }
2853 catch (Exception e) {
2854 throw processException(e);
2855 }
2856 finally {
2857 if (result == null) {
2858 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2859 finderArgs, new ArrayList<DLFolder>());
2860 }
2861
2862 closeSession(session);
2863 }
2864 }
2865 else {
2866 if (result instanceof List<?>) {
2867 return null;
2868 }
2869 else {
2870 return (DLFolder)result;
2871 }
2872 }
2873 }
2874
2875
2881 public List<DLFolder> findAll() throws SystemException {
2882 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2883 }
2884
2885
2897 public List<DLFolder> findAll(int start, int end) throws SystemException {
2898 return findAll(start, end, null);
2899 }
2900
2901
2914 public List<DLFolder> findAll(int start, int end,
2915 OrderByComparator orderByComparator) throws SystemException {
2916 Object[] finderArgs = new Object[] {
2917 String.valueOf(start), String.valueOf(end),
2918 String.valueOf(orderByComparator)
2919 };
2920
2921 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2922 finderArgs, this);
2923
2924 if (list == null) {
2925 Session session = null;
2926
2927 try {
2928 session = openSession();
2929
2930 StringBundler query = null;
2931 String sql = null;
2932
2933 if (orderByComparator != null) {
2934 query = new StringBundler(2 +
2935 (orderByComparator.getOrderByFields().length * 3));
2936
2937 query.append(_SQL_SELECT_DLFOLDER);
2938
2939 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2940 orderByComparator);
2941
2942 sql = query.toString();
2943 }
2944 else {
2945 sql = _SQL_SELECT_DLFOLDER.concat(DLFolderModelImpl.ORDER_BY_JPQL);
2946 }
2947
2948 Query q = session.createQuery(sql);
2949
2950 if (orderByComparator == null) {
2951 list = (List<DLFolder>)QueryUtil.list(q, getDialect(),
2952 start, end, false);
2953
2954 Collections.sort(list);
2955 }
2956 else {
2957 list = (List<DLFolder>)QueryUtil.list(q, getDialect(),
2958 start, end);
2959 }
2960 }
2961 catch (Exception e) {
2962 throw processException(e);
2963 }
2964 finally {
2965 if (list == null) {
2966 list = new ArrayList<DLFolder>();
2967 }
2968
2969 cacheResult(list);
2970
2971 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2972
2973 closeSession(session);
2974 }
2975 }
2976
2977 return list;
2978 }
2979
2980
2986 public void removeByUuid(String uuid) throws SystemException {
2987 for (DLFolder dlFolder : findByUuid(uuid)) {
2988 remove(dlFolder);
2989 }
2990 }
2991
2992
2999 public void removeByUUID_G(String uuid, long groupId)
3000 throws NoSuchFolderException, SystemException {
3001 DLFolder dlFolder = findByUUID_G(uuid, groupId);
3002
3003 remove(dlFolder);
3004 }
3005
3006
3012 public void removeByGroupId(long groupId) throws SystemException {
3013 for (DLFolder dlFolder : findByGroupId(groupId)) {
3014 remove(dlFolder);
3015 }
3016 }
3017
3018
3024 public void removeByCompanyId(long companyId) throws SystemException {
3025 for (DLFolder dlFolder : findByCompanyId(companyId)) {
3026 remove(dlFolder);
3027 }
3028 }
3029
3030
3037 public void removeByG_P(long groupId, long parentFolderId)
3038 throws SystemException {
3039 for (DLFolder dlFolder : findByG_P(groupId, parentFolderId)) {
3040 remove(dlFolder);
3041 }
3042 }
3043
3044
3051 public void removeByP_N(long parentFolderId, String name)
3052 throws SystemException {
3053 for (DLFolder dlFolder : findByP_N(parentFolderId, name)) {
3054 remove(dlFolder);
3055 }
3056 }
3057
3058
3066 public void removeByG_P_N(long groupId, long parentFolderId, String name)
3067 throws NoSuchFolderException, SystemException {
3068 DLFolder dlFolder = findByG_P_N(groupId, parentFolderId, name);
3069
3070 remove(dlFolder);
3071 }
3072
3073
3078 public void removeAll() throws SystemException {
3079 for (DLFolder dlFolder : findAll()) {
3080 remove(dlFolder);
3081 }
3082 }
3083
3084
3091 public int countByUuid(String uuid) throws SystemException {
3092 Object[] finderArgs = new Object[] { uuid };
3093
3094 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
3095 finderArgs, this);
3096
3097 if (count == null) {
3098 Session session = null;
3099
3100 try {
3101 session = openSession();
3102
3103 StringBundler query = new StringBundler(2);
3104
3105 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3106
3107 if (uuid == null) {
3108 query.append(_FINDER_COLUMN_UUID_UUID_1);
3109 }
3110 else {
3111 if (uuid.equals(StringPool.BLANK)) {
3112 query.append(_FINDER_COLUMN_UUID_UUID_3);
3113 }
3114 else {
3115 query.append(_FINDER_COLUMN_UUID_UUID_2);
3116 }
3117 }
3118
3119 String sql = query.toString();
3120
3121 Query q = session.createQuery(sql);
3122
3123 QueryPos qPos = QueryPos.getInstance(q);
3124
3125 if (uuid != null) {
3126 qPos.add(uuid);
3127 }
3128
3129 count = (Long)q.uniqueResult();
3130 }
3131 catch (Exception e) {
3132 throw processException(e);
3133 }
3134 finally {
3135 if (count == null) {
3136 count = Long.valueOf(0);
3137 }
3138
3139 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3140 finderArgs, count);
3141
3142 closeSession(session);
3143 }
3144 }
3145
3146 return count.intValue();
3147 }
3148
3149
3157 public int countByUUID_G(String uuid, long groupId)
3158 throws SystemException {
3159 Object[] finderArgs = new Object[] { uuid, groupId };
3160
3161 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
3162 finderArgs, this);
3163
3164 if (count == null) {
3165 Session session = null;
3166
3167 try {
3168 session = openSession();
3169
3170 StringBundler query = new StringBundler(3);
3171
3172 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3173
3174 if (uuid == null) {
3175 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
3176 }
3177 else {
3178 if (uuid.equals(StringPool.BLANK)) {
3179 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
3180 }
3181 else {
3182 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
3183 }
3184 }
3185
3186 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
3187
3188 String sql = query.toString();
3189
3190 Query q = session.createQuery(sql);
3191
3192 QueryPos qPos = QueryPos.getInstance(q);
3193
3194 if (uuid != null) {
3195 qPos.add(uuid);
3196 }
3197
3198 qPos.add(groupId);
3199
3200 count = (Long)q.uniqueResult();
3201 }
3202 catch (Exception e) {
3203 throw processException(e);
3204 }
3205 finally {
3206 if (count == null) {
3207 count = Long.valueOf(0);
3208 }
3209
3210 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
3211 finderArgs, count);
3212
3213 closeSession(session);
3214 }
3215 }
3216
3217 return count.intValue();
3218 }
3219
3220
3227 public int countByGroupId(long groupId) throws SystemException {
3228 Object[] finderArgs = new Object[] { groupId };
3229
3230 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
3231 finderArgs, this);
3232
3233 if (count == null) {
3234 Session session = null;
3235
3236 try {
3237 session = openSession();
3238
3239 StringBundler query = new StringBundler(2);
3240
3241 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3242
3243 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3244
3245 String sql = query.toString();
3246
3247 Query q = session.createQuery(sql);
3248
3249 QueryPos qPos = QueryPos.getInstance(q);
3250
3251 qPos.add(groupId);
3252
3253 count = (Long)q.uniqueResult();
3254 }
3255 catch (Exception e) {
3256 throw processException(e);
3257 }
3258 finally {
3259 if (count == null) {
3260 count = Long.valueOf(0);
3261 }
3262
3263 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
3264 finderArgs, count);
3265
3266 closeSession(session);
3267 }
3268 }
3269
3270 return count.intValue();
3271 }
3272
3273
3280 public int filterCountByGroupId(long groupId) throws SystemException {
3281 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3282 return countByGroupId(groupId);
3283 }
3284
3285 Session session = null;
3286
3287 try {
3288 session = openSession();
3289
3290 StringBundler query = new StringBundler(2);
3291
3292 query.append(_FILTER_SQL_COUNT_DLFOLDER_WHERE);
3293
3294 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3295
3296 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3297 DLFolder.class.getName(), _FILTER_COLUMN_PK,
3298 _FILTER_COLUMN_USERID, groupId);
3299
3300 SQLQuery q = session.createSQLQuery(sql);
3301
3302 q.addScalar(COUNT_COLUMN_NAME,
3303 com.liferay.portal.kernel.dao.orm.Type.LONG);
3304
3305 QueryPos qPos = QueryPos.getInstance(q);
3306
3307 qPos.add(groupId);
3308
3309 Long count = (Long)q.uniqueResult();
3310
3311 return count.intValue();
3312 }
3313 catch (Exception e) {
3314 throw processException(e);
3315 }
3316 finally {
3317 closeSession(session);
3318 }
3319 }
3320
3321
3328 public int countByCompanyId(long companyId) throws SystemException {
3329 Object[] finderArgs = new Object[] { companyId };
3330
3331 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
3332 finderArgs, this);
3333
3334 if (count == null) {
3335 Session session = null;
3336
3337 try {
3338 session = openSession();
3339
3340 StringBundler query = new StringBundler(2);
3341
3342 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3343
3344 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
3345
3346 String sql = query.toString();
3347
3348 Query q = session.createQuery(sql);
3349
3350 QueryPos qPos = QueryPos.getInstance(q);
3351
3352 qPos.add(companyId);
3353
3354 count = (Long)q.uniqueResult();
3355 }
3356 catch (Exception e) {
3357 throw processException(e);
3358 }
3359 finally {
3360 if (count == null) {
3361 count = Long.valueOf(0);
3362 }
3363
3364 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
3365 finderArgs, count);
3366
3367 closeSession(session);
3368 }
3369 }
3370
3371 return count.intValue();
3372 }
3373
3374
3382 public int countByG_P(long groupId, long parentFolderId)
3383 throws SystemException {
3384 Object[] finderArgs = new Object[] { groupId, parentFolderId };
3385
3386 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P,
3387 finderArgs, this);
3388
3389 if (count == null) {
3390 Session session = null;
3391
3392 try {
3393 session = openSession();
3394
3395 StringBundler query = new StringBundler(3);
3396
3397 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3398
3399 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
3400
3401 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
3402
3403 String sql = query.toString();
3404
3405 Query q = session.createQuery(sql);
3406
3407 QueryPos qPos = QueryPos.getInstance(q);
3408
3409 qPos.add(groupId);
3410
3411 qPos.add(parentFolderId);
3412
3413 count = (Long)q.uniqueResult();
3414 }
3415 catch (Exception e) {
3416 throw processException(e);
3417 }
3418 finally {
3419 if (count == null) {
3420 count = Long.valueOf(0);
3421 }
3422
3423 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P, finderArgs,
3424 count);
3425
3426 closeSession(session);
3427 }
3428 }
3429
3430 return count.intValue();
3431 }
3432
3433
3441 public int filterCountByG_P(long groupId, long parentFolderId)
3442 throws SystemException {
3443 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3444 return countByG_P(groupId, parentFolderId);
3445 }
3446
3447 Session session = null;
3448
3449 try {
3450 session = openSession();
3451
3452 StringBundler query = new StringBundler(3);
3453
3454 query.append(_FILTER_SQL_COUNT_DLFOLDER_WHERE);
3455
3456 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
3457
3458 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
3459
3460 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3461 DLFolder.class.getName(), _FILTER_COLUMN_PK,
3462 _FILTER_COLUMN_USERID, groupId);
3463
3464 SQLQuery q = session.createSQLQuery(sql);
3465
3466 q.addScalar(COUNT_COLUMN_NAME,
3467 com.liferay.portal.kernel.dao.orm.Type.LONG);
3468
3469 QueryPos qPos = QueryPos.getInstance(q);
3470
3471 qPos.add(groupId);
3472
3473 qPos.add(parentFolderId);
3474
3475 Long count = (Long)q.uniqueResult();
3476
3477 return count.intValue();
3478 }
3479 catch (Exception e) {
3480 throw processException(e);
3481 }
3482 finally {
3483 closeSession(session);
3484 }
3485 }
3486
3487
3495 public int countByP_N(long parentFolderId, String name)
3496 throws SystemException {
3497 Object[] finderArgs = new Object[] { parentFolderId, name };
3498
3499 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_N,
3500 finderArgs, this);
3501
3502 if (count == null) {
3503 Session session = null;
3504
3505 try {
3506 session = openSession();
3507
3508 StringBundler query = new StringBundler(3);
3509
3510 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3511
3512 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
3513
3514 if (name == null) {
3515 query.append(_FINDER_COLUMN_P_N_NAME_1);
3516 }
3517 else {
3518 if (name.equals(StringPool.BLANK)) {
3519 query.append(_FINDER_COLUMN_P_N_NAME_3);
3520 }
3521 else {
3522 query.append(_FINDER_COLUMN_P_N_NAME_2);
3523 }
3524 }
3525
3526 String sql = query.toString();
3527
3528 Query q = session.createQuery(sql);
3529
3530 QueryPos qPos = QueryPos.getInstance(q);
3531
3532 qPos.add(parentFolderId);
3533
3534 if (name != null) {
3535 qPos.add(name);
3536 }
3537
3538 count = (Long)q.uniqueResult();
3539 }
3540 catch (Exception e) {
3541 throw processException(e);
3542 }
3543 finally {
3544 if (count == null) {
3545 count = Long.valueOf(0);
3546 }
3547
3548 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_N, finderArgs,
3549 count);
3550
3551 closeSession(session);
3552 }
3553 }
3554
3555 return count.intValue();
3556 }
3557
3558
3567 public int countByG_P_N(long groupId, long parentFolderId, String name)
3568 throws SystemException {
3569 Object[] finderArgs = new Object[] { groupId, parentFolderId, name };
3570
3571 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P_N,
3572 finderArgs, this);
3573
3574 if (count == null) {
3575 Session session = null;
3576
3577 try {
3578 session = openSession();
3579
3580 StringBundler query = new StringBundler(4);
3581
3582 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3583
3584 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
3585
3586 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
3587
3588 if (name == null) {
3589 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
3590 }
3591 else {
3592 if (name.equals(StringPool.BLANK)) {
3593 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
3594 }
3595 else {
3596 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
3597 }
3598 }
3599
3600 String sql = query.toString();
3601
3602 Query q = session.createQuery(sql);
3603
3604 QueryPos qPos = QueryPos.getInstance(q);
3605
3606 qPos.add(groupId);
3607
3608 qPos.add(parentFolderId);
3609
3610 if (name != null) {
3611 qPos.add(name);
3612 }
3613
3614 count = (Long)q.uniqueResult();
3615 }
3616 catch (Exception e) {
3617 throw processException(e);
3618 }
3619 finally {
3620 if (count == null) {
3621 count = Long.valueOf(0);
3622 }
3623
3624 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P_N,
3625 finderArgs, count);
3626
3627 closeSession(session);
3628 }
3629 }
3630
3631 return count.intValue();
3632 }
3633
3634
3643 public int filterCountByG_P_N(long groupId, long parentFolderId, String name)
3644 throws SystemException {
3645 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3646 return countByG_P_N(groupId, parentFolderId, name);
3647 }
3648
3649 Session session = null;
3650
3651 try {
3652 session = openSession();
3653
3654 StringBundler query = new StringBundler(4);
3655
3656 query.append(_FILTER_SQL_COUNT_DLFOLDER_WHERE);
3657
3658 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
3659
3660 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
3661
3662 if (name == null) {
3663 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
3664 }
3665 else {
3666 if (name.equals(StringPool.BLANK)) {
3667 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
3668 }
3669 else {
3670 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
3671 }
3672 }
3673
3674 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3675 DLFolder.class.getName(), _FILTER_COLUMN_PK,
3676 _FILTER_COLUMN_USERID, groupId);
3677
3678 SQLQuery q = session.createSQLQuery(sql);
3679
3680 q.addScalar(COUNT_COLUMN_NAME,
3681 com.liferay.portal.kernel.dao.orm.Type.LONG);
3682
3683 QueryPos qPos = QueryPos.getInstance(q);
3684
3685 qPos.add(groupId);
3686
3687 qPos.add(parentFolderId);
3688
3689 if (name != null) {
3690 qPos.add(name);
3691 }
3692
3693 Long count = (Long)q.uniqueResult();
3694
3695 return count.intValue();
3696 }
3697 catch (Exception e) {
3698 throw processException(e);
3699 }
3700 finally {
3701 closeSession(session);
3702 }
3703 }
3704
3705
3711 public int countAll() throws SystemException {
3712 Object[] finderArgs = new Object[0];
3713
3714 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3715 finderArgs, this);
3716
3717 if (count == null) {
3718 Session session = null;
3719
3720 try {
3721 session = openSession();
3722
3723 Query q = session.createQuery(_SQL_COUNT_DLFOLDER);
3724
3725 count = (Long)q.uniqueResult();
3726 }
3727 catch (Exception e) {
3728 throw processException(e);
3729 }
3730 finally {
3731 if (count == null) {
3732 count = Long.valueOf(0);
3733 }
3734
3735 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3736 count);
3737
3738 closeSession(session);
3739 }
3740 }
3741
3742 return count.intValue();
3743 }
3744
3745
3748 public void afterPropertiesSet() {
3749 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3750 com.liferay.portal.util.PropsUtil.get(
3751 "value.object.listener.com.liferay.portlet.documentlibrary.model.DLFolder")));
3752
3753 if (listenerClassNames.length > 0) {
3754 try {
3755 List<ModelListener<DLFolder>> listenersList = new ArrayList<ModelListener<DLFolder>>();
3756
3757 for (String listenerClassName : listenerClassNames) {
3758 listenersList.add((ModelListener<DLFolder>)InstanceFactory.newInstance(
3759 listenerClassName));
3760 }
3761
3762 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3763 }
3764 catch (Exception e) {
3765 _log.error(e);
3766 }
3767 }
3768 }
3769
3770 @BeanReference(type = DLFileEntryPersistence.class)
3771 protected DLFileEntryPersistence dlFileEntryPersistence;
3772 @BeanReference(type = DLFileRankPersistence.class)
3773 protected DLFileRankPersistence dlFileRankPersistence;
3774 @BeanReference(type = DLFileShortcutPersistence.class)
3775 protected DLFileShortcutPersistence dlFileShortcutPersistence;
3776 @BeanReference(type = DLFileVersionPersistence.class)
3777 protected DLFileVersionPersistence dlFileVersionPersistence;
3778 @BeanReference(type = DLFolderPersistence.class)
3779 protected DLFolderPersistence dlFolderPersistence;
3780 @BeanReference(type = GroupPersistence.class)
3781 protected GroupPersistence groupPersistence;
3782 @BeanReference(type = LayoutPersistence.class)
3783 protected LayoutPersistence layoutPersistence;
3784 @BeanReference(type = LockPersistence.class)
3785 protected LockPersistence lockPersistence;
3786 @BeanReference(type = ResourcePersistence.class)
3787 protected ResourcePersistence resourcePersistence;
3788 @BeanReference(type = UserPersistence.class)
3789 protected UserPersistence userPersistence;
3790 @BeanReference(type = WebDAVPropsPersistence.class)
3791 protected WebDAVPropsPersistence webDAVPropsPersistence;
3792 @BeanReference(type = ExpandoValuePersistence.class)
3793 protected ExpandoValuePersistence expandoValuePersistence;
3794 private static final String _SQL_SELECT_DLFOLDER = "SELECT dlFolder FROM DLFolder dlFolder";
3795 private static final String _SQL_SELECT_DLFOLDER_WHERE = "SELECT dlFolder FROM DLFolder dlFolder WHERE ";
3796 private static final String _SQL_COUNT_DLFOLDER = "SELECT COUNT(dlFolder) FROM DLFolder dlFolder";
3797 private static final String _SQL_COUNT_DLFOLDER_WHERE = "SELECT COUNT(dlFolder) FROM DLFolder dlFolder WHERE ";
3798 private static final String _FINDER_COLUMN_UUID_UUID_1 = "dlFolder.uuid IS NULL";
3799 private static final String _FINDER_COLUMN_UUID_UUID_2 = "dlFolder.uuid = ?";
3800 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(dlFolder.uuid IS NULL OR dlFolder.uuid = ?)";
3801 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "dlFolder.uuid IS NULL AND ";
3802 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "dlFolder.uuid = ? AND ";
3803 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(dlFolder.uuid IS NULL OR dlFolder.uuid = ?) AND ";
3804 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "dlFolder.groupId = ?";
3805 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "dlFolder.groupId = ?";
3806 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "dlFolder.companyId = ?";
3807 private static final String _FINDER_COLUMN_G_P_GROUPID_2 = "dlFolder.groupId = ? AND ";
3808 private static final String _FINDER_COLUMN_G_P_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ?";
3809 private static final String _FINDER_COLUMN_P_N_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ? AND ";
3810 private static final String _FINDER_COLUMN_P_N_NAME_1 = "dlFolder.name IS NULL";
3811 private static final String _FINDER_COLUMN_P_N_NAME_2 = "dlFolder.name = ?";
3812 private static final String _FINDER_COLUMN_P_N_NAME_3 = "(dlFolder.name IS NULL OR dlFolder.name = ?)";
3813 private static final String _FINDER_COLUMN_G_P_N_GROUPID_2 = "dlFolder.groupId = ? AND ";
3814 private static final String _FINDER_COLUMN_G_P_N_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ? AND ";
3815 private static final String _FINDER_COLUMN_G_P_N_NAME_1 = "dlFolder.name IS NULL";
3816 private static final String _FINDER_COLUMN_G_P_N_NAME_2 = "dlFolder.name = ?";
3817 private static final String _FINDER_COLUMN_G_P_N_NAME_3 = "(dlFolder.name IS NULL OR dlFolder.name = ?)";
3818 private static final String _FILTER_SQL_SELECT_DLFOLDER_WHERE = "SELECT DISTINCT {dlFolder.*} FROM DLFolder dlFolder WHERE ";
3819 private static final String _FILTER_SQL_COUNT_DLFOLDER_WHERE = "SELECT COUNT(DISTINCT dlFolder.folderId) AS COUNT_VALUE FROM DLFolder dlFolder WHERE ";
3820 private static final String _FILTER_COLUMN_PK = "dlFolder.folderId";
3821 private static final String _FILTER_COLUMN_USERID = "dlFolder.userId";
3822 private static final String _FILTER_ENTITY_ALIAS = "dlFolder";
3823 private static final String _ORDER_BY_ENTITY_ALIAS = "dlFolder.";
3824 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DLFolder exists with the primary key ";
3825 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DLFolder exists with the key {";
3826 private static Log _log = LogFactoryUtil.getLog(DLFolderPersistenceImpl.class);
3827 }