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