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
068 public class DLFolderPersistenceImpl extends BasePersistenceImpl<DLFolder>
069 implements DLFolderPersistence {
070 public static final String FINDER_CLASS_NAME_ENTITY = DLFolderImpl.class.getName();
071 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
072 ".List";
073 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
074 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
075 "findByUuid",
076 new String[] {
077 String.class.getName(),
078
079 "java.lang.Integer", "java.lang.Integer",
080 "com.liferay.portal.kernel.util.OrderByComparator"
081 });
082 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
083 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
084 "countByUuid", new String[] { String.class.getName() });
085 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
086 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
087 "fetchByUUID_G",
088 new String[] { String.class.getName(), Long.class.getName() });
089 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
090 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
091 "countByUUID_G",
092 new String[] { String.class.getName(), Long.class.getName() });
093 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
094 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
095 "findByGroupId",
096 new String[] {
097 Long.class.getName(),
098
099 "java.lang.Integer", "java.lang.Integer",
100 "com.liferay.portal.kernel.util.OrderByComparator"
101 });
102 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
103 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
104 "countByGroupId", new String[] { Long.class.getName() });
105 public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
106 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
107 "findByCompanyId",
108 new String[] {
109 Long.class.getName(),
110
111 "java.lang.Integer", "java.lang.Integer",
112 "com.liferay.portal.kernel.util.OrderByComparator"
113 });
114 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
115 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
116 "countByCompanyId", new String[] { Long.class.getName() });
117 public static final FinderPath FINDER_PATH_FIND_BY_G_P = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
118 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
119 "findByG_P",
120 new String[] {
121 Long.class.getName(), Long.class.getName(),
122
123 "java.lang.Integer", "java.lang.Integer",
124 "com.liferay.portal.kernel.util.OrderByComparator"
125 });
126 public static final FinderPath FINDER_PATH_COUNT_BY_G_P = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
127 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
128 "countByG_P",
129 new String[] { Long.class.getName(), Long.class.getName() });
130 public static final FinderPath FINDER_PATH_FIND_BY_P_N = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
131 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
132 "findByP_N",
133 new String[] {
134 Long.class.getName(), String.class.getName(),
135
136 "java.lang.Integer", "java.lang.Integer",
137 "com.liferay.portal.kernel.util.OrderByComparator"
138 });
139 public static final FinderPath FINDER_PATH_COUNT_BY_P_N = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
140 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
141 "countByP_N",
142 new String[] { Long.class.getName(), String.class.getName() });
143 public static final FinderPath FINDER_PATH_FETCH_BY_G_P_N = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
144 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
145 "fetchByG_P_N",
146 new String[] {
147 Long.class.getName(), Long.class.getName(),
148 String.class.getName()
149 });
150 public static final FinderPath FINDER_PATH_COUNT_BY_G_P_N = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
151 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
152 "countByG_P_N",
153 new String[] {
154 Long.class.getName(), Long.class.getName(),
155 String.class.getName()
156 });
157 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
158 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
159 "findAll", new String[0]);
160 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
161 DLFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
162 "countAll", new String[0]);
163
164 public void cacheResult(DLFolder dlFolder) {
165 EntityCacheUtil.putResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
166 DLFolderImpl.class, dlFolder.getPrimaryKey(), dlFolder);
167
168 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
169 new Object[] { dlFolder.getUuid(), new Long(dlFolder.getGroupId()) },
170 dlFolder);
171
172 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
173 new Object[] {
174 new Long(dlFolder.getGroupId()),
175 new Long(dlFolder.getParentFolderId()),
176
177 dlFolder.getName()
178 }, dlFolder);
179 }
180
181 public void cacheResult(List<DLFolder> dlFolders) {
182 for (DLFolder dlFolder : dlFolders) {
183 if (EntityCacheUtil.getResult(
184 DLFolderModelImpl.ENTITY_CACHE_ENABLED,
185 DLFolderImpl.class, dlFolder.getPrimaryKey(), this) == null) {
186 cacheResult(dlFolder);
187 }
188 }
189 }
190
191 public void clearCache() {
192 CacheRegistryUtil.clear(DLFolderImpl.class.getName());
193 EntityCacheUtil.clearCache(DLFolderImpl.class.getName());
194 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
195 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
196 }
197
198 public void clearCache(DLFolder dlFolder) {
199 EntityCacheUtil.removeResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
200 DLFolderImpl.class, dlFolder.getPrimaryKey());
201
202 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
203 new Object[] { dlFolder.getUuid(), new Long(dlFolder.getGroupId()) });
204
205 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
206 new Object[] {
207 new Long(dlFolder.getGroupId()),
208 new Long(dlFolder.getParentFolderId()),
209
210 dlFolder.getName()
211 });
212 }
213
214 public DLFolder create(long folderId) {
215 DLFolder dlFolder = new DLFolderImpl();
216
217 dlFolder.setNew(true);
218 dlFolder.setPrimaryKey(folderId);
219
220 String uuid = PortalUUIDUtil.generate();
221
222 dlFolder.setUuid(uuid);
223
224 return dlFolder;
225 }
226
227 public DLFolder remove(Serializable primaryKey)
228 throws NoSuchModelException, SystemException {
229 return remove(((Long)primaryKey).longValue());
230 }
231
232 public DLFolder remove(long folderId)
233 throws NoSuchFolderException, SystemException {
234 Session session = null;
235
236 try {
237 session = openSession();
238
239 DLFolder dlFolder = (DLFolder)session.get(DLFolderImpl.class,
240 new Long(folderId));
241
242 if (dlFolder == null) {
243 if (_log.isWarnEnabled()) {
244 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + folderId);
245 }
246
247 throw new NoSuchFolderException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
248 folderId);
249 }
250
251 return remove(dlFolder);
252 }
253 catch (NoSuchFolderException nsee) {
254 throw nsee;
255 }
256 catch (Exception e) {
257 throw processException(e);
258 }
259 finally {
260 closeSession(session);
261 }
262 }
263
264 protected DLFolder removeImpl(DLFolder dlFolder) throws SystemException {
265 dlFolder = toUnwrappedModel(dlFolder);
266
267 Session session = null;
268
269 try {
270 session = openSession();
271
272 if (dlFolder.isCachedModel() || BatchSessionUtil.isEnabled()) {
273 Object staleObject = session.get(DLFolderImpl.class,
274 dlFolder.getPrimaryKeyObj());
275
276 if (staleObject != null) {
277 session.evict(staleObject);
278 }
279 }
280
281 session.delete(dlFolder);
282
283 session.flush();
284 }
285 catch (Exception e) {
286 throw processException(e);
287 }
288 finally {
289 closeSession(session);
290 }
291
292 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
293
294 DLFolderModelImpl dlFolderModelImpl = (DLFolderModelImpl)dlFolder;
295
296 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
297 new Object[] {
298 dlFolderModelImpl.getOriginalUuid(),
299 new Long(dlFolderModelImpl.getOriginalGroupId())
300 });
301
302 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
303 new Object[] {
304 new Long(dlFolderModelImpl.getOriginalGroupId()),
305 new Long(dlFolderModelImpl.getOriginalParentFolderId()),
306
307 dlFolderModelImpl.getOriginalName()
308 });
309
310 EntityCacheUtil.removeResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
311 DLFolderImpl.class, dlFolder.getPrimaryKey());
312
313 return dlFolder;
314 }
315
316 public DLFolder updateImpl(
317 com.liferay.portlet.documentlibrary.model.DLFolder dlFolder,
318 boolean merge) throws SystemException {
319 dlFolder = toUnwrappedModel(dlFolder);
320
321 boolean isNew = dlFolder.isNew();
322
323 DLFolderModelImpl dlFolderModelImpl = (DLFolderModelImpl)dlFolder;
324
325 if (Validator.isNull(dlFolder.getUuid())) {
326 String uuid = PortalUUIDUtil.generate();
327
328 dlFolder.setUuid(uuid);
329 }
330
331 Session session = null;
332
333 try {
334 session = openSession();
335
336 BatchSessionUtil.update(session, dlFolder, merge);
337
338 dlFolder.setNew(false);
339 }
340 catch (Exception e) {
341 throw processException(e);
342 }
343 finally {
344 closeSession(session);
345 }
346
347 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
348
349 EntityCacheUtil.putResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
350 DLFolderImpl.class, dlFolder.getPrimaryKey(), dlFolder);
351
352 if (!isNew &&
353 (!Validator.equals(dlFolder.getUuid(),
354 dlFolderModelImpl.getOriginalUuid()) ||
355 (dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()))) {
356 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
357 new Object[] {
358 dlFolderModelImpl.getOriginalUuid(),
359 new Long(dlFolderModelImpl.getOriginalGroupId())
360 });
361 }
362
363 if (isNew ||
364 (!Validator.equals(dlFolder.getUuid(),
365 dlFolderModelImpl.getOriginalUuid()) ||
366 (dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()))) {
367 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
368 new Object[] { dlFolder.getUuid(), new Long(
369 dlFolder.getGroupId()) }, dlFolder);
370 }
371
372 if (!isNew &&
373 ((dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()) ||
374 (dlFolder.getParentFolderId() != dlFolderModelImpl.getOriginalParentFolderId()) ||
375 !Validator.equals(dlFolder.getName(),
376 dlFolderModelImpl.getOriginalName()))) {
377 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
378 new Object[] {
379 new Long(dlFolderModelImpl.getOriginalGroupId()),
380 new Long(dlFolderModelImpl.getOriginalParentFolderId()),
381
382 dlFolderModelImpl.getOriginalName()
383 });
384 }
385
386 if (isNew ||
387 ((dlFolder.getGroupId() != dlFolderModelImpl.getOriginalGroupId()) ||
388 (dlFolder.getParentFolderId() != dlFolderModelImpl.getOriginalParentFolderId()) ||
389 !Validator.equals(dlFolder.getName(),
390 dlFolderModelImpl.getOriginalName()))) {
391 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
392 new Object[] {
393 new Long(dlFolder.getGroupId()),
394 new Long(dlFolder.getParentFolderId()),
395
396 dlFolder.getName()
397 }, dlFolder);
398 }
399
400 return dlFolder;
401 }
402
403 protected DLFolder toUnwrappedModel(DLFolder dlFolder) {
404 if (dlFolder instanceof DLFolderImpl) {
405 return dlFolder;
406 }
407
408 DLFolderImpl dlFolderImpl = new DLFolderImpl();
409
410 dlFolderImpl.setNew(dlFolder.isNew());
411 dlFolderImpl.setPrimaryKey(dlFolder.getPrimaryKey());
412
413 dlFolderImpl.setUuid(dlFolder.getUuid());
414 dlFolderImpl.setFolderId(dlFolder.getFolderId());
415 dlFolderImpl.setGroupId(dlFolder.getGroupId());
416 dlFolderImpl.setCompanyId(dlFolder.getCompanyId());
417 dlFolderImpl.setUserId(dlFolder.getUserId());
418 dlFolderImpl.setUserName(dlFolder.getUserName());
419 dlFolderImpl.setCreateDate(dlFolder.getCreateDate());
420 dlFolderImpl.setModifiedDate(dlFolder.getModifiedDate());
421 dlFolderImpl.setParentFolderId(dlFolder.getParentFolderId());
422 dlFolderImpl.setName(dlFolder.getName());
423 dlFolderImpl.setDescription(dlFolder.getDescription());
424 dlFolderImpl.setLastPostDate(dlFolder.getLastPostDate());
425
426 return dlFolderImpl;
427 }
428
429 public DLFolder findByPrimaryKey(Serializable primaryKey)
430 throws NoSuchModelException, SystemException {
431 return findByPrimaryKey(((Long)primaryKey).longValue());
432 }
433
434 public DLFolder findByPrimaryKey(long folderId)
435 throws NoSuchFolderException, SystemException {
436 DLFolder dlFolder = fetchByPrimaryKey(folderId);
437
438 if (dlFolder == null) {
439 if (_log.isWarnEnabled()) {
440 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + folderId);
441 }
442
443 throw new NoSuchFolderException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
444 folderId);
445 }
446
447 return dlFolder;
448 }
449
450 public DLFolder fetchByPrimaryKey(Serializable primaryKey)
451 throws SystemException {
452 return fetchByPrimaryKey(((Long)primaryKey).longValue());
453 }
454
455 public DLFolder fetchByPrimaryKey(long folderId) throws SystemException {
456 DLFolder dlFolder = (DLFolder)EntityCacheUtil.getResult(DLFolderModelImpl.ENTITY_CACHE_ENABLED,
457 DLFolderImpl.class, folderId, this);
458
459 if (dlFolder == null) {
460 Session session = null;
461
462 try {
463 session = openSession();
464
465 dlFolder = (DLFolder)session.get(DLFolderImpl.class,
466 new Long(folderId));
467 }
468 catch (Exception e) {
469 throw processException(e);
470 }
471 finally {
472 if (dlFolder != null) {
473 cacheResult(dlFolder);
474 }
475
476 closeSession(session);
477 }
478 }
479
480 return dlFolder;
481 }
482
483 public List<DLFolder> findByUuid(String uuid) throws SystemException {
484 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
485 }
486
487 public List<DLFolder> findByUuid(String uuid, int start, int end)
488 throws SystemException {
489 return findByUuid(uuid, start, end, null);
490 }
491
492 public List<DLFolder> findByUuid(String uuid, int start, int end,
493 OrderByComparator orderByComparator) throws SystemException {
494 Object[] finderArgs = new Object[] {
495 uuid,
496
497 String.valueOf(start), String.valueOf(end),
498 String.valueOf(orderByComparator)
499 };
500
501 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
502 finderArgs, this);
503
504 if (list == null) {
505 Session session = null;
506
507 try {
508 session = openSession();
509
510 StringBundler query = null;
511
512 if (orderByComparator != null) {
513 query = new StringBundler(3 +
514 (orderByComparator.getOrderByFields().length * 3));
515 }
516 else {
517 query = new StringBundler(3);
518 }
519
520 query.append(_SQL_SELECT_DLFOLDER_WHERE);
521
522 if (uuid == null) {
523 query.append(_FINDER_COLUMN_UUID_UUID_1);
524 }
525 else {
526 if (uuid.equals(StringPool.BLANK)) {
527 query.append(_FINDER_COLUMN_UUID_UUID_3);
528 }
529 else {
530 query.append(_FINDER_COLUMN_UUID_UUID_2);
531 }
532 }
533
534 if (orderByComparator != null) {
535 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
536 orderByComparator);
537 }
538
539 else {
540 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
541 }
542
543 String sql = query.toString();
544
545 Query q = session.createQuery(sql);
546
547 QueryPos qPos = QueryPos.getInstance(q);
548
549 if (uuid != null) {
550 qPos.add(uuid);
551 }
552
553 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
554 end);
555 }
556 catch (Exception e) {
557 throw processException(e);
558 }
559 finally {
560 if (list == null) {
561 list = new ArrayList<DLFolder>();
562 }
563
564 cacheResult(list);
565
566 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
567 list);
568
569 closeSession(session);
570 }
571 }
572
573 return list;
574 }
575
576 public DLFolder findByUuid_First(String uuid,
577 OrderByComparator orderByComparator)
578 throws NoSuchFolderException, SystemException {
579 List<DLFolder> list = findByUuid(uuid, 0, 1, orderByComparator);
580
581 if (list.isEmpty()) {
582 StringBundler msg = new StringBundler(4);
583
584 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
585
586 msg.append("uuid=");
587 msg.append(uuid);
588
589 msg.append(StringPool.CLOSE_CURLY_BRACE);
590
591 throw new NoSuchFolderException(msg.toString());
592 }
593 else {
594 return list.get(0);
595 }
596 }
597
598 public DLFolder findByUuid_Last(String uuid,
599 OrderByComparator orderByComparator)
600 throws NoSuchFolderException, SystemException {
601 int count = countByUuid(uuid);
602
603 List<DLFolder> list = findByUuid(uuid, count - 1, count,
604 orderByComparator);
605
606 if (list.isEmpty()) {
607 StringBundler msg = new StringBundler(4);
608
609 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
610
611 msg.append("uuid=");
612 msg.append(uuid);
613
614 msg.append(StringPool.CLOSE_CURLY_BRACE);
615
616 throw new NoSuchFolderException(msg.toString());
617 }
618 else {
619 return list.get(0);
620 }
621 }
622
623 public DLFolder[] findByUuid_PrevAndNext(long folderId, String uuid,
624 OrderByComparator orderByComparator)
625 throws NoSuchFolderException, SystemException {
626 DLFolder dlFolder = findByPrimaryKey(folderId);
627
628 Session session = null;
629
630 try {
631 session = openSession();
632
633 DLFolder[] array = new DLFolderImpl[3];
634
635 array[0] = getByUuid_PrevAndNext(session, dlFolder, uuid,
636 orderByComparator, true);
637
638 array[1] = dlFolder;
639
640 array[2] = getByUuid_PrevAndNext(session, dlFolder, uuid,
641 orderByComparator, false);
642
643 return array;
644 }
645 catch (Exception e) {
646 throw processException(e);
647 }
648 finally {
649 closeSession(session);
650 }
651 }
652
653 protected DLFolder getByUuid_PrevAndNext(Session session,
654 DLFolder dlFolder, String uuid, OrderByComparator orderByComparator,
655 boolean previous) {
656 StringBundler query = null;
657
658 if (orderByComparator != null) {
659 query = new StringBundler(6 +
660 (orderByComparator.getOrderByFields().length * 6));
661 }
662 else {
663 query = new StringBundler(3);
664 }
665
666 query.append(_SQL_SELECT_DLFOLDER_WHERE);
667
668 if (uuid == null) {
669 query.append(_FINDER_COLUMN_UUID_UUID_1);
670 }
671 else {
672 if (uuid.equals(StringPool.BLANK)) {
673 query.append(_FINDER_COLUMN_UUID_UUID_3);
674 }
675 else {
676 query.append(_FINDER_COLUMN_UUID_UUID_2);
677 }
678 }
679
680 if (orderByComparator != null) {
681 String[] orderByFields = orderByComparator.getOrderByFields();
682
683 if (orderByFields.length > 0) {
684 query.append(WHERE_AND);
685 }
686
687 for (int i = 0; i < orderByFields.length; i++) {
688 query.append(_ORDER_BY_ENTITY_ALIAS);
689 query.append(orderByFields[i]);
690
691 if ((i + 1) < orderByFields.length) {
692 if (orderByComparator.isAscending() ^ previous) {
693 query.append(WHERE_GREATER_THAN_HAS_NEXT);
694 }
695 else {
696 query.append(WHERE_LESSER_THAN_HAS_NEXT);
697 }
698 }
699 else {
700 if (orderByComparator.isAscending() ^ previous) {
701 query.append(WHERE_GREATER_THAN);
702 }
703 else {
704 query.append(WHERE_LESSER_THAN);
705 }
706 }
707 }
708
709 query.append(ORDER_BY_CLAUSE);
710
711 for (int i = 0; i < orderByFields.length; i++) {
712 query.append(_ORDER_BY_ENTITY_ALIAS);
713 query.append(orderByFields[i]);
714
715 if ((i + 1) < orderByFields.length) {
716 if (orderByComparator.isAscending() ^ previous) {
717 query.append(ORDER_BY_ASC_HAS_NEXT);
718 }
719 else {
720 query.append(ORDER_BY_DESC_HAS_NEXT);
721 }
722 }
723 else {
724 if (orderByComparator.isAscending() ^ previous) {
725 query.append(ORDER_BY_ASC);
726 }
727 else {
728 query.append(ORDER_BY_DESC);
729 }
730 }
731 }
732 }
733
734 else {
735 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
736 }
737
738 String sql = query.toString();
739
740 Query q = session.createQuery(sql);
741
742 q.setFirstResult(0);
743 q.setMaxResults(2);
744
745 QueryPos qPos = QueryPos.getInstance(q);
746
747 if (uuid != null) {
748 qPos.add(uuid);
749 }
750
751 if (orderByComparator != null) {
752 Object[] values = orderByComparator.getOrderByValues(dlFolder);
753
754 for (Object value : values) {
755 qPos.add(value);
756 }
757 }
758
759 List<DLFolder> list = q.list();
760
761 if (list.size() == 2) {
762 return list.get(1);
763 }
764 else {
765 return null;
766 }
767 }
768
769 public DLFolder findByUUID_G(String uuid, long groupId)
770 throws NoSuchFolderException, SystemException {
771 DLFolder dlFolder = fetchByUUID_G(uuid, groupId);
772
773 if (dlFolder == null) {
774 StringBundler msg = new StringBundler(6);
775
776 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
777
778 msg.append("uuid=");
779 msg.append(uuid);
780
781 msg.append(", groupId=");
782 msg.append(groupId);
783
784 msg.append(StringPool.CLOSE_CURLY_BRACE);
785
786 if (_log.isWarnEnabled()) {
787 _log.warn(msg.toString());
788 }
789
790 throw new NoSuchFolderException(msg.toString());
791 }
792
793 return dlFolder;
794 }
795
796 public DLFolder fetchByUUID_G(String uuid, long groupId)
797 throws SystemException {
798 return fetchByUUID_G(uuid, groupId, true);
799 }
800
801 public DLFolder fetchByUUID_G(String uuid, long groupId,
802 boolean retrieveFromCache) throws SystemException {
803 Object[] finderArgs = new Object[] { uuid, groupId };
804
805 Object result = null;
806
807 if (retrieveFromCache) {
808 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
809 finderArgs, this);
810 }
811
812 if (result == null) {
813 Session session = null;
814
815 try {
816 session = openSession();
817
818 StringBundler query = new StringBundler(4);
819
820 query.append(_SQL_SELECT_DLFOLDER_WHERE);
821
822 if (uuid == null) {
823 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
824 }
825 else {
826 if (uuid.equals(StringPool.BLANK)) {
827 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
828 }
829 else {
830 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
831 }
832 }
833
834 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
835
836 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
837
838 String sql = query.toString();
839
840 Query q = session.createQuery(sql);
841
842 QueryPos qPos = QueryPos.getInstance(q);
843
844 if (uuid != null) {
845 qPos.add(uuid);
846 }
847
848 qPos.add(groupId);
849
850 List<DLFolder> list = q.list();
851
852 result = list;
853
854 DLFolder dlFolder = null;
855
856 if (list.isEmpty()) {
857 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
858 finderArgs, list);
859 }
860 else {
861 dlFolder = list.get(0);
862
863 cacheResult(dlFolder);
864
865 if ((dlFolder.getUuid() == null) ||
866 !dlFolder.getUuid().equals(uuid) ||
867 (dlFolder.getGroupId() != groupId)) {
868 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
869 finderArgs, dlFolder);
870 }
871 }
872
873 return dlFolder;
874 }
875 catch (Exception e) {
876 throw processException(e);
877 }
878 finally {
879 if (result == null) {
880 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
881 finderArgs, new ArrayList<DLFolder>());
882 }
883
884 closeSession(session);
885 }
886 }
887 else {
888 if (result instanceof List<?>) {
889 return null;
890 }
891 else {
892 return (DLFolder)result;
893 }
894 }
895 }
896
897 public List<DLFolder> findByGroupId(long groupId) throws SystemException {
898 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
899 }
900
901 public List<DLFolder> findByGroupId(long groupId, int start, int end)
902 throws SystemException {
903 return findByGroupId(groupId, start, end, null);
904 }
905
906 public List<DLFolder> findByGroupId(long groupId, int start, int end,
907 OrderByComparator orderByComparator) throws SystemException {
908 Object[] finderArgs = new Object[] {
909 groupId,
910
911 String.valueOf(start), String.valueOf(end),
912 String.valueOf(orderByComparator)
913 };
914
915 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
916 finderArgs, this);
917
918 if (list == null) {
919 Session session = null;
920
921 try {
922 session = openSession();
923
924 StringBundler query = null;
925
926 if (orderByComparator != null) {
927 query = new StringBundler(3 +
928 (orderByComparator.getOrderByFields().length * 3));
929 }
930 else {
931 query = new StringBundler(3);
932 }
933
934 query.append(_SQL_SELECT_DLFOLDER_WHERE);
935
936 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
937
938 if (orderByComparator != null) {
939 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
940 orderByComparator);
941 }
942
943 else {
944 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
945 }
946
947 String sql = query.toString();
948
949 Query q = session.createQuery(sql);
950
951 QueryPos qPos = QueryPos.getInstance(q);
952
953 qPos.add(groupId);
954
955 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
956 end);
957 }
958 catch (Exception e) {
959 throw processException(e);
960 }
961 finally {
962 if (list == null) {
963 list = new ArrayList<DLFolder>();
964 }
965
966 cacheResult(list);
967
968 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
969 finderArgs, list);
970
971 closeSession(session);
972 }
973 }
974
975 return list;
976 }
977
978 public DLFolder findByGroupId_First(long groupId,
979 OrderByComparator orderByComparator)
980 throws NoSuchFolderException, SystemException {
981 List<DLFolder> list = findByGroupId(groupId, 0, 1, orderByComparator);
982
983 if (list.isEmpty()) {
984 StringBundler msg = new StringBundler(4);
985
986 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
987
988 msg.append("groupId=");
989 msg.append(groupId);
990
991 msg.append(StringPool.CLOSE_CURLY_BRACE);
992
993 throw new NoSuchFolderException(msg.toString());
994 }
995 else {
996 return list.get(0);
997 }
998 }
999
1000 public DLFolder findByGroupId_Last(long groupId,
1001 OrderByComparator orderByComparator)
1002 throws NoSuchFolderException, SystemException {
1003 int count = countByGroupId(groupId);
1004
1005 List<DLFolder> list = findByGroupId(groupId, count - 1, count,
1006 orderByComparator);
1007
1008 if (list.isEmpty()) {
1009 StringBundler msg = new StringBundler(4);
1010
1011 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1012
1013 msg.append("groupId=");
1014 msg.append(groupId);
1015
1016 msg.append(StringPool.CLOSE_CURLY_BRACE);
1017
1018 throw new NoSuchFolderException(msg.toString());
1019 }
1020 else {
1021 return list.get(0);
1022 }
1023 }
1024
1025 public DLFolder[] findByGroupId_PrevAndNext(long folderId, long groupId,
1026 OrderByComparator orderByComparator)
1027 throws NoSuchFolderException, SystemException {
1028 DLFolder dlFolder = findByPrimaryKey(folderId);
1029
1030 Session session = null;
1031
1032 try {
1033 session = openSession();
1034
1035 DLFolder[] array = new DLFolderImpl[3];
1036
1037 array[0] = getByGroupId_PrevAndNext(session, dlFolder, groupId,
1038 orderByComparator, true);
1039
1040 array[1] = dlFolder;
1041
1042 array[2] = getByGroupId_PrevAndNext(session, dlFolder, groupId,
1043 orderByComparator, false);
1044
1045 return array;
1046 }
1047 catch (Exception e) {
1048 throw processException(e);
1049 }
1050 finally {
1051 closeSession(session);
1052 }
1053 }
1054
1055 protected DLFolder getByGroupId_PrevAndNext(Session session,
1056 DLFolder dlFolder, long groupId, OrderByComparator orderByComparator,
1057 boolean previous) {
1058 StringBundler query = null;
1059
1060 if (orderByComparator != null) {
1061 query = new StringBundler(6 +
1062 (orderByComparator.getOrderByFields().length * 6));
1063 }
1064 else {
1065 query = new StringBundler(3);
1066 }
1067
1068 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1069
1070 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1071
1072 if (orderByComparator != null) {
1073 String[] orderByFields = orderByComparator.getOrderByFields();
1074
1075 if (orderByFields.length > 0) {
1076 query.append(WHERE_AND);
1077 }
1078
1079 for (int i = 0; i < orderByFields.length; i++) {
1080 query.append(_ORDER_BY_ENTITY_ALIAS);
1081 query.append(orderByFields[i]);
1082
1083 if ((i + 1) < orderByFields.length) {
1084 if (orderByComparator.isAscending() ^ previous) {
1085 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1086 }
1087 else {
1088 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1089 }
1090 }
1091 else {
1092 if (orderByComparator.isAscending() ^ previous) {
1093 query.append(WHERE_GREATER_THAN);
1094 }
1095 else {
1096 query.append(WHERE_LESSER_THAN);
1097 }
1098 }
1099 }
1100
1101 query.append(ORDER_BY_CLAUSE);
1102
1103 for (int i = 0; i < orderByFields.length; i++) {
1104 query.append(_ORDER_BY_ENTITY_ALIAS);
1105 query.append(orderByFields[i]);
1106
1107 if ((i + 1) < orderByFields.length) {
1108 if (orderByComparator.isAscending() ^ previous) {
1109 query.append(ORDER_BY_ASC_HAS_NEXT);
1110 }
1111 else {
1112 query.append(ORDER_BY_DESC_HAS_NEXT);
1113 }
1114 }
1115 else {
1116 if (orderByComparator.isAscending() ^ previous) {
1117 query.append(ORDER_BY_ASC);
1118 }
1119 else {
1120 query.append(ORDER_BY_DESC);
1121 }
1122 }
1123 }
1124 }
1125
1126 else {
1127 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1128 }
1129
1130 String sql = query.toString();
1131
1132 Query q = session.createQuery(sql);
1133
1134 q.setFirstResult(0);
1135 q.setMaxResults(2);
1136
1137 QueryPos qPos = QueryPos.getInstance(q);
1138
1139 qPos.add(groupId);
1140
1141 if (orderByComparator != null) {
1142 Object[] values = orderByComparator.getOrderByValues(dlFolder);
1143
1144 for (Object value : values) {
1145 qPos.add(value);
1146 }
1147 }
1148
1149 List<DLFolder> list = q.list();
1150
1151 if (list.size() == 2) {
1152 return list.get(1);
1153 }
1154 else {
1155 return null;
1156 }
1157 }
1158
1159 public List<DLFolder> filterFindByGroupId(long groupId)
1160 throws SystemException {
1161 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1162 QueryUtil.ALL_POS, null);
1163 }
1164
1165 public List<DLFolder> filterFindByGroupId(long groupId, int start, int end)
1166 throws SystemException {
1167 return filterFindByGroupId(groupId, start, end, null);
1168 }
1169
1170 public List<DLFolder> filterFindByGroupId(long groupId, int start, int end,
1171 OrderByComparator orderByComparator) throws SystemException {
1172 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1173 return findByGroupId(groupId, start, end, orderByComparator);
1174 }
1175
1176 Session session = null;
1177
1178 try {
1179 session = openSession();
1180
1181 StringBundler query = null;
1182
1183 if (orderByComparator != null) {
1184 query = new StringBundler(3 +
1185 (orderByComparator.getOrderByFields().length * 3));
1186 }
1187 else {
1188 query = new StringBundler(3);
1189 }
1190
1191 query.append(_FILTER_SQL_SELECT_DLFOLDER_WHERE);
1192
1193 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1194
1195 if (orderByComparator != null) {
1196 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1197 orderByComparator);
1198 }
1199
1200 else {
1201 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1202 }
1203
1204 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1205 DLFolder.class.getName(), _FILTER_COLUMN_PK,
1206 _FILTER_COLUMN_USERID, groupId);
1207
1208 SQLQuery q = session.createSQLQuery(sql);
1209
1210 q.addEntity(_FILTER_ENTITY_ALIAS, DLFolderImpl.class);
1211
1212 QueryPos qPos = QueryPos.getInstance(q);
1213
1214 qPos.add(groupId);
1215
1216 return (List<DLFolder>)QueryUtil.list(q, getDialect(), start, end);
1217 }
1218 catch (Exception e) {
1219 throw processException(e);
1220 }
1221 finally {
1222 closeSession(session);
1223 }
1224 }
1225
1226 public List<DLFolder> findByCompanyId(long companyId)
1227 throws SystemException {
1228 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1229 null);
1230 }
1231
1232 public List<DLFolder> findByCompanyId(long companyId, int start, int end)
1233 throws SystemException {
1234 return findByCompanyId(companyId, start, end, null);
1235 }
1236
1237 public List<DLFolder> findByCompanyId(long companyId, int start, int end,
1238 OrderByComparator orderByComparator) throws SystemException {
1239 Object[] finderArgs = new Object[] {
1240 companyId,
1241
1242 String.valueOf(start), String.valueOf(end),
1243 String.valueOf(orderByComparator)
1244 };
1245
1246 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1247 finderArgs, this);
1248
1249 if (list == null) {
1250 Session session = null;
1251
1252 try {
1253 session = openSession();
1254
1255 StringBundler query = null;
1256
1257 if (orderByComparator != null) {
1258 query = new StringBundler(3 +
1259 (orderByComparator.getOrderByFields().length * 3));
1260 }
1261 else {
1262 query = new StringBundler(3);
1263 }
1264
1265 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1266
1267 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1268
1269 if (orderByComparator != null) {
1270 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1271 orderByComparator);
1272 }
1273
1274 else {
1275 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1276 }
1277
1278 String sql = query.toString();
1279
1280 Query q = session.createQuery(sql);
1281
1282 QueryPos qPos = QueryPos.getInstance(q);
1283
1284 qPos.add(companyId);
1285
1286 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1287 end);
1288 }
1289 catch (Exception e) {
1290 throw processException(e);
1291 }
1292 finally {
1293 if (list == null) {
1294 list = new ArrayList<DLFolder>();
1295 }
1296
1297 cacheResult(list);
1298
1299 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1300 finderArgs, list);
1301
1302 closeSession(session);
1303 }
1304 }
1305
1306 return list;
1307 }
1308
1309 public DLFolder findByCompanyId_First(long companyId,
1310 OrderByComparator orderByComparator)
1311 throws NoSuchFolderException, SystemException {
1312 List<DLFolder> list = findByCompanyId(companyId, 0, 1, orderByComparator);
1313
1314 if (list.isEmpty()) {
1315 StringBundler msg = new StringBundler(4);
1316
1317 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1318
1319 msg.append("companyId=");
1320 msg.append(companyId);
1321
1322 msg.append(StringPool.CLOSE_CURLY_BRACE);
1323
1324 throw new NoSuchFolderException(msg.toString());
1325 }
1326 else {
1327 return list.get(0);
1328 }
1329 }
1330
1331 public DLFolder findByCompanyId_Last(long companyId,
1332 OrderByComparator orderByComparator)
1333 throws NoSuchFolderException, SystemException {
1334 int count = countByCompanyId(companyId);
1335
1336 List<DLFolder> list = findByCompanyId(companyId, count - 1, count,
1337 orderByComparator);
1338
1339 if (list.isEmpty()) {
1340 StringBundler msg = new StringBundler(4);
1341
1342 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1343
1344 msg.append("companyId=");
1345 msg.append(companyId);
1346
1347 msg.append(StringPool.CLOSE_CURLY_BRACE);
1348
1349 throw new NoSuchFolderException(msg.toString());
1350 }
1351 else {
1352 return list.get(0);
1353 }
1354 }
1355
1356 public DLFolder[] findByCompanyId_PrevAndNext(long folderId,
1357 long companyId, OrderByComparator orderByComparator)
1358 throws NoSuchFolderException, SystemException {
1359 DLFolder dlFolder = findByPrimaryKey(folderId);
1360
1361 Session session = null;
1362
1363 try {
1364 session = openSession();
1365
1366 DLFolder[] array = new DLFolderImpl[3];
1367
1368 array[0] = getByCompanyId_PrevAndNext(session, dlFolder, companyId,
1369 orderByComparator, true);
1370
1371 array[1] = dlFolder;
1372
1373 array[2] = getByCompanyId_PrevAndNext(session, dlFolder, companyId,
1374 orderByComparator, false);
1375
1376 return array;
1377 }
1378 catch (Exception e) {
1379 throw processException(e);
1380 }
1381 finally {
1382 closeSession(session);
1383 }
1384 }
1385
1386 protected DLFolder getByCompanyId_PrevAndNext(Session session,
1387 DLFolder dlFolder, long companyId, OrderByComparator orderByComparator,
1388 boolean previous) {
1389 StringBundler query = null;
1390
1391 if (orderByComparator != null) {
1392 query = new StringBundler(6 +
1393 (orderByComparator.getOrderByFields().length * 6));
1394 }
1395 else {
1396 query = new StringBundler(3);
1397 }
1398
1399 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1400
1401 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1402
1403 if (orderByComparator != null) {
1404 String[] orderByFields = orderByComparator.getOrderByFields();
1405
1406 if (orderByFields.length > 0) {
1407 query.append(WHERE_AND);
1408 }
1409
1410 for (int i = 0; i < orderByFields.length; i++) {
1411 query.append(_ORDER_BY_ENTITY_ALIAS);
1412 query.append(orderByFields[i]);
1413
1414 if ((i + 1) < orderByFields.length) {
1415 if (orderByComparator.isAscending() ^ previous) {
1416 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1417 }
1418 else {
1419 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1420 }
1421 }
1422 else {
1423 if (orderByComparator.isAscending() ^ previous) {
1424 query.append(WHERE_GREATER_THAN);
1425 }
1426 else {
1427 query.append(WHERE_LESSER_THAN);
1428 }
1429 }
1430 }
1431
1432 query.append(ORDER_BY_CLAUSE);
1433
1434 for (int i = 0; i < orderByFields.length; i++) {
1435 query.append(_ORDER_BY_ENTITY_ALIAS);
1436 query.append(orderByFields[i]);
1437
1438 if ((i + 1) < orderByFields.length) {
1439 if (orderByComparator.isAscending() ^ previous) {
1440 query.append(ORDER_BY_ASC_HAS_NEXT);
1441 }
1442 else {
1443 query.append(ORDER_BY_DESC_HAS_NEXT);
1444 }
1445 }
1446 else {
1447 if (orderByComparator.isAscending() ^ previous) {
1448 query.append(ORDER_BY_ASC);
1449 }
1450 else {
1451 query.append(ORDER_BY_DESC);
1452 }
1453 }
1454 }
1455 }
1456
1457 else {
1458 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1459 }
1460
1461 String sql = query.toString();
1462
1463 Query q = session.createQuery(sql);
1464
1465 q.setFirstResult(0);
1466 q.setMaxResults(2);
1467
1468 QueryPos qPos = QueryPos.getInstance(q);
1469
1470 qPos.add(companyId);
1471
1472 if (orderByComparator != null) {
1473 Object[] values = orderByComparator.getOrderByValues(dlFolder);
1474
1475 for (Object value : values) {
1476 qPos.add(value);
1477 }
1478 }
1479
1480 List<DLFolder> list = q.list();
1481
1482 if (list.size() == 2) {
1483 return list.get(1);
1484 }
1485 else {
1486 return null;
1487 }
1488 }
1489
1490 public List<DLFolder> findByG_P(long groupId, long parentFolderId)
1491 throws SystemException {
1492 return findByG_P(groupId, parentFolderId, QueryUtil.ALL_POS,
1493 QueryUtil.ALL_POS, null);
1494 }
1495
1496 public List<DLFolder> findByG_P(long groupId, long parentFolderId,
1497 int start, int end) throws SystemException {
1498 return findByG_P(groupId, parentFolderId, start, end, null);
1499 }
1500
1501 public List<DLFolder> findByG_P(long groupId, long parentFolderId,
1502 int start, int end, OrderByComparator orderByComparator)
1503 throws SystemException {
1504 Object[] finderArgs = new Object[] {
1505 groupId, parentFolderId,
1506
1507 String.valueOf(start), String.valueOf(end),
1508 String.valueOf(orderByComparator)
1509 };
1510
1511 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_P,
1512 finderArgs, this);
1513
1514 if (list == null) {
1515 Session session = null;
1516
1517 try {
1518 session = openSession();
1519
1520 StringBundler query = null;
1521
1522 if (orderByComparator != null) {
1523 query = new StringBundler(4 +
1524 (orderByComparator.getOrderByFields().length * 3));
1525 }
1526 else {
1527 query = new StringBundler(4);
1528 }
1529
1530 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1531
1532 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1533
1534 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
1535
1536 if (orderByComparator != null) {
1537 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1538 orderByComparator);
1539 }
1540
1541 else {
1542 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1543 }
1544
1545 String sql = query.toString();
1546
1547 Query q = session.createQuery(sql);
1548
1549 QueryPos qPos = QueryPos.getInstance(q);
1550
1551 qPos.add(groupId);
1552
1553 qPos.add(parentFolderId);
1554
1555 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1556 end);
1557 }
1558 catch (Exception e) {
1559 throw processException(e);
1560 }
1561 finally {
1562 if (list == null) {
1563 list = new ArrayList<DLFolder>();
1564 }
1565
1566 cacheResult(list);
1567
1568 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_P, finderArgs,
1569 list);
1570
1571 closeSession(session);
1572 }
1573 }
1574
1575 return list;
1576 }
1577
1578 public DLFolder findByG_P_First(long groupId, long parentFolderId,
1579 OrderByComparator orderByComparator)
1580 throws NoSuchFolderException, SystemException {
1581 List<DLFolder> list = findByG_P(groupId, parentFolderId, 0, 1,
1582 orderByComparator);
1583
1584 if (list.isEmpty()) {
1585 StringBundler msg = new StringBundler(6);
1586
1587 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1588
1589 msg.append("groupId=");
1590 msg.append(groupId);
1591
1592 msg.append(", parentFolderId=");
1593 msg.append(parentFolderId);
1594
1595 msg.append(StringPool.CLOSE_CURLY_BRACE);
1596
1597 throw new NoSuchFolderException(msg.toString());
1598 }
1599 else {
1600 return list.get(0);
1601 }
1602 }
1603
1604 public DLFolder findByG_P_Last(long groupId, long parentFolderId,
1605 OrderByComparator orderByComparator)
1606 throws NoSuchFolderException, SystemException {
1607 int count = countByG_P(groupId, parentFolderId);
1608
1609 List<DLFolder> list = findByG_P(groupId, parentFolderId, count - 1,
1610 count, orderByComparator);
1611
1612 if (list.isEmpty()) {
1613 StringBundler msg = new StringBundler(6);
1614
1615 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1616
1617 msg.append("groupId=");
1618 msg.append(groupId);
1619
1620 msg.append(", parentFolderId=");
1621 msg.append(parentFolderId);
1622
1623 msg.append(StringPool.CLOSE_CURLY_BRACE);
1624
1625 throw new NoSuchFolderException(msg.toString());
1626 }
1627 else {
1628 return list.get(0);
1629 }
1630 }
1631
1632 public DLFolder[] findByG_P_PrevAndNext(long folderId, long groupId,
1633 long parentFolderId, OrderByComparator orderByComparator)
1634 throws NoSuchFolderException, SystemException {
1635 DLFolder dlFolder = findByPrimaryKey(folderId);
1636
1637 Session session = null;
1638
1639 try {
1640 session = openSession();
1641
1642 DLFolder[] array = new DLFolderImpl[3];
1643
1644 array[0] = getByG_P_PrevAndNext(session, dlFolder, groupId,
1645 parentFolderId, orderByComparator, true);
1646
1647 array[1] = dlFolder;
1648
1649 array[2] = getByG_P_PrevAndNext(session, dlFolder, groupId,
1650 parentFolderId, orderByComparator, false);
1651
1652 return array;
1653 }
1654 catch (Exception e) {
1655 throw processException(e);
1656 }
1657 finally {
1658 closeSession(session);
1659 }
1660 }
1661
1662 protected DLFolder getByG_P_PrevAndNext(Session session, DLFolder dlFolder,
1663 long groupId, long parentFolderId, OrderByComparator orderByComparator,
1664 boolean previous) {
1665 StringBundler query = null;
1666
1667 if (orderByComparator != null) {
1668 query = new StringBundler(6 +
1669 (orderByComparator.getOrderByFields().length * 6));
1670 }
1671 else {
1672 query = new StringBundler(3);
1673 }
1674
1675 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1676
1677 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1678
1679 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
1680
1681 if (orderByComparator != null) {
1682 String[] orderByFields = orderByComparator.getOrderByFields();
1683
1684 if (orderByFields.length > 0) {
1685 query.append(WHERE_AND);
1686 }
1687
1688 for (int i = 0; i < orderByFields.length; i++) {
1689 query.append(_ORDER_BY_ENTITY_ALIAS);
1690 query.append(orderByFields[i]);
1691
1692 if ((i + 1) < orderByFields.length) {
1693 if (orderByComparator.isAscending() ^ previous) {
1694 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1695 }
1696 else {
1697 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1698 }
1699 }
1700 else {
1701 if (orderByComparator.isAscending() ^ previous) {
1702 query.append(WHERE_GREATER_THAN);
1703 }
1704 else {
1705 query.append(WHERE_LESSER_THAN);
1706 }
1707 }
1708 }
1709
1710 query.append(ORDER_BY_CLAUSE);
1711
1712 for (int i = 0; i < orderByFields.length; i++) {
1713 query.append(_ORDER_BY_ENTITY_ALIAS);
1714 query.append(orderByFields[i]);
1715
1716 if ((i + 1) < orderByFields.length) {
1717 if (orderByComparator.isAscending() ^ previous) {
1718 query.append(ORDER_BY_ASC_HAS_NEXT);
1719 }
1720 else {
1721 query.append(ORDER_BY_DESC_HAS_NEXT);
1722 }
1723 }
1724 else {
1725 if (orderByComparator.isAscending() ^ previous) {
1726 query.append(ORDER_BY_ASC);
1727 }
1728 else {
1729 query.append(ORDER_BY_DESC);
1730 }
1731 }
1732 }
1733 }
1734
1735 else {
1736 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1737 }
1738
1739 String sql = query.toString();
1740
1741 Query q = session.createQuery(sql);
1742
1743 q.setFirstResult(0);
1744 q.setMaxResults(2);
1745
1746 QueryPos qPos = QueryPos.getInstance(q);
1747
1748 qPos.add(groupId);
1749
1750 qPos.add(parentFolderId);
1751
1752 if (orderByComparator != null) {
1753 Object[] values = orderByComparator.getOrderByValues(dlFolder);
1754
1755 for (Object value : values) {
1756 qPos.add(value);
1757 }
1758 }
1759
1760 List<DLFolder> list = q.list();
1761
1762 if (list.size() == 2) {
1763 return list.get(1);
1764 }
1765 else {
1766 return null;
1767 }
1768 }
1769
1770 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId)
1771 throws SystemException {
1772 return filterFindByG_P(groupId, parentFolderId, QueryUtil.ALL_POS,
1773 QueryUtil.ALL_POS, null);
1774 }
1775
1776 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId,
1777 int start, int end) throws SystemException {
1778 return filterFindByG_P(groupId, parentFolderId, start, end, null);
1779 }
1780
1781 public List<DLFolder> filterFindByG_P(long groupId, long parentFolderId,
1782 int start, int end, OrderByComparator orderByComparator)
1783 throws SystemException {
1784 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1785 return findByG_P(groupId, parentFolderId, start, end,
1786 orderByComparator);
1787 }
1788
1789 Session session = null;
1790
1791 try {
1792 session = openSession();
1793
1794 StringBundler query = null;
1795
1796 if (orderByComparator != null) {
1797 query = new StringBundler(4 +
1798 (orderByComparator.getOrderByFields().length * 3));
1799 }
1800 else {
1801 query = new StringBundler(4);
1802 }
1803
1804 query.append(_FILTER_SQL_SELECT_DLFOLDER_WHERE);
1805
1806 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1807
1808 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
1809
1810 if (orderByComparator != null) {
1811 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1812 orderByComparator);
1813 }
1814
1815 else {
1816 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1817 }
1818
1819 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1820 DLFolder.class.getName(), _FILTER_COLUMN_PK,
1821 _FILTER_COLUMN_USERID, groupId);
1822
1823 SQLQuery q = session.createSQLQuery(sql);
1824
1825 q.addEntity(_FILTER_ENTITY_ALIAS, DLFolderImpl.class);
1826
1827 QueryPos qPos = QueryPos.getInstance(q);
1828
1829 qPos.add(groupId);
1830
1831 qPos.add(parentFolderId);
1832
1833 return (List<DLFolder>)QueryUtil.list(q, getDialect(), start, end);
1834 }
1835 catch (Exception e) {
1836 throw processException(e);
1837 }
1838 finally {
1839 closeSession(session);
1840 }
1841 }
1842
1843 public List<DLFolder> findByP_N(long parentFolderId, String name)
1844 throws SystemException {
1845 return findByP_N(parentFolderId, name, QueryUtil.ALL_POS,
1846 QueryUtil.ALL_POS, null);
1847 }
1848
1849 public List<DLFolder> findByP_N(long parentFolderId, String name,
1850 int start, int end) throws SystemException {
1851 return findByP_N(parentFolderId, name, start, end, null);
1852 }
1853
1854 public List<DLFolder> findByP_N(long parentFolderId, String name,
1855 int start, int end, OrderByComparator orderByComparator)
1856 throws SystemException {
1857 Object[] finderArgs = new Object[] {
1858 parentFolderId, name,
1859
1860 String.valueOf(start), String.valueOf(end),
1861 String.valueOf(orderByComparator)
1862 };
1863
1864 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_P_N,
1865 finderArgs, this);
1866
1867 if (list == null) {
1868 Session session = null;
1869
1870 try {
1871 session = openSession();
1872
1873 StringBundler query = null;
1874
1875 if (orderByComparator != null) {
1876 query = new StringBundler(4 +
1877 (orderByComparator.getOrderByFields().length * 3));
1878 }
1879 else {
1880 query = new StringBundler(4);
1881 }
1882
1883 query.append(_SQL_SELECT_DLFOLDER_WHERE);
1884
1885 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
1886
1887 if (name == null) {
1888 query.append(_FINDER_COLUMN_P_N_NAME_1);
1889 }
1890 else {
1891 if (name.equals(StringPool.BLANK)) {
1892 query.append(_FINDER_COLUMN_P_N_NAME_3);
1893 }
1894 else {
1895 query.append(_FINDER_COLUMN_P_N_NAME_2);
1896 }
1897 }
1898
1899 if (orderByComparator != null) {
1900 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1901 orderByComparator);
1902 }
1903
1904 else {
1905 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
1906 }
1907
1908 String sql = query.toString();
1909
1910 Query q = session.createQuery(sql);
1911
1912 QueryPos qPos = QueryPos.getInstance(q);
1913
1914 qPos.add(parentFolderId);
1915
1916 if (name != null) {
1917 qPos.add(name);
1918 }
1919
1920 list = (List<DLFolder>)QueryUtil.list(q, getDialect(), start,
1921 end);
1922 }
1923 catch (Exception e) {
1924 throw processException(e);
1925 }
1926 finally {
1927 if (list == null) {
1928 list = new ArrayList<DLFolder>();
1929 }
1930
1931 cacheResult(list);
1932
1933 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_P_N, finderArgs,
1934 list);
1935
1936 closeSession(session);
1937 }
1938 }
1939
1940 return list;
1941 }
1942
1943 public DLFolder findByP_N_First(long parentFolderId, String name,
1944 OrderByComparator orderByComparator)
1945 throws NoSuchFolderException, SystemException {
1946 List<DLFolder> list = findByP_N(parentFolderId, name, 0, 1,
1947 orderByComparator);
1948
1949 if (list.isEmpty()) {
1950 StringBundler msg = new StringBundler(6);
1951
1952 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1953
1954 msg.append("parentFolderId=");
1955 msg.append(parentFolderId);
1956
1957 msg.append(", name=");
1958 msg.append(name);
1959
1960 msg.append(StringPool.CLOSE_CURLY_BRACE);
1961
1962 throw new NoSuchFolderException(msg.toString());
1963 }
1964 else {
1965 return list.get(0);
1966 }
1967 }
1968
1969 public DLFolder findByP_N_Last(long parentFolderId, String name,
1970 OrderByComparator orderByComparator)
1971 throws NoSuchFolderException, SystemException {
1972 int count = countByP_N(parentFolderId, name);
1973
1974 List<DLFolder> list = findByP_N(parentFolderId, name, count - 1, count,
1975 orderByComparator);
1976
1977 if (list.isEmpty()) {
1978 StringBundler msg = new StringBundler(6);
1979
1980 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1981
1982 msg.append("parentFolderId=");
1983 msg.append(parentFolderId);
1984
1985 msg.append(", name=");
1986 msg.append(name);
1987
1988 msg.append(StringPool.CLOSE_CURLY_BRACE);
1989
1990 throw new NoSuchFolderException(msg.toString());
1991 }
1992 else {
1993 return list.get(0);
1994 }
1995 }
1996
1997 public DLFolder[] findByP_N_PrevAndNext(long folderId, long parentFolderId,
1998 String name, OrderByComparator orderByComparator)
1999 throws NoSuchFolderException, SystemException {
2000 DLFolder dlFolder = findByPrimaryKey(folderId);
2001
2002 Session session = null;
2003
2004 try {
2005 session = openSession();
2006
2007 DLFolder[] array = new DLFolderImpl[3];
2008
2009 array[0] = getByP_N_PrevAndNext(session, dlFolder, parentFolderId,
2010 name, orderByComparator, true);
2011
2012 array[1] = dlFolder;
2013
2014 array[2] = getByP_N_PrevAndNext(session, dlFolder, parentFolderId,
2015 name, orderByComparator, false);
2016
2017 return array;
2018 }
2019 catch (Exception e) {
2020 throw processException(e);
2021 }
2022 finally {
2023 closeSession(session);
2024 }
2025 }
2026
2027 protected DLFolder getByP_N_PrevAndNext(Session session, DLFolder dlFolder,
2028 long parentFolderId, String name, OrderByComparator orderByComparator,
2029 boolean previous) {
2030 StringBundler query = null;
2031
2032 if (orderByComparator != null) {
2033 query = new StringBundler(6 +
2034 (orderByComparator.getOrderByFields().length * 6));
2035 }
2036 else {
2037 query = new StringBundler(3);
2038 }
2039
2040 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2041
2042 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
2043
2044 if (name == null) {
2045 query.append(_FINDER_COLUMN_P_N_NAME_1);
2046 }
2047 else {
2048 if (name.equals(StringPool.BLANK)) {
2049 query.append(_FINDER_COLUMN_P_N_NAME_3);
2050 }
2051 else {
2052 query.append(_FINDER_COLUMN_P_N_NAME_2);
2053 }
2054 }
2055
2056 if (orderByComparator != null) {
2057 String[] orderByFields = orderByComparator.getOrderByFields();
2058
2059 if (orderByFields.length > 0) {
2060 query.append(WHERE_AND);
2061 }
2062
2063 for (int i = 0; i < orderByFields.length; i++) {
2064 query.append(_ORDER_BY_ENTITY_ALIAS);
2065 query.append(orderByFields[i]);
2066
2067 if ((i + 1) < orderByFields.length) {
2068 if (orderByComparator.isAscending() ^ previous) {
2069 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2070 }
2071 else {
2072 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2073 }
2074 }
2075 else {
2076 if (orderByComparator.isAscending() ^ previous) {
2077 query.append(WHERE_GREATER_THAN);
2078 }
2079 else {
2080 query.append(WHERE_LESSER_THAN);
2081 }
2082 }
2083 }
2084
2085 query.append(ORDER_BY_CLAUSE);
2086
2087 for (int i = 0; i < orderByFields.length; i++) {
2088 query.append(_ORDER_BY_ENTITY_ALIAS);
2089 query.append(orderByFields[i]);
2090
2091 if ((i + 1) < orderByFields.length) {
2092 if (orderByComparator.isAscending() ^ previous) {
2093 query.append(ORDER_BY_ASC_HAS_NEXT);
2094 }
2095 else {
2096 query.append(ORDER_BY_DESC_HAS_NEXT);
2097 }
2098 }
2099 else {
2100 if (orderByComparator.isAscending() ^ previous) {
2101 query.append(ORDER_BY_ASC);
2102 }
2103 else {
2104 query.append(ORDER_BY_DESC);
2105 }
2106 }
2107 }
2108 }
2109
2110 else {
2111 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2112 }
2113
2114 String sql = query.toString();
2115
2116 Query q = session.createQuery(sql);
2117
2118 q.setFirstResult(0);
2119 q.setMaxResults(2);
2120
2121 QueryPos qPos = QueryPos.getInstance(q);
2122
2123 qPos.add(parentFolderId);
2124
2125 if (name != null) {
2126 qPos.add(name);
2127 }
2128
2129 if (orderByComparator != null) {
2130 Object[] values = orderByComparator.getOrderByValues(dlFolder);
2131
2132 for (Object value : values) {
2133 qPos.add(value);
2134 }
2135 }
2136
2137 List<DLFolder> list = q.list();
2138
2139 if (list.size() == 2) {
2140 return list.get(1);
2141 }
2142 else {
2143 return null;
2144 }
2145 }
2146
2147 public DLFolder findByG_P_N(long groupId, long parentFolderId, String name)
2148 throws NoSuchFolderException, SystemException {
2149 DLFolder dlFolder = fetchByG_P_N(groupId, parentFolderId, name);
2150
2151 if (dlFolder == null) {
2152 StringBundler msg = new StringBundler(8);
2153
2154 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2155
2156 msg.append("groupId=");
2157 msg.append(groupId);
2158
2159 msg.append(", parentFolderId=");
2160 msg.append(parentFolderId);
2161
2162 msg.append(", name=");
2163 msg.append(name);
2164
2165 msg.append(StringPool.CLOSE_CURLY_BRACE);
2166
2167 if (_log.isWarnEnabled()) {
2168 _log.warn(msg.toString());
2169 }
2170
2171 throw new NoSuchFolderException(msg.toString());
2172 }
2173
2174 return dlFolder;
2175 }
2176
2177 public DLFolder fetchByG_P_N(long groupId, long parentFolderId, String name)
2178 throws SystemException {
2179 return fetchByG_P_N(groupId, parentFolderId, name, true);
2180 }
2181
2182 public DLFolder fetchByG_P_N(long groupId, long parentFolderId,
2183 String name, boolean retrieveFromCache) throws SystemException {
2184 Object[] finderArgs = new Object[] { groupId, parentFolderId, name };
2185
2186 Object result = null;
2187
2188 if (retrieveFromCache) {
2189 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_P_N,
2190 finderArgs, this);
2191 }
2192
2193 if (result == null) {
2194 Session session = null;
2195
2196 try {
2197 session = openSession();
2198
2199 StringBundler query = new StringBundler(5);
2200
2201 query.append(_SQL_SELECT_DLFOLDER_WHERE);
2202
2203 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
2204
2205 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
2206
2207 if (name == null) {
2208 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
2209 }
2210 else {
2211 if (name.equals(StringPool.BLANK)) {
2212 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
2213 }
2214 else {
2215 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
2216 }
2217 }
2218
2219 query.append(DLFolderModelImpl.ORDER_BY_JPQL);
2220
2221 String sql = query.toString();
2222
2223 Query q = session.createQuery(sql);
2224
2225 QueryPos qPos = QueryPos.getInstance(q);
2226
2227 qPos.add(groupId);
2228
2229 qPos.add(parentFolderId);
2230
2231 if (name != null) {
2232 qPos.add(name);
2233 }
2234
2235 List<DLFolder> list = q.list();
2236
2237 result = list;
2238
2239 DLFolder dlFolder = null;
2240
2241 if (list.isEmpty()) {
2242 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2243 finderArgs, list);
2244 }
2245 else {
2246 dlFolder = list.get(0);
2247
2248 cacheResult(dlFolder);
2249
2250 if ((dlFolder.getGroupId() != groupId) ||
2251 (dlFolder.getParentFolderId() != parentFolderId) ||
2252 (dlFolder.getName() == null) ||
2253 !dlFolder.getName().equals(name)) {
2254 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2255 finderArgs, dlFolder);
2256 }
2257 }
2258
2259 return dlFolder;
2260 }
2261 catch (Exception e) {
2262 throw processException(e);
2263 }
2264 finally {
2265 if (result == null) {
2266 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2267 finderArgs, new ArrayList<DLFolder>());
2268 }
2269
2270 closeSession(session);
2271 }
2272 }
2273 else {
2274 if (result instanceof List<?>) {
2275 return null;
2276 }
2277 else {
2278 return (DLFolder)result;
2279 }
2280 }
2281 }
2282
2283 public List<DLFolder> findAll() throws SystemException {
2284 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2285 }
2286
2287 public List<DLFolder> findAll(int start, int end) throws SystemException {
2288 return findAll(start, end, null);
2289 }
2290
2291 public List<DLFolder> findAll(int start, int end,
2292 OrderByComparator orderByComparator) throws SystemException {
2293 Object[] finderArgs = new Object[] {
2294 String.valueOf(start), String.valueOf(end),
2295 String.valueOf(orderByComparator)
2296 };
2297
2298 List<DLFolder> list = (List<DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2299 finderArgs, this);
2300
2301 if (list == null) {
2302 Session session = null;
2303
2304 try {
2305 session = openSession();
2306
2307 StringBundler query = null;
2308 String sql = null;
2309
2310 if (orderByComparator != null) {
2311 query = new StringBundler(2 +
2312 (orderByComparator.getOrderByFields().length * 3));
2313
2314 query.append(_SQL_SELECT_DLFOLDER);
2315
2316 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2317 orderByComparator);
2318
2319 sql = query.toString();
2320 }
2321 else {
2322 sql = _SQL_SELECT_DLFOLDER.concat(DLFolderModelImpl.ORDER_BY_JPQL);
2323 }
2324
2325 Query q = session.createQuery(sql);
2326
2327 if (orderByComparator == null) {
2328 list = (List<DLFolder>)QueryUtil.list(q, getDialect(),
2329 start, end, false);
2330
2331 Collections.sort(list);
2332 }
2333 else {
2334 list = (List<DLFolder>)QueryUtil.list(q, getDialect(),
2335 start, end);
2336 }
2337 }
2338 catch (Exception e) {
2339 throw processException(e);
2340 }
2341 finally {
2342 if (list == null) {
2343 list = new ArrayList<DLFolder>();
2344 }
2345
2346 cacheResult(list);
2347
2348 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2349
2350 closeSession(session);
2351 }
2352 }
2353
2354 return list;
2355 }
2356
2357 public void removeByUuid(String uuid) throws SystemException {
2358 for (DLFolder dlFolder : findByUuid(uuid)) {
2359 remove(dlFolder);
2360 }
2361 }
2362
2363 public void removeByUUID_G(String uuid, long groupId)
2364 throws NoSuchFolderException, SystemException {
2365 DLFolder dlFolder = findByUUID_G(uuid, groupId);
2366
2367 remove(dlFolder);
2368 }
2369
2370 public void removeByGroupId(long groupId) throws SystemException {
2371 for (DLFolder dlFolder : findByGroupId(groupId)) {
2372 remove(dlFolder);
2373 }
2374 }
2375
2376 public void removeByCompanyId(long companyId) throws SystemException {
2377 for (DLFolder dlFolder : findByCompanyId(companyId)) {
2378 remove(dlFolder);
2379 }
2380 }
2381
2382 public void removeByG_P(long groupId, long parentFolderId)
2383 throws SystemException {
2384 for (DLFolder dlFolder : findByG_P(groupId, parentFolderId)) {
2385 remove(dlFolder);
2386 }
2387 }
2388
2389 public void removeByP_N(long parentFolderId, String name)
2390 throws SystemException {
2391 for (DLFolder dlFolder : findByP_N(parentFolderId, name)) {
2392 remove(dlFolder);
2393 }
2394 }
2395
2396 public void removeByG_P_N(long groupId, long parentFolderId, String name)
2397 throws NoSuchFolderException, SystemException {
2398 DLFolder dlFolder = findByG_P_N(groupId, parentFolderId, name);
2399
2400 remove(dlFolder);
2401 }
2402
2403 public void removeAll() throws SystemException {
2404 for (DLFolder dlFolder : findAll()) {
2405 remove(dlFolder);
2406 }
2407 }
2408
2409 public int countByUuid(String uuid) throws SystemException {
2410 Object[] finderArgs = new Object[] { uuid };
2411
2412 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2413 finderArgs, this);
2414
2415 if (count == null) {
2416 Session session = null;
2417
2418 try {
2419 session = openSession();
2420
2421 StringBundler query = new StringBundler(2);
2422
2423 query.append(_SQL_COUNT_DLFOLDER_WHERE);
2424
2425 if (uuid == null) {
2426 query.append(_FINDER_COLUMN_UUID_UUID_1);
2427 }
2428 else {
2429 if (uuid.equals(StringPool.BLANK)) {
2430 query.append(_FINDER_COLUMN_UUID_UUID_3);
2431 }
2432 else {
2433 query.append(_FINDER_COLUMN_UUID_UUID_2);
2434 }
2435 }
2436
2437 String sql = query.toString();
2438
2439 Query q = session.createQuery(sql);
2440
2441 QueryPos qPos = QueryPos.getInstance(q);
2442
2443 if (uuid != null) {
2444 qPos.add(uuid);
2445 }
2446
2447 count = (Long)q.uniqueResult();
2448 }
2449 catch (Exception e) {
2450 throw processException(e);
2451 }
2452 finally {
2453 if (count == null) {
2454 count = Long.valueOf(0);
2455 }
2456
2457 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2458 finderArgs, count);
2459
2460 closeSession(session);
2461 }
2462 }
2463
2464 return count.intValue();
2465 }
2466
2467 public int countByUUID_G(String uuid, long groupId)
2468 throws SystemException {
2469 Object[] finderArgs = new Object[] { uuid, groupId };
2470
2471 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2472 finderArgs, this);
2473
2474 if (count == null) {
2475 Session session = null;
2476
2477 try {
2478 session = openSession();
2479
2480 StringBundler query = new StringBundler(3);
2481
2482 query.append(_SQL_COUNT_DLFOLDER_WHERE);
2483
2484 if (uuid == null) {
2485 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2486 }
2487 else {
2488 if (uuid.equals(StringPool.BLANK)) {
2489 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2490 }
2491 else {
2492 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2493 }
2494 }
2495
2496 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2497
2498 String sql = query.toString();
2499
2500 Query q = session.createQuery(sql);
2501
2502 QueryPos qPos = QueryPos.getInstance(q);
2503
2504 if (uuid != null) {
2505 qPos.add(uuid);
2506 }
2507
2508 qPos.add(groupId);
2509
2510 count = (Long)q.uniqueResult();
2511 }
2512 catch (Exception e) {
2513 throw processException(e);
2514 }
2515 finally {
2516 if (count == null) {
2517 count = Long.valueOf(0);
2518 }
2519
2520 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2521 finderArgs, count);
2522
2523 closeSession(session);
2524 }
2525 }
2526
2527 return count.intValue();
2528 }
2529
2530 public int countByGroupId(long groupId) throws SystemException {
2531 Object[] finderArgs = new Object[] { groupId };
2532
2533 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2534 finderArgs, this);
2535
2536 if (count == null) {
2537 Session session = null;
2538
2539 try {
2540 session = openSession();
2541
2542 StringBundler query = new StringBundler(2);
2543
2544 query.append(_SQL_COUNT_DLFOLDER_WHERE);
2545
2546 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2547
2548 String sql = query.toString();
2549
2550 Query q = session.createQuery(sql);
2551
2552 QueryPos qPos = QueryPos.getInstance(q);
2553
2554 qPos.add(groupId);
2555
2556 count = (Long)q.uniqueResult();
2557 }
2558 catch (Exception e) {
2559 throw processException(e);
2560 }
2561 finally {
2562 if (count == null) {
2563 count = Long.valueOf(0);
2564 }
2565
2566 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2567 finderArgs, count);
2568
2569 closeSession(session);
2570 }
2571 }
2572
2573 return count.intValue();
2574 }
2575
2576 public int filterCountByGroupId(long groupId) throws SystemException {
2577 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2578 return countByGroupId(groupId);
2579 }
2580
2581 Session session = null;
2582
2583 try {
2584 session = openSession();
2585
2586 StringBundler query = new StringBundler(2);
2587
2588 query.append(_FILTER_SQL_COUNT_DLFOLDER_WHERE);
2589
2590 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2591
2592 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2593 DLFolder.class.getName(), _FILTER_COLUMN_PK,
2594 _FILTER_COLUMN_USERID, groupId);
2595
2596 SQLQuery q = session.createSQLQuery(sql);
2597
2598 q.addScalar(COUNT_COLUMN_NAME,
2599 com.liferay.portal.kernel.dao.orm.Type.LONG);
2600
2601 QueryPos qPos = QueryPos.getInstance(q);
2602
2603 qPos.add(groupId);
2604
2605 Long count = (Long)q.uniqueResult();
2606
2607 return count.intValue();
2608 }
2609 catch (Exception e) {
2610 throw processException(e);
2611 }
2612 finally {
2613 closeSession(session);
2614 }
2615 }
2616
2617 public int countByCompanyId(long companyId) throws SystemException {
2618 Object[] finderArgs = new Object[] { companyId };
2619
2620 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2621 finderArgs, this);
2622
2623 if (count == null) {
2624 Session session = null;
2625
2626 try {
2627 session = openSession();
2628
2629 StringBundler query = new StringBundler(2);
2630
2631 query.append(_SQL_COUNT_DLFOLDER_WHERE);
2632
2633 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2634
2635 String sql = query.toString();
2636
2637 Query q = session.createQuery(sql);
2638
2639 QueryPos qPos = QueryPos.getInstance(q);
2640
2641 qPos.add(companyId);
2642
2643 count = (Long)q.uniqueResult();
2644 }
2645 catch (Exception e) {
2646 throw processException(e);
2647 }
2648 finally {
2649 if (count == null) {
2650 count = Long.valueOf(0);
2651 }
2652
2653 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2654 finderArgs, count);
2655
2656 closeSession(session);
2657 }
2658 }
2659
2660 return count.intValue();
2661 }
2662
2663 public int countByG_P(long groupId, long parentFolderId)
2664 throws SystemException {
2665 Object[] finderArgs = new Object[] { groupId, parentFolderId };
2666
2667 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P,
2668 finderArgs, this);
2669
2670 if (count == null) {
2671 Session session = null;
2672
2673 try {
2674 session = openSession();
2675
2676 StringBundler query = new StringBundler(3);
2677
2678 query.append(_SQL_COUNT_DLFOLDER_WHERE);
2679
2680 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
2681
2682 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
2683
2684 String sql = query.toString();
2685
2686 Query q = session.createQuery(sql);
2687
2688 QueryPos qPos = QueryPos.getInstance(q);
2689
2690 qPos.add(groupId);
2691
2692 qPos.add(parentFolderId);
2693
2694 count = (Long)q.uniqueResult();
2695 }
2696 catch (Exception e) {
2697 throw processException(e);
2698 }
2699 finally {
2700 if (count == null) {
2701 count = Long.valueOf(0);
2702 }
2703
2704 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P, finderArgs,
2705 count);
2706
2707 closeSession(session);
2708 }
2709 }
2710
2711 return count.intValue();
2712 }
2713
2714 public int filterCountByG_P(long groupId, long parentFolderId)
2715 throws SystemException {
2716 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2717 return countByG_P(groupId, parentFolderId);
2718 }
2719
2720 Session session = null;
2721
2722 try {
2723 session = openSession();
2724
2725 StringBundler query = new StringBundler(3);
2726
2727 query.append(_FILTER_SQL_COUNT_DLFOLDER_WHERE);
2728
2729 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
2730
2731 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
2732
2733 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2734 DLFolder.class.getName(), _FILTER_COLUMN_PK,
2735 _FILTER_COLUMN_USERID, groupId);
2736
2737 SQLQuery q = session.createSQLQuery(sql);
2738
2739 q.addScalar(COUNT_COLUMN_NAME,
2740 com.liferay.portal.kernel.dao.orm.Type.LONG);
2741
2742 QueryPos qPos = QueryPos.getInstance(q);
2743
2744 qPos.add(groupId);
2745
2746 qPos.add(parentFolderId);
2747
2748 Long count = (Long)q.uniqueResult();
2749
2750 return count.intValue();
2751 }
2752 catch (Exception e) {
2753 throw processException(e);
2754 }
2755 finally {
2756 closeSession(session);
2757 }
2758 }
2759
2760 public int countByP_N(long parentFolderId, String name)
2761 throws SystemException {
2762 Object[] finderArgs = new Object[] { parentFolderId, name };
2763
2764 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_N,
2765 finderArgs, this);
2766
2767 if (count == null) {
2768 Session session = null;
2769
2770 try {
2771 session = openSession();
2772
2773 StringBundler query = new StringBundler(3);
2774
2775 query.append(_SQL_COUNT_DLFOLDER_WHERE);
2776
2777 query.append(_FINDER_COLUMN_P_N_PARENTFOLDERID_2);
2778
2779 if (name == null) {
2780 query.append(_FINDER_COLUMN_P_N_NAME_1);
2781 }
2782 else {
2783 if (name.equals(StringPool.BLANK)) {
2784 query.append(_FINDER_COLUMN_P_N_NAME_3);
2785 }
2786 else {
2787 query.append(_FINDER_COLUMN_P_N_NAME_2);
2788 }
2789 }
2790
2791 String sql = query.toString();
2792
2793 Query q = session.createQuery(sql);
2794
2795 QueryPos qPos = QueryPos.getInstance(q);
2796
2797 qPos.add(parentFolderId);
2798
2799 if (name != null) {
2800 qPos.add(name);
2801 }
2802
2803 count = (Long)q.uniqueResult();
2804 }
2805 catch (Exception e) {
2806 throw processException(e);
2807 }
2808 finally {
2809 if (count == null) {
2810 count = Long.valueOf(0);
2811 }
2812
2813 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_N, finderArgs,
2814 count);
2815
2816 closeSession(session);
2817 }
2818 }
2819
2820 return count.intValue();
2821 }
2822
2823 public int countByG_P_N(long groupId, long parentFolderId, String name)
2824 throws SystemException {
2825 Object[] finderArgs = new Object[] { groupId, parentFolderId, name };
2826
2827 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P_N,
2828 finderArgs, this);
2829
2830 if (count == null) {
2831 Session session = null;
2832
2833 try {
2834 session = openSession();
2835
2836 StringBundler query = new StringBundler(4);
2837
2838 query.append(_SQL_COUNT_DLFOLDER_WHERE);
2839
2840 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
2841
2842 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
2843
2844 if (name == null) {
2845 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
2846 }
2847 else {
2848 if (name.equals(StringPool.BLANK)) {
2849 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
2850 }
2851 else {
2852 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
2853 }
2854 }
2855
2856 String sql = query.toString();
2857
2858 Query q = session.createQuery(sql);
2859
2860 QueryPos qPos = QueryPos.getInstance(q);
2861
2862 qPos.add(groupId);
2863
2864 qPos.add(parentFolderId);
2865
2866 if (name != null) {
2867 qPos.add(name);
2868 }
2869
2870 count = (Long)q.uniqueResult();
2871 }
2872 catch (Exception e) {
2873 throw processException(e);
2874 }
2875 finally {
2876 if (count == null) {
2877 count = Long.valueOf(0);
2878 }
2879
2880 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P_N,
2881 finderArgs, count);
2882
2883 closeSession(session);
2884 }
2885 }
2886
2887 return count.intValue();
2888 }
2889
2890 public int filterCountByG_P_N(long groupId, long parentFolderId, String name)
2891 throws SystemException {
2892 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2893 return countByG_P_N(groupId, parentFolderId, name);
2894 }
2895
2896 Session session = null;
2897
2898 try {
2899 session = openSession();
2900
2901 StringBundler query = new StringBundler(4);
2902
2903 query.append(_FILTER_SQL_COUNT_DLFOLDER_WHERE);
2904
2905 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
2906
2907 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
2908
2909 if (name == null) {
2910 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
2911 }
2912 else {
2913 if (name.equals(StringPool.BLANK)) {
2914 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
2915 }
2916 else {
2917 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
2918 }
2919 }
2920
2921 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2922 DLFolder.class.getName(), _FILTER_COLUMN_PK,
2923 _FILTER_COLUMN_USERID, groupId);
2924
2925 SQLQuery q = session.createSQLQuery(sql);
2926
2927 q.addScalar(COUNT_COLUMN_NAME,
2928 com.liferay.portal.kernel.dao.orm.Type.LONG);
2929
2930 QueryPos qPos = QueryPos.getInstance(q);
2931
2932 qPos.add(groupId);
2933
2934 qPos.add(parentFolderId);
2935
2936 if (name != null) {
2937 qPos.add(name);
2938 }
2939
2940 Long count = (Long)q.uniqueResult();
2941
2942 return count.intValue();
2943 }
2944 catch (Exception e) {
2945 throw processException(e);
2946 }
2947 finally {
2948 closeSession(session);
2949 }
2950 }
2951
2952 public int countAll() throws SystemException {
2953 Object[] finderArgs = new Object[0];
2954
2955 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2956 finderArgs, this);
2957
2958 if (count == null) {
2959 Session session = null;
2960
2961 try {
2962 session = openSession();
2963
2964 Query q = session.createQuery(_SQL_COUNT_DLFOLDER);
2965
2966 count = (Long)q.uniqueResult();
2967 }
2968 catch (Exception e) {
2969 throw processException(e);
2970 }
2971 finally {
2972 if (count == null) {
2973 count = Long.valueOf(0);
2974 }
2975
2976 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2977 count);
2978
2979 closeSession(session);
2980 }
2981 }
2982
2983 return count.intValue();
2984 }
2985
2986 public void afterPropertiesSet() {
2987 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2988 com.liferay.portal.util.PropsUtil.get(
2989 "value.object.listener.com.liferay.portlet.documentlibrary.model.DLFolder")));
2990
2991 if (listenerClassNames.length > 0) {
2992 try {
2993 List<ModelListener<DLFolder>> listenersList = new ArrayList<ModelListener<DLFolder>>();
2994
2995 for (String listenerClassName : listenerClassNames) {
2996 listenersList.add((ModelListener<DLFolder>)InstanceFactory.newInstance(
2997 listenerClassName));
2998 }
2999
3000 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3001 }
3002 catch (Exception e) {
3003 _log.error(e);
3004 }
3005 }
3006 }
3007
3008 @BeanReference(type = DLFileEntryPersistence.class)
3009 protected DLFileEntryPersistence dlFileEntryPersistence;
3010 @BeanReference(type = DLFileRankPersistence.class)
3011 protected DLFileRankPersistence dlFileRankPersistence;
3012 @BeanReference(type = DLFileShortcutPersistence.class)
3013 protected DLFileShortcutPersistence dlFileShortcutPersistence;
3014 @BeanReference(type = DLFileVersionPersistence.class)
3015 protected DLFileVersionPersistence dlFileVersionPersistence;
3016 @BeanReference(type = DLFolderPersistence.class)
3017 protected DLFolderPersistence dlFolderPersistence;
3018 @BeanReference(type = GroupPersistence.class)
3019 protected GroupPersistence groupPersistence;
3020 @BeanReference(type = LayoutPersistence.class)
3021 protected LayoutPersistence layoutPersistence;
3022 @BeanReference(type = LockPersistence.class)
3023 protected LockPersistence lockPersistence;
3024 @BeanReference(type = ResourcePersistence.class)
3025 protected ResourcePersistence resourcePersistence;
3026 @BeanReference(type = UserPersistence.class)
3027 protected UserPersistence userPersistence;
3028 @BeanReference(type = WebDAVPropsPersistence.class)
3029 protected WebDAVPropsPersistence webDAVPropsPersistence;
3030 @BeanReference(type = ExpandoValuePersistence.class)
3031 protected ExpandoValuePersistence expandoValuePersistence;
3032 private static final String _SQL_SELECT_DLFOLDER = "SELECT dlFolder FROM DLFolder dlFolder";
3033 private static final String _SQL_SELECT_DLFOLDER_WHERE = "SELECT dlFolder FROM DLFolder dlFolder WHERE ";
3034 private static final String _SQL_COUNT_DLFOLDER = "SELECT COUNT(dlFolder) FROM DLFolder dlFolder";
3035 private static final String _SQL_COUNT_DLFOLDER_WHERE = "SELECT COUNT(dlFolder) FROM DLFolder dlFolder WHERE ";
3036 private static final String _FINDER_COLUMN_UUID_UUID_1 = "dlFolder.uuid IS NULL";
3037 private static final String _FINDER_COLUMN_UUID_UUID_2 = "dlFolder.uuid = ?";
3038 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(dlFolder.uuid IS NULL OR dlFolder.uuid = ?)";
3039 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "dlFolder.uuid IS NULL AND ";
3040 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "dlFolder.uuid = ? AND ";
3041 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(dlFolder.uuid IS NULL OR dlFolder.uuid = ?) AND ";
3042 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "dlFolder.groupId = ?";
3043 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "dlFolder.groupId = ?";
3044 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "dlFolder.companyId = ?";
3045 private static final String _FINDER_COLUMN_G_P_GROUPID_2 = "dlFolder.groupId = ? AND ";
3046 private static final String _FINDER_COLUMN_G_P_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ?";
3047 private static final String _FINDER_COLUMN_P_N_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ? AND ";
3048 private static final String _FINDER_COLUMN_P_N_NAME_1 = "dlFolder.name IS NULL";
3049 private static final String _FINDER_COLUMN_P_N_NAME_2 = "dlFolder.name = ?";
3050 private static final String _FINDER_COLUMN_P_N_NAME_3 = "(dlFolder.name IS NULL OR dlFolder.name = ?)";
3051 private static final String _FINDER_COLUMN_G_P_N_GROUPID_2 = "dlFolder.groupId = ? AND ";
3052 private static final String _FINDER_COLUMN_G_P_N_PARENTFOLDERID_2 = "dlFolder.parentFolderId = ? AND ";
3053 private static final String _FINDER_COLUMN_G_P_N_NAME_1 = "dlFolder.name IS NULL";
3054 private static final String _FINDER_COLUMN_G_P_N_NAME_2 = "dlFolder.name = ?";
3055 private static final String _FINDER_COLUMN_G_P_N_NAME_3 = "(dlFolder.name IS NULL OR dlFolder.name = ?)";
3056 private static final String _FILTER_SQL_SELECT_DLFOLDER_WHERE = "SELECT DISTINCT {dlFolder.*} FROM DLFolder dlFolder WHERE ";
3057 private static final String _FILTER_SQL_COUNT_DLFOLDER_WHERE = "SELECT COUNT(DISTINCT dlFolder.folderId) AS COUNT_VALUE FROM DLFolder dlFolder WHERE ";
3058 private static final String _FILTER_COLUMN_PK = "dlFolder.folderId";
3059 private static final String _FILTER_COLUMN_USERID = "dlFolder.userId";
3060 private static final String _FILTER_ENTITY_ALIAS = "dlFolder";
3061 private static final String _ORDER_BY_ENTITY_ALIAS = "dlFolder.";
3062 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DLFolder exists with the primary key ";
3063 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DLFolder exists with the key {";
3064 private static Log _log = LogFactoryUtil.getLog(DLFolderPersistenceImpl.class);
3065 }