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