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 BatchSessionUtil.delete(session, dlFolder);
329 }
330 catch (Exception e) {
331 throw processException(e);
332 }
333 finally {
334 closeSession(session);
335 }
336
337 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
338
339 DLFolderModelImpl dlFolderModelImpl = (DLFolderModelImpl)dlFolder;
340
341 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
342 new Object[] {
343 dlFolderModelImpl.getOriginalUuid(),
344 new Long(dlFolderModelImpl.getOriginalGroupId())
345 });
346
347 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
348 new Object[] {
349 new Long(dlFolderModelImpl.getOriginalGroupId()),
350 new Long(dlFolderModelImpl.getOriginalParentFolderId()),
351
352 dlFolderModelImpl.getOriginalName()
353 });
354
355 EntityCacheUtil.removeResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
356 DLFolderImpl.class, dlFolder.getPrimaryKey());
357
358 return dlFolder;
359 }
360
361 public DLFolder updateImpl(
362 com.liferay.portlet.documentlibrary.model.DLFolder dlFolder,
363 boolean merge) throws SystemException {
364 dlFolder = toUnwrappedModel(dlFolder);
365
366 boolean isNew = dlFolder.isNew();
367
368 DLFolderModelImpl dlFolderModelImpl = (DLFolderModelImpl)dlFolder;
369
370 if (Validator.isNull(dlFolder.getUuid())) {
371 String uuid = PortalUUIDUtil.generate();
372
373 dlFolder.setUuid(uuid);
374 }
375
376 Session session = null;
377
378 try {
379 session = openSession();
380
381 BatchSessionUtil.update(session, dlFolder, merge);
382
383 dlFolder.setNew(false);
384 }
385 catch (Exception e) {
386 throw processException(e);
387 }
388 finally {
389 closeSession(session);
390 }
391
392 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
393
394 EntityCacheUtil.putResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
395 DLFolderImpl.class, dlFolder.getPrimaryKey(), dlFolder);
396
397 if (!isNew &&
398 (!Validator.equals(dlFolder.getUuid(),
399 dlFolderModelImpl.getOriginalUuid()) ||
400 (dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()))) {
401 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
402 new Object[] {
403 dlFolderModelImpl.getOriginalUuid(),
404 new Long(dlFolderModelImpl.getOriginalGroupId())
405 });
406 }
407
408 if (isNew ||
409 (!Validator.equals(dlFolder.getUuid(),
410 dlFolderModelImpl.getOriginalUuid()) ||
411 (dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()))) {
412 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
413 new Object[] { dlFolder.getUuid(), new Long(
414 dlFolder.getGroupId()) }, dlFolder);
415 }
416
417 if (!isNew &&
418 ((dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()) ||
419 (dlFolder.getParentFolderId() != dlFolderModelImpl.getOriginalParentFolderId()) ||
420 !Validator.equals(dlFolder.getName(),
421 dlFolderModelImpl.getOriginalName()))) {
422 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
423 new Object[] {
424 new Long(dlFolderModelImpl.getOriginalGroupId()),
425 new Long(dlFolderModelImpl.getOriginalParentFolderId()),
426
427 dlFolderModelImpl.getOriginalName()
428 });
429 }
430
431 if (isNew ||
432 ((dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()) ||
433 (dlFolder.getParentFolderId() != dlFolderModelImpl.getOriginalParentFolderId()) ||
434 !Validator.equals(dlFolder.getName(),
435 dlFolderModelImpl.getOriginalName()))) {
436 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
437 new Object[] {
438 new Long(dlFolder.getGroupId()),
439 new Long(dlFolder.getParentFolderId()),
440
441 dlFolder.getName()
442 }, dlFolder);
443 }
444
445 return dlFolder;
446 }
447
448 protected DLFolder toUnwrappedModel(DLFolder dlFolder) {
449 if (dlFolder instanceof DLFolderImpl) {
450 return dlFolder;
451 }
452
453 DLFolderImpl dlFolderImpl = new DLFolderImpl();
454
455 dlFolderImpl.setNew(dlFolder.isNew());
456 dlFolderImpl.setPrimaryKey(dlFolder.getPrimaryKey());
457
458 dlFolderImpl.setUuid(dlFolder.getUuid());
459 dlFolderImpl.setFolderId(dlFolder.getFolderId());
460 dlFolderImpl.setGroupId(dlFolder.getGroupId());
461 dlFolderImpl.setCompanyId(dlFolder.getCompanyId());
462 dlFolderImpl.setUserId(dlFolder.getUserId());
463 dlFolderImpl.setUserName(dlFolder.getUserName());
464 dlFolderImpl.setCreateDate(dlFolder.getCreateDate());
465 dlFolderImpl.setModifiedDate(dlFolder.getModifiedDate());
466 dlFolderImpl.setParentFolderId(dlFolder.getParentFolderId());
467 dlFolderImpl.setName(dlFolder.getName());
468 dlFolderImpl.setDescription(dlFolder.getDescription());
469 dlFolderImpl.setLastPostDate(dlFolder.getLastPostDate());
470
471 return dlFolderImpl;
472 }
473
474
482 public DLFolder findByPrimaryKey(Serializable primaryKey)
483 throws NoSuchModelException, SystemException {
484 return findByPrimaryKey(((Long)primaryKey).longValue());
485 }
486
487
495 public DLFolder findByPrimaryKey(long folderId)
496 throws NoSuchFolderException, SystemException {
497 DLFolder dlFolder = fetchByPrimaryKey(folderId);
498
499 if (dlFolder == null) {
500 if (_log.isWarnEnabled()) {
501 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + folderId);
502 }
503
504 throw new NoSuchFolderException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
505 folderId);
506 }
507
508 return dlFolder;
509 }
510
511
518 public DLFolder fetchByPrimaryKey(Serializable primaryKey)
519 throws SystemException {
520 return fetchByPrimaryKey(((Long)primaryKey).longValue());
521 }
522
523
530 public DLFolder fetchByPrimaryKey(long folderId) throws SystemException {
531 DLFolder dlFolder = (DLFolder)EntityCacheUtil.getResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
532 DLFolderImpl.class, folderId, this);
533
534 if (dlFolder == null) {
535 Session session = null;
536
537 try {
538 session = openSession();
539
540 dlFolder = (DLFolder)session.get(DLFolderImpl.class,
541 new Long(folderId));
542 }
543 catch (Exception e) {
544 throw processException(e);
545 }
546 finally {
547 if (dlFolder != null) {
548 cacheResult(dlFolder);
549 }
550
551 closeSession(session);
552 }
553 }
554
555 return dlFolder;
556 }
557
558
565 public List<DLFolder> findByUuid(String uuid) throws SystemException {
566 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
567 }
568
569
582 public List<DLFolder> findByUuid(String uuid, int start, int end)
583 throws SystemException {
584 return findByUuid(uuid, start, end, null);
585 }
586
587
601 public List<DLFolder> findByUuid(String uuid, int start, int end,
602 OrderByComparator orderByComparator) throws SystemException {
603 Object[] finderArgs = new Object[] {
604 uuid,
605
606 String.valueOf(start), String.valueOf(end),
607 String.valueOf(orderByComparator)
608 };
609
610 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
611 finderArgs, this);
612
613 if (list == null) {
614 Session session = null;
615
616 try {
617 session = openSession();
618
619 StringBundler query = null;
620
621 if (orderByComparator != null) {
622 query = new StringBundler(3 +
623 (orderByComparator.getOrderByFields().length * 3));
624 }
625 else {
626 query = new StringBundler(3);
627 }
628
629 query.append(_SQL_SELECT_DLFOLDER_WHERE);
630
631 if (uuid == null) {
632 query.append(_FINDER_COLUMN_UUID_UUID_1);
633 }
634 else {
635 if (uuid.equals(StringPool.BLANK)) {
636 query.append(_FINDER_COLUMN_UUID_UUID_3);
637 }
638 else {
639 query.append(_FINDER_COLUMN_UUID_UUID_2);
640 }
641 }
642
643 if (orderByComparator != null) {
644 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
645 orderByComparator);
646 }
647
648 else {
649 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
650 }
651
652 String sql = query.toString();
653
654 Query q = session.createQuery(sql);
655
656 QueryPos qPos = QueryPos.getInstance(q);
657
658 if (uuid != null) {
659 qPos.add(uuid);
660 }
661
662 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
663 end);
664 }
665 catch (Exception e) {
666 throw processException(e);
667 }
668 finally {
669 if (list == null) {
670 list = new ArrayList<DLFolder>();
671 }
672
673 cacheResult(list);
674
675 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
676 list);
677
678 closeSession(session);
679 }
680 }
681
682 return list;
683 }
684
685
698 public DLFolder findByUuid_First(String uuid,
699 OrderByComparator orderByComparator)
700 throws NoSuchFolderException, SystemException {
701 List<DLFolder> list = findByUuid(uuid, 0, 1, orderByComparator);
702
703 if (list.isEmpty()) {
704 StringBundler msg = new StringBundler(4);
705
706 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
707
708 msg.append("uuid=");
709 msg.append(uuid);
710
711 msg.append(StringPool.CLOSE_CURLY_BRACE);
712
713 throw new NoSuchFolderException(msg.toString());
714 }
715 else {
716 return list.get(0);
717 }
718 }
719
720
733 public DLFolder findByUuid_Last(String uuid,
734 OrderByComparator orderByComparator)
735 throws NoSuchFolderException, SystemException {
736 int count = countByUuid(uuid);
737
738 List<DLFolder> list = findByUuid(uuid, count - 1, count,
739 orderByComparator);
740
741 if (list.isEmpty()) {
742 StringBundler msg = new StringBundler(4);
743
744 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
745
746 msg.append("uuid=");
747 msg.append(uuid);
748
749 msg.append(StringPool.CLOSE_CURLY_BRACE);
750
751 throw new NoSuchFolderException(msg.toString());
752 }
753 else {
754 return list.get(0);
755 }
756 }
757
758
772 public DLFolder[] findByUuid_PrevAndNext(long folderId, String uuid,
773 OrderByComparator orderByComparator)
774 throws NoSuchFolderException, SystemException {
775 DLFolder dlFolder = findByPrimaryKey(folderId);
776
777 Session session = null;
778
779 try {
780 session = openSession();
781
782 DLFolder[] array = new DLFolderImpl[3];
783
784 array[0] = getByUuid_PrevAndNext(session, dlFolder, uuid,
785 orderByComparator, true);
786
787 array[1] = dlFolder;
788
789 array[2] = getByUuid_PrevAndNext(session, dlFolder, uuid,
790 orderByComparator, false);
791
792 return array;
793 }
794 catch (Exception e) {
795 throw processException(e);
796 }
797 finally {
798 closeSession(session);
799 }
800 }
801
802 protected DLFolder getByUuid_PrevAndNext(Session session,
803 DLFolder dlFolder, String uuid, OrderByComparator orderByComparator,
804 boolean previous) {
805 StringBundler query = null;
806
807 if (orderByComparator != null) {
808 query = new StringBundler(6 +
809 (orderByComparator.getOrderByFields().length * 6));
810 }
811 else {
812 query = new StringBundler(3);
813 }
814
815 query.append(_SQL_SELECT_DLFOLDER_WHERE);
816
817 if (uuid == null) {
818 query.append(_FINDER_COLUMN_UUID_UUID_1);
819 }
820 else {
821 if (uuid.equals(StringPool.BLANK)) {
822 query.append(_FINDER_COLUMN_UUID_UUID_3);
823 }
824 else {
825 query.append(_FINDER_COLUMN_UUID_UUID_2);
826 }
827 }
828
829 if (orderByComparator != null) {
830 String[] orderByFields = orderByComparator.getOrderByFields();
831
832 if (orderByFields.length > 0) {
833 query.append(WHERE_AND);
834 }
835
836 for (int i = 0; i < orderByFields.length; i++) {
837 query.append(_ORDER_BY_ENTITY_ALIAS);
838 query.append(orderByFields[i]);
839
840 if ((i + 1) < orderByFields.length) {
841 if (orderByComparator.isAscending() ^ previous) {
842 query.append(WHERE_GREATER_THAN_HAS_NEXT);
843 }
844 else {
845 query.append(WHERE_LESSER_THAN_HAS_NEXT);
846 }
847 }
848 else {
849 if (orderByComparator.isAscending() ^ previous) {
850 query.append(WHERE_GREATER_THAN);
851 }
852 else {
853 query.append(WHERE_LESSER_THAN);
854 }
855 }
856 }
857
858 query.append(ORDER_BY_CLAUSE);
859
860 for (int i = 0; i < orderByFields.length; i++) {
861 query.append(_ORDER_BY_ENTITY_ALIAS);
862 query.append(orderByFields[i]);
863
864 if ((i + 1) < orderByFields.length) {
865 if (orderByComparator.isAscending() ^ previous) {
866 query.append(ORDER_BY_ASC_HAS_NEXT);
867 }
868 else {
869 query.append(ORDER_BY_DESC_HAS_NEXT);
870 }
871 }
872 else {
873 if (orderByComparator.isAscending() ^ previous) {
874 query.append(ORDER_BY_ASC);
875 }
876 else {
877 query.append(ORDER_BY_DESC);
878 }
879 }
880 }
881 }
882
883 else {
884 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
885 }
886
887 String sql = query.toString();
888
889 Query q = session.createQuery(sql);
890
891 q.setFirstResult(0);
892 q.setMaxResults(2);
893
894 QueryPos qPos = QueryPos.getInstance(q);
895
896 if (uuid != null) {
897 qPos.add(uuid);
898 }
899
900 if (orderByComparator != null) {
901 Object[] values = orderByComparator.getOrderByValues(dlFolder);
902
903 for (Object value : values) {
904 qPos.add(value);
905 }
906 }
907
908 List<DLFolder> list = q.list();
909
910 if (list.size() == 2) {
911 return list.get(1);
912 }
913 else {
914 return null;
915 }
916 }
917
918
927 public DLFolder findByUUID_G(String uuid, long groupId)
928 throws NoSuchFolderException, SystemException {
929 DLFolder dlFolder = fetchByUUID_G(uuid, groupId);
930
931 if (dlFolder == null) {
932 StringBundler msg = new StringBundler(6);
933
934 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
935
936 msg.append("uuid=");
937 msg.append(uuid);
938
939 msg.append(", groupId=");
940 msg.append(groupId);
941
942 msg.append(StringPool.CLOSE_CURLY_BRACE);
943
944 if (_log.isWarnEnabled()) {
945 _log.warn(msg.toString());
946 }
947
948 throw new NoSuchFolderException(msg.toString());
949 }
950
951 return dlFolder;
952 }
953
954
962 public DLFolder fetchByUUID_G(String uuid, long groupId)
963 throws SystemException {
964 return fetchByUUID_G(uuid, groupId, true);
965 }
966
967
975 public DLFolder fetchByUUID_G(String uuid, long groupId,
976 boolean retrieveFromCache) throws SystemException {
977 Object[] finderArgs = new Object[] { uuid, groupId };
978
979 Object result = null;
980
981 if (retrieveFromCache) {
982 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
983 finderArgs, this);
984 }
985
986 if (result == null) {
987 Session session = null;
988
989 try {
990 session = openSession();
991
992 StringBundler query = new StringBundler(4);
993
994 query.append(_SQL_SELECT_DLFOLDER_WHERE);
995
996 if (uuid == null) {
997 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
998 }
999 else {
1000 if (uuid.equals(StringPool.BLANK)) {
1001 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1002 }
1003 else {
1004 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1005 }
1006 }
1007
1008 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1009
1010 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1011
1012 String sql = query.toString();
1013
1014 Query q = session.createQuery(sql);
1015
1016 QueryPos qPos = QueryPos.getInstance(q);
1017
1018 if (uuid != null) {
1019 qPos.add(uuid);
1020 }
1021
1022 qPos.add(groupId);
1023
1024 List<DLFolder> list = q.list();
1025
1026 result = list;
1027
1028 DLFolder dlFolder = null;
1029
1030 if (list.isEmpty()) {
1031 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1032 finderArgs, list);
1033 }
1034 else {
1035 dlFolder = list.get(0);
1036
1037 cacheResult(dlFolder);
1038
1039 if ((dlFolder.getUuid() == null) ||
1040 !dlFolder.getUuid().equals(uuid) ||
1041 (dlFolder.getGroupId() != groupId)) {
1042 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1043 finderArgs, dlFolder);
1044 }
1045 }
1046
1047 return dlFolder;
1048 }
1049 catch (Exception e) {
1050 throw processException(e);
1051 }
1052 finally {
1053 if (result == null) {
1054 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1055 finderArgs, new ArrayList<DLFolder>());
1056 }
1057
1058 closeSession(session);
1059 }
1060 }
1061 else {
1062 if (result instanceof List<?>) {
1063 return null;
1064 }
1065 else {
1066 return (DLFolder)result;
1067 }
1068 }
1069 }
1070
1071
1078 public List<DLFolder> findByGroupId(long groupId) throws SystemException {
1079 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1080 }
1081
1082
1095 public List<DLFolder> findByGroupId(long groupId, int start, int end)
1096 throws SystemException {
1097 return findByGroupId(groupId, start, end, null);
1098 }
1099
1100
1114 public List<DLFolder> findByGroupId(long groupId, int start, int end,
1115 OrderByComparator orderByComparator) throws SystemException {
1116 Object[] finderArgs = new Object[] {
1117 groupId,
1118
1119 String.valueOf(start), String.valueOf(end),
1120 String.valueOf(orderByComparator)
1121 };
1122
1123 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1124 finderArgs, this);
1125
1126 if (list == null) {
1127 Session session = null;
1128
1129 try {
1130 session = openSession();
1131
1132 StringBundler query = null;
1133
1134 if (orderByComparator != null) {
1135 query = new StringBundler(3 +
1136 (orderByComparator.getOrderByFields().length * 3));
1137 }
1138 else {
1139 query = new StringBundler(3);
1140 }
1141
1142 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1143
1144 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1145
1146 if (orderByComparator != null) {
1147 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1148 orderByComparator);
1149 }
1150
1151 else {
1152 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1153 }
1154
1155 String sql = query.toString();
1156
1157 Query q = session.createQuery(sql);
1158
1159 QueryPos qPos = QueryPos.getInstance(q);
1160
1161 qPos.add(groupId);
1162
1163 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1164 end);
1165 }
1166 catch (Exception e) {
1167 throw processException(e);
1168 }
1169 finally {
1170 if (list == null) {
1171 list = new ArrayList<DLFolder>();
1172 }
1173
1174 cacheResult(list);
1175
1176 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1177 finderArgs, list);
1178
1179 closeSession(session);
1180 }
1181 }
1182
1183 return list;
1184 }
1185
1186
1199 public DLFolder findByGroupId_First(long groupId,
1200 OrderByComparator orderByComparator)
1201 throws NoSuchFolderException, SystemException {
1202 List<DLFolder> list = findByGroupId(groupId, 0, 1, orderByComparator);
1203
1204 if (list.isEmpty()) {
1205 StringBundler msg = new StringBundler(4);
1206
1207 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1208
1209 msg.append("groupId=");
1210 msg.append(groupId);
1211
1212 msg.append(StringPool.CLOSE_CURLY_BRACE);
1213
1214 throw new NoSuchFolderException(msg.toString());
1215 }
1216 else {
1217 return list.get(0);
1218 }
1219 }
1220
1221
1234 public DLFolder findByGroupId_Last(long groupId,
1235 OrderByComparator orderByComparator)
1236 throws NoSuchFolderException, SystemException {
1237 int count = countByGroupId(groupId);
1238
1239 List<DLFolder> list = findByGroupId(groupId, count - 1, count,
1240 orderByComparator);
1241
1242 if (list.isEmpty()) {
1243 StringBundler msg = new StringBundler(4);
1244
1245 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1246
1247 msg.append("groupId=");
1248 msg.append(groupId);
1249
1250 msg.append(StringPool.CLOSE_CURLY_BRACE);
1251
1252 throw new NoSuchFolderException(msg.toString());
1253 }
1254 else {
1255 return list.get(0);
1256 }
1257 }
1258
1259
1273 public DLFolder[] findByGroupId_PrevAndNext(long folderId, long groupId,
1274 OrderByComparator orderByComparator)
1275 throws NoSuchFolderException, SystemException {
1276 DLFolder dlFolder = findByPrimaryKey(folderId);
1277
1278 Session session = null;
1279
1280 try {
1281 session = openSession();
1282
1283 DLFolder[] array = new DLFolderImpl[3];
1284
1285 array[0] = getByGroupId_PrevAndNext(session, dlFolder, groupId,
1286 orderByComparator, true);
1287
1288 array[1] = dlFolder;
1289
1290 array[2] = getByGroupId_PrevAndNext(session, dlFolder, groupId,
1291 orderByComparator, false);
1292
1293 return array;
1294 }
1295 catch (Exception e) {
1296 throw processException(e);
1297 }
1298 finally {
1299 closeSession(session);
1300 }
1301 }
1302
1303 protected DLFolder getByGroupId_PrevAndNext(Session session,
1304 DLFolder dlFolder, long groupId, OrderByComparator orderByComparator,
1305 boolean previous) {
1306 StringBundler query = null;
1307
1308 if (orderByComparator != null) {
1309 query = new StringBundler(6 +
1310 (orderByComparator.getOrderByFields().length * 6));
1311 }
1312 else {
1313 query = new StringBundler(3);
1314 }
1315
1316 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1317
1318 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1319
1320 if (orderByComparator != null) {
1321 String[] orderByFields = orderByComparator.getOrderByFields();
1322
1323 if (orderByFields.length > 0) {
1324 query.append(WHERE_AND);
1325 }
1326
1327 for (int i = 0; i < orderByFields.length; i++) {
1328 query.append(_ORDER_BY_ENTITY_ALIAS);
1329 query.append(orderByFields[i]);
1330
1331 if ((i + 1) < orderByFields.length) {
1332 if (orderByComparator.isAscending() ^ previous) {
1333 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1334 }
1335 else {
1336 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1337 }
1338 }
1339 else {
1340 if (orderByComparator.isAscending() ^ previous) {
1341 query.append(WHERE_GREATER_THAN);
1342 }
1343 else {
1344 query.append(WHERE_LESSER_THAN);
1345 }
1346 }
1347 }
1348
1349 query.append(ORDER_BY_CLAUSE);
1350
1351 for (int i = 0; i < orderByFields.length; i++) {
1352 query.append(_ORDER_BY_ENTITY_ALIAS);
1353 query.append(orderByFields[i]);
1354
1355 if ((i + 1) < orderByFields.length) {
1356 if (orderByComparator.isAscending() ^ previous) {
1357 query.append(ORDER_BY_ASC_HAS_NEXT);
1358 }
1359 else {
1360 query.append(ORDER_BY_DESC_HAS_NEXT);
1361 }
1362 }
1363 else {
1364 if (orderByComparator.isAscending() ^ previous) {
1365 query.append(ORDER_BY_ASC);
1366 }
1367 else {
1368 query.append(ORDER_BY_DESC);
1369 }
1370 }
1371 }
1372 }
1373
1374 else {
1375 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1376 }
1377
1378 String sql = query.toString();
1379
1380 Query q = session.createQuery(sql);
1381
1382 q.setFirstResult(0);
1383 q.setMaxResults(2);
1384
1385 QueryPos qPos = QueryPos.getInstance(q);
1386
1387 qPos.add(groupId);
1388
1389 if (orderByComparator != null) {
1390 Object[] values = orderByComparator.getOrderByValues(dlFolder);
1391
1392 for (Object value : values) {
1393 qPos.add(value);
1394 }
1395 }
1396
1397 List<DLFolder> list = q.list();
1398
1399 if (list.size() == 2) {
1400 return list.get(1);
1401 }
1402 else {
1403 return null;
1404 }
1405 }
1406
1407
1414 public List<DLFolder> filterFindByGroupId(long groupId)
1415 throws SystemException {
1416 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1417 QueryUtil.ALL_POS, null);
1418 }
1419
1420
1433 public List<DLFolder> filterFindByGroupId(long groupId, int start, int end)
1434 throws SystemException {
1435 return filterFindByGroupId(groupId, start, end, null);
1436 }
1437
1438
1452 public List<DLFolder> filterFindByGroupId(long groupId, int start, int end,
1453 OrderByComparator orderByComparator) throws SystemException {
1454 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1455 return findByGroupId(groupId, start, end, orderByComparator);
1456 }
1457
1458 Session session = null;
1459
1460 try {
1461 session = openSession();
1462
1463 StringBundler query = null;
1464
1465 if (orderByComparator != null) {
1466 query = new StringBundler(3 +
1467 (orderByComparator.getOrderByFields().length * 3));
1468 }
1469 else {
1470 query = new StringBundler(3);
1471 }
1472
1473 if (getDB().isSupportsInlineDistinct()) {
1474 query.append(_FILTER_SQL_SELECT_DLFOLDER_WHERE);
1475 }
1476 else {
1477 query.append(_FILTER_SQL_SELECT_DLFOLDER_NO_INLINE_DISTINCT_WHERE);
1478 }
1479
1480 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1481
1482 if (orderByComparator != null) {
1483 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1484 orderByComparator);
1485 }
1486
1487 else {
1488 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1489 }
1490
1491 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1492 DLFolder.class.getName(), _FILTER_COLUMN_PK,
1493 _FILTER_COLUMN_USERID, groupId);
1494
1495 SQLQuery q = session.createSQLQuery(sql);
1496
1497 q.addEntity(_FILTER_ENTITY_ALIAS, DLFolderImpl.class);
1498
1499 QueryPos qPos = QueryPos.getInstance(q);
1500
1501 qPos.add(groupId);
1502
1503 return (List<DLFolder>)QueryUtil.list(q, getDialect(), start, end);
1504 }
1505 catch (Exception e) {
1506 throw processException(e);
1507 }
1508 finally {
1509 closeSession(session);
1510 }
1511 }
1512
1513
1520 public List<DLFolder> findByCompanyId(long companyId)
1521 throws SystemException {
1522 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1523 null);
1524 }
1525
1526
1539 public List<DLFolder> findByCompanyId(long companyId, int start, int end)
1540 throws SystemException {
1541 return findByCompanyId(companyId, start, end, null);
1542 }
1543
1544
1558 public List<DLFolder> findByCompanyId(long companyId, int start, int end,
1559 OrderByComparator orderByComparator) throws SystemException {
1560 Object[] finderArgs = new Object[] {
1561 companyId,
1562
1563 String.valueOf(start), String.valueOf(end),
1564 String.valueOf(orderByComparator)
1565 };
1566
1567 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1568 finderArgs, this);
1569
1570 if (list == null) {
1571 Session session = null;
1572
1573 try {
1574 session = openSession();
1575
1576 StringBundler query = null;
1577
1578 if (orderByComparator != null) {
1579 query = new StringBundler(3 +
1580 (orderByComparator.getOrderByFields().length * 3));
1581 }
1582 else {
1583 query = new StringBundler(3);
1584 }
1585
1586 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1587
1588 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1589
1590 if (orderByComparator != null) {
1591 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1592 orderByComparator);
1593 }
1594
1595 else {
1596 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1597 }
1598
1599 String sql = query.toString();
1600
1601 Query q = session.createQuery(sql);
1602
1603 QueryPos qPos = QueryPos.getInstance(q);
1604
1605 qPos.add(companyId);
1606
1607 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1608 end);
1609 }
1610 catch (Exception e) {
1611 throw processException(e);
1612 }
1613 finally {
1614 if (list == null) {
1615 list = new ArrayList<DLFolder>();
1616 }
1617
1618 cacheResult(list);
1619
1620 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1621 finderArgs, list);
1622
1623 closeSession(session);
1624 }
1625 }
1626
1627 return list;
1628 }
1629
1630
1643 public DLFolder findByCompanyId_First(long companyId,
1644 OrderByComparator orderByComparator)
1645 throws NoSuchFolderException, SystemException {
1646 List<DLFolder> list = findByCompanyId(companyId, 0, 1, orderByComparator);
1647
1648 if (list.isEmpty()) {
1649 StringBundler msg = new StringBundler(4);
1650
1651 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1652
1653 msg.append("companyId=");
1654 msg.append(companyId);
1655
1656 msg.append(StringPool.CLOSE_CURLY_BRACE);
1657
1658 throw new NoSuchFolderException(msg.toString());
1659 }
1660 else {
1661 return list.get(0);
1662 }
1663 }
1664
1665
1678 public DLFolder findByCompanyId_Last(long companyId,
1679 OrderByComparator orderByComparator)
1680 throws NoSuchFolderException, SystemException {
1681 int count = countByCompanyId(companyId);
1682
1683 List<DLFolder> list = findByCompanyId(companyId, count - 1, count,
1684 orderByComparator);
1685
1686 if (list.isEmpty()) {
1687 StringBundler msg = new StringBundler(4);
1688
1689 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1690
1691 msg.append("companyId=");
1692 msg.append(companyId);
1693
1694 msg.append(StringPool.CLOSE_CURLY_BRACE);
1695
1696 throw new NoSuchFolderException(msg.toString());
1697 }
1698 else {
1699 return list.get(0);
1700 }
1701 }
1702
1703
1717 public DLFolder[] findByCompanyId_PrevAndNext(long folderId,
1718 long companyId, OrderByComparator orderByComparator)
1719 throws NoSuchFolderException, SystemException {
1720 DLFolder dlFolder = findByPrimaryKey(folderId);
1721
1722 Session session = null;
1723
1724 try {
1725 session = openSession();
1726
1727 DLFolder[] array = new DLFolderImpl[3];
1728
1729 array[0] = getByCompanyId_PrevAndNext(session, dlFolder, companyId,
1730 orderByComparator, true);
1731
1732 array[1] = dlFolder;
1733
1734 array[2] = getByCompanyId_PrevAndNext(session, dlFolder, companyId,
1735 orderByComparator, false);
1736
1737 return array;
1738 }
1739 catch (Exception e) {
1740 throw processException(e);
1741 }
1742 finally {
1743 closeSession(session);
1744 }
1745 }
1746
1747 protected DLFolder getByCompanyId_PrevAndNext(Session session,
1748 DLFolder dlFolder, long companyId, OrderByComparator orderByComparator,
1749 boolean previous) {
1750 StringBundler query = null;
1751
1752 if (orderByComparator != null) {
1753 query = new StringBundler(6 +
1754 (orderByComparator.getOrderByFields().length * 6));
1755 }
1756 else {
1757 query = new StringBundler(3);
1758 }
1759
1760 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1761
1762 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1763
1764 if (orderByComparator != null) {
1765 String[] orderByFields = orderByComparator.getOrderByFields();
1766
1767 if (orderByFields.length > 0) {
1768 query.append(WHERE_AND);
1769 }
1770
1771 for (int i = 0; i < orderByFields.length; i++) {
1772 query.append(_ORDER_BY_ENTITY_ALIAS);
1773 query.append(orderByFields[i]);
1774
1775 if ((i + 1) < orderByFields.length) {
1776 if (orderByComparator.isAscending() ^ previous) {
1777 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1778 }
1779 else {
1780 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1781 }
1782 }
1783 else {
1784 if (orderByComparator.isAscending() ^ previous) {
1785 query.append(WHERE_GREATER_THAN);
1786 }
1787 else {
1788 query.append(WHERE_LESSER_THAN);
1789 }
1790 }
1791 }
1792
1793 query.append(ORDER_BY_CLAUSE);
1794
1795 for (int i = 0; i < orderByFields.length; i++) {
1796 query.append(_ORDER_BY_ENTITY_ALIAS);
1797 query.append(orderByFields[i]);
1798
1799 if ((i + 1) < orderByFields.length) {
1800 if (orderByComparator.isAscending() ^ previous) {
1801 query.append(ORDER_BY_ASC_HAS_NEXT);
1802 }
1803 else {
1804 query.append(ORDER_BY_DESC_HAS_NEXT);
1805 }
1806 }
1807 else {
1808 if (orderByComparator.isAscending() ^ previous) {
1809 query.append(ORDER_BY_ASC);
1810 }
1811 else {
1812 query.append(ORDER_BY_DESC);
1813 }
1814 }
1815 }
1816 }
1817
1818 else {
1819 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1820 }
1821
1822 String sql = query.toString();
1823
1824 Query q = session.createQuery(sql);
1825
1826 q.setFirstResult(0);
1827 q.setMaxResults(2);
1828
1829 QueryPos qPos = QueryPos.getInstance(q);
1830
1831 qPos.add(companyId);
1832
1833 if (orderByComparator != null) {
1834 Object[] values = orderByComparator.getOrderByValues(dlFolder);
1835
1836 for (Object value : values) {
1837 qPos.add(value);
1838 }
1839 }
1840
1841 List<DLFolder> list = q.list();
1842
1843 if (list.size() == 2) {
1844 return list.get(1);
1845 }
1846 else {
1847 return null;
1848 }
1849 }
1850
1851
1859 public List<DLFolder> findByG_P(long groupId, long parentFolderId)
1860 throws SystemException {
1861 return findByG_P(groupId, parentFolderId, QueryUtil.ALL_POS,
1862 QueryUtil.ALL_POS, null);
1863 }
1864
1865
1879 public List<DLFolder> findByG_P(long groupId, long parentFolderId,
1880 int start, int end) throws SystemException {
1881 return findByG_P(groupId, parentFolderId, start, end, null);
1882 }
1883
1884
1899 public List<DLFolder> findByG_P(long groupId, long parentFolderId,
1900 int start, int end, OrderByComparator orderByComparator)
1901 throws SystemException {
1902 Object[] finderArgs = new Object[] {
1903 groupId, parentFolderId,
1904
1905 String.valueOf(start), String.valueOf(end),
1906 String.valueOf(orderByComparator)
1907 };
1908
1909 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_P,
1910 finderArgs, this);
1911
1912 if (list == null) {
1913 Session session = null;
1914
1915 try {
1916 session = openSession();
1917
1918 StringBundler query = null;
1919
1920 if (orderByComparator != null) {
1921 query = new StringBundler(4 +
1922 (orderByComparator.getOrderByFields().length * 3));
1923 }
1924 else {
1925 query = new StringBundler(4);
1926 }
1927
1928 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1929
1930 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1931
1932 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
1933
1934 if (orderByComparator != null) {
1935 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1936 orderByComparator);
1937 }
1938
1939 else {
1940 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1941 }
1942
1943 String sql = query.toString();
1944
1945 Query q = session.createQuery(sql);
1946
1947 QueryPos qPos = QueryPos.getInstance(q);
1948
1949 qPos.add(groupId);
1950
1951 qPos.add(parentFolderId);
1952
1953 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1954 end);
1955 }
1956 catch (Exception e) {
1957 throw processException(e);
1958 }
1959 finally {
1960 if (list == null) {
1961 list = new ArrayList<DLFolder>();
1962 }
1963
1964 cacheResult(list);
1965
1966 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_P, finderArgs,
1967 list);
1968
1969 closeSession(session);
1970 }
1971 }
1972
1973 return list;
1974 }
1975
1976
1990 public DLFolder findByG_P_First(long groupId, long parentFolderId,
1991 OrderByComparator orderByComparator)
1992 throws NoSuchFolderException, SystemException {
1993 List<DLFolder> list = findByG_P(groupId, parentFolderId, 0, 1,
1994 orderByComparator);
1995
1996 if (list.isEmpty()) {
1997 StringBundler msg = new StringBundler(6);
1998
1999 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2000
2001 msg.append("groupId=");
2002 msg.append(groupId);
2003
2004 msg.append(", parentFolderId=");
2005 msg.append(parentFolderId);
2006
2007 msg.append(StringPool.CLOSE_CURLY_BRACE);
2008
2009 throw new NoSuchFolderException(msg.toString());
2010 }
2011 else {
2012 return list.get(0);
2013 }
2014 }
2015
2016
2030 public DLFolder findByG_P_Last(long groupId, long parentFolderId,
2031 OrderByComparator orderByComparator)
2032 throws NoSuchFolderException, SystemException {
2033 int count = countByG_P(groupId, parentFolderId);
2034
2035 List<DLFolder> list = findByG_P(groupId, parentFolderId, count - 1,
2036 count, orderByComparator);
2037
2038 if (list.isEmpty()) {
2039 StringBundler msg = new StringBundler(6);
2040
2041 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2042
2043 msg.append("groupId=");
2044 msg.append(groupId);
2045
2046 msg.append(", parentFolderId=");
2047 msg.append(parentFolderId);
2048
2049 msg.append(StringPool.CLOSE_CURLY_BRACE);
2050
2051 throw new NoSuchFolderException(msg.toString());
2052 }
2053 else {
2054 return list.get(0);
2055 }
2056 }
2057
2058
2073 public DLFolder[] findByG_P_PrevAndNext(long folderId, long groupId,
2074 long parentFolderId, OrderByComparator orderByComparator)
2075 throws NoSuchFolderException, SystemException {
2076 DLFolder dlFolder = findByPrimaryKey(folderId);
2077
2078 Session session = null;
2079
2080 try {
2081 session = openSession();
2082
2083 DLFolder[] array = new DLFolderImpl[3];
2084
2085 array[0] = getByG_P_PrevAndNext(session, dlFolder, groupId,
2086 parentFolderId, orderByComparator, true);
2087
2088 array[1] = dlFolder;
2089
2090 array[2] = getByG_P_PrevAndNext(session, dlFolder, groupId,
2091 parentFolderId, orderByComparator, false);
2092
2093 return array;
2094 }
2095 catch (Exception e) {
2096 throw processException(e);
2097 }
2098 finally {
2099 closeSession(session);
2100 }
2101 }
2102
2103 protected DLFolder getByG_P_PrevAndNext(Session session, DLFolder dlFolder,
2104 long groupId, long parentFolderId, OrderByComparator orderByComparator,
2105 boolean previous) {
2106 StringBundler query = null;
2107
2108 if (orderByComparator != null) {
2109 query = new StringBundler(6 +
2110 (orderByComparator.getOrderByFields().length * 6));
2111 }
2112 else {
2113 query = new StringBundler(3);
2114 }
2115
2116 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2117
2118 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
2119
2120 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
2121
2122 if (orderByComparator != null) {
2123 String[] orderByFields = orderByComparator.getOrderByFields();
2124
2125 if (orderByFields.length > 0) {
2126 query.append(WHERE_AND);
2127 }
2128
2129 for (int i = 0; i < orderByFields.length; i++) {
2130 query.append(_ORDER_BY_ENTITY_ALIAS);
2131 query.append(orderByFields[i]);
2132
2133 if ((i + 1) < orderByFields.length) {
2134 if (orderByComparator.isAscending() ^ previous) {
2135 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2136 }
2137 else {
2138 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2139 }
2140 }
2141 else {
2142 if (orderByComparator.isAscending() ^ previous) {
2143 query.append(WHERE_GREATER_THAN);
2144 }
2145 else {
2146 query.append(WHERE_LESSER_THAN);
2147 }
2148 }
2149 }
2150
2151 query.append(ORDER_BY_CLAUSE);
2152
2153 for (int i = 0; i < orderByFields.length; i++) {
2154 query.append(_ORDER_BY_ENTITY_ALIAS);
2155 query.append(orderByFields[i]);
2156
2157 if ((i + 1) < orderByFields.length) {
2158 if (orderByComparator.isAscending() ^ previous) {
2159 query.append(ORDER_BY_ASC_HAS_NEXT);
2160 }
2161 else {
2162 query.append(ORDER_BY_DESC_HAS_NEXT);
2163 }
2164 }
2165 else {
2166 if (orderByComparator.isAscending() ^ previous) {
2167 query.append(ORDER_BY_ASC);
2168 }
2169 else {
2170 query.append(ORDER_BY_DESC);
2171 }
2172 }
2173 }
2174 }
2175
2176 else {
2177 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2178 }
2179
2180 String sql = query.toString();
2181
2182 Query q = session.createQuery(sql);
2183
2184 q.setFirstResult(0);
2185 q.setMaxResults(2);
2186
2187 QueryPos qPos = QueryPos.getInstance(q);
2188
2189 qPos.add(groupId);
2190
2191 qPos.add(parentFolderId);
2192
2193 if (orderByComparator != null) {
2194 Object[] values = orderByComparator.getOrderByValues(dlFolder);
2195
2196 for (Object value : values) {
2197 qPos.add(value);
2198 }
2199 }
2200
2201 List<DLFolder> list = q.list();
2202
2203 if (list.size() == 2) {
2204 return list.get(1);
2205 }
2206 else {
2207 return null;
2208 }
2209 }
2210
2211
2219 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId)
2220 throws SystemException {
2221 return filterFindByG_P(groupId, parentFolderId, QueryUtil.ALL_POS,
2222 QueryUtil.ALL_POS, null);
2223 }
2224
2225
2239 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId,
2240 int start, int end) throws SystemException {
2241 return filterFindByG_P(groupId, parentFolderId, start, end, null);
2242 }
2243
2244
2259 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId,
2260 int start, int end, OrderByComparator orderByComparator)
2261 throws SystemException {
2262 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2263 return findByG_P(groupId, parentFolderId, start, end,
2264 orderByComparator);
2265 }
2266
2267 Session session = null;
2268
2269 try {
2270 session = openSession();
2271
2272 StringBundler query = null;
2273
2274 if (orderByComparator != null) {
2275 query = new StringBundler(4 +
2276 (orderByComparator.getOrderByFields().length * 3));
2277 }
2278 else {
2279 query = new StringBundler(4);
2280 }
2281
2282 if (getDB().isSupportsInlineDistinct()) {
2283 query.append(_FILTER_SQL_SELECT_DLFOLDER_WHERE);
2284 }
2285 else {
2286 query.append(_FILTER_SQL_SELECT_DLFOLDER_NO_INLINE_DISTINCT_WHERE);
2287 }
2288
2289 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
2290
2291 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
2292
2293 if (orderByComparator != null) {
2294 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2295 orderByComparator);
2296 }
2297
2298 else {
2299 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2300 }
2301
2302 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2303 DLFolder.class.getName(), _FILTER_COLUMN_PK,
2304 _FILTER_COLUMN_USERID, groupId);
2305
2306 SQLQuery q = session.createSQLQuery(sql);
2307
2308 q.addEntity(_FILTER_ENTITY_ALIAS, DLFolderImpl.class);
2309
2310 QueryPos qPos = QueryPos.getInstance(q);
2311
2312 qPos.add(groupId);
2313
2314 qPos.add(parentFolderId);
2315
2316 return (List<DLFolder>)QueryUtil.list(q, getDialect(), start, end);
2317 }
2318 catch (Exception e) {
2319 throw processException(e);
2320 }
2321 finally {
2322 closeSession(session);
2323 }
2324 }
2325
2326
2334 public List<DLFolder> findByP_N(long parentFolderId, String name)
2335 throws SystemException {
2336 return findByP_N(parentFolderId, name, QueryUtil.ALL_POS,
2337 QueryUtil.ALL_POS, null);
2338 }
2339
2340
2354 public List<DLFolder> findByP_N(long parentFolderId, String name,
2355 int start, int end) throws SystemException {
2356 return findByP_N(parentFolderId, name, start, end, null);
2357 }
2358
2359
2374 public List<DLFolder> findByP_N(long parentFolderId, String name,
2375 int start, int end, OrderByComparator orderByComparator)
2376 throws SystemException {
2377 Object[] finderArgs = new Object[] {
2378 parentFolderId, name,
2379
2380 String.valueOf(start), String.valueOf(end),
2381 String.valueOf(orderByComparator)
2382 };
2383
2384 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_P_N,
2385 finderArgs, this);
2386
2387 if (list == null) {
2388 Session session = null;
2389
2390 try {
2391 session = openSession();
2392
2393 StringBundler query = null;
2394
2395 if (orderByComparator != null) {
2396 query = new StringBundler(4 +
2397 (orderByComparator.getOrderByFields().length * 3));
2398 }
2399 else {
2400 query = new StringBundler(4);
2401 }
2402
2403 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2404
2405 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
2406
2407 if (name == null) {
2408 query.append(_FINDER_COLUMN_P_N_NAME_1);
2409 }
2410 else {
2411 if (name.equals(StringPool.BLANK)) {
2412 query.append(_FINDER_COLUMN_P_N_NAME_3);
2413 }
2414 else {
2415 query.append(_FINDER_COLUMN_P_N_NAME_2);
2416 }
2417 }
2418
2419 if (orderByComparator != null) {
2420 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2421 orderByComparator);
2422 }
2423
2424 else {
2425 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2426 }
2427
2428 String sql = query.toString();
2429
2430 Query q = session.createQuery(sql);
2431
2432 QueryPos qPos = QueryPos.getInstance(q);
2433
2434 qPos.add(parentFolderId);
2435
2436 if (name != null) {
2437 qPos.add(name);
2438 }
2439
2440 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
2441 end);
2442 }
2443 catch (Exception e) {
2444 throw processException(e);
2445 }
2446 finally {
2447 if (list == null) {
2448 list = new ArrayList<DLFolder>();
2449 }
2450
2451 cacheResult(list);
2452
2453 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_P_N, finderArgs,
2454 list);
2455
2456 closeSession(session);
2457 }
2458 }
2459
2460 return list;
2461 }
2462
2463
2477 public DLFolder findByP_N_First(long parentFolderId, String name,
2478 OrderByComparator orderByComparator)
2479 throws NoSuchFolderException, SystemException {
2480 List<DLFolder> list = findByP_N(parentFolderId, name, 0, 1,
2481 orderByComparator);
2482
2483 if (list.isEmpty()) {
2484 StringBundler msg = new StringBundler(6);
2485
2486 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2487
2488 msg.append("parentFolderId=");
2489 msg.append(parentFolderId);
2490
2491 msg.append(", name=");
2492 msg.append(name);
2493
2494 msg.append(StringPool.CLOSE_CURLY_BRACE);
2495
2496 throw new NoSuchFolderException(msg.toString());
2497 }
2498 else {
2499 return list.get(0);
2500 }
2501 }
2502
2503
2517 public DLFolder findByP_N_Last(long parentFolderId, String name,
2518 OrderByComparator orderByComparator)
2519 throws NoSuchFolderException, SystemException {
2520 int count = countByP_N(parentFolderId, name);
2521
2522 List<DLFolder> list = findByP_N(parentFolderId, name, count - 1, count,
2523 orderByComparator);
2524
2525 if (list.isEmpty()) {
2526 StringBundler msg = new StringBundler(6);
2527
2528 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2529
2530 msg.append("parentFolderId=");
2531 msg.append(parentFolderId);
2532
2533 msg.append(", name=");
2534 msg.append(name);
2535
2536 msg.append(StringPool.CLOSE_CURLY_BRACE);
2537
2538 throw new NoSuchFolderException(msg.toString());
2539 }
2540 else {
2541 return list.get(0);
2542 }
2543 }
2544
2545
2560 public DLFolder[] findByP_N_PrevAndNext(long folderId, long parentFolderId,
2561 String name, OrderByComparator orderByComparator)
2562 throws NoSuchFolderException, SystemException {
2563 DLFolder dlFolder = findByPrimaryKey(folderId);
2564
2565 Session session = null;
2566
2567 try {
2568 session = openSession();
2569
2570 DLFolder[] array = new DLFolderImpl[3];
2571
2572 array[0] = getByP_N_PrevAndNext(session, dlFolder, parentFolderId,
2573 name, orderByComparator, true);
2574
2575 array[1] = dlFolder;
2576
2577 array[2] = getByP_N_PrevAndNext(session, dlFolder, parentFolderId,
2578 name, orderByComparator, false);
2579
2580 return array;
2581 }
2582 catch (Exception e) {
2583 throw processException(e);
2584 }
2585 finally {
2586 closeSession(session);
2587 }
2588 }
2589
2590 protected DLFolder getByP_N_PrevAndNext(Session session, DLFolder dlFolder,
2591 long parentFolderId, String name, OrderByComparator orderByComparator,
2592 boolean previous) {
2593 StringBundler query = null;
2594
2595 if (orderByComparator != null) {
2596 query = new StringBundler(6 +
2597 (orderByComparator.getOrderByFields().length * 6));
2598 }
2599 else {
2600 query = new StringBundler(3);
2601 }
2602
2603 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2604
2605 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
2606
2607 if (name == null) {
2608 query.append(_FINDER_COLUMN_P_N_NAME_1);
2609 }
2610 else {
2611 if (name.equals(StringPool.BLANK)) {
2612 query.append(_FINDER_COLUMN_P_N_NAME_3);
2613 }
2614 else {
2615 query.append(_FINDER_COLUMN_P_N_NAME_2);
2616 }
2617 }
2618
2619 if (orderByComparator != null) {
2620 String[] orderByFields = orderByComparator.getOrderByFields();
2621
2622 if (orderByFields.length > 0) {
2623 query.append(WHERE_AND);
2624 }
2625
2626 for (int i = 0; i < orderByFields.length; i++) {
2627 query.append(_ORDER_BY_ENTITY_ALIAS);
2628 query.append(orderByFields[i]);
2629
2630 if ((i + 1) < orderByFields.length) {
2631 if (orderByComparator.isAscending() ^ previous) {
2632 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2633 }
2634 else {
2635 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2636 }
2637 }
2638 else {
2639 if (orderByComparator.isAscending() ^ previous) {
2640 query.append(WHERE_GREATER_THAN);
2641 }
2642 else {
2643 query.append(WHERE_LESSER_THAN);
2644 }
2645 }
2646 }
2647
2648 query.append(ORDER_BY_CLAUSE);
2649
2650 for (int i = 0; i < orderByFields.length; i++) {
2651 query.append(_ORDER_BY_ENTITY_ALIAS);
2652 query.append(orderByFields[i]);
2653
2654 if ((i + 1) < orderByFields.length) {
2655 if (orderByComparator.isAscending() ^ previous) {
2656 query.append(ORDER_BY_ASC_HAS_NEXT);
2657 }
2658 else {
2659 query.append(ORDER_BY_DESC_HAS_NEXT);
2660 }
2661 }
2662 else {
2663 if (orderByComparator.isAscending() ^ previous) {
2664 query.append(ORDER_BY_ASC);
2665 }
2666 else {
2667 query.append(ORDER_BY_DESC);
2668 }
2669 }
2670 }
2671 }
2672
2673 else {
2674 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2675 }
2676
2677 String sql = query.toString();
2678
2679 Query q = session.createQuery(sql);
2680
2681 q.setFirstResult(0);
2682 q.setMaxResults(2);
2683
2684 QueryPos qPos = QueryPos.getInstance(q);
2685
2686 qPos.add(parentFolderId);
2687
2688 if (name != null) {
2689 qPos.add(name);
2690 }
2691
2692 if (orderByComparator != null) {
2693 Object[] values = orderByComparator.getOrderByValues(dlFolder);
2694
2695 for (Object value : values) {
2696 qPos.add(value);
2697 }
2698 }
2699
2700 List<DLFolder> list = q.list();
2701
2702 if (list.size() == 2) {
2703 return list.get(1);
2704 }
2705 else {
2706 return null;
2707 }
2708 }
2709
2710
2720 public DLFolder findByG_P_N(long groupId, long parentFolderId, String name)
2721 throws NoSuchFolderException, SystemException {
2722 DLFolder dlFolder = fetchByG_P_N(groupId, parentFolderId, name);
2723
2724 if (dlFolder == null) {
2725 StringBundler msg = new StringBundler(8);
2726
2727 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2728
2729 msg.append("groupId=");
2730 msg.append(groupId);
2731
2732 msg.append(", parentFolderId=");
2733 msg.append(parentFolderId);
2734
2735 msg.append(", name=");
2736 msg.append(name);
2737
2738 msg.append(StringPool.CLOSE_CURLY_BRACE);
2739
2740 if (_log.isWarnEnabled()) {
2741 _log.warn(msg.toString());
2742 }
2743
2744 throw new NoSuchFolderException(msg.toString());
2745 }
2746
2747 return dlFolder;
2748 }
2749
2750
2759 public DLFolder fetchByG_P_N(long groupId, long parentFolderId, String name)
2760 throws SystemException {
2761 return fetchByG_P_N(groupId, parentFolderId, name, true);
2762 }
2763
2764
2773 public DLFolder fetchByG_P_N(long groupId, long parentFolderId,
2774 String name, boolean retrieveFromCache) throws SystemException {
2775 Object[] finderArgs = new Object[] { groupId, parentFolderId, name };
2776
2777 Object result = null;
2778
2779 if (retrieveFromCache) {
2780 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_P_N,
2781 finderArgs, this);
2782 }
2783
2784 if (result == null) {
2785 Session session = null;
2786
2787 try {
2788 session = openSession();
2789
2790 StringBundler query = new StringBundler(5);
2791
2792 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2793
2794 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
2795
2796 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
2797
2798 if (name == null) {
2799 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
2800 }
2801 else {
2802 if (name.equals(StringPool.BLANK)) {
2803 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
2804 }
2805 else {
2806 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
2807 }
2808 }
2809
2810 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2811
2812 String sql = query.toString();
2813
2814 Query q = session.createQuery(sql);
2815
2816 QueryPos qPos = QueryPos.getInstance(q);
2817
2818 qPos.add(groupId);
2819
2820 qPos.add(parentFolderId);
2821
2822 if (name != null) {
2823 qPos.add(name);
2824 }
2825
2826 List<DLFolder> list = q.list();
2827
2828 result = list;
2829
2830 DLFolder dlFolder = null;
2831
2832 if (list.isEmpty()) {
2833 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2834 finderArgs, list);
2835 }
2836 else {
2837 dlFolder = list.get(0);
2838
2839 cacheResult(dlFolder);
2840
2841 if ((dlFolder.getGroupId() != groupId) ||
2842 (dlFolder.getParentFolderId() != parentFolderId) ||
2843 (dlFolder.getName() == null) ||
2844 !dlFolder.getName().equals(name)) {
2845 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2846 finderArgs, dlFolder);
2847 }
2848 }
2849
2850 return dlFolder;
2851 }
2852 catch (Exception e) {
2853 throw processException(e);
2854 }
2855 finally {
2856 if (result == null) {
2857 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2858 finderArgs, new ArrayList<DLFolder>());
2859 }
2860
2861 closeSession(session);
2862 }
2863 }
2864 else {
2865 if (result instanceof List<?>) {
2866 return null;
2867 }
2868 else {
2869 return (DLFolder)result;
2870 }
2871 }
2872 }
2873
2874
2880 public List<DLFolder> findAll() throws SystemException {
2881 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2882 }
2883
2884
2896 public List<DLFolder> findAll(int start, int end) throws SystemException {
2897 return findAll(start, end, null);
2898 }
2899
2900
2913 public List<DLFolder> findAll(int start, int end,
2914 OrderByComparator orderByComparator) throws SystemException {
2915 Object[] finderArgs = new Object[] {
2916 String.valueOf(start), String.valueOf(end),
2917 String.valueOf(orderByComparator)
2918 };
2919
2920 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2921 finderArgs, this);
2922
2923 if (list == null) {
2924 Session session = null;
2925
2926 try {
2927 session = openSession();
2928
2929 StringBundler query = null;
2930 String sql = null;
2931
2932 if (orderByComparator != null) {
2933 query = new StringBundler(2 +
2934 (orderByComparator.getOrderByFields().length * 3));
2935
2936 query.append(_SQL_SELECT_DLFOLDER);
2937
2938 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2939 orderByComparator);
2940
2941 sql = query.toString();
2942 }
2943 else {
2944 sql = _SQL_SELECT_DLFOLDER.concat(DLFolderModelImpl.ORDER_BY_JPQL);
2945 }
2946
2947 Query q = session.createQuery(sql);
2948
2949 if (orderByComparator == null) {
2950 list = (List<DLFolder>)QueryUtil.list(q, getDialect(),
2951 start, end, false);
2952
2953 Collections.sort(list);
2954 }
2955 else {
2956 list = (List<DLFolder>)QueryUtil.list(q, getDialect(),
2957 start, end);
2958 }
2959 }
2960 catch (Exception e) {
2961 throw processException(e);
2962 }
2963 finally {
2964 if (list == null) {
2965 list = new ArrayList<DLFolder>();
2966 }
2967
2968 cacheResult(list);
2969
2970 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2971
2972 closeSession(session);
2973 }
2974 }
2975
2976 return list;
2977 }
2978
2979
2985 public void removeByUuid(String uuid) throws SystemException {
2986 for (DLFolder dlFolder : findByUuid(uuid)) {
2987 remove(dlFolder);
2988 }
2989 }
2990
2991
2998 public void removeByUUID_G(String uuid, long groupId)
2999 throws NoSuchFolderException, SystemException {
3000 DLFolder dlFolder = findByUUID_G(uuid, groupId);
3001
3002 remove(dlFolder);
3003 }
3004
3005
3011 public void removeByGroupId(long groupId) throws SystemException {
3012 for (DLFolder dlFolder : findByGroupId(groupId)) {
3013 remove(dlFolder);
3014 }
3015 }
3016
3017
3023 public void removeByCompanyId(long companyId) throws SystemException {
3024 for (DLFolder dlFolder : findByCompanyId(companyId)) {
3025 remove(dlFolder);
3026 }
3027 }
3028
3029
3036 public void removeByG_P(long groupId, long parentFolderId)
3037 throws SystemException {
3038 for (DLFolder dlFolder : findByG_P(groupId, parentFolderId)) {
3039 remove(dlFolder);
3040 }
3041 }
3042
3043
3050 public void removeByP_N(long parentFolderId, String name)
3051 throws SystemException {
3052 for (DLFolder dlFolder : findByP_N(parentFolderId, name)) {
3053 remove(dlFolder);
3054 }
3055 }
3056
3057
3065 public void removeByG_P_N(long groupId, long parentFolderId, String name)
3066 throws NoSuchFolderException, SystemException {
3067 DLFolder dlFolder = findByG_P_N(groupId, parentFolderId, name);
3068
3069 remove(dlFolder);
3070 }
3071
3072
3077 public void removeAll() throws SystemException {
3078 for (DLFolder dlFolder : findAll()) {
3079 remove(dlFolder);
3080 }
3081 }
3082
3083
3090 public int countByUuid(String uuid) throws SystemException {
3091 Object[] finderArgs = new Object[] { uuid };
3092
3093 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
3094 finderArgs, this);
3095
3096 if (count == null) {
3097 Session session = null;
3098
3099 try {
3100 session = openSession();
3101
3102 StringBundler query = new StringBundler(2);
3103
3104 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3105
3106 if (uuid == null) {
3107 query.append(_FINDER_COLUMN_UUID_UUID_1);
3108 }
3109 else {
3110 if (uuid.equals(StringPool.BLANK)) {
3111 query.append(_FINDER_COLUMN_UUID_UUID_3);
3112 }
3113 else {
3114 query.append(_FINDER_COLUMN_UUID_UUID_2);
3115 }
3116 }
3117
3118 String sql = query.toString();
3119
3120 Query q = session.createQuery(sql);
3121
3122 QueryPos qPos = QueryPos.getInstance(q);
3123
3124 if (uuid != null) {
3125 qPos.add(uuid);
3126 }
3127
3128 count = (Long)q.uniqueResult();
3129 }
3130 catch (Exception e) {
3131 throw processException(e);
3132 }
3133 finally {
3134 if (count == null) {
3135 count = Long.valueOf(0);
3136 }
3137
3138 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3139 finderArgs, count);
3140
3141 closeSession(session);
3142 }
3143 }
3144
3145 return count.intValue();
3146 }
3147
3148
3156 public int countByUUID_G(String uuid, long groupId)
3157 throws SystemException {
3158 Object[] finderArgs = new Object[] { uuid, groupId };
3159
3160 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
3161 finderArgs, this);
3162
3163 if (count == null) {
3164 Session session = null;
3165
3166 try {
3167 session = openSession();
3168
3169 StringBundler query = new StringBundler(3);
3170
3171 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3172
3173 if (uuid == null) {
3174 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
3175 }
3176 else {
3177 if (uuid.equals(StringPool.BLANK)) {
3178 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
3179 }
3180 else {
3181 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
3182 }
3183 }
3184
3185 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
3186
3187 String sql = query.toString();
3188
3189 Query q = session.createQuery(sql);
3190
3191 QueryPos qPos = QueryPos.getInstance(q);
3192
3193 if (uuid != null) {
3194 qPos.add(uuid);
3195 }
3196
3197 qPos.add(groupId);
3198
3199 count = (Long)q.uniqueResult();
3200 }
3201 catch (Exception e) {
3202 throw processException(e);
3203 }
3204 finally {
3205 if (count == null) {
3206 count = Long.valueOf(0);
3207 }
3208
3209 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
3210 finderArgs, count);
3211
3212 closeSession(session);
3213 }
3214 }
3215
3216 return count.intValue();
3217 }
3218
3219
3226 public int countByGroupId(long groupId) throws SystemException {
3227 Object[] finderArgs = new Object[] { groupId };
3228
3229 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
3230 finderArgs, this);
3231
3232 if (count == null) {
3233 Session session = null;
3234
3235 try {
3236 session = openSession();
3237
3238 StringBundler query = new StringBundler(2);
3239
3240 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3241
3242 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3243
3244 String sql = query.toString();
3245
3246 Query q = session.createQuery(sql);
3247
3248 QueryPos qPos = QueryPos.getInstance(q);
3249
3250 qPos.add(groupId);
3251
3252 count = (Long)q.uniqueResult();
3253 }
3254 catch (Exception e) {
3255 throw processException(e);
3256 }
3257 finally {
3258 if (count == null) {
3259 count = Long.valueOf(0);
3260 }
3261
3262 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
3263 finderArgs, count);
3264
3265 closeSession(session);
3266 }
3267 }
3268
3269 return count.intValue();
3270 }
3271
3272
3279 public int filterCountByGroupId(long groupId) throws SystemException {
3280 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3281 return countByGroupId(groupId);
3282 }
3283
3284 Session session = null;
3285
3286 try {
3287 session = openSession();
3288
3289 StringBundler query = new StringBundler(2);
3290
3291 query.append(_FILTER_SQL_COUNT_DLFOLDER_WHERE);
3292
3293 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3294
3295 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3296 DLFolder.class.getName(), _FILTER_COLUMN_PK,
3297 _FILTER_COLUMN_USERID, groupId);
3298
3299 SQLQuery q = session.createSQLQuery(sql);
3300
3301 q.addScalar(COUNT_COLUMN_NAME,
3302 com.liferay.portal.kernel.dao.orm.Type.LONG);
3303
3304 QueryPos qPos = QueryPos.getInstance(q);
3305
3306 qPos.add(groupId);
3307
3308 Long count = (Long)q.uniqueResult();
3309
3310 return count.intValue();
3311 }
3312 catch (Exception e) {
3313 throw processException(e);
3314 }
3315 finally {
3316 closeSession(session);
3317 }
3318 }
3319
3320
3327 public int countByCompanyId(long companyId) throws SystemException {
3328 Object[] finderArgs = new Object[] { companyId };
3329
3330 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
3331 finderArgs, this);
3332
3333 if (count == null) {
3334 Session session = null;
3335
3336 try {
3337 session = openSession();
3338
3339 StringBundler query = new StringBundler(2);
3340
3341 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3342
3343 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
3344
3345 String sql = query.toString();
3346
3347 Query q = session.createQuery(sql);
3348
3349 QueryPos qPos = QueryPos.getInstance(q);
3350
3351 qPos.add(companyId);
3352
3353 count = (Long)q.uniqueResult();
3354 }
3355 catch (Exception e) {
3356 throw processException(e);
3357 }
3358 finally {
3359 if (count == null) {
3360 count = Long.valueOf(0);
3361 }
3362
3363 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
3364 finderArgs, count);
3365
3366 closeSession(session);
3367 }
3368 }
3369
3370 return count.intValue();
3371 }
3372
3373
3381 public int countByG_P(long groupId, long parentFolderId)
3382 throws SystemException {
3383 Object[] finderArgs = new Object[] { groupId, parentFolderId };
3384
3385 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P,
3386 finderArgs, this);
3387
3388 if (count == null) {
3389 Session session = null;
3390
3391 try {
3392 session = openSession();
3393
3394 StringBundler query = new StringBundler(3);
3395
3396 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3397
3398 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
3399
3400 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
3401
3402 String sql = query.toString();
3403
3404 Query q = session.createQuery(sql);
3405
3406 QueryPos qPos = QueryPos.getInstance(q);
3407
3408 qPos.add(groupId);
3409
3410 qPos.add(parentFolderId);
3411
3412 count = (Long)q.uniqueResult();
3413 }
3414 catch (Exception e) {
3415 throw processException(e);
3416 }
3417 finally {
3418 if (count == null) {
3419 count = Long.valueOf(0);
3420 }
3421
3422 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P, finderArgs,
3423 count);
3424
3425 closeSession(session);
3426 }
3427 }
3428
3429 return count.intValue();
3430 }
3431
3432
3440 public int filterCountByG_P(long groupId, long parentFolderId)
3441 throws SystemException {
3442 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3443 return countByG_P(groupId, parentFolderId);
3444 }
3445
3446 Session session = null;
3447
3448 try {
3449 session = openSession();
3450
3451 StringBundler query = new StringBundler(3);
3452
3453 query.append(_FILTER_SQL_COUNT_DLFOLDER_WHERE);
3454
3455 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
3456
3457 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
3458
3459 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3460 DLFolder.class.getName(), _FILTER_COLUMN_PK,
3461 _FILTER_COLUMN_USERID, groupId);
3462
3463 SQLQuery q = session.createSQLQuery(sql);
3464
3465 q.addScalar(COUNT_COLUMN_NAME,
3466 com.liferay.portal.kernel.dao.orm.Type.LONG);
3467
3468 QueryPos qPos = QueryPos.getInstance(q);
3469
3470 qPos.add(groupId);
3471
3472 qPos.add(parentFolderId);
3473
3474 Long count = (Long)q.uniqueResult();
3475
3476 return count.intValue();
3477 }
3478 catch (Exception e) {
3479 throw processException(e);
3480 }
3481 finally {
3482 closeSession(session);
3483 }
3484 }
3485
3486
3494 public int countByP_N(long parentFolderId, String name)
3495 throws SystemException {
3496 Object[] finderArgs = new Object[] { parentFolderId, name };
3497
3498 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_N,
3499 finderArgs, this);
3500
3501 if (count == null) {
3502 Session session = null;
3503
3504 try {
3505 session = openSession();
3506
3507 StringBundler query = new StringBundler(3);
3508
3509 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3510
3511 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
3512
3513 if (name == null) {
3514 query.append(_FINDER_COLUMN_P_N_NAME_1);
3515 }
3516 else {
3517 if (name.equals(StringPool.BLANK)) {
3518 query.append(_FINDER_COLUMN_P_N_NAME_3);
3519 }
3520 else {
3521 query.append(_FINDER_COLUMN_P_N_NAME_2);
3522 }
3523 }
3524
3525 String sql = query.toString();
3526
3527 Query q = session.createQuery(sql);
3528
3529 QueryPos qPos = QueryPos.getInstance(q);
3530
3531 qPos.add(parentFolderId);
3532
3533 if (name != null) {
3534 qPos.add(name);
3535 }
3536
3537 count = (Long)q.uniqueResult();
3538 }
3539 catch (Exception e) {
3540 throw processException(e);
3541 }
3542 finally {
3543 if (count == null) {
3544 count = Long.valueOf(0);
3545 }
3546
3547 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_N, finderArgs,
3548 count);
3549
3550 closeSession(session);
3551 }
3552 }
3553
3554 return count.intValue();
3555 }
3556
3557
3566 public int countByG_P_N(long groupId, long parentFolderId, String name)
3567 throws SystemException {
3568 Object[] finderArgs = new Object[] { groupId, parentFolderId, name };
3569
3570 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P_N,
3571 finderArgs, this);
3572
3573 if (count == null) {
3574 Session session = null;
3575
3576 try {
3577 session = openSession();
3578
3579 StringBundler query = new StringBundler(4);
3580
3581 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3582
3583 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
3584
3585 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
3586
3587 if (name == null) {
3588 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
3589 }
3590 else {
3591 if (name.equals(StringPool.BLANK)) {
3592 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
3593 }
3594 else {
3595 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
3596 }
3597 }
3598
3599 String sql = query.toString();
3600
3601 Query q = session.createQuery(sql);
3602
3603 QueryPos qPos = QueryPos.getInstance(q);
3604
3605 qPos.add(groupId);
3606
3607 qPos.add(parentFolderId);
3608
3609 if (name != null) {
3610 qPos.add(name);
3611 }
3612
3613 count = (Long)q.uniqueResult();
3614 }
3615 catch (Exception e) {
3616 throw processException(e);
3617 }
3618 finally {
3619 if (count == null) {
3620 count = Long.valueOf(0);
3621 }
3622
3623 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P_N,
3624 finderArgs, count);
3625
3626 closeSession(session);
3627 }
3628 }
3629
3630 return count.intValue();
3631 }
3632
3633
3642 public int filterCountByG_P_N(long groupId, long parentFolderId, String name)
3643 throws SystemException {
3644 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3645 return countByG_P_N(groupId, parentFolderId, name);
3646 }
3647
3648 Session session = null;
3649
3650 try {
3651 session = openSession();
3652
3653 StringBundler query = new StringBundler(4);
3654
3655 query.append(_FILTER_SQL_COUNT_DLFOLDER_WHERE);
3656
3657 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
3658
3659 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
3660
3661 if (name == null) {
3662 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
3663 }
3664 else {
3665 if (name.equals(StringPool.BLANK)) {
3666 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
3667 }
3668 else {
3669 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
3670 }
3671 }
3672
3673 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3674 DLFolder.class.getName(), _FILTER_COLUMN_PK,
3675 _FILTER_COLUMN_USERID, groupId);
3676
3677 SQLQuery q = session.createSQLQuery(sql);
3678
3679 q.addScalar(COUNT_COLUMN_NAME,
3680 com.liferay.portal.kernel.dao.orm.Type.LONG);
3681
3682 QueryPos qPos = QueryPos.getInstance(q);
3683
3684 qPos.add(groupId);
3685
3686 qPos.add(parentFolderId);
3687
3688 if (name != null) {
3689 qPos.add(name);
3690 }
3691
3692 Long count = (Long)q.uniqueResult();
3693
3694 return count.intValue();
3695 }
3696 catch (Exception e) {
3697 throw processException(e);
3698 }
3699 finally {
3700 closeSession(session);
3701 }
3702 }
3703
3704
3710 public int countAll() throws SystemException {
3711 Object[] finderArgs = new Object[0];
3712
3713 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3714 finderArgs, this);
3715
3716 if (count == null) {
3717 Session session = null;
3718
3719 try {
3720 session = openSession();
3721
3722 Query q = session.createQuery(_SQL_COUNT_DLFOLDER);
3723
3724 count = (Long)q.uniqueResult();
3725 }
3726 catch (Exception e) {
3727 throw processException(e);
3728 }
3729 finally {
3730 if (count == null) {
3731 count = Long.valueOf(0);
3732 }
3733
3734 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3735 count);
3736
3737 closeSession(session);
3738 }
3739 }
3740
3741 return count.intValue();
3742 }
3743
3744
3747 public void afterPropertiesSet() {
3748 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3749 com.liferay.portal.util.PropsUtil.get(
3750 "value.object.listener.com.liferay.portlet.documentlibrary.model.DLFolder")));
3751
3752 if (listenerClassNames.length > 0) {
3753 try {
3754 List<ModelListener<DLFolder>> listenersList = new ArrayList<ModelListener<DLFolder>>();
3755
3756 for (String listenerClassName : listenerClassNames) {
3757 listenersList.add((ModelListener<DLFolder>)InstanceFactory.newInstance(
3758 listenerClassName));
3759 }
3760
3761 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3762 }
3763 catch (Exception e) {
3764 _log.error(e);
3765 }
3766 }
3767 }
3768
3769 public void destroy() {
3770 EntityCacheUtil.removeCache(DLFolderImpl.class.getName());
3771 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3772 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
3773 }
3774
3775 @BeanReference(type = DLFileEntryPersistence.class)
3776 protected DLFileEntryPersistence dlFileEntryPersistence;
3777 @BeanReference(type = DLFileRankPersistence.class)
3778 protected DLFileRankPersistence dlFileRankPersistence;
3779 @BeanReference(type = DLFileShortcutPersistence.class)
3780 protected DLFileShortcutPersistence dlFileShortcutPersistence;
3781 @BeanReference(type = DLFileVersionPersistence.class)
3782 protected DLFileVersionPersistence dlFileVersionPersistence;
3783 @BeanReference(type = DLFolderPersistence.class)
3784 protected DLFolderPersistence dlFolderPersistence;
3785 @BeanReference(type = GroupPersistence.class)
3786 protected GroupPersistence groupPersistence;
3787 @BeanReference(type = LayoutPersistence.class)
3788 protected LayoutPersistence layoutPersistence;
3789 @BeanReference(type = LockPersistence.class)
3790 protected LockPersistence lockPersistence;
3791 @BeanReference(type = ResourcePersistence.class)
3792 protected ResourcePersistence resourcePersistence;
3793 @BeanReference(type = UserPersistence.class)
3794 protected UserPersistence userPersistence;
3795 @BeanReference(type = WebDAVPropsPersistence.class)
3796 protected WebDAVPropsPersistence webDAVPropsPersistence;
3797 @BeanReference(type = ExpandoValuePersistence.class)
3798 protected ExpandoValuePersistence expandoValuePersistence;
3799 private static final String _SQL_SELECT_DLFOLDER = "SELECT dlFolder FROM DLFolder dlFolder";
3800 private static final String _SQL_SELECT_DLFOLDER_WHERE = "SELECT dlFolder FROM DLFolder dlFolder WHERE ";
3801 private static final String _SQL_COUNT_DLFOLDER = "SELECT COUNT(dlFolder) FROM DLFolder dlFolder";
3802 private static final String _SQL_COUNT_DLFOLDER_WHERE = "SELECT COUNT(dlFolder) FROM DLFolder dlFolder WHERE ";
3803 private static final String _FINDER_COLUMN_UUID_UUID_1 = "dlFolder.uuid IS NULL";
3804 private static final String _FINDER_COLUMN_UUID_UUID_2 = "dlFolder.uuid = ?";
3805 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(dlFolder.uuid IS NULL OR dlFolder.uuid = ?)";
3806 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "dlFolder.uuid IS NULL AND ";
3807 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "dlFolder.uuid = ? AND ";
3808 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(dlFolder.uuid IS NULL OR dlFolder.uuid = ?) AND ";
3809 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "dlFolder.groupId = ?";
3810 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "dlFolder.groupId = ?";
3811 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "dlFolder.companyId = ?";
3812 private static final String _FINDER_COLUMN_G_P_GROUPID_2 = "dlFolder.groupId = ? AND ";
3813 private static final String _FINDER_COLUMN_G_P_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ?";
3814 private static final String _FINDER_COLUMN_P_N_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ? AND ";
3815 private static final String _FINDER_COLUMN_P_N_NAME_1 = "dlFolder.name IS NULL";
3816 private static final String _FINDER_COLUMN_P_N_NAME_2 = "dlFolder.name = ?";
3817 private static final String _FINDER_COLUMN_P_N_NAME_3 = "(dlFolder.name IS NULL OR dlFolder.name = ?)";
3818 private static final String _FINDER_COLUMN_G_P_N_GROUPID_2 = "dlFolder.groupId = ? AND ";
3819 private static final String _FINDER_COLUMN_G_P_N_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ? AND ";
3820 private static final String _FINDER_COLUMN_G_P_N_NAME_1 = "dlFolder.name IS NULL";
3821 private static final String _FINDER_COLUMN_G_P_N_NAME_2 = "dlFolder.name = ?";
3822 private static final String _FINDER_COLUMN_G_P_N_NAME_3 = "(dlFolder.name IS NULL OR dlFolder.name = ?)";
3823 private static final String _FILTER_SQL_SELECT_DLFOLDER_WHERE = "SELECT DISTINCT {dlFolder.*} FROM DLFolder dlFolder WHERE ";
3824 private static final String _FILTER_SQL_SELECT_DLFOLDER_NO_INLINE_DISTINCT_WHERE =
3825 "SELECT {dlFolder.*} FROM (SELECT DISTINCT folderId FROM DLFolder) dlFolder2 INNER JOIN DLFolder dlFolder ON (dlFolder2.folderId = dlFolder.folderId) WHERE ";
3826 private static final String _FILTER_SQL_COUNT_DLFOLDER_WHERE = "SELECT COUNT(DISTINCT dlFolder.folderId) AS COUNT_VALUE FROM DLFolder dlFolder WHERE ";
3827 private static final String _FILTER_COLUMN_PK = "dlFolder.folderId";
3828 private static final String _FILTER_COLUMN_USERID = "dlFolder.userId";
3829 private static final String _FILTER_ENTITY_ALIAS = "dlFolder";
3830 private static final String _ORDER_BY_ENTITY_ALIAS = "dlFolder.";
3831 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DLFolder exists with the primary key ";
3832 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DLFolder exists with the key {";
3833 private static Log _log = LogFactoryUtil.getLog(DLFolderPersistenceImpl.class);
3834 }