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