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.getUuid(),
344 new Long(dlFolderModelImpl.getGroupId())
345 });
346
347 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
348 new Object[] {
349 new Long(dlFolderModelImpl.getGroupId()),
350 new Long(dlFolderModelImpl.getParentFolderId()),
351
352 dlFolderModelImpl.getName()
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 StringBundler query = null;
615
616 if (orderByComparator != null) {
617 query = new StringBundler(3 +
618 (orderByComparator.getOrderByFields().length * 3));
619 }
620 else {
621 query = new StringBundler(3);
622 }
623
624 query.append(_SQL_SELECT_DLFOLDER_WHERE);
625
626 if (uuid == null) {
627 query.append(_FINDER_COLUMN_UUID_UUID_1);
628 }
629 else {
630 if (uuid.equals(StringPool.BLANK)) {
631 query.append(_FINDER_COLUMN_UUID_UUID_3);
632 }
633 else {
634 query.append(_FINDER_COLUMN_UUID_UUID_2);
635 }
636 }
637
638 if (orderByComparator != null) {
639 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
640 orderByComparator);
641 }
642
643 else {
644 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
645 }
646
647 String sql = query.toString();
648
649 Session session = null;
650
651 try {
652 session = openSession();
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 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_UUID,
671 finderArgs);
672 }
673 else {
674 cacheResult(list);
675
676 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID,
677 finderArgs, list);
678 }
679
680 closeSession(session);
681 }
682 }
683
684 return list;
685 }
686
687
700 public DLFolder findByUuid_First(String uuid,
701 OrderByComparator orderByComparator)
702 throws NoSuchFolderException, SystemException {
703 List<DLFolder> list = findByUuid(uuid, 0, 1, orderByComparator);
704
705 if (list.isEmpty()) {
706 StringBundler msg = new StringBundler(4);
707
708 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
709
710 msg.append("uuid=");
711 msg.append(uuid);
712
713 msg.append(StringPool.CLOSE_CURLY_BRACE);
714
715 throw new NoSuchFolderException(msg.toString());
716 }
717 else {
718 return list.get(0);
719 }
720 }
721
722
735 public DLFolder findByUuid_Last(String uuid,
736 OrderByComparator orderByComparator)
737 throws NoSuchFolderException, SystemException {
738 int count = countByUuid(uuid);
739
740 List<DLFolder> list = findByUuid(uuid, count - 1, count,
741 orderByComparator);
742
743 if (list.isEmpty()) {
744 StringBundler msg = new StringBundler(4);
745
746 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
747
748 msg.append("uuid=");
749 msg.append(uuid);
750
751 msg.append(StringPool.CLOSE_CURLY_BRACE);
752
753 throw new NoSuchFolderException(msg.toString());
754 }
755 else {
756 return list.get(0);
757 }
758 }
759
760
774 public DLFolder[] findByUuid_PrevAndNext(long folderId, String uuid,
775 OrderByComparator orderByComparator)
776 throws NoSuchFolderException, SystemException {
777 DLFolder dlFolder = findByPrimaryKey(folderId);
778
779 Session session = null;
780
781 try {
782 session = openSession();
783
784 DLFolder[] array = new DLFolderImpl[3];
785
786 array[0] = getByUuid_PrevAndNext(session, dlFolder, uuid,
787 orderByComparator, true);
788
789 array[1] = dlFolder;
790
791 array[2] = getByUuid_PrevAndNext(session, dlFolder, uuid,
792 orderByComparator, false);
793
794 return array;
795 }
796 catch (Exception e) {
797 throw processException(e);
798 }
799 finally {
800 closeSession(session);
801 }
802 }
803
804 protected DLFolder getByUuid_PrevAndNext(Session session,
805 DLFolder dlFolder, String uuid, OrderByComparator orderByComparator,
806 boolean previous) {
807 StringBundler query = null;
808
809 if (orderByComparator != null) {
810 query = new StringBundler(6 +
811 (orderByComparator.getOrderByFields().length * 6));
812 }
813 else {
814 query = new StringBundler(3);
815 }
816
817 query.append(_SQL_SELECT_DLFOLDER_WHERE);
818
819 if (uuid == null) {
820 query.append(_FINDER_COLUMN_UUID_UUID_1);
821 }
822 else {
823 if (uuid.equals(StringPool.BLANK)) {
824 query.append(_FINDER_COLUMN_UUID_UUID_3);
825 }
826 else {
827 query.append(_FINDER_COLUMN_UUID_UUID_2);
828 }
829 }
830
831 if (orderByComparator != null) {
832 String[] orderByFields = orderByComparator.getOrderByFields();
833
834 if (orderByFields.length > 0) {
835 query.append(WHERE_AND);
836 }
837
838 for (int i = 0; i < orderByFields.length; i++) {
839 query.append(_ORDER_BY_ENTITY_ALIAS);
840 query.append(orderByFields[i]);
841
842 if ((i + 1) < orderByFields.length) {
843 if (orderByComparator.isAscending() ^ previous) {
844 query.append(WHERE_GREATER_THAN_HAS_NEXT);
845 }
846 else {
847 query.append(WHERE_LESSER_THAN_HAS_NEXT);
848 }
849 }
850 else {
851 if (orderByComparator.isAscending() ^ previous) {
852 query.append(WHERE_GREATER_THAN);
853 }
854 else {
855 query.append(WHERE_LESSER_THAN);
856 }
857 }
858 }
859
860 query.append(ORDER_BY_CLAUSE);
861
862 for (int i = 0; i < orderByFields.length; i++) {
863 query.append(_ORDER_BY_ENTITY_ALIAS);
864 query.append(orderByFields[i]);
865
866 if ((i + 1) < orderByFields.length) {
867 if (orderByComparator.isAscending() ^ previous) {
868 query.append(ORDER_BY_ASC_HAS_NEXT);
869 }
870 else {
871 query.append(ORDER_BY_DESC_HAS_NEXT);
872 }
873 }
874 else {
875 if (orderByComparator.isAscending() ^ previous) {
876 query.append(ORDER_BY_ASC);
877 }
878 else {
879 query.append(ORDER_BY_DESC);
880 }
881 }
882 }
883 }
884
885 else {
886 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
887 }
888
889 String sql = query.toString();
890
891 Query q = session.createQuery(sql);
892
893 q.setFirstResult(0);
894 q.setMaxResults(2);
895
896 QueryPos qPos = QueryPos.getInstance(q);
897
898 if (uuid != null) {
899 qPos.add(uuid);
900 }
901
902 if (orderByComparator != null) {
903 Object[] values = orderByComparator.getOrderByValues(dlFolder);
904
905 for (Object value : values) {
906 qPos.add(value);
907 }
908 }
909
910 List<DLFolder> list = q.list();
911
912 if (list.size() == 2) {
913 return list.get(1);
914 }
915 else {
916 return null;
917 }
918 }
919
920
929 public DLFolder findByUUID_G(String uuid, long groupId)
930 throws NoSuchFolderException, SystemException {
931 DLFolder dlFolder = fetchByUUID_G(uuid, groupId);
932
933 if (dlFolder == null) {
934 StringBundler msg = new StringBundler(6);
935
936 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
937
938 msg.append("uuid=");
939 msg.append(uuid);
940
941 msg.append(", groupId=");
942 msg.append(groupId);
943
944 msg.append(StringPool.CLOSE_CURLY_BRACE);
945
946 if (_log.isWarnEnabled()) {
947 _log.warn(msg.toString());
948 }
949
950 throw new NoSuchFolderException(msg.toString());
951 }
952
953 return dlFolder;
954 }
955
956
964 public DLFolder fetchByUUID_G(String uuid, long groupId)
965 throws SystemException {
966 return fetchByUUID_G(uuid, groupId, true);
967 }
968
969
977 public DLFolder fetchByUUID_G(String uuid, long groupId,
978 boolean retrieveFromCache) throws SystemException {
979 Object[] finderArgs = new Object[] { uuid, groupId };
980
981 Object result = null;
982
983 if (retrieveFromCache) {
984 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
985 finderArgs, this);
986 }
987
988 if (result == null) {
989 StringBundler query = new StringBundler(4);
990
991 query.append(_SQL_SELECT_DLFOLDER_WHERE);
992
993 if (uuid == null) {
994 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
995 }
996 else {
997 if (uuid.equals(StringPool.BLANK)) {
998 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
999 }
1000 else {
1001 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1002 }
1003 }
1004
1005 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1006
1007 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1008
1009 String sql = query.toString();
1010
1011 Session session = null;
1012
1013 try {
1014 session = openSession();
1015
1016 Query q = session.createQuery(sql);
1017
1018 QueryPos qPos = QueryPos.getInstance(q);
1019
1020 if (uuid != null) {
1021 qPos.add(uuid);
1022 }
1023
1024 qPos.add(groupId);
1025
1026 List<DLFolder> list = q.list();
1027
1028 result = list;
1029
1030 DLFolder dlFolder = null;
1031
1032 if (list.isEmpty()) {
1033 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1034 finderArgs, list);
1035 }
1036 else {
1037 dlFolder = list.get(0);
1038
1039 cacheResult(dlFolder);
1040
1041 if ((dlFolder.getUuid() == null) ||
1042 !dlFolder.getUuid().equals(uuid) ||
1043 (dlFolder.getGroupId() != groupId)) {
1044 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1045 finderArgs, dlFolder);
1046 }
1047 }
1048
1049 return dlFolder;
1050 }
1051 catch (Exception e) {
1052 throw processException(e);
1053 }
1054 finally {
1055 if (result == null) {
1056 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1057 finderArgs);
1058 }
1059
1060 closeSession(session);
1061 }
1062 }
1063 else {
1064 if (result instanceof List<?>) {
1065 return null;
1066 }
1067 else {
1068 return (DLFolder)result;
1069 }
1070 }
1071 }
1072
1073
1080 public List<DLFolder> findByGroupId(long groupId) throws SystemException {
1081 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1082 }
1083
1084
1097 public List<DLFolder> findByGroupId(long groupId, int start, int end)
1098 throws SystemException {
1099 return findByGroupId(groupId, start, end, null);
1100 }
1101
1102
1116 public List<DLFolder> findByGroupId(long groupId, int start, int end,
1117 OrderByComparator orderByComparator) throws SystemException {
1118 Object[] finderArgs = new Object[] {
1119 groupId,
1120
1121 String.valueOf(start), String.valueOf(end),
1122 String.valueOf(orderByComparator)
1123 };
1124
1125 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1126 finderArgs, this);
1127
1128 if (list == null) {
1129 StringBundler query = null;
1130
1131 if (orderByComparator != null) {
1132 query = new StringBundler(3 +
1133 (orderByComparator.getOrderByFields().length * 3));
1134 }
1135 else {
1136 query = new StringBundler(3);
1137 }
1138
1139 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1140
1141 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1142
1143 if (orderByComparator != null) {
1144 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1145 orderByComparator);
1146 }
1147
1148 else {
1149 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1150 }
1151
1152 String sql = query.toString();
1153
1154 Session session = null;
1155
1156 try {
1157 session = openSession();
1158
1159 Query q = session.createQuery(sql);
1160
1161 QueryPos qPos = QueryPos.getInstance(q);
1162
1163 qPos.add(groupId);
1164
1165 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1166 end);
1167 }
1168 catch (Exception e) {
1169 throw processException(e);
1170 }
1171 finally {
1172 if (list == null) {
1173 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_GROUPID,
1174 finderArgs);
1175 }
1176 else {
1177 cacheResult(list);
1178
1179 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1180 finderArgs, list);
1181 }
1182
1183 closeSession(session);
1184 }
1185 }
1186
1187 return list;
1188 }
1189
1190
1203 public DLFolder findByGroupId_First(long groupId,
1204 OrderByComparator orderByComparator)
1205 throws NoSuchFolderException, SystemException {
1206 List<DLFolder> list = findByGroupId(groupId, 0, 1, orderByComparator);
1207
1208 if (list.isEmpty()) {
1209 StringBundler msg = new StringBundler(4);
1210
1211 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1212
1213 msg.append("groupId=");
1214 msg.append(groupId);
1215
1216 msg.append(StringPool.CLOSE_CURLY_BRACE);
1217
1218 throw new NoSuchFolderException(msg.toString());
1219 }
1220 else {
1221 return list.get(0);
1222 }
1223 }
1224
1225
1238 public DLFolder findByGroupId_Last(long groupId,
1239 OrderByComparator orderByComparator)
1240 throws NoSuchFolderException, SystemException {
1241 int count = countByGroupId(groupId);
1242
1243 List<DLFolder> list = findByGroupId(groupId, count - 1, count,
1244 orderByComparator);
1245
1246 if (list.isEmpty()) {
1247 StringBundler msg = new StringBundler(4);
1248
1249 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1250
1251 msg.append("groupId=");
1252 msg.append(groupId);
1253
1254 msg.append(StringPool.CLOSE_CURLY_BRACE);
1255
1256 throw new NoSuchFolderException(msg.toString());
1257 }
1258 else {
1259 return list.get(0);
1260 }
1261 }
1262
1263
1277 public DLFolder[] findByGroupId_PrevAndNext(long folderId, long groupId,
1278 OrderByComparator orderByComparator)
1279 throws NoSuchFolderException, SystemException {
1280 DLFolder dlFolder = findByPrimaryKey(folderId);
1281
1282 Session session = null;
1283
1284 try {
1285 session = openSession();
1286
1287 DLFolder[] array = new DLFolderImpl[3];
1288
1289 array[0] = getByGroupId_PrevAndNext(session, dlFolder, groupId,
1290 orderByComparator, true);
1291
1292 array[1] = dlFolder;
1293
1294 array[2] = getByGroupId_PrevAndNext(session, dlFolder, groupId,
1295 orderByComparator, false);
1296
1297 return array;
1298 }
1299 catch (Exception e) {
1300 throw processException(e);
1301 }
1302 finally {
1303 closeSession(session);
1304 }
1305 }
1306
1307 protected DLFolder getByGroupId_PrevAndNext(Session session,
1308 DLFolder dlFolder, long groupId, OrderByComparator orderByComparator,
1309 boolean previous) {
1310 StringBundler query = null;
1311
1312 if (orderByComparator != null) {
1313 query = new StringBundler(6 +
1314 (orderByComparator.getOrderByFields().length * 6));
1315 }
1316 else {
1317 query = new StringBundler(3);
1318 }
1319
1320 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1321
1322 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1323
1324 if (orderByComparator != null) {
1325 String[] orderByFields = orderByComparator.getOrderByFields();
1326
1327 if (orderByFields.length > 0) {
1328 query.append(WHERE_AND);
1329 }
1330
1331 for (int i = 0; i < orderByFields.length; i++) {
1332 query.append(_ORDER_BY_ENTITY_ALIAS);
1333 query.append(orderByFields[i]);
1334
1335 if ((i + 1) < orderByFields.length) {
1336 if (orderByComparator.isAscending() ^ previous) {
1337 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1338 }
1339 else {
1340 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1341 }
1342 }
1343 else {
1344 if (orderByComparator.isAscending() ^ previous) {
1345 query.append(WHERE_GREATER_THAN);
1346 }
1347 else {
1348 query.append(WHERE_LESSER_THAN);
1349 }
1350 }
1351 }
1352
1353 query.append(ORDER_BY_CLAUSE);
1354
1355 for (int i = 0; i < orderByFields.length; i++) {
1356 query.append(_ORDER_BY_ENTITY_ALIAS);
1357 query.append(orderByFields[i]);
1358
1359 if ((i + 1) < orderByFields.length) {
1360 if (orderByComparator.isAscending() ^ previous) {
1361 query.append(ORDER_BY_ASC_HAS_NEXT);
1362 }
1363 else {
1364 query.append(ORDER_BY_DESC_HAS_NEXT);
1365 }
1366 }
1367 else {
1368 if (orderByComparator.isAscending() ^ previous) {
1369 query.append(ORDER_BY_ASC);
1370 }
1371 else {
1372 query.append(ORDER_BY_DESC);
1373 }
1374 }
1375 }
1376 }
1377
1378 else {
1379 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1380 }
1381
1382 String sql = query.toString();
1383
1384 Query q = session.createQuery(sql);
1385
1386 q.setFirstResult(0);
1387 q.setMaxResults(2);
1388
1389 QueryPos qPos = QueryPos.getInstance(q);
1390
1391 qPos.add(groupId);
1392
1393 if (orderByComparator != null) {
1394 Object[] values = orderByComparator.getOrderByValues(dlFolder);
1395
1396 for (Object value : values) {
1397 qPos.add(value);
1398 }
1399 }
1400
1401 List<DLFolder> list = q.list();
1402
1403 if (list.size() == 2) {
1404 return list.get(1);
1405 }
1406 else {
1407 return null;
1408 }
1409 }
1410
1411
1418 public List<DLFolder> filterFindByGroupId(long groupId)
1419 throws SystemException {
1420 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1421 QueryUtil.ALL_POS, null);
1422 }
1423
1424
1437 public List<DLFolder> filterFindByGroupId(long groupId, int start, int end)
1438 throws SystemException {
1439 return filterFindByGroupId(groupId, start, end, null);
1440 }
1441
1442
1456 public List<DLFolder> filterFindByGroupId(long groupId, int start, int end,
1457 OrderByComparator orderByComparator) throws SystemException {
1458 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1459 return findByGroupId(groupId, start, end, orderByComparator);
1460 }
1461
1462 StringBundler query = null;
1463
1464 if (orderByComparator != null) {
1465 query = new StringBundler(3 +
1466 (orderByComparator.getOrderByFields().length * 3));
1467 }
1468 else {
1469 query = new StringBundler(3);
1470 }
1471
1472 if (getDB().isSupportsInlineDistinct()) {
1473 query.append(_FILTER_SQL_SELECT_DLFOLDER_WHERE);
1474 }
1475 else {
1476 query.append(_FILTER_SQL_SELECT_DLFOLDER_NO_INLINE_DISTINCT_WHERE_1);
1477 }
1478
1479 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1480
1481 if (!getDB().isSupportsInlineDistinct()) {
1482 query.append(_FILTER_SQL_SELECT_DLFOLDER_NO_INLINE_DISTINCT_WHERE_2);
1483 }
1484
1485 if (orderByComparator != null) {
1486 if (getDB().isSupportsInlineDistinct()) {
1487 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1488 orderByComparator);
1489 }
1490 else {
1491 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1492 orderByComparator);
1493 }
1494 }
1495
1496 else {
1497 if (getDB().isSupportsInlineDistinct()) {
1498 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1499 }
1500 else {
1501 query.append(DLFolderModelImpl.ORDER_BY_SQL);
1502 }
1503 }
1504
1505 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1506 DLFolder.class.getName(), _FILTER_COLUMN_PK,
1507 _FILTER_COLUMN_USERID, groupId);
1508
1509 Session session = null;
1510
1511 try {
1512 session = openSession();
1513
1514 SQLQuery q = session.createSQLQuery(sql);
1515
1516 if (getDB().isSupportsInlineDistinct()) {
1517 q.addEntity(_FILTER_ENTITY_ALIAS, DLFolderImpl.class);
1518 }
1519 else {
1520 q.addEntity(_FILTER_ENTITY_TABLE, DLFolderImpl.class);
1521 }
1522
1523 QueryPos qPos = QueryPos.getInstance(q);
1524
1525 qPos.add(groupId);
1526
1527 return (List<DLFolder>)QueryUtil.list(q, getDialect(), start, end);
1528 }
1529 catch (Exception e) {
1530 throw processException(e);
1531 }
1532 finally {
1533 closeSession(session);
1534 }
1535 }
1536
1537
1544 public List<DLFolder> findByCompanyId(long companyId)
1545 throws SystemException {
1546 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1547 null);
1548 }
1549
1550
1563 public List<DLFolder> findByCompanyId(long companyId, int start, int end)
1564 throws SystemException {
1565 return findByCompanyId(companyId, start, end, null);
1566 }
1567
1568
1582 public List<DLFolder> findByCompanyId(long companyId, int start, int end,
1583 OrderByComparator orderByComparator) throws SystemException {
1584 Object[] finderArgs = new Object[] {
1585 companyId,
1586
1587 String.valueOf(start), String.valueOf(end),
1588 String.valueOf(orderByComparator)
1589 };
1590
1591 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1592 finderArgs, this);
1593
1594 if (list == null) {
1595 StringBundler query = null;
1596
1597 if (orderByComparator != null) {
1598 query = new StringBundler(3 +
1599 (orderByComparator.getOrderByFields().length * 3));
1600 }
1601 else {
1602 query = new StringBundler(3);
1603 }
1604
1605 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1606
1607 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1608
1609 if (orderByComparator != null) {
1610 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1611 orderByComparator);
1612 }
1613
1614 else {
1615 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1616 }
1617
1618 String sql = query.toString();
1619
1620 Session session = null;
1621
1622 try {
1623 session = openSession();
1624
1625 Query q = session.createQuery(sql);
1626
1627 QueryPos qPos = QueryPos.getInstance(q);
1628
1629 qPos.add(companyId);
1630
1631 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1632 end);
1633 }
1634 catch (Exception e) {
1635 throw processException(e);
1636 }
1637 finally {
1638 if (list == null) {
1639 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_COMPANYID,
1640 finderArgs);
1641 }
1642 else {
1643 cacheResult(list);
1644
1645 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1646 finderArgs, list);
1647 }
1648
1649 closeSession(session);
1650 }
1651 }
1652
1653 return list;
1654 }
1655
1656
1669 public DLFolder findByCompanyId_First(long companyId,
1670 OrderByComparator orderByComparator)
1671 throws NoSuchFolderException, SystemException {
1672 List<DLFolder> list = findByCompanyId(companyId, 0, 1, orderByComparator);
1673
1674 if (list.isEmpty()) {
1675 StringBundler msg = new StringBundler(4);
1676
1677 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1678
1679 msg.append("companyId=");
1680 msg.append(companyId);
1681
1682 msg.append(StringPool.CLOSE_CURLY_BRACE);
1683
1684 throw new NoSuchFolderException(msg.toString());
1685 }
1686 else {
1687 return list.get(0);
1688 }
1689 }
1690
1691
1704 public DLFolder findByCompanyId_Last(long companyId,
1705 OrderByComparator orderByComparator)
1706 throws NoSuchFolderException, SystemException {
1707 int count = countByCompanyId(companyId);
1708
1709 List<DLFolder> list = findByCompanyId(companyId, count - 1, count,
1710 orderByComparator);
1711
1712 if (list.isEmpty()) {
1713 StringBundler msg = new StringBundler(4);
1714
1715 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1716
1717 msg.append("companyId=");
1718 msg.append(companyId);
1719
1720 msg.append(StringPool.CLOSE_CURLY_BRACE);
1721
1722 throw new NoSuchFolderException(msg.toString());
1723 }
1724 else {
1725 return list.get(0);
1726 }
1727 }
1728
1729
1743 public DLFolder[] findByCompanyId_PrevAndNext(long folderId,
1744 long companyId, OrderByComparator orderByComparator)
1745 throws NoSuchFolderException, SystemException {
1746 DLFolder dlFolder = findByPrimaryKey(folderId);
1747
1748 Session session = null;
1749
1750 try {
1751 session = openSession();
1752
1753 DLFolder[] array = new DLFolderImpl[3];
1754
1755 array[0] = getByCompanyId_PrevAndNext(session, dlFolder, companyId,
1756 orderByComparator, true);
1757
1758 array[1] = dlFolder;
1759
1760 array[2] = getByCompanyId_PrevAndNext(session, dlFolder, companyId,
1761 orderByComparator, false);
1762
1763 return array;
1764 }
1765 catch (Exception e) {
1766 throw processException(e);
1767 }
1768 finally {
1769 closeSession(session);
1770 }
1771 }
1772
1773 protected DLFolder getByCompanyId_PrevAndNext(Session session,
1774 DLFolder dlFolder, long companyId, OrderByComparator orderByComparator,
1775 boolean previous) {
1776 StringBundler query = null;
1777
1778 if (orderByComparator != null) {
1779 query = new StringBundler(6 +
1780 (orderByComparator.getOrderByFields().length * 6));
1781 }
1782 else {
1783 query = new StringBundler(3);
1784 }
1785
1786 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1787
1788 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1789
1790 if (orderByComparator != null) {
1791 String[] orderByFields = orderByComparator.getOrderByFields();
1792
1793 if (orderByFields.length > 0) {
1794 query.append(WHERE_AND);
1795 }
1796
1797 for (int i = 0; i < orderByFields.length; i++) {
1798 query.append(_ORDER_BY_ENTITY_ALIAS);
1799 query.append(orderByFields[i]);
1800
1801 if ((i + 1) < orderByFields.length) {
1802 if (orderByComparator.isAscending() ^ previous) {
1803 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1804 }
1805 else {
1806 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1807 }
1808 }
1809 else {
1810 if (orderByComparator.isAscending() ^ previous) {
1811 query.append(WHERE_GREATER_THAN);
1812 }
1813 else {
1814 query.append(WHERE_LESSER_THAN);
1815 }
1816 }
1817 }
1818
1819 query.append(ORDER_BY_CLAUSE);
1820
1821 for (int i = 0; i < orderByFields.length; i++) {
1822 query.append(_ORDER_BY_ENTITY_ALIAS);
1823 query.append(orderByFields[i]);
1824
1825 if ((i + 1) < orderByFields.length) {
1826 if (orderByComparator.isAscending() ^ previous) {
1827 query.append(ORDER_BY_ASC_HAS_NEXT);
1828 }
1829 else {
1830 query.append(ORDER_BY_DESC_HAS_NEXT);
1831 }
1832 }
1833 else {
1834 if (orderByComparator.isAscending() ^ previous) {
1835 query.append(ORDER_BY_ASC);
1836 }
1837 else {
1838 query.append(ORDER_BY_DESC);
1839 }
1840 }
1841 }
1842 }
1843
1844 else {
1845 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1846 }
1847
1848 String sql = query.toString();
1849
1850 Query q = session.createQuery(sql);
1851
1852 q.setFirstResult(0);
1853 q.setMaxResults(2);
1854
1855 QueryPos qPos = QueryPos.getInstance(q);
1856
1857 qPos.add(companyId);
1858
1859 if (orderByComparator != null) {
1860 Object[] values = orderByComparator.getOrderByValues(dlFolder);
1861
1862 for (Object value : values) {
1863 qPos.add(value);
1864 }
1865 }
1866
1867 List<DLFolder> list = q.list();
1868
1869 if (list.size() == 2) {
1870 return list.get(1);
1871 }
1872 else {
1873 return null;
1874 }
1875 }
1876
1877
1885 public List<DLFolder> findByG_P(long groupId, long parentFolderId)
1886 throws SystemException {
1887 return findByG_P(groupId, parentFolderId, QueryUtil.ALL_POS,
1888 QueryUtil.ALL_POS, null);
1889 }
1890
1891
1905 public List<DLFolder> findByG_P(long groupId, long parentFolderId,
1906 int start, int end) throws SystemException {
1907 return findByG_P(groupId, parentFolderId, start, end, null);
1908 }
1909
1910
1925 public List<DLFolder> findByG_P(long groupId, long parentFolderId,
1926 int start, int end, OrderByComparator orderByComparator)
1927 throws SystemException {
1928 Object[] finderArgs = new Object[] {
1929 groupId, parentFolderId,
1930
1931 String.valueOf(start), String.valueOf(end),
1932 String.valueOf(orderByComparator)
1933 };
1934
1935 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_P,
1936 finderArgs, this);
1937
1938 if (list == null) {
1939 StringBundler query = null;
1940
1941 if (orderByComparator != null) {
1942 query = new StringBundler(4 +
1943 (orderByComparator.getOrderByFields().length * 3));
1944 }
1945 else {
1946 query = new StringBundler(4);
1947 }
1948
1949 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1950
1951 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1952
1953 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
1954
1955 if (orderByComparator != null) {
1956 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1957 orderByComparator);
1958 }
1959
1960 else {
1961 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1962 }
1963
1964 String sql = query.toString();
1965
1966 Session session = null;
1967
1968 try {
1969 session = openSession();
1970
1971 Query q = session.createQuery(sql);
1972
1973 QueryPos qPos = QueryPos.getInstance(q);
1974
1975 qPos.add(groupId);
1976
1977 qPos.add(parentFolderId);
1978
1979 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1980 end);
1981 }
1982 catch (Exception e) {
1983 throw processException(e);
1984 }
1985 finally {
1986 if (list == null) {
1987 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_P,
1988 finderArgs);
1989 }
1990 else {
1991 cacheResult(list);
1992
1993 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_P,
1994 finderArgs, list);
1995 }
1996
1997 closeSession(session);
1998 }
1999 }
2000
2001 return list;
2002 }
2003
2004
2018 public DLFolder findByG_P_First(long groupId, long parentFolderId,
2019 OrderByComparator orderByComparator)
2020 throws NoSuchFolderException, SystemException {
2021 List<DLFolder> list = findByG_P(groupId, parentFolderId, 0, 1,
2022 orderByComparator);
2023
2024 if (list.isEmpty()) {
2025 StringBundler msg = new StringBundler(6);
2026
2027 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2028
2029 msg.append("groupId=");
2030 msg.append(groupId);
2031
2032 msg.append(", parentFolderId=");
2033 msg.append(parentFolderId);
2034
2035 msg.append(StringPool.CLOSE_CURLY_BRACE);
2036
2037 throw new NoSuchFolderException(msg.toString());
2038 }
2039 else {
2040 return list.get(0);
2041 }
2042 }
2043
2044
2058 public DLFolder findByG_P_Last(long groupId, long parentFolderId,
2059 OrderByComparator orderByComparator)
2060 throws NoSuchFolderException, SystemException {
2061 int count = countByG_P(groupId, parentFolderId);
2062
2063 List<DLFolder> list = findByG_P(groupId, parentFolderId, count - 1,
2064 count, orderByComparator);
2065
2066 if (list.isEmpty()) {
2067 StringBundler msg = new StringBundler(6);
2068
2069 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2070
2071 msg.append("groupId=");
2072 msg.append(groupId);
2073
2074 msg.append(", parentFolderId=");
2075 msg.append(parentFolderId);
2076
2077 msg.append(StringPool.CLOSE_CURLY_BRACE);
2078
2079 throw new NoSuchFolderException(msg.toString());
2080 }
2081 else {
2082 return list.get(0);
2083 }
2084 }
2085
2086
2101 public DLFolder[] findByG_P_PrevAndNext(long folderId, long groupId,
2102 long parentFolderId, OrderByComparator orderByComparator)
2103 throws NoSuchFolderException, SystemException {
2104 DLFolder dlFolder = findByPrimaryKey(folderId);
2105
2106 Session session = null;
2107
2108 try {
2109 session = openSession();
2110
2111 DLFolder[] array = new DLFolderImpl[3];
2112
2113 array[0] = getByG_P_PrevAndNext(session, dlFolder, groupId,
2114 parentFolderId, orderByComparator, true);
2115
2116 array[1] = dlFolder;
2117
2118 array[2] = getByG_P_PrevAndNext(session, dlFolder, groupId,
2119 parentFolderId, orderByComparator, false);
2120
2121 return array;
2122 }
2123 catch (Exception e) {
2124 throw processException(e);
2125 }
2126 finally {
2127 closeSession(session);
2128 }
2129 }
2130
2131 protected DLFolder getByG_P_PrevAndNext(Session session, DLFolder dlFolder,
2132 long groupId, long parentFolderId, OrderByComparator orderByComparator,
2133 boolean previous) {
2134 StringBundler query = null;
2135
2136 if (orderByComparator != null) {
2137 query = new StringBundler(6 +
2138 (orderByComparator.getOrderByFields().length * 6));
2139 }
2140 else {
2141 query = new StringBundler(3);
2142 }
2143
2144 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2145
2146 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
2147
2148 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
2149
2150 if (orderByComparator != null) {
2151 String[] orderByFields = orderByComparator.getOrderByFields();
2152
2153 if (orderByFields.length > 0) {
2154 query.append(WHERE_AND);
2155 }
2156
2157 for (int i = 0; i < orderByFields.length; i++) {
2158 query.append(_ORDER_BY_ENTITY_ALIAS);
2159 query.append(orderByFields[i]);
2160
2161 if ((i + 1) < orderByFields.length) {
2162 if (orderByComparator.isAscending() ^ previous) {
2163 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2164 }
2165 else {
2166 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2167 }
2168 }
2169 else {
2170 if (orderByComparator.isAscending() ^ previous) {
2171 query.append(WHERE_GREATER_THAN);
2172 }
2173 else {
2174 query.append(WHERE_LESSER_THAN);
2175 }
2176 }
2177 }
2178
2179 query.append(ORDER_BY_CLAUSE);
2180
2181 for (int i = 0; i < orderByFields.length; i++) {
2182 query.append(_ORDER_BY_ENTITY_ALIAS);
2183 query.append(orderByFields[i]);
2184
2185 if ((i + 1) < orderByFields.length) {
2186 if (orderByComparator.isAscending() ^ previous) {
2187 query.append(ORDER_BY_ASC_HAS_NEXT);
2188 }
2189 else {
2190 query.append(ORDER_BY_DESC_HAS_NEXT);
2191 }
2192 }
2193 else {
2194 if (orderByComparator.isAscending() ^ previous) {
2195 query.append(ORDER_BY_ASC);
2196 }
2197 else {
2198 query.append(ORDER_BY_DESC);
2199 }
2200 }
2201 }
2202 }
2203
2204 else {
2205 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2206 }
2207
2208 String sql = query.toString();
2209
2210 Query q = session.createQuery(sql);
2211
2212 q.setFirstResult(0);
2213 q.setMaxResults(2);
2214
2215 QueryPos qPos = QueryPos.getInstance(q);
2216
2217 qPos.add(groupId);
2218
2219 qPos.add(parentFolderId);
2220
2221 if (orderByComparator != null) {
2222 Object[] values = orderByComparator.getOrderByValues(dlFolder);
2223
2224 for (Object value : values) {
2225 qPos.add(value);
2226 }
2227 }
2228
2229 List<DLFolder> list = q.list();
2230
2231 if (list.size() == 2) {
2232 return list.get(1);
2233 }
2234 else {
2235 return null;
2236 }
2237 }
2238
2239
2247 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId)
2248 throws SystemException {
2249 return filterFindByG_P(groupId, parentFolderId, QueryUtil.ALL_POS,
2250 QueryUtil.ALL_POS, null);
2251 }
2252
2253
2267 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId,
2268 int start, int end) throws SystemException {
2269 return filterFindByG_P(groupId, parentFolderId, start, end, null);
2270 }
2271
2272
2287 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId,
2288 int start, int end, OrderByComparator orderByComparator)
2289 throws SystemException {
2290 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2291 return findByG_P(groupId, parentFolderId, start, end,
2292 orderByComparator);
2293 }
2294
2295 StringBundler query = null;
2296
2297 if (orderByComparator != null) {
2298 query = new StringBundler(4 +
2299 (orderByComparator.getOrderByFields().length * 3));
2300 }
2301 else {
2302 query = new StringBundler(4);
2303 }
2304
2305 if (getDB().isSupportsInlineDistinct()) {
2306 query.append(_FILTER_SQL_SELECT_DLFOLDER_WHERE);
2307 }
2308 else {
2309 query.append(_FILTER_SQL_SELECT_DLFOLDER_NO_INLINE_DISTINCT_WHERE_1);
2310 }
2311
2312 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
2313
2314 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
2315
2316 if (!getDB().isSupportsInlineDistinct()) {
2317 query.append(_FILTER_SQL_SELECT_DLFOLDER_NO_INLINE_DISTINCT_WHERE_2);
2318 }
2319
2320 if (orderByComparator != null) {
2321 if (getDB().isSupportsInlineDistinct()) {
2322 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2323 orderByComparator);
2324 }
2325 else {
2326 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2327 orderByComparator);
2328 }
2329 }
2330
2331 else {
2332 if (getDB().isSupportsInlineDistinct()) {
2333 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2334 }
2335 else {
2336 query.append(DLFolderModelImpl.ORDER_BY_SQL);
2337 }
2338 }
2339
2340 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2341 DLFolder.class.getName(), _FILTER_COLUMN_PK,
2342 _FILTER_COLUMN_USERID, groupId);
2343
2344 Session session = null;
2345
2346 try {
2347 session = openSession();
2348
2349 SQLQuery q = session.createSQLQuery(sql);
2350
2351 if (getDB().isSupportsInlineDistinct()) {
2352 q.addEntity(_FILTER_ENTITY_ALIAS, DLFolderImpl.class);
2353 }
2354 else {
2355 q.addEntity(_FILTER_ENTITY_TABLE, DLFolderImpl.class);
2356 }
2357
2358 QueryPos qPos = QueryPos.getInstance(q);
2359
2360 qPos.add(groupId);
2361
2362 qPos.add(parentFolderId);
2363
2364 return (List<DLFolder>)QueryUtil.list(q, getDialect(), start, end);
2365 }
2366 catch (Exception e) {
2367 throw processException(e);
2368 }
2369 finally {
2370 closeSession(session);
2371 }
2372 }
2373
2374
2382 public List<DLFolder> findByP_N(long parentFolderId, String name)
2383 throws SystemException {
2384 return findByP_N(parentFolderId, name, QueryUtil.ALL_POS,
2385 QueryUtil.ALL_POS, null);
2386 }
2387
2388
2402 public List<DLFolder> findByP_N(long parentFolderId, String name,
2403 int start, int end) throws SystemException {
2404 return findByP_N(parentFolderId, name, start, end, null);
2405 }
2406
2407
2422 public List<DLFolder> findByP_N(long parentFolderId, String name,
2423 int start, int end, OrderByComparator orderByComparator)
2424 throws SystemException {
2425 Object[] finderArgs = new Object[] {
2426 parentFolderId, name,
2427
2428 String.valueOf(start), String.valueOf(end),
2429 String.valueOf(orderByComparator)
2430 };
2431
2432 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_P_N,
2433 finderArgs, this);
2434
2435 if (list == null) {
2436 StringBundler query = null;
2437
2438 if (orderByComparator != null) {
2439 query = new StringBundler(4 +
2440 (orderByComparator.getOrderByFields().length * 3));
2441 }
2442 else {
2443 query = new StringBundler(4);
2444 }
2445
2446 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2447
2448 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
2449
2450 if (name == null) {
2451 query.append(_FINDER_COLUMN_P_N_NAME_1);
2452 }
2453 else {
2454 if (name.equals(StringPool.BLANK)) {
2455 query.append(_FINDER_COLUMN_P_N_NAME_3);
2456 }
2457 else {
2458 query.append(_FINDER_COLUMN_P_N_NAME_2);
2459 }
2460 }
2461
2462 if (orderByComparator != null) {
2463 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2464 orderByComparator);
2465 }
2466
2467 else {
2468 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2469 }
2470
2471 String sql = query.toString();
2472
2473 Session session = null;
2474
2475 try {
2476 session = openSession();
2477
2478 Query q = session.createQuery(sql);
2479
2480 QueryPos qPos = QueryPos.getInstance(q);
2481
2482 qPos.add(parentFolderId);
2483
2484 if (name != null) {
2485 qPos.add(name);
2486 }
2487
2488 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
2489 end);
2490 }
2491 catch (Exception e) {
2492 throw processException(e);
2493 }
2494 finally {
2495 if (list == null) {
2496 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_P_N,
2497 finderArgs);
2498 }
2499 else {
2500 cacheResult(list);
2501
2502 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_P_N,
2503 finderArgs, list);
2504 }
2505
2506 closeSession(session);
2507 }
2508 }
2509
2510 return list;
2511 }
2512
2513
2527 public DLFolder findByP_N_First(long parentFolderId, String name,
2528 OrderByComparator orderByComparator)
2529 throws NoSuchFolderException, SystemException {
2530 List<DLFolder> list = findByP_N(parentFolderId, name, 0, 1,
2531 orderByComparator);
2532
2533 if (list.isEmpty()) {
2534 StringBundler msg = new StringBundler(6);
2535
2536 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2537
2538 msg.append("parentFolderId=");
2539 msg.append(parentFolderId);
2540
2541 msg.append(", name=");
2542 msg.append(name);
2543
2544 msg.append(StringPool.CLOSE_CURLY_BRACE);
2545
2546 throw new NoSuchFolderException(msg.toString());
2547 }
2548 else {
2549 return list.get(0);
2550 }
2551 }
2552
2553
2567 public DLFolder findByP_N_Last(long parentFolderId, String name,
2568 OrderByComparator orderByComparator)
2569 throws NoSuchFolderException, SystemException {
2570 int count = countByP_N(parentFolderId, name);
2571
2572 List<DLFolder> list = findByP_N(parentFolderId, name, count - 1, count,
2573 orderByComparator);
2574
2575 if (list.isEmpty()) {
2576 StringBundler msg = new StringBundler(6);
2577
2578 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2579
2580 msg.append("parentFolderId=");
2581 msg.append(parentFolderId);
2582
2583 msg.append(", name=");
2584 msg.append(name);
2585
2586 msg.append(StringPool.CLOSE_CURLY_BRACE);
2587
2588 throw new NoSuchFolderException(msg.toString());
2589 }
2590 else {
2591 return list.get(0);
2592 }
2593 }
2594
2595
2610 public DLFolder[] findByP_N_PrevAndNext(long folderId, long parentFolderId,
2611 String name, OrderByComparator orderByComparator)
2612 throws NoSuchFolderException, SystemException {
2613 DLFolder dlFolder = findByPrimaryKey(folderId);
2614
2615 Session session = null;
2616
2617 try {
2618 session = openSession();
2619
2620 DLFolder[] array = new DLFolderImpl[3];
2621
2622 array[0] = getByP_N_PrevAndNext(session, dlFolder, parentFolderId,
2623 name, orderByComparator, true);
2624
2625 array[1] = dlFolder;
2626
2627 array[2] = getByP_N_PrevAndNext(session, dlFolder, parentFolderId,
2628 name, orderByComparator, false);
2629
2630 return array;
2631 }
2632 catch (Exception e) {
2633 throw processException(e);
2634 }
2635 finally {
2636 closeSession(session);
2637 }
2638 }
2639
2640 protected DLFolder getByP_N_PrevAndNext(Session session, DLFolder dlFolder,
2641 long parentFolderId, String name, OrderByComparator orderByComparator,
2642 boolean previous) {
2643 StringBundler query = null;
2644
2645 if (orderByComparator != null) {
2646 query = new StringBundler(6 +
2647 (orderByComparator.getOrderByFields().length * 6));
2648 }
2649 else {
2650 query = new StringBundler(3);
2651 }
2652
2653 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2654
2655 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
2656
2657 if (name == null) {
2658 query.append(_FINDER_COLUMN_P_N_NAME_1);
2659 }
2660 else {
2661 if (name.equals(StringPool.BLANK)) {
2662 query.append(_FINDER_COLUMN_P_N_NAME_3);
2663 }
2664 else {
2665 query.append(_FINDER_COLUMN_P_N_NAME_2);
2666 }
2667 }
2668
2669 if (orderByComparator != null) {
2670 String[] orderByFields = orderByComparator.getOrderByFields();
2671
2672 if (orderByFields.length > 0) {
2673 query.append(WHERE_AND);
2674 }
2675
2676 for (int i = 0; i < orderByFields.length; i++) {
2677 query.append(_ORDER_BY_ENTITY_ALIAS);
2678 query.append(orderByFields[i]);
2679
2680 if ((i + 1) < orderByFields.length) {
2681 if (orderByComparator.isAscending() ^ previous) {
2682 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2683 }
2684 else {
2685 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2686 }
2687 }
2688 else {
2689 if (orderByComparator.isAscending() ^ previous) {
2690 query.append(WHERE_GREATER_THAN);
2691 }
2692 else {
2693 query.append(WHERE_LESSER_THAN);
2694 }
2695 }
2696 }
2697
2698 query.append(ORDER_BY_CLAUSE);
2699
2700 for (int i = 0; i < orderByFields.length; i++) {
2701 query.append(_ORDER_BY_ENTITY_ALIAS);
2702 query.append(orderByFields[i]);
2703
2704 if ((i + 1) < orderByFields.length) {
2705 if (orderByComparator.isAscending() ^ previous) {
2706 query.append(ORDER_BY_ASC_HAS_NEXT);
2707 }
2708 else {
2709 query.append(ORDER_BY_DESC_HAS_NEXT);
2710 }
2711 }
2712 else {
2713 if (orderByComparator.isAscending() ^ previous) {
2714 query.append(ORDER_BY_ASC);
2715 }
2716 else {
2717 query.append(ORDER_BY_DESC);
2718 }
2719 }
2720 }
2721 }
2722
2723 else {
2724 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2725 }
2726
2727 String sql = query.toString();
2728
2729 Query q = session.createQuery(sql);
2730
2731 q.setFirstResult(0);
2732 q.setMaxResults(2);
2733
2734 QueryPos qPos = QueryPos.getInstance(q);
2735
2736 qPos.add(parentFolderId);
2737
2738 if (name != null) {
2739 qPos.add(name);
2740 }
2741
2742 if (orderByComparator != null) {
2743 Object[] values = orderByComparator.getOrderByValues(dlFolder);
2744
2745 for (Object value : values) {
2746 qPos.add(value);
2747 }
2748 }
2749
2750 List<DLFolder> list = q.list();
2751
2752 if (list.size() == 2) {
2753 return list.get(1);
2754 }
2755 else {
2756 return null;
2757 }
2758 }
2759
2760
2770 public DLFolder findByG_P_N(long groupId, long parentFolderId, String name)
2771 throws NoSuchFolderException, SystemException {
2772 DLFolder dlFolder = fetchByG_P_N(groupId, parentFolderId, name);
2773
2774 if (dlFolder == null) {
2775 StringBundler msg = new StringBundler(8);
2776
2777 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2778
2779 msg.append("groupId=");
2780 msg.append(groupId);
2781
2782 msg.append(", parentFolderId=");
2783 msg.append(parentFolderId);
2784
2785 msg.append(", name=");
2786 msg.append(name);
2787
2788 msg.append(StringPool.CLOSE_CURLY_BRACE);
2789
2790 if (_log.isWarnEnabled()) {
2791 _log.warn(msg.toString());
2792 }
2793
2794 throw new NoSuchFolderException(msg.toString());
2795 }
2796
2797 return dlFolder;
2798 }
2799
2800
2809 public DLFolder fetchByG_P_N(long groupId, long parentFolderId, String name)
2810 throws SystemException {
2811 return fetchByG_P_N(groupId, parentFolderId, name, true);
2812 }
2813
2814
2823 public DLFolder fetchByG_P_N(long groupId, long parentFolderId,
2824 String name, boolean retrieveFromCache) throws SystemException {
2825 Object[] finderArgs = new Object[] { groupId, parentFolderId, name };
2826
2827 Object result = null;
2828
2829 if (retrieveFromCache) {
2830 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_P_N,
2831 finderArgs, this);
2832 }
2833
2834 if (result == null) {
2835 StringBundler query = new StringBundler(5);
2836
2837 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2838
2839 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
2840
2841 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
2842
2843 if (name == null) {
2844 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
2845 }
2846 else {
2847 if (name.equals(StringPool.BLANK)) {
2848 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
2849 }
2850 else {
2851 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
2852 }
2853 }
2854
2855 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2856
2857 String sql = query.toString();
2858
2859 Session session = null;
2860
2861 try {
2862 session = openSession();
2863
2864 Query q = session.createQuery(sql);
2865
2866 QueryPos qPos = QueryPos.getInstance(q);
2867
2868 qPos.add(groupId);
2869
2870 qPos.add(parentFolderId);
2871
2872 if (name != null) {
2873 qPos.add(name);
2874 }
2875
2876 List<DLFolder> list = q.list();
2877
2878 result = list;
2879
2880 DLFolder dlFolder = null;
2881
2882 if (list.isEmpty()) {
2883 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2884 finderArgs, list);
2885 }
2886 else {
2887 dlFolder = list.get(0);
2888
2889 cacheResult(dlFolder);
2890
2891 if ((dlFolder.getGroupId() != groupId) ||
2892 (dlFolder.getParentFolderId() != parentFolderId) ||
2893 (dlFolder.getName() == null) ||
2894 !dlFolder.getName().equals(name)) {
2895 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2896 finderArgs, dlFolder);
2897 }
2898 }
2899
2900 return dlFolder;
2901 }
2902 catch (Exception e) {
2903 throw processException(e);
2904 }
2905 finally {
2906 if (result == null) {
2907 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
2908 finderArgs);
2909 }
2910
2911 closeSession(session);
2912 }
2913 }
2914 else {
2915 if (result instanceof List<?>) {
2916 return null;
2917 }
2918 else {
2919 return (DLFolder)result;
2920 }
2921 }
2922 }
2923
2924
2930 public List<DLFolder> findAll() throws SystemException {
2931 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2932 }
2933
2934
2946 public List<DLFolder> findAll(int start, int end) throws SystemException {
2947 return findAll(start, end, null);
2948 }
2949
2950
2963 public List<DLFolder> findAll(int start, int end,
2964 OrderByComparator orderByComparator) throws SystemException {
2965 Object[] finderArgs = new Object[] {
2966 String.valueOf(start), String.valueOf(end),
2967 String.valueOf(orderByComparator)
2968 };
2969
2970 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2971 finderArgs, this);
2972
2973 if (list == null) {
2974 StringBundler query = null;
2975 String sql = null;
2976
2977 if (orderByComparator != null) {
2978 query = new StringBundler(2 +
2979 (orderByComparator.getOrderByFields().length * 3));
2980
2981 query.append(_SQL_SELECT_DLFOLDER);
2982
2983 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2984 orderByComparator);
2985
2986 sql = query.toString();
2987 }
2988 else {
2989 sql = _SQL_SELECT_DLFOLDER.concat(DLFolderModelImpl.ORDER_BY_JPQL);
2990 }
2991
2992 Session session = null;
2993
2994 try {
2995 session = openSession();
2996
2997 Query q = session.createQuery(sql);
2998
2999 if (orderByComparator == null) {
3000 list = (List<DLFolder>)QueryUtil.list(q, getDialect(),
3001 start, end, false);
3002
3003 Collections.sort(list);
3004 }
3005 else {
3006 list = (List<DLFolder>)QueryUtil.list(q, getDialect(),
3007 start, end);
3008 }
3009 }
3010 catch (Exception e) {
3011 throw processException(e);
3012 }
3013 finally {
3014 if (list == null) {
3015 FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
3016 finderArgs);
3017 }
3018 else {
3019 cacheResult(list);
3020
3021 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
3022 list);
3023 }
3024
3025 closeSession(session);
3026 }
3027 }
3028
3029 return list;
3030 }
3031
3032
3038 public void removeByUuid(String uuid) throws SystemException {
3039 for (DLFolder dlFolder : findByUuid(uuid)) {
3040 remove(dlFolder);
3041 }
3042 }
3043
3044
3051 public void removeByUUID_G(String uuid, long groupId)
3052 throws NoSuchFolderException, SystemException {
3053 DLFolder dlFolder = findByUUID_G(uuid, groupId);
3054
3055 remove(dlFolder);
3056 }
3057
3058
3064 public void removeByGroupId(long groupId) throws SystemException {
3065 for (DLFolder dlFolder : findByGroupId(groupId)) {
3066 remove(dlFolder);
3067 }
3068 }
3069
3070
3076 public void removeByCompanyId(long companyId) throws SystemException {
3077 for (DLFolder dlFolder : findByCompanyId(companyId)) {
3078 remove(dlFolder);
3079 }
3080 }
3081
3082
3089 public void removeByG_P(long groupId, long parentFolderId)
3090 throws SystemException {
3091 for (DLFolder dlFolder : findByG_P(groupId, parentFolderId)) {
3092 remove(dlFolder);
3093 }
3094 }
3095
3096
3103 public void removeByP_N(long parentFolderId, String name)
3104 throws SystemException {
3105 for (DLFolder dlFolder : findByP_N(parentFolderId, name)) {
3106 remove(dlFolder);
3107 }
3108 }
3109
3110
3118 public void removeByG_P_N(long groupId, long parentFolderId, String name)
3119 throws NoSuchFolderException, SystemException {
3120 DLFolder dlFolder = findByG_P_N(groupId, parentFolderId, name);
3121
3122 remove(dlFolder);
3123 }
3124
3125
3130 public void removeAll() throws SystemException {
3131 for (DLFolder dlFolder : findAll()) {
3132 remove(dlFolder);
3133 }
3134 }
3135
3136
3143 public int countByUuid(String uuid) throws SystemException {
3144 Object[] finderArgs = new Object[] { uuid };
3145
3146 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
3147 finderArgs, this);
3148
3149 if (count == null) {
3150 StringBundler query = new StringBundler(2);
3151
3152 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3153
3154 if (uuid == null) {
3155 query.append(_FINDER_COLUMN_UUID_UUID_1);
3156 }
3157 else {
3158 if (uuid.equals(StringPool.BLANK)) {
3159 query.append(_FINDER_COLUMN_UUID_UUID_3);
3160 }
3161 else {
3162 query.append(_FINDER_COLUMN_UUID_UUID_2);
3163 }
3164 }
3165
3166 String sql = query.toString();
3167
3168 Session session = null;
3169
3170 try {
3171 session = openSession();
3172
3173 Query q = session.createQuery(sql);
3174
3175 QueryPos qPos = QueryPos.getInstance(q);
3176
3177 if (uuid != null) {
3178 qPos.add(uuid);
3179 }
3180
3181 count = (Long)q.uniqueResult();
3182 }
3183 catch (Exception e) {
3184 throw processException(e);
3185 }
3186 finally {
3187 if (count == null) {
3188 count = Long.valueOf(0);
3189 }
3190
3191 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3192 finderArgs, count);
3193
3194 closeSession(session);
3195 }
3196 }
3197
3198 return count.intValue();
3199 }
3200
3201
3209 public int countByUUID_G(String uuid, long groupId)
3210 throws SystemException {
3211 Object[] finderArgs = new Object[] { uuid, groupId };
3212
3213 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
3214 finderArgs, this);
3215
3216 if (count == null) {
3217 StringBundler query = new StringBundler(3);
3218
3219 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3220
3221 if (uuid == null) {
3222 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
3223 }
3224 else {
3225 if (uuid.equals(StringPool.BLANK)) {
3226 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
3227 }
3228 else {
3229 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
3230 }
3231 }
3232
3233 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
3234
3235 String sql = query.toString();
3236
3237 Session session = null;
3238
3239 try {
3240 session = openSession();
3241
3242 Query q = session.createQuery(sql);
3243
3244 QueryPos qPos = QueryPos.getInstance(q);
3245
3246 if (uuid != null) {
3247 qPos.add(uuid);
3248 }
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_UUID_G,
3263 finderArgs, count);
3264
3265 closeSession(session);
3266 }
3267 }
3268
3269 return count.intValue();
3270 }
3271
3272
3279 public int countByGroupId(long groupId) throws SystemException {
3280 Object[] finderArgs = new Object[] { groupId };
3281
3282 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
3283 finderArgs, this);
3284
3285 if (count == null) {
3286 StringBundler query = new StringBundler(2);
3287
3288 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3289
3290 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3291
3292 String sql = query.toString();
3293
3294 Session session = null;
3295
3296 try {
3297 session = openSession();
3298
3299 Query q = session.createQuery(sql);
3300
3301 QueryPos qPos = QueryPos.getInstance(q);
3302
3303 qPos.add(groupId);
3304
3305 count = (Long)q.uniqueResult();
3306 }
3307 catch (Exception e) {
3308 throw processException(e);
3309 }
3310 finally {
3311 if (count == null) {
3312 count = Long.valueOf(0);
3313 }
3314
3315 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
3316 finderArgs, count);
3317
3318 closeSession(session);
3319 }
3320 }
3321
3322 return count.intValue();
3323 }
3324
3325
3332 public int filterCountByGroupId(long groupId) throws SystemException {
3333 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3334 return countByGroupId(groupId);
3335 }
3336
3337 StringBundler query = new StringBundler(2);
3338
3339 query.append(_FILTER_SQL_COUNT_DLFOLDER_WHERE);
3340
3341 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3342
3343 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3344 DLFolder.class.getName(), _FILTER_COLUMN_PK,
3345 _FILTER_COLUMN_USERID, groupId);
3346
3347 Session session = null;
3348
3349 try {
3350 session = openSession();
3351
3352 SQLQuery q = session.createSQLQuery(sql);
3353
3354 q.addScalar(COUNT_COLUMN_NAME,
3355 com.liferay.portal.kernel.dao.orm.Type.LONG);
3356
3357 QueryPos qPos = QueryPos.getInstance(q);
3358
3359 qPos.add(groupId);
3360
3361 Long count = (Long)q.uniqueResult();
3362
3363 return count.intValue();
3364 }
3365 catch (Exception e) {
3366 throw processException(e);
3367 }
3368 finally {
3369 closeSession(session);
3370 }
3371 }
3372
3373
3380 public int countByCompanyId(long companyId) throws SystemException {
3381 Object[] finderArgs = new Object[] { companyId };
3382
3383 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
3384 finderArgs, this);
3385
3386 if (count == null) {
3387 StringBundler query = new StringBundler(2);
3388
3389 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3390
3391 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
3392
3393 String sql = query.toString();
3394
3395 Session session = null;
3396
3397 try {
3398 session = openSession();
3399
3400 Query q = session.createQuery(sql);
3401
3402 QueryPos qPos = QueryPos.getInstance(q);
3403
3404 qPos.add(companyId);
3405
3406 count = (Long)q.uniqueResult();
3407 }
3408 catch (Exception e) {
3409 throw processException(e);
3410 }
3411 finally {
3412 if (count == null) {
3413 count = Long.valueOf(0);
3414 }
3415
3416 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
3417 finderArgs, count);
3418
3419 closeSession(session);
3420 }
3421 }
3422
3423 return count.intValue();
3424 }
3425
3426
3434 public int countByG_P(long groupId, long parentFolderId)
3435 throws SystemException {
3436 Object[] finderArgs = new Object[] { groupId, parentFolderId };
3437
3438 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P,
3439 finderArgs, this);
3440
3441 if (count == null) {
3442 StringBundler query = new StringBundler(3);
3443
3444 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3445
3446 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
3447
3448 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
3449
3450 String sql = query.toString();
3451
3452 Session session = null;
3453
3454 try {
3455 session = openSession();
3456
3457 Query q = session.createQuery(sql);
3458
3459 QueryPos qPos = QueryPos.getInstance(q);
3460
3461 qPos.add(groupId);
3462
3463 qPos.add(parentFolderId);
3464
3465 count = (Long)q.uniqueResult();
3466 }
3467 catch (Exception e) {
3468 throw processException(e);
3469 }
3470 finally {
3471 if (count == null) {
3472 count = Long.valueOf(0);
3473 }
3474
3475 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P, finderArgs,
3476 count);
3477
3478 closeSession(session);
3479 }
3480 }
3481
3482 return count.intValue();
3483 }
3484
3485
3493 public int filterCountByG_P(long groupId, long parentFolderId)
3494 throws SystemException {
3495 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3496 return countByG_P(groupId, parentFolderId);
3497 }
3498
3499 StringBundler query = new StringBundler(3);
3500
3501 query.append(_FILTER_SQL_COUNT_DLFOLDER_WHERE);
3502
3503 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
3504
3505 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
3506
3507 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3508 DLFolder.class.getName(), _FILTER_COLUMN_PK,
3509 _FILTER_COLUMN_USERID, groupId);
3510
3511 Session session = null;
3512
3513 try {
3514 session = openSession();
3515
3516 SQLQuery q = session.createSQLQuery(sql);
3517
3518 q.addScalar(COUNT_COLUMN_NAME,
3519 com.liferay.portal.kernel.dao.orm.Type.LONG);
3520
3521 QueryPos qPos = QueryPos.getInstance(q);
3522
3523 qPos.add(groupId);
3524
3525 qPos.add(parentFolderId);
3526
3527 Long count = (Long)q.uniqueResult();
3528
3529 return count.intValue();
3530 }
3531 catch (Exception e) {
3532 throw processException(e);
3533 }
3534 finally {
3535 closeSession(session);
3536 }
3537 }
3538
3539
3547 public int countByP_N(long parentFolderId, String name)
3548 throws SystemException {
3549 Object[] finderArgs = new Object[] { parentFolderId, name };
3550
3551 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_N,
3552 finderArgs, this);
3553
3554 if (count == null) {
3555 StringBundler query = new StringBundler(3);
3556
3557 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3558
3559 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
3560
3561 if (name == null) {
3562 query.append(_FINDER_COLUMN_P_N_NAME_1);
3563 }
3564 else {
3565 if (name.equals(StringPool.BLANK)) {
3566 query.append(_FINDER_COLUMN_P_N_NAME_3);
3567 }
3568 else {
3569 query.append(_FINDER_COLUMN_P_N_NAME_2);
3570 }
3571 }
3572
3573 String sql = query.toString();
3574
3575 Session session = null;
3576
3577 try {
3578 session = openSession();
3579
3580 Query q = session.createQuery(sql);
3581
3582 QueryPos qPos = QueryPos.getInstance(q);
3583
3584 qPos.add(parentFolderId);
3585
3586 if (name != null) {
3587 qPos.add(name);
3588 }
3589
3590 count = (Long)q.uniqueResult();
3591 }
3592 catch (Exception e) {
3593 throw processException(e);
3594 }
3595 finally {
3596 if (count == null) {
3597 count = Long.valueOf(0);
3598 }
3599
3600 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_N, finderArgs,
3601 count);
3602
3603 closeSession(session);
3604 }
3605 }
3606
3607 return count.intValue();
3608 }
3609
3610
3619 public int countByG_P_N(long groupId, long parentFolderId, String name)
3620 throws SystemException {
3621 Object[] finderArgs = new Object[] { groupId, parentFolderId, name };
3622
3623 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P_N,
3624 finderArgs, this);
3625
3626 if (count == null) {
3627 StringBundler query = new StringBundler(4);
3628
3629 query.append(_SQL_COUNT_DLFOLDER_WHERE);
3630
3631 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
3632
3633 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
3634
3635 if (name == null) {
3636 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
3637 }
3638 else {
3639 if (name.equals(StringPool.BLANK)) {
3640 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
3641 }
3642 else {
3643 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
3644 }
3645 }
3646
3647 String sql = query.toString();
3648
3649 Session session = null;
3650
3651 try {
3652 session = openSession();
3653
3654 Query q = session.createQuery(sql);
3655
3656 QueryPos qPos = QueryPos.getInstance(q);
3657
3658 qPos.add(groupId);
3659
3660 qPos.add(parentFolderId);
3661
3662 if (name != null) {
3663 qPos.add(name);
3664 }
3665
3666 count = (Long)q.uniqueResult();
3667 }
3668 catch (Exception e) {
3669 throw processException(e);
3670 }
3671 finally {
3672 if (count == null) {
3673 count = Long.valueOf(0);
3674 }
3675
3676 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P_N,
3677 finderArgs, count);
3678
3679 closeSession(session);
3680 }
3681 }
3682
3683 return count.intValue();
3684 }
3685
3686
3692 public int countAll() throws SystemException {
3693 Object[] finderArgs = new Object[0];
3694
3695 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3696 finderArgs, this);
3697
3698 if (count == null) {
3699 Session session = null;
3700
3701 try {
3702 session = openSession();
3703
3704 Query q = session.createQuery(_SQL_COUNT_DLFOLDER);
3705
3706 count = (Long)q.uniqueResult();
3707 }
3708 catch (Exception e) {
3709 throw processException(e);
3710 }
3711 finally {
3712 if (count == null) {
3713 count = Long.valueOf(0);
3714 }
3715
3716 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3717 count);
3718
3719 closeSession(session);
3720 }
3721 }
3722
3723 return count.intValue();
3724 }
3725
3726
3729 public void afterPropertiesSet() {
3730 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3731 com.liferay.portal.util.PropsUtil.get(
3732 "value.object.listener.com.liferay.portlet.documentlibrary.model.DLFolder")));
3733
3734 if (listenerClassNames.length > 0) {
3735 try {
3736 List<ModelListener<DLFolder>> listenersList = new ArrayList<ModelListener<DLFolder>>();
3737
3738 for (String listenerClassName : listenerClassNames) {
3739 listenersList.add((ModelListener<DLFolder>)InstanceFactory.newInstance(
3740 listenerClassName));
3741 }
3742
3743 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3744 }
3745 catch (Exception e) {
3746 _log.error(e);
3747 }
3748 }
3749 }
3750
3751 public void destroy() {
3752 EntityCacheUtil.removeCache(DLFolderImpl.class.getName());
3753 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3754 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
3755 }
3756
3757 @BeanReference(type = DLFileEntryPersistence.class)
3758 protected DLFileEntryPersistence dlFileEntryPersistence;
3759 @BeanReference(type = DLFileRankPersistence.class)
3760 protected DLFileRankPersistence dlFileRankPersistence;
3761 @BeanReference(type = DLFileShortcutPersistence.class)
3762 protected DLFileShortcutPersistence dlFileShortcutPersistence;
3763 @BeanReference(type = DLFileVersionPersistence.class)
3764 protected DLFileVersionPersistence dlFileVersionPersistence;
3765 @BeanReference(type = DLFolderPersistence.class)
3766 protected DLFolderPersistence dlFolderPersistence;
3767 @BeanReference(type = GroupPersistence.class)
3768 protected GroupPersistence groupPersistence;
3769 @BeanReference(type = LayoutPersistence.class)
3770 protected LayoutPersistence layoutPersistence;
3771 @BeanReference(type = LockPersistence.class)
3772 protected LockPersistence lockPersistence;
3773 @BeanReference(type = ResourcePersistence.class)
3774 protected ResourcePersistence resourcePersistence;
3775 @BeanReference(type = UserPersistence.class)
3776 protected UserPersistence userPersistence;
3777 @BeanReference(type = WebDAVPropsPersistence.class)
3778 protected WebDAVPropsPersistence webDAVPropsPersistence;
3779 @BeanReference(type = ExpandoValuePersistence.class)
3780 protected ExpandoValuePersistence expandoValuePersistence;
3781 private static final String _SQL_SELECT_DLFOLDER = "SELECT dlFolder FROM DLFolder dlFolder";
3782 private static final String _SQL_SELECT_DLFOLDER_WHERE = "SELECT dlFolder FROM DLFolder dlFolder WHERE ";
3783 private static final String _SQL_COUNT_DLFOLDER = "SELECT COUNT(dlFolder) FROM DLFolder dlFolder";
3784 private static final String _SQL_COUNT_DLFOLDER_WHERE = "SELECT COUNT(dlFolder) FROM DLFolder dlFolder WHERE ";
3785 private static final String _FINDER_COLUMN_UUID_UUID_1 = "dlFolder.uuid IS NULL";
3786 private static final String _FINDER_COLUMN_UUID_UUID_2 = "dlFolder.uuid = ?";
3787 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(dlFolder.uuid IS NULL OR dlFolder.uuid = ?)";
3788 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "dlFolder.uuid IS NULL AND ";
3789 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "dlFolder.uuid = ? AND ";
3790 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(dlFolder.uuid IS NULL OR dlFolder.uuid = ?) AND ";
3791 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "dlFolder.groupId = ?";
3792 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "dlFolder.groupId = ?";
3793 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "dlFolder.companyId = ?";
3794 private static final String _FINDER_COLUMN_G_P_GROUPID_2 = "dlFolder.groupId = ? AND ";
3795 private static final String _FINDER_COLUMN_G_P_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ?";
3796 private static final String _FINDER_COLUMN_P_N_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ? AND ";
3797 private static final String _FINDER_COLUMN_P_N_NAME_1 = "dlFolder.name IS NULL";
3798 private static final String _FINDER_COLUMN_P_N_NAME_2 = "dlFolder.name = ?";
3799 private static final String _FINDER_COLUMN_P_N_NAME_3 = "(dlFolder.name IS NULL OR dlFolder.name = ?)";
3800 private static final String _FINDER_COLUMN_G_P_N_GROUPID_2 = "dlFolder.groupId = ? AND ";
3801 private static final String _FINDER_COLUMN_G_P_N_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ? AND ";
3802 private static final String _FINDER_COLUMN_G_P_N_NAME_1 = "dlFolder.name IS NULL";
3803 private static final String _FINDER_COLUMN_G_P_N_NAME_2 = "dlFolder.name = ?";
3804 private static final String _FINDER_COLUMN_G_P_N_NAME_3 = "(dlFolder.name IS NULL OR dlFolder.name = ?)";
3805 private static final String _FILTER_SQL_SELECT_DLFOLDER_WHERE = "SELECT DISTINCT {dlFolder.*} FROM DLFolder dlFolder WHERE ";
3806 private static final String _FILTER_SQL_SELECT_DLFOLDER_NO_INLINE_DISTINCT_WHERE_1 =
3807 "SELECT {DLFolder.*} FROM (SELECT DISTINCT dlFolder.folderId FROM DLFolder dlFolder WHERE ";
3808 private static final String _FILTER_SQL_SELECT_DLFOLDER_NO_INLINE_DISTINCT_WHERE_2 =
3809 ") TEMP_TABLE INNER JOIN DLFolder ON TEMP_TABLE.folderId = DLFolder.folderId";
3810 private static final String _FILTER_SQL_COUNT_DLFOLDER_WHERE = "SELECT COUNT(DISTINCT dlFolder.folderId) AS COUNT_VALUE FROM DLFolder dlFolder WHERE ";
3811 private static final String _FILTER_COLUMN_PK = "dlFolder.folderId";
3812 private static final String _FILTER_COLUMN_USERID = "dlFolder.userId";
3813 private static final String _FILTER_ENTITY_ALIAS = "dlFolder";
3814 private static final String _FILTER_ENTITY_TABLE = "DLFolder";
3815 private static final String _ORDER_BY_ENTITY_ALIAS = "dlFolder.";
3816 private static final String _ORDER_BY_ENTITY_TABLE = "DLFolder.";
3817 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DLFolder exists with the primary key ";
3818 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DLFolder exists with the key {";
3819 private static Log _log = LogFactoryUtil.getLog(DLFolderPersistenceImpl.class);
3820 }