001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.documentlibrary.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.annotation.BeanReference;
019    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderPath;
023    import com.liferay.portal.kernel.dao.orm.Query;
024    import com.liferay.portal.kernel.dao.orm.QueryPos;
025    import com.liferay.portal.kernel.dao.orm.QueryUtil;
026    import com.liferay.portal.kernel.dao.orm.SQLQuery;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.kernel.util.Validator;
038    import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
039    import com.liferay.portal.model.ModelListener;
040    import com.liferay.portal.security.permission.InlineSQLHelperUtil;
041    import com.liferay.portal.service.persistence.BatchSessionUtil;
042    import com.liferay.portal.service.persistence.ResourcePersistence;
043    import com.liferay.portal.service.persistence.UserPersistence;
044    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
045    
046    import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
047    import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
048    import com.liferay.portlet.documentlibrary.NoSuchFileShortcutException;
049    import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
050    import com.liferay.portlet.documentlibrary.model.impl.DLFileShortcutImpl;
051    import com.liferay.portlet.documentlibrary.model.impl.DLFileShortcutModelImpl;
052    
053    import java.io.Serializable;
054    
055    import java.util.ArrayList;
056    import java.util.Collections;
057    import java.util.List;
058    
059    /**
060     * The persistence implementation for the d l file shortcut service.
061     *
062     * <p>
063     * Never modify or reference this class directly. Always use {@link DLFileShortcutUtil} to access the d l file shortcut persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
064     * </p>
065     *
066     * <p>
067     * Caching information and settings can be found in <code>portal.properties</code>
068     * </p>
069     *
070     * @author Brian Wing Shun Chan
071     * @see DLFileShortcutPersistence
072     * @see DLFileShortcutUtil
073     * @generated
074     */
075    public class DLFileShortcutPersistenceImpl extends BasePersistenceImpl<DLFileShortcut>
076            implements DLFileShortcutPersistence {
077            public static final String FINDER_CLASS_NAME_ENTITY = DLFileShortcutImpl.class.getName();
078            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
079                    ".List";
080            public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
081                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
082                            FINDER_CLASS_NAME_LIST, "findByUuid",
083                            new String[] {
084                                    String.class.getName(),
085                                    
086                            "java.lang.Integer", "java.lang.Integer",
087                                    "com.liferay.portal.kernel.util.OrderByComparator"
088                            });
089            public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
090                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
091                            FINDER_CLASS_NAME_LIST, "countByUuid",
092                            new String[] { String.class.getName() });
093            public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
094                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
095                            FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
096                            new String[] { String.class.getName(), Long.class.getName() });
097            public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
098                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
099                            FINDER_CLASS_NAME_LIST, "countByUUID_G",
100                            new String[] { String.class.getName(), Long.class.getName() });
101            public static final FinderPath FINDER_PATH_FIND_BY_G_F = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
102                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
103                            FINDER_CLASS_NAME_LIST, "findByG_F",
104                            new String[] {
105                                    Long.class.getName(), Long.class.getName(),
106                                    
107                            "java.lang.Integer", "java.lang.Integer",
108                                    "com.liferay.portal.kernel.util.OrderByComparator"
109                            });
110            public static final FinderPath FINDER_PATH_COUNT_BY_G_F = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
111                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
112                            FINDER_CLASS_NAME_LIST, "countByG_F",
113                            new String[] { Long.class.getName(), Long.class.getName() });
114            public static final FinderPath FINDER_PATH_FIND_BY_G_F_S = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
115                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
116                            FINDER_CLASS_NAME_LIST, "findByG_F_S",
117                            new String[] {
118                                    Long.class.getName(), Long.class.getName(),
119                                    Integer.class.getName(),
120                                    
121                            "java.lang.Integer", "java.lang.Integer",
122                                    "com.liferay.portal.kernel.util.OrderByComparator"
123                            });
124            public static final FinderPath FINDER_PATH_COUNT_BY_G_F_S = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
125                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
126                            FINDER_CLASS_NAME_LIST, "countByG_F_S",
127                            new String[] {
128                                    Long.class.getName(), Long.class.getName(),
129                                    Integer.class.getName()
130                            });
131            public static final FinderPath FINDER_PATH_FIND_BY_G_TF_TN = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
132                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
133                            FINDER_CLASS_NAME_LIST, "findByG_TF_TN",
134                            new String[] {
135                                    Long.class.getName(), Long.class.getName(),
136                                    String.class.getName(),
137                                    
138                            "java.lang.Integer", "java.lang.Integer",
139                                    "com.liferay.portal.kernel.util.OrderByComparator"
140                            });
141            public static final FinderPath FINDER_PATH_COUNT_BY_G_TF_TN = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
142                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
143                            FINDER_CLASS_NAME_LIST, "countByG_TF_TN",
144                            new String[] {
145                                    Long.class.getName(), Long.class.getName(),
146                                    String.class.getName()
147                            });
148            public static final FinderPath FINDER_PATH_FIND_BY_G_TF_TN_S = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
149                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
150                            FINDER_CLASS_NAME_LIST, "findByG_TF_TN_S",
151                            new String[] {
152                                    Long.class.getName(), Long.class.getName(),
153                                    String.class.getName(), Integer.class.getName(),
154                                    
155                            "java.lang.Integer", "java.lang.Integer",
156                                    "com.liferay.portal.kernel.util.OrderByComparator"
157                            });
158            public static final FinderPath FINDER_PATH_COUNT_BY_G_TF_TN_S = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
159                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
160                            FINDER_CLASS_NAME_LIST, "countByG_TF_TN_S",
161                            new String[] {
162                                    Long.class.getName(), Long.class.getName(),
163                                    String.class.getName(), Integer.class.getName()
164                            });
165            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
166                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
167                            FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
168            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
169                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
170                            FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
171    
172            /**
173             * Caches the d l file shortcut in the entity cache if it is enabled.
174             *
175             * @param dlFileShortcut the d l file shortcut to cache
176             */
177            public void cacheResult(DLFileShortcut dlFileShortcut) {
178                    EntityCacheUtil.putResult(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
179                            DLFileShortcutImpl.class, dlFileShortcut.getPrimaryKey(),
180                            dlFileShortcut);
181    
182                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
183                            new Object[] {
184                                    dlFileShortcut.getUuid(), new Long(dlFileShortcut.getGroupId())
185                            }, dlFileShortcut);
186            }
187    
188            /**
189             * Caches the d l file shortcuts in the entity cache if it is enabled.
190             *
191             * @param dlFileShortcuts the d l file shortcuts to cache
192             */
193            public void cacheResult(List<DLFileShortcut> dlFileShortcuts) {
194                    for (DLFileShortcut dlFileShortcut : dlFileShortcuts) {
195                            if (EntityCacheUtil.getResult(
196                                                    DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
197                                                    DLFileShortcutImpl.class,
198                                                    dlFileShortcut.getPrimaryKey(), this) == null) {
199                                    cacheResult(dlFileShortcut);
200                            }
201                    }
202            }
203    
204            /**
205             * Clears the cache for all d l file shortcuts.
206             *
207             * <p>
208             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
209             * </p>
210             */
211            public void clearCache() {
212                    CacheRegistryUtil.clear(DLFileShortcutImpl.class.getName());
213                    EntityCacheUtil.clearCache(DLFileShortcutImpl.class.getName());
214                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
215                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
216            }
217    
218            /**
219             * Clears the cache for the d l file shortcut.
220             *
221             * <p>
222             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
223             * </p>
224             */
225            public void clearCache(DLFileShortcut dlFileShortcut) {
226                    EntityCacheUtil.removeResult(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
227                            DLFileShortcutImpl.class, dlFileShortcut.getPrimaryKey());
228    
229                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
230                            new Object[] {
231                                    dlFileShortcut.getUuid(), new Long(dlFileShortcut.getGroupId())
232                            });
233            }
234    
235            /**
236             * Creates a new d l file shortcut with the primary key. Does not add the d l file shortcut to the database.
237             *
238             * @param fileShortcutId the primary key for the new d l file shortcut
239             * @return the new d l file shortcut
240             */
241            public DLFileShortcut create(long fileShortcutId) {
242                    DLFileShortcut dlFileShortcut = new DLFileShortcutImpl();
243    
244                    dlFileShortcut.setNew(true);
245                    dlFileShortcut.setPrimaryKey(fileShortcutId);
246    
247                    String uuid = PortalUUIDUtil.generate();
248    
249                    dlFileShortcut.setUuid(uuid);
250    
251                    return dlFileShortcut;
252            }
253    
254            /**
255             * Removes the d l file shortcut with the primary key from the database. Also notifies the appropriate model listeners.
256             *
257             * @param primaryKey the primary key of the d l file shortcut to remove
258             * @return the d l file shortcut that was removed
259             * @throws com.liferay.portal.NoSuchModelException if a d l file shortcut with the primary key could not be found
260             * @throws SystemException if a system exception occurred
261             */
262            public DLFileShortcut remove(Serializable primaryKey)
263                    throws NoSuchModelException, SystemException {
264                    return remove(((Long)primaryKey).longValue());
265            }
266    
267            /**
268             * Removes the d l file shortcut with the primary key from the database. Also notifies the appropriate model listeners.
269             *
270             * @param fileShortcutId the primary key of the d l file shortcut to remove
271             * @return the d l file shortcut that was removed
272             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a d l file shortcut with the primary key could not be found
273             * @throws SystemException if a system exception occurred
274             */
275            public DLFileShortcut remove(long fileShortcutId)
276                    throws NoSuchFileShortcutException, SystemException {
277                    Session session = null;
278    
279                    try {
280                            session = openSession();
281    
282                            DLFileShortcut dlFileShortcut = (DLFileShortcut)session.get(DLFileShortcutImpl.class,
283                                            new Long(fileShortcutId));
284    
285                            if (dlFileShortcut == null) {
286                                    if (_log.isWarnEnabled()) {
287                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
288                                                    fileShortcutId);
289                                    }
290    
291                                    throw new NoSuchFileShortcutException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
292                                            fileShortcutId);
293                            }
294    
295                            return remove(dlFileShortcut);
296                    }
297                    catch (NoSuchFileShortcutException nsee) {
298                            throw nsee;
299                    }
300                    catch (Exception e) {
301                            throw processException(e);
302                    }
303                    finally {
304                            closeSession(session);
305                    }
306            }
307    
308            protected DLFileShortcut removeImpl(DLFileShortcut dlFileShortcut)
309                    throws SystemException {
310                    dlFileShortcut = toUnwrappedModel(dlFileShortcut);
311    
312                    Session session = null;
313    
314                    try {
315                            session = openSession();
316    
317                            BatchSessionUtil.delete(session, dlFileShortcut);
318                    }
319                    catch (Exception e) {
320                            throw processException(e);
321                    }
322                    finally {
323                            closeSession(session);
324                    }
325    
326                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
327    
328                    DLFileShortcutModelImpl dlFileShortcutModelImpl = (DLFileShortcutModelImpl)dlFileShortcut;
329    
330                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
331                            new Object[] {
332                                    dlFileShortcutModelImpl.getUuid(),
333                                    new Long(dlFileShortcutModelImpl.getGroupId())
334                            });
335    
336                    EntityCacheUtil.removeResult(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
337                            DLFileShortcutImpl.class, dlFileShortcut.getPrimaryKey());
338    
339                    return dlFileShortcut;
340            }
341    
342            public DLFileShortcut updateImpl(
343                    com.liferay.portlet.documentlibrary.model.DLFileShortcut dlFileShortcut,
344                    boolean merge) throws SystemException {
345                    dlFileShortcut = toUnwrappedModel(dlFileShortcut);
346    
347                    boolean isNew = dlFileShortcut.isNew();
348    
349                    DLFileShortcutModelImpl dlFileShortcutModelImpl = (DLFileShortcutModelImpl)dlFileShortcut;
350    
351                    if (Validator.isNull(dlFileShortcut.getUuid())) {
352                            String uuid = PortalUUIDUtil.generate();
353    
354                            dlFileShortcut.setUuid(uuid);
355                    }
356    
357                    Session session = null;
358    
359                    try {
360                            session = openSession();
361    
362                            BatchSessionUtil.update(session, dlFileShortcut, merge);
363    
364                            dlFileShortcut.setNew(false);
365                    }
366                    catch (Exception e) {
367                            throw processException(e);
368                    }
369                    finally {
370                            closeSession(session);
371                    }
372    
373                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
374    
375                    EntityCacheUtil.putResult(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
376                            DLFileShortcutImpl.class, dlFileShortcut.getPrimaryKey(),
377                            dlFileShortcut);
378    
379                    if (!isNew &&
380                                    (!Validator.equals(dlFileShortcut.getUuid(),
381                                            dlFileShortcutModelImpl.getOriginalUuid()) ||
382                                    (dlFileShortcut.getGroupId() != dlFileShortcutModelImpl.getOriginalGroupId()))) {
383                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
384                                    new Object[] {
385                                            dlFileShortcutModelImpl.getOriginalUuid(),
386                                            new Long(dlFileShortcutModelImpl.getOriginalGroupId())
387                                    });
388                    }
389    
390                    if (isNew ||
391                                    (!Validator.equals(dlFileShortcut.getUuid(),
392                                            dlFileShortcutModelImpl.getOriginalUuid()) ||
393                                    (dlFileShortcut.getGroupId() != dlFileShortcutModelImpl.getOriginalGroupId()))) {
394                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
395                                    new Object[] {
396                                            dlFileShortcut.getUuid(),
397                                            new Long(dlFileShortcut.getGroupId())
398                                    }, dlFileShortcut);
399                    }
400    
401                    return dlFileShortcut;
402            }
403    
404            protected DLFileShortcut toUnwrappedModel(DLFileShortcut dlFileShortcut) {
405                    if (dlFileShortcut instanceof DLFileShortcutImpl) {
406                            return dlFileShortcut;
407                    }
408    
409                    DLFileShortcutImpl dlFileShortcutImpl = new DLFileShortcutImpl();
410    
411                    dlFileShortcutImpl.setNew(dlFileShortcut.isNew());
412                    dlFileShortcutImpl.setPrimaryKey(dlFileShortcut.getPrimaryKey());
413    
414                    dlFileShortcutImpl.setUuid(dlFileShortcut.getUuid());
415                    dlFileShortcutImpl.setFileShortcutId(dlFileShortcut.getFileShortcutId());
416                    dlFileShortcutImpl.setGroupId(dlFileShortcut.getGroupId());
417                    dlFileShortcutImpl.setCompanyId(dlFileShortcut.getCompanyId());
418                    dlFileShortcutImpl.setUserId(dlFileShortcut.getUserId());
419                    dlFileShortcutImpl.setUserName(dlFileShortcut.getUserName());
420                    dlFileShortcutImpl.setCreateDate(dlFileShortcut.getCreateDate());
421                    dlFileShortcutImpl.setModifiedDate(dlFileShortcut.getModifiedDate());
422                    dlFileShortcutImpl.setFolderId(dlFileShortcut.getFolderId());
423                    dlFileShortcutImpl.setToFolderId(dlFileShortcut.getToFolderId());
424                    dlFileShortcutImpl.setToName(dlFileShortcut.getToName());
425                    dlFileShortcutImpl.setStatus(dlFileShortcut.getStatus());
426                    dlFileShortcutImpl.setStatusByUserId(dlFileShortcut.getStatusByUserId());
427                    dlFileShortcutImpl.setStatusByUserName(dlFileShortcut.getStatusByUserName());
428                    dlFileShortcutImpl.setStatusDate(dlFileShortcut.getStatusDate());
429    
430                    return dlFileShortcutImpl;
431            }
432    
433            /**
434             * Finds the d l file shortcut with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
435             *
436             * @param primaryKey the primary key of the d l file shortcut to find
437             * @return the d l file shortcut
438             * @throws com.liferay.portal.NoSuchModelException if a d l file shortcut with the primary key could not be found
439             * @throws SystemException if a system exception occurred
440             */
441            public DLFileShortcut findByPrimaryKey(Serializable primaryKey)
442                    throws NoSuchModelException, SystemException {
443                    return findByPrimaryKey(((Long)primaryKey).longValue());
444            }
445    
446            /**
447             * Finds the d l file shortcut with the primary key or throws a {@link com.liferay.portlet.documentlibrary.NoSuchFileShortcutException} if it could not be found.
448             *
449             * @param fileShortcutId the primary key of the d l file shortcut to find
450             * @return the d l file shortcut
451             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a d l file shortcut with the primary key could not be found
452             * @throws SystemException if a system exception occurred
453             */
454            public DLFileShortcut findByPrimaryKey(long fileShortcutId)
455                    throws NoSuchFileShortcutException, SystemException {
456                    DLFileShortcut dlFileShortcut = fetchByPrimaryKey(fileShortcutId);
457    
458                    if (dlFileShortcut == null) {
459                            if (_log.isWarnEnabled()) {
460                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + fileShortcutId);
461                            }
462    
463                            throw new NoSuchFileShortcutException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
464                                    fileShortcutId);
465                    }
466    
467                    return dlFileShortcut;
468            }
469    
470            /**
471             * Finds the d l file shortcut with the primary key or returns <code>null</code> if it could not be found.
472             *
473             * @param primaryKey the primary key of the d l file shortcut to find
474             * @return the d l file shortcut, or <code>null</code> if a d l file shortcut with the primary key could not be found
475             * @throws SystemException if a system exception occurred
476             */
477            public DLFileShortcut fetchByPrimaryKey(Serializable primaryKey)
478                    throws SystemException {
479                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
480            }
481    
482            /**
483             * Finds the d l file shortcut with the primary key or returns <code>null</code> if it could not be found.
484             *
485             * @param fileShortcutId the primary key of the d l file shortcut to find
486             * @return the d l file shortcut, or <code>null</code> if a d l file shortcut with the primary key could not be found
487             * @throws SystemException if a system exception occurred
488             */
489            public DLFileShortcut fetchByPrimaryKey(long fileShortcutId)
490                    throws SystemException {
491                    DLFileShortcut dlFileShortcut = (DLFileShortcut)EntityCacheUtil.getResult(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
492                                    DLFileShortcutImpl.class, fileShortcutId, this);
493    
494                    if (dlFileShortcut == null) {
495                            Session session = null;
496    
497                            try {
498                                    session = openSession();
499    
500                                    dlFileShortcut = (DLFileShortcut)session.get(DLFileShortcutImpl.class,
501                                                    new Long(fileShortcutId));
502                            }
503                            catch (Exception e) {
504                                    throw processException(e);
505                            }
506                            finally {
507                                    if (dlFileShortcut != null) {
508                                            cacheResult(dlFileShortcut);
509                                    }
510    
511                                    closeSession(session);
512                            }
513                    }
514    
515                    return dlFileShortcut;
516            }
517    
518            /**
519             * Finds all the d l file shortcuts where uuid = &#63;.
520             *
521             * @param uuid the uuid to search with
522             * @return the matching d l file shortcuts
523             * @throws SystemException if a system exception occurred
524             */
525            public List<DLFileShortcut> findByUuid(String uuid)
526                    throws SystemException {
527                    return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
528            }
529    
530            /**
531             * Finds a range of all the d l file shortcuts where uuid = &#63;.
532             *
533             * <p>
534             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
535             * </p>
536             *
537             * @param uuid the uuid to search with
538             * @param start the lower bound of the range of d l file shortcuts to return
539             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
540             * @return the range of matching d l file shortcuts
541             * @throws SystemException if a system exception occurred
542             */
543            public List<DLFileShortcut> findByUuid(String uuid, int start, int end)
544                    throws SystemException {
545                    return findByUuid(uuid, start, end, null);
546            }
547    
548            /**
549             * Finds an ordered range of all the d l file shortcuts where uuid = &#63;.
550             *
551             * <p>
552             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
553             * </p>
554             *
555             * @param uuid the uuid to search with
556             * @param start the lower bound of the range of d l file shortcuts to return
557             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
558             * @param orderByComparator the comparator to order the results by
559             * @return the ordered range of matching d l file shortcuts
560             * @throws SystemException if a system exception occurred
561             */
562            public List<DLFileShortcut> findByUuid(String uuid, int start, int end,
563                    OrderByComparator orderByComparator) throws SystemException {
564                    Object[] finderArgs = new Object[] {
565                                    uuid,
566                                    
567                                    String.valueOf(start), String.valueOf(end),
568                                    String.valueOf(orderByComparator)
569                            };
570    
571                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
572                                    finderArgs, this);
573    
574                    if (list == null) {
575                            StringBundler query = null;
576    
577                            if (orderByComparator != null) {
578                                    query = new StringBundler(3 +
579                                                    (orderByComparator.getOrderByFields().length * 3));
580                            }
581                            else {
582                                    query = new StringBundler(2);
583                            }
584    
585                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
586    
587                            if (uuid == null) {
588                                    query.append(_FINDER_COLUMN_UUID_UUID_1);
589                            }
590                            else {
591                                    if (uuid.equals(StringPool.BLANK)) {
592                                            query.append(_FINDER_COLUMN_UUID_UUID_3);
593                                    }
594                                    else {
595                                            query.append(_FINDER_COLUMN_UUID_UUID_2);
596                                    }
597                            }
598    
599                            if (orderByComparator != null) {
600                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
601                                            orderByComparator);
602                            }
603    
604                            String sql = query.toString();
605    
606                            Session session = null;
607    
608                            try {
609                                    session = openSession();
610    
611                                    Query q = session.createQuery(sql);
612    
613                                    QueryPos qPos = QueryPos.getInstance(q);
614    
615                                    if (uuid != null) {
616                                            qPos.add(uuid);
617                                    }
618    
619                                    list = (List<DLFileShortcut>)QueryUtil.list(q, getDialect(),
620                                                    start, end);
621                            }
622                            catch (Exception e) {
623                                    throw processException(e);
624                            }
625                            finally {
626                                    if (list == null) {
627                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_UUID,
628                                                    finderArgs);
629                                    }
630                                    else {
631                                            cacheResult(list);
632    
633                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID,
634                                                    finderArgs, list);
635                                    }
636    
637                                    closeSession(session);
638                            }
639                    }
640    
641                    return list;
642            }
643    
644            /**
645             * Finds the first d l file shortcut in the ordered set where uuid = &#63;.
646             *
647             * <p>
648             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
649             * </p>
650             *
651             * @param uuid the uuid to search with
652             * @param orderByComparator the comparator to order the set by
653             * @return the first matching d l file shortcut
654             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching d l file shortcut could not be found
655             * @throws SystemException if a system exception occurred
656             */
657            public DLFileShortcut findByUuid_First(String uuid,
658                    OrderByComparator orderByComparator)
659                    throws NoSuchFileShortcutException, SystemException {
660                    List<DLFileShortcut> list = findByUuid(uuid, 0, 1, orderByComparator);
661    
662                    if (list.isEmpty()) {
663                            StringBundler msg = new StringBundler(4);
664    
665                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
666    
667                            msg.append("uuid=");
668                            msg.append(uuid);
669    
670                            msg.append(StringPool.CLOSE_CURLY_BRACE);
671    
672                            throw new NoSuchFileShortcutException(msg.toString());
673                    }
674                    else {
675                            return list.get(0);
676                    }
677            }
678    
679            /**
680             * Finds the last d l file shortcut in the ordered set where uuid = &#63;.
681             *
682             * <p>
683             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
684             * </p>
685             *
686             * @param uuid the uuid to search with
687             * @param orderByComparator the comparator to order the set by
688             * @return the last matching d l file shortcut
689             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching d l file shortcut could not be found
690             * @throws SystemException if a system exception occurred
691             */
692            public DLFileShortcut findByUuid_Last(String uuid,
693                    OrderByComparator orderByComparator)
694                    throws NoSuchFileShortcutException, SystemException {
695                    int count = countByUuid(uuid);
696    
697                    List<DLFileShortcut> list = findByUuid(uuid, count - 1, count,
698                                    orderByComparator);
699    
700                    if (list.isEmpty()) {
701                            StringBundler msg = new StringBundler(4);
702    
703                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
704    
705                            msg.append("uuid=");
706                            msg.append(uuid);
707    
708                            msg.append(StringPool.CLOSE_CURLY_BRACE);
709    
710                            throw new NoSuchFileShortcutException(msg.toString());
711                    }
712                    else {
713                            return list.get(0);
714                    }
715            }
716    
717            /**
718             * Finds the d l file shortcuts before and after the current d l file shortcut in the ordered set where uuid = &#63;.
719             *
720             * <p>
721             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
722             * </p>
723             *
724             * @param fileShortcutId the primary key of the current d l file shortcut
725             * @param uuid the uuid to search with
726             * @param orderByComparator the comparator to order the set by
727             * @return the previous, current, and next d l file shortcut
728             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a d l file shortcut with the primary key could not be found
729             * @throws SystemException if a system exception occurred
730             */
731            public DLFileShortcut[] findByUuid_PrevAndNext(long fileShortcutId,
732                    String uuid, OrderByComparator orderByComparator)
733                    throws NoSuchFileShortcutException, SystemException {
734                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
735    
736                    Session session = null;
737    
738                    try {
739                            session = openSession();
740    
741                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
742    
743                            array[0] = getByUuid_PrevAndNext(session, dlFileShortcut, uuid,
744                                            orderByComparator, true);
745    
746                            array[1] = dlFileShortcut;
747    
748                            array[2] = getByUuid_PrevAndNext(session, dlFileShortcut, uuid,
749                                            orderByComparator, false);
750    
751                            return array;
752                    }
753                    catch (Exception e) {
754                            throw processException(e);
755                    }
756                    finally {
757                            closeSession(session);
758                    }
759            }
760    
761            protected DLFileShortcut getByUuid_PrevAndNext(Session session,
762                    DLFileShortcut dlFileShortcut, String uuid,
763                    OrderByComparator orderByComparator, boolean previous) {
764                    StringBundler query = null;
765    
766                    if (orderByComparator != null) {
767                            query = new StringBundler(6 +
768                                            (orderByComparator.getOrderByFields().length * 6));
769                    }
770                    else {
771                            query = new StringBundler(3);
772                    }
773    
774                    query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
775    
776                    if (uuid == null) {
777                            query.append(_FINDER_COLUMN_UUID_UUID_1);
778                    }
779                    else {
780                            if (uuid.equals(StringPool.BLANK)) {
781                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
782                            }
783                            else {
784                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
785                            }
786                    }
787    
788                    if (orderByComparator != null) {
789                            String[] orderByFields = orderByComparator.getOrderByFields();
790    
791                            if (orderByFields.length > 0) {
792                                    query.append(WHERE_AND);
793                            }
794    
795                            for (int i = 0; i < orderByFields.length; i++) {
796                                    query.append(_ORDER_BY_ENTITY_ALIAS);
797                                    query.append(orderByFields[i]);
798    
799                                    if ((i + 1) < orderByFields.length) {
800                                            if (orderByComparator.isAscending() ^ previous) {
801                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
802                                            }
803                                            else {
804                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
805                                            }
806                                    }
807                                    else {
808                                            if (orderByComparator.isAscending() ^ previous) {
809                                                    query.append(WHERE_GREATER_THAN);
810                                            }
811                                            else {
812                                                    query.append(WHERE_LESSER_THAN);
813                                            }
814                                    }
815                            }
816    
817                            query.append(ORDER_BY_CLAUSE);
818    
819                            for (int i = 0; i < orderByFields.length; i++) {
820                                    query.append(_ORDER_BY_ENTITY_ALIAS);
821                                    query.append(orderByFields[i]);
822    
823                                    if ((i + 1) < orderByFields.length) {
824                                            if (orderByComparator.isAscending() ^ previous) {
825                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
826                                            }
827                                            else {
828                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
829                                            }
830                                    }
831                                    else {
832                                            if (orderByComparator.isAscending() ^ previous) {
833                                                    query.append(ORDER_BY_ASC);
834                                            }
835                                            else {
836                                                    query.append(ORDER_BY_DESC);
837                                            }
838                                    }
839                            }
840                    }
841    
842                    String sql = query.toString();
843    
844                    Query q = session.createQuery(sql);
845    
846                    q.setFirstResult(0);
847                    q.setMaxResults(2);
848    
849                    QueryPos qPos = QueryPos.getInstance(q);
850    
851                    if (uuid != null) {
852                            qPos.add(uuid);
853                    }
854    
855                    if (orderByComparator != null) {
856                            Object[] values = orderByComparator.getOrderByValues(dlFileShortcut);
857    
858                            for (Object value : values) {
859                                    qPos.add(value);
860                            }
861                    }
862    
863                    List<DLFileShortcut> list = q.list();
864    
865                    if (list.size() == 2) {
866                            return list.get(1);
867                    }
868                    else {
869                            return null;
870                    }
871            }
872    
873            /**
874             * Finds the d l file shortcut where uuid = &#63; and groupId = &#63; or throws a {@link com.liferay.portlet.documentlibrary.NoSuchFileShortcutException} if it could not be found.
875             *
876             * @param uuid the uuid to search with
877             * @param groupId the group id to search with
878             * @return the matching d l file shortcut
879             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching d l file shortcut could not be found
880             * @throws SystemException if a system exception occurred
881             */
882            public DLFileShortcut findByUUID_G(String uuid, long groupId)
883                    throws NoSuchFileShortcutException, SystemException {
884                    DLFileShortcut dlFileShortcut = fetchByUUID_G(uuid, groupId);
885    
886                    if (dlFileShortcut == null) {
887                            StringBundler msg = new StringBundler(6);
888    
889                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
890    
891                            msg.append("uuid=");
892                            msg.append(uuid);
893    
894                            msg.append(", groupId=");
895                            msg.append(groupId);
896    
897                            msg.append(StringPool.CLOSE_CURLY_BRACE);
898    
899                            if (_log.isWarnEnabled()) {
900                                    _log.warn(msg.toString());
901                            }
902    
903                            throw new NoSuchFileShortcutException(msg.toString());
904                    }
905    
906                    return dlFileShortcut;
907            }
908    
909            /**
910             * Finds the d l file shortcut where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
911             *
912             * @param uuid the uuid to search with
913             * @param groupId the group id to search with
914             * @return the matching d l file shortcut, or <code>null</code> if a matching d l file shortcut could not be found
915             * @throws SystemException if a system exception occurred
916             */
917            public DLFileShortcut fetchByUUID_G(String uuid, long groupId)
918                    throws SystemException {
919                    return fetchByUUID_G(uuid, groupId, true);
920            }
921    
922            /**
923             * Finds the d l file shortcut where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
924             *
925             * @param uuid the uuid to search with
926             * @param groupId the group id to search with
927             * @return the matching d l file shortcut, or <code>null</code> if a matching d l file shortcut could not be found
928             * @throws SystemException if a system exception occurred
929             */
930            public DLFileShortcut fetchByUUID_G(String uuid, long groupId,
931                    boolean retrieveFromCache) throws SystemException {
932                    Object[] finderArgs = new Object[] { uuid, groupId };
933    
934                    Object result = null;
935    
936                    if (retrieveFromCache) {
937                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
938                                            finderArgs, this);
939                    }
940    
941                    if (result == null) {
942                            StringBundler query = new StringBundler(3);
943    
944                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
945    
946                            if (uuid == null) {
947                                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
948                            }
949                            else {
950                                    if (uuid.equals(StringPool.BLANK)) {
951                                            query.append(_FINDER_COLUMN_UUID_G_UUID_3);
952                                    }
953                                    else {
954                                            query.append(_FINDER_COLUMN_UUID_G_UUID_2);
955                                    }
956                            }
957    
958                            query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
959    
960                            String sql = query.toString();
961    
962                            Session session = null;
963    
964                            try {
965                                    session = openSession();
966    
967                                    Query q = session.createQuery(sql);
968    
969                                    QueryPos qPos = QueryPos.getInstance(q);
970    
971                                    if (uuid != null) {
972                                            qPos.add(uuid);
973                                    }
974    
975                                    qPos.add(groupId);
976    
977                                    List<DLFileShortcut> list = q.list();
978    
979                                    result = list;
980    
981                                    DLFileShortcut dlFileShortcut = null;
982    
983                                    if (list.isEmpty()) {
984                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
985                                                    finderArgs, list);
986                                    }
987                                    else {
988                                            dlFileShortcut = list.get(0);
989    
990                                            cacheResult(dlFileShortcut);
991    
992                                            if ((dlFileShortcut.getUuid() == null) ||
993                                                            !dlFileShortcut.getUuid().equals(uuid) ||
994                                                            (dlFileShortcut.getGroupId() != groupId)) {
995                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
996                                                            finderArgs, dlFileShortcut);
997                                            }
998                                    }
999    
1000                                    return dlFileShortcut;
1001                            }
1002                            catch (Exception e) {
1003                                    throw processException(e);
1004                            }
1005                            finally {
1006                                    if (result == null) {
1007                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1008                                                    finderArgs);
1009                                    }
1010    
1011                                    closeSession(session);
1012                            }
1013                    }
1014                    else {
1015                            if (result instanceof List<?>) {
1016                                    return null;
1017                            }
1018                            else {
1019                                    return (DLFileShortcut)result;
1020                            }
1021                    }
1022            }
1023    
1024            /**
1025             * Finds all the d l file shortcuts where groupId = &#63; and folderId = &#63;.
1026             *
1027             * @param groupId the group id to search with
1028             * @param folderId the folder id to search with
1029             * @return the matching d l file shortcuts
1030             * @throws SystemException if a system exception occurred
1031             */
1032            public List<DLFileShortcut> findByG_F(long groupId, long folderId)
1033                    throws SystemException {
1034                    return findByG_F(groupId, folderId, QueryUtil.ALL_POS,
1035                            QueryUtil.ALL_POS, null);
1036            }
1037    
1038            /**
1039             * Finds a range of all the d l file shortcuts where groupId = &#63; and folderId = &#63;.
1040             *
1041             * <p>
1042             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1043             * </p>
1044             *
1045             * @param groupId the group id to search with
1046             * @param folderId the folder id to search with
1047             * @param start the lower bound of the range of d l file shortcuts to return
1048             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
1049             * @return the range of matching d l file shortcuts
1050             * @throws SystemException if a system exception occurred
1051             */
1052            public List<DLFileShortcut> findByG_F(long groupId, long folderId,
1053                    int start, int end) throws SystemException {
1054                    return findByG_F(groupId, folderId, start, end, null);
1055            }
1056    
1057            /**
1058             * Finds an ordered range of all the d l file shortcuts where groupId = &#63; and folderId = &#63;.
1059             *
1060             * <p>
1061             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1062             * </p>
1063             *
1064             * @param groupId the group id to search with
1065             * @param folderId the folder id to search with
1066             * @param start the lower bound of the range of d l file shortcuts to return
1067             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
1068             * @param orderByComparator the comparator to order the results by
1069             * @return the ordered range of matching d l file shortcuts
1070             * @throws SystemException if a system exception occurred
1071             */
1072            public List<DLFileShortcut> findByG_F(long groupId, long folderId,
1073                    int start, int end, OrderByComparator orderByComparator)
1074                    throws SystemException {
1075                    Object[] finderArgs = new Object[] {
1076                                    groupId, folderId,
1077                                    
1078                                    String.valueOf(start), String.valueOf(end),
1079                                    String.valueOf(orderByComparator)
1080                            };
1081    
1082                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_F,
1083                                    finderArgs, this);
1084    
1085                    if (list == null) {
1086                            StringBundler query = null;
1087    
1088                            if (orderByComparator != null) {
1089                                    query = new StringBundler(4 +
1090                                                    (orderByComparator.getOrderByFields().length * 3));
1091                            }
1092                            else {
1093                                    query = new StringBundler(3);
1094                            }
1095    
1096                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
1097    
1098                            query.append(_FINDER_COLUMN_G_F_GROUPID_2);
1099    
1100                            query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
1101    
1102                            if (orderByComparator != null) {
1103                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1104                                            orderByComparator);
1105                            }
1106    
1107                            String sql = query.toString();
1108    
1109                            Session session = null;
1110    
1111                            try {
1112                                    session = openSession();
1113    
1114                                    Query q = session.createQuery(sql);
1115    
1116                                    QueryPos qPos = QueryPos.getInstance(q);
1117    
1118                                    qPos.add(groupId);
1119    
1120                                    qPos.add(folderId);
1121    
1122                                    list = (List<DLFileShortcut>)QueryUtil.list(q, getDialect(),
1123                                                    start, end);
1124                            }
1125                            catch (Exception e) {
1126                                    throw processException(e);
1127                            }
1128                            finally {
1129                                    if (list == null) {
1130                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_F,
1131                                                    finderArgs);
1132                                    }
1133                                    else {
1134                                            cacheResult(list);
1135    
1136                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_F,
1137                                                    finderArgs, list);
1138                                    }
1139    
1140                                    closeSession(session);
1141                            }
1142                    }
1143    
1144                    return list;
1145            }
1146    
1147            /**
1148             * Finds the first d l file shortcut in the ordered set where groupId = &#63; and folderId = &#63;.
1149             *
1150             * <p>
1151             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1152             * </p>
1153             *
1154             * @param groupId the group id to search with
1155             * @param folderId the folder id to search with
1156             * @param orderByComparator the comparator to order the set by
1157             * @return the first matching d l file shortcut
1158             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching d l file shortcut could not be found
1159             * @throws SystemException if a system exception occurred
1160             */
1161            public DLFileShortcut findByG_F_First(long groupId, long folderId,
1162                    OrderByComparator orderByComparator)
1163                    throws NoSuchFileShortcutException, SystemException {
1164                    List<DLFileShortcut> list = findByG_F(groupId, folderId, 0, 1,
1165                                    orderByComparator);
1166    
1167                    if (list.isEmpty()) {
1168                            StringBundler msg = new StringBundler(6);
1169    
1170                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1171    
1172                            msg.append("groupId=");
1173                            msg.append(groupId);
1174    
1175                            msg.append(", folderId=");
1176                            msg.append(folderId);
1177    
1178                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1179    
1180                            throw new NoSuchFileShortcutException(msg.toString());
1181                    }
1182                    else {
1183                            return list.get(0);
1184                    }
1185            }
1186    
1187            /**
1188             * Finds the last d l file shortcut in the ordered set where groupId = &#63; and folderId = &#63;.
1189             *
1190             * <p>
1191             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1192             * </p>
1193             *
1194             * @param groupId the group id to search with
1195             * @param folderId the folder id to search with
1196             * @param orderByComparator the comparator to order the set by
1197             * @return the last matching d l file shortcut
1198             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching d l file shortcut could not be found
1199             * @throws SystemException if a system exception occurred
1200             */
1201            public DLFileShortcut findByG_F_Last(long groupId, long folderId,
1202                    OrderByComparator orderByComparator)
1203                    throws NoSuchFileShortcutException, SystemException {
1204                    int count = countByG_F(groupId, folderId);
1205    
1206                    List<DLFileShortcut> list = findByG_F(groupId, folderId, count - 1,
1207                                    count, orderByComparator);
1208    
1209                    if (list.isEmpty()) {
1210                            StringBundler msg = new StringBundler(6);
1211    
1212                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1213    
1214                            msg.append("groupId=");
1215                            msg.append(groupId);
1216    
1217                            msg.append(", folderId=");
1218                            msg.append(folderId);
1219    
1220                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1221    
1222                            throw new NoSuchFileShortcutException(msg.toString());
1223                    }
1224                    else {
1225                            return list.get(0);
1226                    }
1227            }
1228    
1229            /**
1230             * Finds the d l file shortcuts before and after the current d l file shortcut in the ordered set where groupId = &#63; and folderId = &#63;.
1231             *
1232             * <p>
1233             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1234             * </p>
1235             *
1236             * @param fileShortcutId the primary key of the current d l file shortcut
1237             * @param groupId the group id to search with
1238             * @param folderId the folder id to search with
1239             * @param orderByComparator the comparator to order the set by
1240             * @return the previous, current, and next d l file shortcut
1241             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a d l file shortcut with the primary key could not be found
1242             * @throws SystemException if a system exception occurred
1243             */
1244            public DLFileShortcut[] findByG_F_PrevAndNext(long fileShortcutId,
1245                    long groupId, long folderId, OrderByComparator orderByComparator)
1246                    throws NoSuchFileShortcutException, SystemException {
1247                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
1248    
1249                    Session session = null;
1250    
1251                    try {
1252                            session = openSession();
1253    
1254                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
1255    
1256                            array[0] = getByG_F_PrevAndNext(session, dlFileShortcut, groupId,
1257                                            folderId, orderByComparator, true);
1258    
1259                            array[1] = dlFileShortcut;
1260    
1261                            array[2] = getByG_F_PrevAndNext(session, dlFileShortcut, groupId,
1262                                            folderId, orderByComparator, false);
1263    
1264                            return array;
1265                    }
1266                    catch (Exception e) {
1267                            throw processException(e);
1268                    }
1269                    finally {
1270                            closeSession(session);
1271                    }
1272            }
1273    
1274            protected DLFileShortcut getByG_F_PrevAndNext(Session session,
1275                    DLFileShortcut dlFileShortcut, long groupId, long folderId,
1276                    OrderByComparator orderByComparator, boolean previous) {
1277                    StringBundler query = null;
1278    
1279                    if (orderByComparator != null) {
1280                            query = new StringBundler(6 +
1281                                            (orderByComparator.getOrderByFields().length * 6));
1282                    }
1283                    else {
1284                            query = new StringBundler(3);
1285                    }
1286    
1287                    query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
1288    
1289                    query.append(_FINDER_COLUMN_G_F_GROUPID_2);
1290    
1291                    query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
1292    
1293                    if (orderByComparator != null) {
1294                            String[] orderByFields = orderByComparator.getOrderByFields();
1295    
1296                            if (orderByFields.length > 0) {
1297                                    query.append(WHERE_AND);
1298                            }
1299    
1300                            for (int i = 0; i < orderByFields.length; i++) {
1301                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1302                                    query.append(orderByFields[i]);
1303    
1304                                    if ((i + 1) < orderByFields.length) {
1305                                            if (orderByComparator.isAscending() ^ previous) {
1306                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1307                                            }
1308                                            else {
1309                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1310                                            }
1311                                    }
1312                                    else {
1313                                            if (orderByComparator.isAscending() ^ previous) {
1314                                                    query.append(WHERE_GREATER_THAN);
1315                                            }
1316                                            else {
1317                                                    query.append(WHERE_LESSER_THAN);
1318                                            }
1319                                    }
1320                            }
1321    
1322                            query.append(ORDER_BY_CLAUSE);
1323    
1324                            for (int i = 0; i < orderByFields.length; i++) {
1325                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1326                                    query.append(orderByFields[i]);
1327    
1328                                    if ((i + 1) < orderByFields.length) {
1329                                            if (orderByComparator.isAscending() ^ previous) {
1330                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1331                                            }
1332                                            else {
1333                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1334                                            }
1335                                    }
1336                                    else {
1337                                            if (orderByComparator.isAscending() ^ previous) {
1338                                                    query.append(ORDER_BY_ASC);
1339                                            }
1340                                            else {
1341                                                    query.append(ORDER_BY_DESC);
1342                                            }
1343                                    }
1344                            }
1345                    }
1346    
1347                    String sql = query.toString();
1348    
1349                    Query q = session.createQuery(sql);
1350    
1351                    q.setFirstResult(0);
1352                    q.setMaxResults(2);
1353    
1354                    QueryPos qPos = QueryPos.getInstance(q);
1355    
1356                    qPos.add(groupId);
1357    
1358                    qPos.add(folderId);
1359    
1360                    if (orderByComparator != null) {
1361                            Object[] values = orderByComparator.getOrderByValues(dlFileShortcut);
1362    
1363                            for (Object value : values) {
1364                                    qPos.add(value);
1365                            }
1366                    }
1367    
1368                    List<DLFileShortcut> list = q.list();
1369    
1370                    if (list.size() == 2) {
1371                            return list.get(1);
1372                    }
1373                    else {
1374                            return null;
1375                    }
1376            }
1377    
1378            /**
1379             * Filters by the user's permissions and finds all the d l file shortcuts where groupId = &#63; and folderId = &#63;.
1380             *
1381             * @param groupId the group id to search with
1382             * @param folderId the folder id to search with
1383             * @return the matching d l file shortcuts that the user has permission to view
1384             * @throws SystemException if a system exception occurred
1385             */
1386            public List<DLFileShortcut> filterFindByG_F(long groupId, long folderId)
1387                    throws SystemException {
1388                    return filterFindByG_F(groupId, folderId, QueryUtil.ALL_POS,
1389                            QueryUtil.ALL_POS, null);
1390            }
1391    
1392            /**
1393             * Filters by the user's permissions and finds a range of all the d l file shortcuts where groupId = &#63; and folderId = &#63;.
1394             *
1395             * <p>
1396             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1397             * </p>
1398             *
1399             * @param groupId the group id to search with
1400             * @param folderId the folder id to search with
1401             * @param start the lower bound of the range of d l file shortcuts to return
1402             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
1403             * @return the range of matching d l file shortcuts that the user has permission to view
1404             * @throws SystemException if a system exception occurred
1405             */
1406            public List<DLFileShortcut> filterFindByG_F(long groupId, long folderId,
1407                    int start, int end) throws SystemException {
1408                    return filterFindByG_F(groupId, folderId, start, end, null);
1409            }
1410    
1411            /**
1412             * Filters by the user's permissions and finds an ordered range of all the d l file shortcuts where groupId = &#63; and folderId = &#63;.
1413             *
1414             * <p>
1415             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1416             * </p>
1417             *
1418             * @param groupId the group id to search with
1419             * @param folderId the folder id to search with
1420             * @param start the lower bound of the range of d l file shortcuts to return
1421             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
1422             * @param orderByComparator the comparator to order the results by
1423             * @return the ordered range of matching d l file shortcuts that the user has permission to view
1424             * @throws SystemException if a system exception occurred
1425             */
1426            public List<DLFileShortcut> filterFindByG_F(long groupId, long folderId,
1427                    int start, int end, OrderByComparator orderByComparator)
1428                    throws SystemException {
1429                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1430                            return findByG_F(groupId, folderId, start, end, orderByComparator);
1431                    }
1432    
1433                    StringBundler query = null;
1434    
1435                    if (orderByComparator != null) {
1436                            query = new StringBundler(4 +
1437                                            (orderByComparator.getOrderByFields().length * 3));
1438                    }
1439                    else {
1440                            query = new StringBundler(3);
1441                    }
1442    
1443                    if (getDB().isSupportsInlineDistinct()) {
1444                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE);
1445                    }
1446                    else {
1447                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1);
1448                    }
1449    
1450                    query.append(_FINDER_COLUMN_G_F_GROUPID_2);
1451    
1452                    query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
1453    
1454                    if (!getDB().isSupportsInlineDistinct()) {
1455                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2);
1456                    }
1457    
1458                    if (orderByComparator != null) {
1459                            if (getDB().isSupportsInlineDistinct()) {
1460                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1461                                            orderByComparator);
1462                            }
1463                            else {
1464                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1465                                            orderByComparator);
1466                            }
1467                    }
1468    
1469                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1470                                    DLFileShortcut.class.getName(), _FILTER_COLUMN_PK,
1471                                    _FILTER_COLUMN_USERID, groupId);
1472    
1473                    Session session = null;
1474    
1475                    try {
1476                            session = openSession();
1477    
1478                            SQLQuery q = session.createSQLQuery(sql);
1479    
1480                            if (getDB().isSupportsInlineDistinct()) {
1481                                    q.addEntity(_FILTER_ENTITY_ALIAS, DLFileShortcutImpl.class);
1482                            }
1483                            else {
1484                                    q.addEntity(_FILTER_ENTITY_TABLE, DLFileShortcutImpl.class);
1485                            }
1486    
1487                            QueryPos qPos = QueryPos.getInstance(q);
1488    
1489                            qPos.add(groupId);
1490    
1491                            qPos.add(folderId);
1492    
1493                            return (List<DLFileShortcut>)QueryUtil.list(q, getDialect(), start,
1494                                    end);
1495                    }
1496                    catch (Exception e) {
1497                            throw processException(e);
1498                    }
1499                    finally {
1500                            closeSession(session);
1501                    }
1502            }
1503    
1504            /**
1505             * Finds all the d l file shortcuts where groupId = &#63; and folderId = &#63; and status = &#63;.
1506             *
1507             * @param groupId the group id to search with
1508             * @param folderId the folder id to search with
1509             * @param status the status to search with
1510             * @return the matching d l file shortcuts
1511             * @throws SystemException if a system exception occurred
1512             */
1513            public List<DLFileShortcut> findByG_F_S(long groupId, long folderId,
1514                    int status) throws SystemException {
1515                    return findByG_F_S(groupId, folderId, status, QueryUtil.ALL_POS,
1516                            QueryUtil.ALL_POS, null);
1517            }
1518    
1519            /**
1520             * Finds a range of all the d l file shortcuts where groupId = &#63; and folderId = &#63; and status = &#63;.
1521             *
1522             * <p>
1523             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1524             * </p>
1525             *
1526             * @param groupId the group id to search with
1527             * @param folderId the folder id to search with
1528             * @param status the status to search with
1529             * @param start the lower bound of the range of d l file shortcuts to return
1530             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
1531             * @return the range of matching d l file shortcuts
1532             * @throws SystemException if a system exception occurred
1533             */
1534            public List<DLFileShortcut> findByG_F_S(long groupId, long folderId,
1535                    int status, int start, int end) throws SystemException {
1536                    return findByG_F_S(groupId, folderId, status, start, end, null);
1537            }
1538    
1539            /**
1540             * Finds an ordered range of all the d l file shortcuts where groupId = &#63; and folderId = &#63; and status = &#63;.
1541             *
1542             * <p>
1543             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1544             * </p>
1545             *
1546             * @param groupId the group id to search with
1547             * @param folderId the folder id to search with
1548             * @param status the status to search with
1549             * @param start the lower bound of the range of d l file shortcuts to return
1550             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
1551             * @param orderByComparator the comparator to order the results by
1552             * @return the ordered range of matching d l file shortcuts
1553             * @throws SystemException if a system exception occurred
1554             */
1555            public List<DLFileShortcut> findByG_F_S(long groupId, long folderId,
1556                    int status, int start, int end, OrderByComparator orderByComparator)
1557                    throws SystemException {
1558                    Object[] finderArgs = new Object[] {
1559                                    groupId, folderId, status,
1560                                    
1561                                    String.valueOf(start), String.valueOf(end),
1562                                    String.valueOf(orderByComparator)
1563                            };
1564    
1565                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_F_S,
1566                                    finderArgs, this);
1567    
1568                    if (list == null) {
1569                            StringBundler query = null;
1570    
1571                            if (orderByComparator != null) {
1572                                    query = new StringBundler(5 +
1573                                                    (orderByComparator.getOrderByFields().length * 3));
1574                            }
1575                            else {
1576                                    query = new StringBundler(4);
1577                            }
1578    
1579                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
1580    
1581                            query.append(_FINDER_COLUMN_G_F_S_GROUPID_2);
1582    
1583                            query.append(_FINDER_COLUMN_G_F_S_FOLDERID_2);
1584    
1585                            query.append(_FINDER_COLUMN_G_F_S_STATUS_2);
1586    
1587                            if (orderByComparator != null) {
1588                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1589                                            orderByComparator);
1590                            }
1591    
1592                            String sql = query.toString();
1593    
1594                            Session session = null;
1595    
1596                            try {
1597                                    session = openSession();
1598    
1599                                    Query q = session.createQuery(sql);
1600    
1601                                    QueryPos qPos = QueryPos.getInstance(q);
1602    
1603                                    qPos.add(groupId);
1604    
1605                                    qPos.add(folderId);
1606    
1607                                    qPos.add(status);
1608    
1609                                    list = (List<DLFileShortcut>)QueryUtil.list(q, getDialect(),
1610                                                    start, end);
1611                            }
1612                            catch (Exception e) {
1613                                    throw processException(e);
1614                            }
1615                            finally {
1616                                    if (list == null) {
1617                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_F_S,
1618                                                    finderArgs);
1619                                    }
1620                                    else {
1621                                            cacheResult(list);
1622    
1623                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_F_S,
1624                                                    finderArgs, list);
1625                                    }
1626    
1627                                    closeSession(session);
1628                            }
1629                    }
1630    
1631                    return list;
1632            }
1633    
1634            /**
1635             * Finds the first d l file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and status = &#63;.
1636             *
1637             * <p>
1638             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1639             * </p>
1640             *
1641             * @param groupId the group id to search with
1642             * @param folderId the folder id to search with
1643             * @param status the status to search with
1644             * @param orderByComparator the comparator to order the set by
1645             * @return the first matching d l file shortcut
1646             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching d l file shortcut could not be found
1647             * @throws SystemException if a system exception occurred
1648             */
1649            public DLFileShortcut findByG_F_S_First(long groupId, long folderId,
1650                    int status, OrderByComparator orderByComparator)
1651                    throws NoSuchFileShortcutException, SystemException {
1652                    List<DLFileShortcut> list = findByG_F_S(groupId, folderId, status, 0,
1653                                    1, orderByComparator);
1654    
1655                    if (list.isEmpty()) {
1656                            StringBundler msg = new StringBundler(8);
1657    
1658                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1659    
1660                            msg.append("groupId=");
1661                            msg.append(groupId);
1662    
1663                            msg.append(", folderId=");
1664                            msg.append(folderId);
1665    
1666                            msg.append(", status=");
1667                            msg.append(status);
1668    
1669                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1670    
1671                            throw new NoSuchFileShortcutException(msg.toString());
1672                    }
1673                    else {
1674                            return list.get(0);
1675                    }
1676            }
1677    
1678            /**
1679             * Finds the last d l file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and status = &#63;.
1680             *
1681             * <p>
1682             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1683             * </p>
1684             *
1685             * @param groupId the group id to search with
1686             * @param folderId the folder id to search with
1687             * @param status the status to search with
1688             * @param orderByComparator the comparator to order the set by
1689             * @return the last matching d l file shortcut
1690             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching d l file shortcut could not be found
1691             * @throws SystemException if a system exception occurred
1692             */
1693            public DLFileShortcut findByG_F_S_Last(long groupId, long folderId,
1694                    int status, OrderByComparator orderByComparator)
1695                    throws NoSuchFileShortcutException, SystemException {
1696                    int count = countByG_F_S(groupId, folderId, status);
1697    
1698                    List<DLFileShortcut> list = findByG_F_S(groupId, folderId, status,
1699                                    count - 1, count, orderByComparator);
1700    
1701                    if (list.isEmpty()) {
1702                            StringBundler msg = new StringBundler(8);
1703    
1704                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1705    
1706                            msg.append("groupId=");
1707                            msg.append(groupId);
1708    
1709                            msg.append(", folderId=");
1710                            msg.append(folderId);
1711    
1712                            msg.append(", status=");
1713                            msg.append(status);
1714    
1715                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1716    
1717                            throw new NoSuchFileShortcutException(msg.toString());
1718                    }
1719                    else {
1720                            return list.get(0);
1721                    }
1722            }
1723    
1724            /**
1725             * Finds the d l file shortcuts before and after the current d l file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and status = &#63;.
1726             *
1727             * <p>
1728             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1729             * </p>
1730             *
1731             * @param fileShortcutId the primary key of the current d l file shortcut
1732             * @param groupId the group id to search with
1733             * @param folderId the folder id to search with
1734             * @param status the status to search with
1735             * @param orderByComparator the comparator to order the set by
1736             * @return the previous, current, and next d l file shortcut
1737             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a d l file shortcut with the primary key could not be found
1738             * @throws SystemException if a system exception occurred
1739             */
1740            public DLFileShortcut[] findByG_F_S_PrevAndNext(long fileShortcutId,
1741                    long groupId, long folderId, int status,
1742                    OrderByComparator orderByComparator)
1743                    throws NoSuchFileShortcutException, SystemException {
1744                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
1745    
1746                    Session session = null;
1747    
1748                    try {
1749                            session = openSession();
1750    
1751                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
1752    
1753                            array[0] = getByG_F_S_PrevAndNext(session, dlFileShortcut, groupId,
1754                                            folderId, status, orderByComparator, true);
1755    
1756                            array[1] = dlFileShortcut;
1757    
1758                            array[2] = getByG_F_S_PrevAndNext(session, dlFileShortcut, groupId,
1759                                            folderId, status, orderByComparator, false);
1760    
1761                            return array;
1762                    }
1763                    catch (Exception e) {
1764                            throw processException(e);
1765                    }
1766                    finally {
1767                            closeSession(session);
1768                    }
1769            }
1770    
1771            protected DLFileShortcut getByG_F_S_PrevAndNext(Session session,
1772                    DLFileShortcut dlFileShortcut, long groupId, long folderId, int status,
1773                    OrderByComparator orderByComparator, boolean previous) {
1774                    StringBundler query = null;
1775    
1776                    if (orderByComparator != null) {
1777                            query = new StringBundler(6 +
1778                                            (orderByComparator.getOrderByFields().length * 6));
1779                    }
1780                    else {
1781                            query = new StringBundler(3);
1782                    }
1783    
1784                    query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
1785    
1786                    query.append(_FINDER_COLUMN_G_F_S_GROUPID_2);
1787    
1788                    query.append(_FINDER_COLUMN_G_F_S_FOLDERID_2);
1789    
1790                    query.append(_FINDER_COLUMN_G_F_S_STATUS_2);
1791    
1792                    if (orderByComparator != null) {
1793                            String[] orderByFields = orderByComparator.getOrderByFields();
1794    
1795                            if (orderByFields.length > 0) {
1796                                    query.append(WHERE_AND);
1797                            }
1798    
1799                            for (int i = 0; i < orderByFields.length; i++) {
1800                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1801                                    query.append(orderByFields[i]);
1802    
1803                                    if ((i + 1) < orderByFields.length) {
1804                                            if (orderByComparator.isAscending() ^ previous) {
1805                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1806                                            }
1807                                            else {
1808                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1809                                            }
1810                                    }
1811                                    else {
1812                                            if (orderByComparator.isAscending() ^ previous) {
1813                                                    query.append(WHERE_GREATER_THAN);
1814                                            }
1815                                            else {
1816                                                    query.append(WHERE_LESSER_THAN);
1817                                            }
1818                                    }
1819                            }
1820    
1821                            query.append(ORDER_BY_CLAUSE);
1822    
1823                            for (int i = 0; i < orderByFields.length; i++) {
1824                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1825                                    query.append(orderByFields[i]);
1826    
1827                                    if ((i + 1) < orderByFields.length) {
1828                                            if (orderByComparator.isAscending() ^ previous) {
1829                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1830                                            }
1831                                            else {
1832                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1833                                            }
1834                                    }
1835                                    else {
1836                                            if (orderByComparator.isAscending() ^ previous) {
1837                                                    query.append(ORDER_BY_ASC);
1838                                            }
1839                                            else {
1840                                                    query.append(ORDER_BY_DESC);
1841                                            }
1842                                    }
1843                            }
1844                    }
1845    
1846                    String sql = query.toString();
1847    
1848                    Query q = session.createQuery(sql);
1849    
1850                    q.setFirstResult(0);
1851                    q.setMaxResults(2);
1852    
1853                    QueryPos qPos = QueryPos.getInstance(q);
1854    
1855                    qPos.add(groupId);
1856    
1857                    qPos.add(folderId);
1858    
1859                    qPos.add(status);
1860    
1861                    if (orderByComparator != null) {
1862                            Object[] values = orderByComparator.getOrderByValues(dlFileShortcut);
1863    
1864                            for (Object value : values) {
1865                                    qPos.add(value);
1866                            }
1867                    }
1868    
1869                    List<DLFileShortcut> list = q.list();
1870    
1871                    if (list.size() == 2) {
1872                            return list.get(1);
1873                    }
1874                    else {
1875                            return null;
1876                    }
1877            }
1878    
1879            /**
1880             * Filters by the user's permissions and finds all the d l file shortcuts where groupId = &#63; and folderId = &#63; and status = &#63;.
1881             *
1882             * @param groupId the group id to search with
1883             * @param folderId the folder id to search with
1884             * @param status the status to search with
1885             * @return the matching d l file shortcuts that the user has permission to view
1886             * @throws SystemException if a system exception occurred
1887             */
1888            public List<DLFileShortcut> filterFindByG_F_S(long groupId, long folderId,
1889                    int status) throws SystemException {
1890                    return filterFindByG_F_S(groupId, folderId, status, QueryUtil.ALL_POS,
1891                            QueryUtil.ALL_POS, null);
1892            }
1893    
1894            /**
1895             * Filters by the user's permissions and finds a range of all the d l file shortcuts where groupId = &#63; and folderId = &#63; and status = &#63;.
1896             *
1897             * <p>
1898             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1899             * </p>
1900             *
1901             * @param groupId the group id to search with
1902             * @param folderId the folder id to search with
1903             * @param status the status to search with
1904             * @param start the lower bound of the range of d l file shortcuts to return
1905             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
1906             * @return the range of matching d l file shortcuts that the user has permission to view
1907             * @throws SystemException if a system exception occurred
1908             */
1909            public List<DLFileShortcut> filterFindByG_F_S(long groupId, long folderId,
1910                    int status, int start, int end) throws SystemException {
1911                    return filterFindByG_F_S(groupId, folderId, status, start, end, null);
1912            }
1913    
1914            /**
1915             * Filters by the user's permissions and finds an ordered range of all the d l file shortcuts where groupId = &#63; and folderId = &#63; and status = &#63;.
1916             *
1917             * <p>
1918             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1919             * </p>
1920             *
1921             * @param groupId the group id to search with
1922             * @param folderId the folder id to search with
1923             * @param status the status to search with
1924             * @param start the lower bound of the range of d l file shortcuts to return
1925             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
1926             * @param orderByComparator the comparator to order the results by
1927             * @return the ordered range of matching d l file shortcuts that the user has permission to view
1928             * @throws SystemException if a system exception occurred
1929             */
1930            public List<DLFileShortcut> filterFindByG_F_S(long groupId, long folderId,
1931                    int status, int start, int end, OrderByComparator orderByComparator)
1932                    throws SystemException {
1933                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1934                            return findByG_F_S(groupId, folderId, status, start, end,
1935                                    orderByComparator);
1936                    }
1937    
1938                    StringBundler query = null;
1939    
1940                    if (orderByComparator != null) {
1941                            query = new StringBundler(5 +
1942                                            (orderByComparator.getOrderByFields().length * 3));
1943                    }
1944                    else {
1945                            query = new StringBundler(4);
1946                    }
1947    
1948                    if (getDB().isSupportsInlineDistinct()) {
1949                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE);
1950                    }
1951                    else {
1952                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1);
1953                    }
1954    
1955                    query.append(_FINDER_COLUMN_G_F_S_GROUPID_2);
1956    
1957                    query.append(_FINDER_COLUMN_G_F_S_FOLDERID_2);
1958    
1959                    query.append(_FINDER_COLUMN_G_F_S_STATUS_2);
1960    
1961                    if (!getDB().isSupportsInlineDistinct()) {
1962                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2);
1963                    }
1964    
1965                    if (orderByComparator != null) {
1966                            if (getDB().isSupportsInlineDistinct()) {
1967                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1968                                            orderByComparator);
1969                            }
1970                            else {
1971                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1972                                            orderByComparator);
1973                            }
1974                    }
1975    
1976                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1977                                    DLFileShortcut.class.getName(), _FILTER_COLUMN_PK,
1978                                    _FILTER_COLUMN_USERID, groupId);
1979    
1980                    Session session = null;
1981    
1982                    try {
1983                            session = openSession();
1984    
1985                            SQLQuery q = session.createSQLQuery(sql);
1986    
1987                            if (getDB().isSupportsInlineDistinct()) {
1988                                    q.addEntity(_FILTER_ENTITY_ALIAS, DLFileShortcutImpl.class);
1989                            }
1990                            else {
1991                                    q.addEntity(_FILTER_ENTITY_TABLE, DLFileShortcutImpl.class);
1992                            }
1993    
1994                            QueryPos qPos = QueryPos.getInstance(q);
1995    
1996                            qPos.add(groupId);
1997    
1998                            qPos.add(folderId);
1999    
2000                            qPos.add(status);
2001    
2002                            return (List<DLFileShortcut>)QueryUtil.list(q, getDialect(), start,
2003                                    end);
2004                    }
2005                    catch (Exception e) {
2006                            throw processException(e);
2007                    }
2008                    finally {
2009                            closeSession(session);
2010                    }
2011            }
2012    
2013            /**
2014             * Finds all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63;.
2015             *
2016             * @param groupId the group id to search with
2017             * @param toFolderId the to folder id to search with
2018             * @param toName the to name to search with
2019             * @return the matching d l file shortcuts
2020             * @throws SystemException if a system exception occurred
2021             */
2022            public List<DLFileShortcut> findByG_TF_TN(long groupId, long toFolderId,
2023                    String toName) throws SystemException {
2024                    return findByG_TF_TN(groupId, toFolderId, toName, QueryUtil.ALL_POS,
2025                            QueryUtil.ALL_POS, null);
2026            }
2027    
2028            /**
2029             * Finds a range of all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63;.
2030             *
2031             * <p>
2032             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2033             * </p>
2034             *
2035             * @param groupId the group id to search with
2036             * @param toFolderId the to folder id to search with
2037             * @param toName the to name to search with
2038             * @param start the lower bound of the range of d l file shortcuts to return
2039             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
2040             * @return the range of matching d l file shortcuts
2041             * @throws SystemException if a system exception occurred
2042             */
2043            public List<DLFileShortcut> findByG_TF_TN(long groupId, long toFolderId,
2044                    String toName, int start, int end) throws SystemException {
2045                    return findByG_TF_TN(groupId, toFolderId, toName, start, end, null);
2046            }
2047    
2048            /**
2049             * Finds an ordered range of all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63;.
2050             *
2051             * <p>
2052             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2053             * </p>
2054             *
2055             * @param groupId the group id to search with
2056             * @param toFolderId the to folder id to search with
2057             * @param toName the to name to search with
2058             * @param start the lower bound of the range of d l file shortcuts to return
2059             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
2060             * @param orderByComparator the comparator to order the results by
2061             * @return the ordered range of matching d l file shortcuts
2062             * @throws SystemException if a system exception occurred
2063             */
2064            public List<DLFileShortcut> findByG_TF_TN(long groupId, long toFolderId,
2065                    String toName, int start, int end, OrderByComparator orderByComparator)
2066                    throws SystemException {
2067                    Object[] finderArgs = new Object[] {
2068                                    groupId, toFolderId, toName,
2069                                    
2070                                    String.valueOf(start), String.valueOf(end),
2071                                    String.valueOf(orderByComparator)
2072                            };
2073    
2074                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_TF_TN,
2075                                    finderArgs, this);
2076    
2077                    if (list == null) {
2078                            StringBundler query = null;
2079    
2080                            if (orderByComparator != null) {
2081                                    query = new StringBundler(5 +
2082                                                    (orderByComparator.getOrderByFields().length * 3));
2083                            }
2084                            else {
2085                                    query = new StringBundler(4);
2086                            }
2087    
2088                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
2089    
2090                            query.append(_FINDER_COLUMN_G_TF_TN_GROUPID_2);
2091    
2092                            query.append(_FINDER_COLUMN_G_TF_TN_TOFOLDERID_2);
2093    
2094                            if (toName == null) {
2095                                    query.append(_FINDER_COLUMN_G_TF_TN_TONAME_1);
2096                            }
2097                            else {
2098                                    if (toName.equals(StringPool.BLANK)) {
2099                                            query.append(_FINDER_COLUMN_G_TF_TN_TONAME_3);
2100                                    }
2101                                    else {
2102                                            query.append(_FINDER_COLUMN_G_TF_TN_TONAME_2);
2103                                    }
2104                            }
2105    
2106                            if (orderByComparator != null) {
2107                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2108                                            orderByComparator);
2109                            }
2110    
2111                            String sql = query.toString();
2112    
2113                            Session session = null;
2114    
2115                            try {
2116                                    session = openSession();
2117    
2118                                    Query q = session.createQuery(sql);
2119    
2120                                    QueryPos qPos = QueryPos.getInstance(q);
2121    
2122                                    qPos.add(groupId);
2123    
2124                                    qPos.add(toFolderId);
2125    
2126                                    if (toName != null) {
2127                                            qPos.add(toName);
2128                                    }
2129    
2130                                    list = (List<DLFileShortcut>)QueryUtil.list(q, getDialect(),
2131                                                    start, end);
2132                            }
2133                            catch (Exception e) {
2134                                    throw processException(e);
2135                            }
2136                            finally {
2137                                    if (list == null) {
2138                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_TF_TN,
2139                                                    finderArgs);
2140                                    }
2141                                    else {
2142                                            cacheResult(list);
2143    
2144                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_TF_TN,
2145                                                    finderArgs, list);
2146                                    }
2147    
2148                                    closeSession(session);
2149                            }
2150                    }
2151    
2152                    return list;
2153            }
2154    
2155            /**
2156             * Finds the first d l file shortcut in the ordered set where groupId = &#63; and toFolderId = &#63; and toName = &#63;.
2157             *
2158             * <p>
2159             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2160             * </p>
2161             *
2162             * @param groupId the group id to search with
2163             * @param toFolderId the to folder id to search with
2164             * @param toName the to name to search with
2165             * @param orderByComparator the comparator to order the set by
2166             * @return the first matching d l file shortcut
2167             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching d l file shortcut could not be found
2168             * @throws SystemException if a system exception occurred
2169             */
2170            public DLFileShortcut findByG_TF_TN_First(long groupId, long toFolderId,
2171                    String toName, OrderByComparator orderByComparator)
2172                    throws NoSuchFileShortcutException, SystemException {
2173                    List<DLFileShortcut> list = findByG_TF_TN(groupId, toFolderId, toName,
2174                                    0, 1, orderByComparator);
2175    
2176                    if (list.isEmpty()) {
2177                            StringBundler msg = new StringBundler(8);
2178    
2179                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2180    
2181                            msg.append("groupId=");
2182                            msg.append(groupId);
2183    
2184                            msg.append(", toFolderId=");
2185                            msg.append(toFolderId);
2186    
2187                            msg.append(", toName=");
2188                            msg.append(toName);
2189    
2190                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2191    
2192                            throw new NoSuchFileShortcutException(msg.toString());
2193                    }
2194                    else {
2195                            return list.get(0);
2196                    }
2197            }
2198    
2199            /**
2200             * Finds the last d l file shortcut in the ordered set where groupId = &#63; and toFolderId = &#63; and toName = &#63;.
2201             *
2202             * <p>
2203             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2204             * </p>
2205             *
2206             * @param groupId the group id to search with
2207             * @param toFolderId the to folder id to search with
2208             * @param toName the to name to search with
2209             * @param orderByComparator the comparator to order the set by
2210             * @return the last matching d l file shortcut
2211             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching d l file shortcut could not be found
2212             * @throws SystemException if a system exception occurred
2213             */
2214            public DLFileShortcut findByG_TF_TN_Last(long groupId, long toFolderId,
2215                    String toName, OrderByComparator orderByComparator)
2216                    throws NoSuchFileShortcutException, SystemException {
2217                    int count = countByG_TF_TN(groupId, toFolderId, toName);
2218    
2219                    List<DLFileShortcut> list = findByG_TF_TN(groupId, toFolderId, toName,
2220                                    count - 1, count, orderByComparator);
2221    
2222                    if (list.isEmpty()) {
2223                            StringBundler msg = new StringBundler(8);
2224    
2225                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2226    
2227                            msg.append("groupId=");
2228                            msg.append(groupId);
2229    
2230                            msg.append(", toFolderId=");
2231                            msg.append(toFolderId);
2232    
2233                            msg.append(", toName=");
2234                            msg.append(toName);
2235    
2236                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2237    
2238                            throw new NoSuchFileShortcutException(msg.toString());
2239                    }
2240                    else {
2241                            return list.get(0);
2242                    }
2243            }
2244    
2245            /**
2246             * Finds the d l file shortcuts before and after the current d l file shortcut in the ordered set where groupId = &#63; and toFolderId = &#63; and toName = &#63;.
2247             *
2248             * <p>
2249             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2250             * </p>
2251             *
2252             * @param fileShortcutId the primary key of the current d l file shortcut
2253             * @param groupId the group id to search with
2254             * @param toFolderId the to folder id to search with
2255             * @param toName the to name to search with
2256             * @param orderByComparator the comparator to order the set by
2257             * @return the previous, current, and next d l file shortcut
2258             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a d l file shortcut with the primary key could not be found
2259             * @throws SystemException if a system exception occurred
2260             */
2261            public DLFileShortcut[] findByG_TF_TN_PrevAndNext(long fileShortcutId,
2262                    long groupId, long toFolderId, String toName,
2263                    OrderByComparator orderByComparator)
2264                    throws NoSuchFileShortcutException, SystemException {
2265                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
2266    
2267                    Session session = null;
2268    
2269                    try {
2270                            session = openSession();
2271    
2272                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
2273    
2274                            array[0] = getByG_TF_TN_PrevAndNext(session, dlFileShortcut,
2275                                            groupId, toFolderId, toName, orderByComparator, true);
2276    
2277                            array[1] = dlFileShortcut;
2278    
2279                            array[2] = getByG_TF_TN_PrevAndNext(session, dlFileShortcut,
2280                                            groupId, toFolderId, toName, orderByComparator, false);
2281    
2282                            return array;
2283                    }
2284                    catch (Exception e) {
2285                            throw processException(e);
2286                    }
2287                    finally {
2288                            closeSession(session);
2289                    }
2290            }
2291    
2292            protected DLFileShortcut getByG_TF_TN_PrevAndNext(Session session,
2293                    DLFileShortcut dlFileShortcut, long groupId, long toFolderId,
2294                    String toName, OrderByComparator orderByComparator, boolean previous) {
2295                    StringBundler query = null;
2296    
2297                    if (orderByComparator != null) {
2298                            query = new StringBundler(6 +
2299                                            (orderByComparator.getOrderByFields().length * 6));
2300                    }
2301                    else {
2302                            query = new StringBundler(3);
2303                    }
2304    
2305                    query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
2306    
2307                    query.append(_FINDER_COLUMN_G_TF_TN_GROUPID_2);
2308    
2309                    query.append(_FINDER_COLUMN_G_TF_TN_TOFOLDERID_2);
2310    
2311                    if (toName == null) {
2312                            query.append(_FINDER_COLUMN_G_TF_TN_TONAME_1);
2313                    }
2314                    else {
2315                            if (toName.equals(StringPool.BLANK)) {
2316                                    query.append(_FINDER_COLUMN_G_TF_TN_TONAME_3);
2317                            }
2318                            else {
2319                                    query.append(_FINDER_COLUMN_G_TF_TN_TONAME_2);
2320                            }
2321                    }
2322    
2323                    if (orderByComparator != null) {
2324                            String[] orderByFields = orderByComparator.getOrderByFields();
2325    
2326                            if (orderByFields.length > 0) {
2327                                    query.append(WHERE_AND);
2328                            }
2329    
2330                            for (int i = 0; i < orderByFields.length; i++) {
2331                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2332                                    query.append(orderByFields[i]);
2333    
2334                                    if ((i + 1) < orderByFields.length) {
2335                                            if (orderByComparator.isAscending() ^ previous) {
2336                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2337                                            }
2338                                            else {
2339                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2340                                            }
2341                                    }
2342                                    else {
2343                                            if (orderByComparator.isAscending() ^ previous) {
2344                                                    query.append(WHERE_GREATER_THAN);
2345                                            }
2346                                            else {
2347                                                    query.append(WHERE_LESSER_THAN);
2348                                            }
2349                                    }
2350                            }
2351    
2352                            query.append(ORDER_BY_CLAUSE);
2353    
2354                            for (int i = 0; i < orderByFields.length; i++) {
2355                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2356                                    query.append(orderByFields[i]);
2357    
2358                                    if ((i + 1) < orderByFields.length) {
2359                                            if (orderByComparator.isAscending() ^ previous) {
2360                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2361                                            }
2362                                            else {
2363                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2364                                            }
2365                                    }
2366                                    else {
2367                                            if (orderByComparator.isAscending() ^ previous) {
2368                                                    query.append(ORDER_BY_ASC);
2369                                            }
2370                                            else {
2371                                                    query.append(ORDER_BY_DESC);
2372                                            }
2373                                    }
2374                            }
2375                    }
2376    
2377                    String sql = query.toString();
2378    
2379                    Query q = session.createQuery(sql);
2380    
2381                    q.setFirstResult(0);
2382                    q.setMaxResults(2);
2383    
2384                    QueryPos qPos = QueryPos.getInstance(q);
2385    
2386                    qPos.add(groupId);
2387    
2388                    qPos.add(toFolderId);
2389    
2390                    if (toName != null) {
2391                            qPos.add(toName);
2392                    }
2393    
2394                    if (orderByComparator != null) {
2395                            Object[] values = orderByComparator.getOrderByValues(dlFileShortcut);
2396    
2397                            for (Object value : values) {
2398                                    qPos.add(value);
2399                            }
2400                    }
2401    
2402                    List<DLFileShortcut> list = q.list();
2403    
2404                    if (list.size() == 2) {
2405                            return list.get(1);
2406                    }
2407                    else {
2408                            return null;
2409                    }
2410            }
2411    
2412            /**
2413             * Filters by the user's permissions and finds all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63;.
2414             *
2415             * @param groupId the group id to search with
2416             * @param toFolderId the to folder id to search with
2417             * @param toName the to name to search with
2418             * @return the matching d l file shortcuts that the user has permission to view
2419             * @throws SystemException if a system exception occurred
2420             */
2421            public List<DLFileShortcut> filterFindByG_TF_TN(long groupId,
2422                    long toFolderId, String toName) throws SystemException {
2423                    return filterFindByG_TF_TN(groupId, toFolderId, toName,
2424                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2425            }
2426    
2427            /**
2428             * Filters by the user's permissions and finds a range of all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63;.
2429             *
2430             * <p>
2431             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2432             * </p>
2433             *
2434             * @param groupId the group id to search with
2435             * @param toFolderId the to folder id to search with
2436             * @param toName the to name to search with
2437             * @param start the lower bound of the range of d l file shortcuts to return
2438             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
2439             * @return the range of matching d l file shortcuts that the user has permission to view
2440             * @throws SystemException if a system exception occurred
2441             */
2442            public List<DLFileShortcut> filterFindByG_TF_TN(long groupId,
2443                    long toFolderId, String toName, int start, int end)
2444                    throws SystemException {
2445                    return filterFindByG_TF_TN(groupId, toFolderId, toName, start, end, null);
2446            }
2447    
2448            /**
2449             * Filters by the user's permissions and finds an ordered range of all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63;.
2450             *
2451             * <p>
2452             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2453             * </p>
2454             *
2455             * @param groupId the group id to search with
2456             * @param toFolderId the to folder id to search with
2457             * @param toName the to name to search with
2458             * @param start the lower bound of the range of d l file shortcuts to return
2459             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
2460             * @param orderByComparator the comparator to order the results by
2461             * @return the ordered range of matching d l file shortcuts that the user has permission to view
2462             * @throws SystemException if a system exception occurred
2463             */
2464            public List<DLFileShortcut> filterFindByG_TF_TN(long groupId,
2465                    long toFolderId, String toName, int start, int end,
2466                    OrderByComparator orderByComparator) throws SystemException {
2467                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2468                            return findByG_TF_TN(groupId, toFolderId, toName, start, end,
2469                                    orderByComparator);
2470                    }
2471    
2472                    StringBundler query = null;
2473    
2474                    if (orderByComparator != null) {
2475                            query = new StringBundler(5 +
2476                                            (orderByComparator.getOrderByFields().length * 3));
2477                    }
2478                    else {
2479                            query = new StringBundler(4);
2480                    }
2481    
2482                    if (getDB().isSupportsInlineDistinct()) {
2483                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE);
2484                    }
2485                    else {
2486                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1);
2487                    }
2488    
2489                    query.append(_FINDER_COLUMN_G_TF_TN_GROUPID_2);
2490    
2491                    query.append(_FINDER_COLUMN_G_TF_TN_TOFOLDERID_2);
2492    
2493                    if (toName == null) {
2494                            query.append(_FINDER_COLUMN_G_TF_TN_TONAME_1);
2495                    }
2496                    else {
2497                            if (toName.equals(StringPool.BLANK)) {
2498                                    query.append(_FINDER_COLUMN_G_TF_TN_TONAME_3);
2499                            }
2500                            else {
2501                                    query.append(_FINDER_COLUMN_G_TF_TN_TONAME_2);
2502                            }
2503                    }
2504    
2505                    if (!getDB().isSupportsInlineDistinct()) {
2506                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2);
2507                    }
2508    
2509                    if (orderByComparator != null) {
2510                            if (getDB().isSupportsInlineDistinct()) {
2511                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2512                                            orderByComparator);
2513                            }
2514                            else {
2515                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2516                                            orderByComparator);
2517                            }
2518                    }
2519    
2520                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2521                                    DLFileShortcut.class.getName(), _FILTER_COLUMN_PK,
2522                                    _FILTER_COLUMN_USERID, groupId);
2523    
2524                    Session session = null;
2525    
2526                    try {
2527                            session = openSession();
2528    
2529                            SQLQuery q = session.createSQLQuery(sql);
2530    
2531                            if (getDB().isSupportsInlineDistinct()) {
2532                                    q.addEntity(_FILTER_ENTITY_ALIAS, DLFileShortcutImpl.class);
2533                            }
2534                            else {
2535                                    q.addEntity(_FILTER_ENTITY_TABLE, DLFileShortcutImpl.class);
2536                            }
2537    
2538                            QueryPos qPos = QueryPos.getInstance(q);
2539    
2540                            qPos.add(groupId);
2541    
2542                            qPos.add(toFolderId);
2543    
2544                            if (toName != null) {
2545                                    qPos.add(toName);
2546                            }
2547    
2548                            return (List<DLFileShortcut>)QueryUtil.list(q, getDialect(), start,
2549                                    end);
2550                    }
2551                    catch (Exception e) {
2552                            throw processException(e);
2553                    }
2554                    finally {
2555                            closeSession(session);
2556                    }
2557            }
2558    
2559            /**
2560             * Finds all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63;.
2561             *
2562             * @param groupId the group id to search with
2563             * @param toFolderId the to folder id to search with
2564             * @param toName the to name to search with
2565             * @param status the status to search with
2566             * @return the matching d l file shortcuts
2567             * @throws SystemException if a system exception occurred
2568             */
2569            public List<DLFileShortcut> findByG_TF_TN_S(long groupId, long toFolderId,
2570                    String toName, int status) throws SystemException {
2571                    return findByG_TF_TN_S(groupId, toFolderId, toName, status,
2572                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2573            }
2574    
2575            /**
2576             * Finds a range of all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63;.
2577             *
2578             * <p>
2579             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2580             * </p>
2581             *
2582             * @param groupId the group id to search with
2583             * @param toFolderId the to folder id to search with
2584             * @param toName the to name to search with
2585             * @param status the status to search with
2586             * @param start the lower bound of the range of d l file shortcuts to return
2587             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
2588             * @return the range of matching d l file shortcuts
2589             * @throws SystemException if a system exception occurred
2590             */
2591            public List<DLFileShortcut> findByG_TF_TN_S(long groupId, long toFolderId,
2592                    String toName, int status, int start, int end)
2593                    throws SystemException {
2594                    return findByG_TF_TN_S(groupId, toFolderId, toName, status, start, end,
2595                            null);
2596            }
2597    
2598            /**
2599             * Finds an ordered range of all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63;.
2600             *
2601             * <p>
2602             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2603             * </p>
2604             *
2605             * @param groupId the group id to search with
2606             * @param toFolderId the to folder id to search with
2607             * @param toName the to name to search with
2608             * @param status the status to search with
2609             * @param start the lower bound of the range of d l file shortcuts to return
2610             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
2611             * @param orderByComparator the comparator to order the results by
2612             * @return the ordered range of matching d l file shortcuts
2613             * @throws SystemException if a system exception occurred
2614             */
2615            public List<DLFileShortcut> findByG_TF_TN_S(long groupId, long toFolderId,
2616                    String toName, int status, int start, int end,
2617                    OrderByComparator orderByComparator) throws SystemException {
2618                    Object[] finderArgs = new Object[] {
2619                                    groupId, toFolderId, toName, status,
2620                                    
2621                                    String.valueOf(start), String.valueOf(end),
2622                                    String.valueOf(orderByComparator)
2623                            };
2624    
2625                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_TF_TN_S,
2626                                    finderArgs, this);
2627    
2628                    if (list == null) {
2629                            StringBundler query = null;
2630    
2631                            if (orderByComparator != null) {
2632                                    query = new StringBundler(6 +
2633                                                    (orderByComparator.getOrderByFields().length * 3));
2634                            }
2635                            else {
2636                                    query = new StringBundler(5);
2637                            }
2638    
2639                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
2640    
2641                            query.append(_FINDER_COLUMN_G_TF_TN_S_GROUPID_2);
2642    
2643                            query.append(_FINDER_COLUMN_G_TF_TN_S_TOFOLDERID_2);
2644    
2645                            if (toName == null) {
2646                                    query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_1);
2647                            }
2648                            else {
2649                                    if (toName.equals(StringPool.BLANK)) {
2650                                            query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_3);
2651                                    }
2652                                    else {
2653                                            query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_2);
2654                                    }
2655                            }
2656    
2657                            query.append(_FINDER_COLUMN_G_TF_TN_S_STATUS_2);
2658    
2659                            if (orderByComparator != null) {
2660                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2661                                            orderByComparator);
2662                            }
2663    
2664                            String sql = query.toString();
2665    
2666                            Session session = null;
2667    
2668                            try {
2669                                    session = openSession();
2670    
2671                                    Query q = session.createQuery(sql);
2672    
2673                                    QueryPos qPos = QueryPos.getInstance(q);
2674    
2675                                    qPos.add(groupId);
2676    
2677                                    qPos.add(toFolderId);
2678    
2679                                    if (toName != null) {
2680                                            qPos.add(toName);
2681                                    }
2682    
2683                                    qPos.add(status);
2684    
2685                                    list = (List<DLFileShortcut>)QueryUtil.list(q, getDialect(),
2686                                                    start, end);
2687                            }
2688                            catch (Exception e) {
2689                                    throw processException(e);
2690                            }
2691                            finally {
2692                                    if (list == null) {
2693                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_TF_TN_S,
2694                                                    finderArgs);
2695                                    }
2696                                    else {
2697                                            cacheResult(list);
2698    
2699                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_TF_TN_S,
2700                                                    finderArgs, list);
2701                                    }
2702    
2703                                    closeSession(session);
2704                            }
2705                    }
2706    
2707                    return list;
2708            }
2709    
2710            /**
2711             * Finds the first d l file shortcut in the ordered set where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63;.
2712             *
2713             * <p>
2714             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2715             * </p>
2716             *
2717             * @param groupId the group id to search with
2718             * @param toFolderId the to folder id to search with
2719             * @param toName the to name to search with
2720             * @param status the status to search with
2721             * @param orderByComparator the comparator to order the set by
2722             * @return the first matching d l file shortcut
2723             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching d l file shortcut could not be found
2724             * @throws SystemException if a system exception occurred
2725             */
2726            public DLFileShortcut findByG_TF_TN_S_First(long groupId, long toFolderId,
2727                    String toName, int status, OrderByComparator orderByComparator)
2728                    throws NoSuchFileShortcutException, SystemException {
2729                    List<DLFileShortcut> list = findByG_TF_TN_S(groupId, toFolderId,
2730                                    toName, status, 0, 1, orderByComparator);
2731    
2732                    if (list.isEmpty()) {
2733                            StringBundler msg = new StringBundler(10);
2734    
2735                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2736    
2737                            msg.append("groupId=");
2738                            msg.append(groupId);
2739    
2740                            msg.append(", toFolderId=");
2741                            msg.append(toFolderId);
2742    
2743                            msg.append(", toName=");
2744                            msg.append(toName);
2745    
2746                            msg.append(", status=");
2747                            msg.append(status);
2748    
2749                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2750    
2751                            throw new NoSuchFileShortcutException(msg.toString());
2752                    }
2753                    else {
2754                            return list.get(0);
2755                    }
2756            }
2757    
2758            /**
2759             * Finds the last d l file shortcut in the ordered set where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63;.
2760             *
2761             * <p>
2762             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2763             * </p>
2764             *
2765             * @param groupId the group id to search with
2766             * @param toFolderId the to folder id to search with
2767             * @param toName the to name to search with
2768             * @param status the status to search with
2769             * @param orderByComparator the comparator to order the set by
2770             * @return the last matching d l file shortcut
2771             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching d l file shortcut could not be found
2772             * @throws SystemException if a system exception occurred
2773             */
2774            public DLFileShortcut findByG_TF_TN_S_Last(long groupId, long toFolderId,
2775                    String toName, int status, OrderByComparator orderByComparator)
2776                    throws NoSuchFileShortcutException, SystemException {
2777                    int count = countByG_TF_TN_S(groupId, toFolderId, toName, status);
2778    
2779                    List<DLFileShortcut> list = findByG_TF_TN_S(groupId, toFolderId,
2780                                    toName, status, count - 1, count, orderByComparator);
2781    
2782                    if (list.isEmpty()) {
2783                            StringBundler msg = new StringBundler(10);
2784    
2785                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2786    
2787                            msg.append("groupId=");
2788                            msg.append(groupId);
2789    
2790                            msg.append(", toFolderId=");
2791                            msg.append(toFolderId);
2792    
2793                            msg.append(", toName=");
2794                            msg.append(toName);
2795    
2796                            msg.append(", status=");
2797                            msg.append(status);
2798    
2799                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2800    
2801                            throw new NoSuchFileShortcutException(msg.toString());
2802                    }
2803                    else {
2804                            return list.get(0);
2805                    }
2806            }
2807    
2808            /**
2809             * Finds the d l file shortcuts before and after the current d l file shortcut in the ordered set where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63;.
2810             *
2811             * <p>
2812             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2813             * </p>
2814             *
2815             * @param fileShortcutId the primary key of the current d l file shortcut
2816             * @param groupId the group id to search with
2817             * @param toFolderId the to folder id to search with
2818             * @param toName the to name to search with
2819             * @param status the status to search with
2820             * @param orderByComparator the comparator to order the set by
2821             * @return the previous, current, and next d l file shortcut
2822             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a d l file shortcut with the primary key could not be found
2823             * @throws SystemException if a system exception occurred
2824             */
2825            public DLFileShortcut[] findByG_TF_TN_S_PrevAndNext(long fileShortcutId,
2826                    long groupId, long toFolderId, String toName, int status,
2827                    OrderByComparator orderByComparator)
2828                    throws NoSuchFileShortcutException, SystemException {
2829                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
2830    
2831                    Session session = null;
2832    
2833                    try {
2834                            session = openSession();
2835    
2836                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
2837    
2838                            array[0] = getByG_TF_TN_S_PrevAndNext(session, dlFileShortcut,
2839                                            groupId, toFolderId, toName, status, orderByComparator, true);
2840    
2841                            array[1] = dlFileShortcut;
2842    
2843                            array[2] = getByG_TF_TN_S_PrevAndNext(session, dlFileShortcut,
2844                                            groupId, toFolderId, toName, status, orderByComparator,
2845                                            false);
2846    
2847                            return array;
2848                    }
2849                    catch (Exception e) {
2850                            throw processException(e);
2851                    }
2852                    finally {
2853                            closeSession(session);
2854                    }
2855            }
2856    
2857            protected DLFileShortcut getByG_TF_TN_S_PrevAndNext(Session session,
2858                    DLFileShortcut dlFileShortcut, long groupId, long toFolderId,
2859                    String toName, int status, OrderByComparator orderByComparator,
2860                    boolean previous) {
2861                    StringBundler query = null;
2862    
2863                    if (orderByComparator != null) {
2864                            query = new StringBundler(6 +
2865                                            (orderByComparator.getOrderByFields().length * 6));
2866                    }
2867                    else {
2868                            query = new StringBundler(3);
2869                    }
2870    
2871                    query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
2872    
2873                    query.append(_FINDER_COLUMN_G_TF_TN_S_GROUPID_2);
2874    
2875                    query.append(_FINDER_COLUMN_G_TF_TN_S_TOFOLDERID_2);
2876    
2877                    if (toName == null) {
2878                            query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_1);
2879                    }
2880                    else {
2881                            if (toName.equals(StringPool.BLANK)) {
2882                                    query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_3);
2883                            }
2884                            else {
2885                                    query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_2);
2886                            }
2887                    }
2888    
2889                    query.append(_FINDER_COLUMN_G_TF_TN_S_STATUS_2);
2890    
2891                    if (orderByComparator != null) {
2892                            String[] orderByFields = orderByComparator.getOrderByFields();
2893    
2894                            if (orderByFields.length > 0) {
2895                                    query.append(WHERE_AND);
2896                            }
2897    
2898                            for (int i = 0; i < orderByFields.length; i++) {
2899                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2900                                    query.append(orderByFields[i]);
2901    
2902                                    if ((i + 1) < orderByFields.length) {
2903                                            if (orderByComparator.isAscending() ^ previous) {
2904                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2905                                            }
2906                                            else {
2907                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2908                                            }
2909                                    }
2910                                    else {
2911                                            if (orderByComparator.isAscending() ^ previous) {
2912                                                    query.append(WHERE_GREATER_THAN);
2913                                            }
2914                                            else {
2915                                                    query.append(WHERE_LESSER_THAN);
2916                                            }
2917                                    }
2918                            }
2919    
2920                            query.append(ORDER_BY_CLAUSE);
2921    
2922                            for (int i = 0; i < orderByFields.length; i++) {
2923                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2924                                    query.append(orderByFields[i]);
2925    
2926                                    if ((i + 1) < orderByFields.length) {
2927                                            if (orderByComparator.isAscending() ^ previous) {
2928                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2929                                            }
2930                                            else {
2931                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2932                                            }
2933                                    }
2934                                    else {
2935                                            if (orderByComparator.isAscending() ^ previous) {
2936                                                    query.append(ORDER_BY_ASC);
2937                                            }
2938                                            else {
2939                                                    query.append(ORDER_BY_DESC);
2940                                            }
2941                                    }
2942                            }
2943                    }
2944    
2945                    String sql = query.toString();
2946    
2947                    Query q = session.createQuery(sql);
2948    
2949                    q.setFirstResult(0);
2950                    q.setMaxResults(2);
2951    
2952                    QueryPos qPos = QueryPos.getInstance(q);
2953    
2954                    qPos.add(groupId);
2955    
2956                    qPos.add(toFolderId);
2957    
2958                    if (toName != null) {
2959                            qPos.add(toName);
2960                    }
2961    
2962                    qPos.add(status);
2963    
2964                    if (orderByComparator != null) {
2965                            Object[] values = orderByComparator.getOrderByValues(dlFileShortcut);
2966    
2967                            for (Object value : values) {
2968                                    qPos.add(value);
2969                            }
2970                    }
2971    
2972                    List<DLFileShortcut> list = q.list();
2973    
2974                    if (list.size() == 2) {
2975                            return list.get(1);
2976                    }
2977                    else {
2978                            return null;
2979                    }
2980            }
2981    
2982            /**
2983             * Filters by the user's permissions and finds all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63;.
2984             *
2985             * @param groupId the group id to search with
2986             * @param toFolderId the to folder id to search with
2987             * @param toName the to name to search with
2988             * @param status the status to search with
2989             * @return the matching d l file shortcuts that the user has permission to view
2990             * @throws SystemException if a system exception occurred
2991             */
2992            public List<DLFileShortcut> filterFindByG_TF_TN_S(long groupId,
2993                    long toFolderId, String toName, int status) throws SystemException {
2994                    return filterFindByG_TF_TN_S(groupId, toFolderId, toName, status,
2995                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2996            }
2997    
2998            /**
2999             * Filters by the user's permissions and finds a range of all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63;.
3000             *
3001             * <p>
3002             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
3003             * </p>
3004             *
3005             * @param groupId the group id to search with
3006             * @param toFolderId the to folder id to search with
3007             * @param toName the to name to search with
3008             * @param status the status to search with
3009             * @param start the lower bound of the range of d l file shortcuts to return
3010             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
3011             * @return the range of matching d l file shortcuts that the user has permission to view
3012             * @throws SystemException if a system exception occurred
3013             */
3014            public List<DLFileShortcut> filterFindByG_TF_TN_S(long groupId,
3015                    long toFolderId, String toName, int status, int start, int end)
3016                    throws SystemException {
3017                    return filterFindByG_TF_TN_S(groupId, toFolderId, toName, status,
3018                            start, end, null);
3019            }
3020    
3021            /**
3022             * Filters by the user's permissions and finds an ordered range of all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63;.
3023             *
3024             * <p>
3025             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
3026             * </p>
3027             *
3028             * @param groupId the group id to search with
3029             * @param toFolderId the to folder id to search with
3030             * @param toName the to name to search with
3031             * @param status the status to search with
3032             * @param start the lower bound of the range of d l file shortcuts to return
3033             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
3034             * @param orderByComparator the comparator to order the results by
3035             * @return the ordered range of matching d l file shortcuts that the user has permission to view
3036             * @throws SystemException if a system exception occurred
3037             */
3038            public List<DLFileShortcut> filterFindByG_TF_TN_S(long groupId,
3039                    long toFolderId, String toName, int status, int start, int end,
3040                    OrderByComparator orderByComparator) throws SystemException {
3041                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3042                            return findByG_TF_TN_S(groupId, toFolderId, toName, status, start,
3043                                    end, orderByComparator);
3044                    }
3045    
3046                    StringBundler query = null;
3047    
3048                    if (orderByComparator != null) {
3049                            query = new StringBundler(6 +
3050                                            (orderByComparator.getOrderByFields().length * 3));
3051                    }
3052                    else {
3053                            query = new StringBundler(5);
3054                    }
3055    
3056                    if (getDB().isSupportsInlineDistinct()) {
3057                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE);
3058                    }
3059                    else {
3060                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1);
3061                    }
3062    
3063                    query.append(_FINDER_COLUMN_G_TF_TN_S_GROUPID_2);
3064    
3065                    query.append(_FINDER_COLUMN_G_TF_TN_S_TOFOLDERID_2);
3066    
3067                    if (toName == null) {
3068                            query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_1);
3069                    }
3070                    else {
3071                            if (toName.equals(StringPool.BLANK)) {
3072                                    query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_3);
3073                            }
3074                            else {
3075                                    query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_2);
3076                            }
3077                    }
3078    
3079                    query.append(_FINDER_COLUMN_G_TF_TN_S_STATUS_2);
3080    
3081                    if (!getDB().isSupportsInlineDistinct()) {
3082                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2);
3083                    }
3084    
3085                    if (orderByComparator != null) {
3086                            if (getDB().isSupportsInlineDistinct()) {
3087                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3088                                            orderByComparator);
3089                            }
3090                            else {
3091                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
3092                                            orderByComparator);
3093                            }
3094                    }
3095    
3096                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3097                                    DLFileShortcut.class.getName(), _FILTER_COLUMN_PK,
3098                                    _FILTER_COLUMN_USERID, groupId);
3099    
3100                    Session session = null;
3101    
3102                    try {
3103                            session = openSession();
3104    
3105                            SQLQuery q = session.createSQLQuery(sql);
3106    
3107                            if (getDB().isSupportsInlineDistinct()) {
3108                                    q.addEntity(_FILTER_ENTITY_ALIAS, DLFileShortcutImpl.class);
3109                            }
3110                            else {
3111                                    q.addEntity(_FILTER_ENTITY_TABLE, DLFileShortcutImpl.class);
3112                            }
3113    
3114                            QueryPos qPos = QueryPos.getInstance(q);
3115    
3116                            qPos.add(groupId);
3117    
3118                            qPos.add(toFolderId);
3119    
3120                            if (toName != null) {
3121                                    qPos.add(toName);
3122                            }
3123    
3124                            qPos.add(status);
3125    
3126                            return (List<DLFileShortcut>)QueryUtil.list(q, getDialect(), start,
3127                                    end);
3128                    }
3129                    catch (Exception e) {
3130                            throw processException(e);
3131                    }
3132                    finally {
3133                            closeSession(session);
3134                    }
3135            }
3136    
3137            /**
3138             * Finds all the d l file shortcuts.
3139             *
3140             * @return the d l file shortcuts
3141             * @throws SystemException if a system exception occurred
3142             */
3143            public List<DLFileShortcut> findAll() throws SystemException {
3144                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3145            }
3146    
3147            /**
3148             * Finds a range of all the d l file shortcuts.
3149             *
3150             * <p>
3151             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
3152             * </p>
3153             *
3154             * @param start the lower bound of the range of d l file shortcuts to return
3155             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
3156             * @return the range of d l file shortcuts
3157             * @throws SystemException if a system exception occurred
3158             */
3159            public List<DLFileShortcut> findAll(int start, int end)
3160                    throws SystemException {
3161                    return findAll(start, end, null);
3162            }
3163    
3164            /**
3165             * Finds an ordered range of all the d l file shortcuts.
3166             *
3167             * <p>
3168             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
3169             * </p>
3170             *
3171             * @param start the lower bound of the range of d l file shortcuts to return
3172             * @param end the upper bound of the range of d l file shortcuts to return (not inclusive)
3173             * @param orderByComparator the comparator to order the results by
3174             * @return the ordered range of d l file shortcuts
3175             * @throws SystemException if a system exception occurred
3176             */
3177            public List<DLFileShortcut> findAll(int start, int end,
3178                    OrderByComparator orderByComparator) throws SystemException {
3179                    Object[] finderArgs = new Object[] {
3180                                    String.valueOf(start), String.valueOf(end),
3181                                    String.valueOf(orderByComparator)
3182                            };
3183    
3184                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
3185                                    finderArgs, this);
3186    
3187                    if (list == null) {
3188                            StringBundler query = null;
3189                            String sql = null;
3190    
3191                            if (orderByComparator != null) {
3192                                    query = new StringBundler(2 +
3193                                                    (orderByComparator.getOrderByFields().length * 3));
3194    
3195                                    query.append(_SQL_SELECT_DLFILESHORTCUT);
3196    
3197                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3198                                            orderByComparator);
3199    
3200                                    sql = query.toString();
3201                            }
3202                            else {
3203                                    sql = _SQL_SELECT_DLFILESHORTCUT;
3204                            }
3205    
3206                            Session session = null;
3207    
3208                            try {
3209                                    session = openSession();
3210    
3211                                    Query q = session.createQuery(sql);
3212    
3213                                    if (orderByComparator == null) {
3214                                            list = (List<DLFileShortcut>)QueryUtil.list(q,
3215                                                            getDialect(), start, end, false);
3216    
3217                                            Collections.sort(list);
3218                                    }
3219                                    else {
3220                                            list = (List<DLFileShortcut>)QueryUtil.list(q,
3221                                                            getDialect(), start, end);
3222                                    }
3223                            }
3224                            catch (Exception e) {
3225                                    throw processException(e);
3226                            }
3227                            finally {
3228                                    if (list == null) {
3229                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
3230                                                    finderArgs);
3231                                    }
3232                                    else {
3233                                            cacheResult(list);
3234    
3235                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
3236                                                    list);
3237                                    }
3238    
3239                                    closeSession(session);
3240                            }
3241                    }
3242    
3243                    return list;
3244            }
3245    
3246            /**
3247             * Removes all the d l file shortcuts where uuid = &#63; from the database.
3248             *
3249             * @param uuid the uuid to search with
3250             * @throws SystemException if a system exception occurred
3251             */
3252            public void removeByUuid(String uuid) throws SystemException {
3253                    for (DLFileShortcut dlFileShortcut : findByUuid(uuid)) {
3254                            remove(dlFileShortcut);
3255                    }
3256            }
3257    
3258            /**
3259             * Removes the d l file shortcut where uuid = &#63; and groupId = &#63; from the database.
3260             *
3261             * @param uuid the uuid to search with
3262             * @param groupId the group id to search with
3263             * @throws SystemException if a system exception occurred
3264             */
3265            public void removeByUUID_G(String uuid, long groupId)
3266                    throws NoSuchFileShortcutException, SystemException {
3267                    DLFileShortcut dlFileShortcut = findByUUID_G(uuid, groupId);
3268    
3269                    remove(dlFileShortcut);
3270            }
3271    
3272            /**
3273             * Removes all the d l file shortcuts where groupId = &#63; and folderId = &#63; from the database.
3274             *
3275             * @param groupId the group id to search with
3276             * @param folderId the folder id to search with
3277             * @throws SystemException if a system exception occurred
3278             */
3279            public void removeByG_F(long groupId, long folderId)
3280                    throws SystemException {
3281                    for (DLFileShortcut dlFileShortcut : findByG_F(groupId, folderId)) {
3282                            remove(dlFileShortcut);
3283                    }
3284            }
3285    
3286            /**
3287             * Removes all the d l file shortcuts where groupId = &#63; and folderId = &#63; and status = &#63; from the database.
3288             *
3289             * @param groupId the group id to search with
3290             * @param folderId the folder id to search with
3291             * @param status the status to search with
3292             * @throws SystemException if a system exception occurred
3293             */
3294            public void removeByG_F_S(long groupId, long folderId, int status)
3295                    throws SystemException {
3296                    for (DLFileShortcut dlFileShortcut : findByG_F_S(groupId, folderId,
3297                                    status)) {
3298                            remove(dlFileShortcut);
3299                    }
3300            }
3301    
3302            /**
3303             * Removes all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63; from the database.
3304             *
3305             * @param groupId the group id to search with
3306             * @param toFolderId the to folder id to search with
3307             * @param toName the to name to search with
3308             * @throws SystemException if a system exception occurred
3309             */
3310            public void removeByG_TF_TN(long groupId, long toFolderId, String toName)
3311                    throws SystemException {
3312                    for (DLFileShortcut dlFileShortcut : findByG_TF_TN(groupId, toFolderId,
3313                                    toName)) {
3314                            remove(dlFileShortcut);
3315                    }
3316            }
3317    
3318            /**
3319             * Removes all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63; from the database.
3320             *
3321             * @param groupId the group id to search with
3322             * @param toFolderId the to folder id to search with
3323             * @param toName the to name to search with
3324             * @param status the status to search with
3325             * @throws SystemException if a system exception occurred
3326             */
3327            public void removeByG_TF_TN_S(long groupId, long toFolderId, String toName,
3328                    int status) throws SystemException {
3329                    for (DLFileShortcut dlFileShortcut : findByG_TF_TN_S(groupId,
3330                                    toFolderId, toName, status)) {
3331                            remove(dlFileShortcut);
3332                    }
3333            }
3334    
3335            /**
3336             * Removes all the d l file shortcuts from the database.
3337             *
3338             * @throws SystemException if a system exception occurred
3339             */
3340            public void removeAll() throws SystemException {
3341                    for (DLFileShortcut dlFileShortcut : findAll()) {
3342                            remove(dlFileShortcut);
3343                    }
3344            }
3345    
3346            /**
3347             * Counts all the d l file shortcuts where uuid = &#63;.
3348             *
3349             * @param uuid the uuid to search with
3350             * @return the number of matching d l file shortcuts
3351             * @throws SystemException if a system exception occurred
3352             */
3353            public int countByUuid(String uuid) throws SystemException {
3354                    Object[] finderArgs = new Object[] { uuid };
3355    
3356                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
3357                                    finderArgs, this);
3358    
3359                    if (count == null) {
3360                            StringBundler query = new StringBundler(2);
3361    
3362                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
3363    
3364                            if (uuid == null) {
3365                                    query.append(_FINDER_COLUMN_UUID_UUID_1);
3366                            }
3367                            else {
3368                                    if (uuid.equals(StringPool.BLANK)) {
3369                                            query.append(_FINDER_COLUMN_UUID_UUID_3);
3370                                    }
3371                                    else {
3372                                            query.append(_FINDER_COLUMN_UUID_UUID_2);
3373                                    }
3374                            }
3375    
3376                            String sql = query.toString();
3377    
3378                            Session session = null;
3379    
3380                            try {
3381                                    session = openSession();
3382    
3383                                    Query q = session.createQuery(sql);
3384    
3385                                    QueryPos qPos = QueryPos.getInstance(q);
3386    
3387                                    if (uuid != null) {
3388                                            qPos.add(uuid);
3389                                    }
3390    
3391                                    count = (Long)q.uniqueResult();
3392                            }
3393                            catch (Exception e) {
3394                                    throw processException(e);
3395                            }
3396                            finally {
3397                                    if (count == null) {
3398                                            count = Long.valueOf(0);
3399                                    }
3400    
3401                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3402                                            finderArgs, count);
3403    
3404                                    closeSession(session);
3405                            }
3406                    }
3407    
3408                    return count.intValue();
3409            }
3410    
3411            /**
3412             * Counts all the d l file shortcuts where uuid = &#63; and groupId = &#63;.
3413             *
3414             * @param uuid the uuid to search with
3415             * @param groupId the group id to search with
3416             * @return the number of matching d l file shortcuts
3417             * @throws SystemException if a system exception occurred
3418             */
3419            public int countByUUID_G(String uuid, long groupId)
3420                    throws SystemException {
3421                    Object[] finderArgs = new Object[] { uuid, groupId };
3422    
3423                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
3424                                    finderArgs, this);
3425    
3426                    if (count == null) {
3427                            StringBundler query = new StringBundler(3);
3428    
3429                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
3430    
3431                            if (uuid == null) {
3432                                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
3433                            }
3434                            else {
3435                                    if (uuid.equals(StringPool.BLANK)) {
3436                                            query.append(_FINDER_COLUMN_UUID_G_UUID_3);
3437                                    }
3438                                    else {
3439                                            query.append(_FINDER_COLUMN_UUID_G_UUID_2);
3440                                    }
3441                            }
3442    
3443                            query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
3444    
3445                            String sql = query.toString();
3446    
3447                            Session session = null;
3448    
3449                            try {
3450                                    session = openSession();
3451    
3452                                    Query q = session.createQuery(sql);
3453    
3454                                    QueryPos qPos = QueryPos.getInstance(q);
3455    
3456                                    if (uuid != null) {
3457                                            qPos.add(uuid);
3458                                    }
3459    
3460                                    qPos.add(groupId);
3461    
3462                                    count = (Long)q.uniqueResult();
3463                            }
3464                            catch (Exception e) {
3465                                    throw processException(e);
3466                            }
3467                            finally {
3468                                    if (count == null) {
3469                                            count = Long.valueOf(0);
3470                                    }
3471    
3472                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
3473                                            finderArgs, count);
3474    
3475                                    closeSession(session);
3476                            }
3477                    }
3478    
3479                    return count.intValue();
3480            }
3481    
3482            /**
3483             * Counts all the d l file shortcuts where groupId = &#63; and folderId = &#63;.
3484             *
3485             * @param groupId the group id to search with
3486             * @param folderId the folder id to search with
3487             * @return the number of matching d l file shortcuts
3488             * @throws SystemException if a system exception occurred
3489             */
3490            public int countByG_F(long groupId, long folderId)
3491                    throws SystemException {
3492                    Object[] finderArgs = new Object[] { groupId, folderId };
3493    
3494                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F,
3495                                    finderArgs, this);
3496    
3497                    if (count == null) {
3498                            StringBundler query = new StringBundler(3);
3499    
3500                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
3501    
3502                            query.append(_FINDER_COLUMN_G_F_GROUPID_2);
3503    
3504                            query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
3505    
3506                            String sql = query.toString();
3507    
3508                            Session session = null;
3509    
3510                            try {
3511                                    session = openSession();
3512    
3513                                    Query q = session.createQuery(sql);
3514    
3515                                    QueryPos qPos = QueryPos.getInstance(q);
3516    
3517                                    qPos.add(groupId);
3518    
3519                                    qPos.add(folderId);
3520    
3521                                    count = (Long)q.uniqueResult();
3522                            }
3523                            catch (Exception e) {
3524                                    throw processException(e);
3525                            }
3526                            finally {
3527                                    if (count == null) {
3528                                            count = Long.valueOf(0);
3529                                    }
3530    
3531                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F, finderArgs,
3532                                            count);
3533    
3534                                    closeSession(session);
3535                            }
3536                    }
3537    
3538                    return count.intValue();
3539            }
3540    
3541            /**
3542             * Filters by the user's permissions and counts all the d l file shortcuts where groupId = &#63; and folderId = &#63;.
3543             *
3544             * @param groupId the group id to search with
3545             * @param folderId the folder id to search with
3546             * @return the number of matching d l file shortcuts that the user has permission to view
3547             * @throws SystemException if a system exception occurred
3548             */
3549            public int filterCountByG_F(long groupId, long folderId)
3550                    throws SystemException {
3551                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3552                            return countByG_F(groupId, folderId);
3553                    }
3554    
3555                    StringBundler query = new StringBundler(3);
3556    
3557                    query.append(_FILTER_SQL_COUNT_DLFILESHORTCUT_WHERE);
3558    
3559                    query.append(_FINDER_COLUMN_G_F_GROUPID_2);
3560    
3561                    query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
3562    
3563                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3564                                    DLFileShortcut.class.getName(), _FILTER_COLUMN_PK,
3565                                    _FILTER_COLUMN_USERID, groupId);
3566    
3567                    Session session = null;
3568    
3569                    try {
3570                            session = openSession();
3571    
3572                            SQLQuery q = session.createSQLQuery(sql);
3573    
3574                            q.addScalar(COUNT_COLUMN_NAME,
3575                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
3576    
3577                            QueryPos qPos = QueryPos.getInstance(q);
3578    
3579                            qPos.add(groupId);
3580    
3581                            qPos.add(folderId);
3582    
3583                            Long count = (Long)q.uniqueResult();
3584    
3585                            return count.intValue();
3586                    }
3587                    catch (Exception e) {
3588                            throw processException(e);
3589                    }
3590                    finally {
3591                            closeSession(session);
3592                    }
3593            }
3594    
3595            /**
3596             * Counts all the d l file shortcuts where groupId = &#63; and folderId = &#63; and status = &#63;.
3597             *
3598             * @param groupId the group id to search with
3599             * @param folderId the folder id to search with
3600             * @param status the status to search with
3601             * @return the number of matching d l file shortcuts
3602             * @throws SystemException if a system exception occurred
3603             */
3604            public int countByG_F_S(long groupId, long folderId, int status)
3605                    throws SystemException {
3606                    Object[] finderArgs = new Object[] { groupId, folderId, status };
3607    
3608                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F_S,
3609                                    finderArgs, this);
3610    
3611                    if (count == null) {
3612                            StringBundler query = new StringBundler(4);
3613    
3614                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
3615    
3616                            query.append(_FINDER_COLUMN_G_F_S_GROUPID_2);
3617    
3618                            query.append(_FINDER_COLUMN_G_F_S_FOLDERID_2);
3619    
3620                            query.append(_FINDER_COLUMN_G_F_S_STATUS_2);
3621    
3622                            String sql = query.toString();
3623    
3624                            Session session = null;
3625    
3626                            try {
3627                                    session = openSession();
3628    
3629                                    Query q = session.createQuery(sql);
3630    
3631                                    QueryPos qPos = QueryPos.getInstance(q);
3632    
3633                                    qPos.add(groupId);
3634    
3635                                    qPos.add(folderId);
3636    
3637                                    qPos.add(status);
3638    
3639                                    count = (Long)q.uniqueResult();
3640                            }
3641                            catch (Exception e) {
3642                                    throw processException(e);
3643                            }
3644                            finally {
3645                                    if (count == null) {
3646                                            count = Long.valueOf(0);
3647                                    }
3648    
3649                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F_S,
3650                                            finderArgs, count);
3651    
3652                                    closeSession(session);
3653                            }
3654                    }
3655    
3656                    return count.intValue();
3657            }
3658    
3659            /**
3660             * Filters by the user's permissions and counts all the d l file shortcuts where groupId = &#63; and folderId = &#63; and status = &#63;.
3661             *
3662             * @param groupId the group id to search with
3663             * @param folderId the folder id to search with
3664             * @param status the status to search with
3665             * @return the number of matching d l file shortcuts that the user has permission to view
3666             * @throws SystemException if a system exception occurred
3667             */
3668            public int filterCountByG_F_S(long groupId, long folderId, int status)
3669                    throws SystemException {
3670                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3671                            return countByG_F_S(groupId, folderId, status);
3672                    }
3673    
3674                    StringBundler query = new StringBundler(4);
3675    
3676                    query.append(_FILTER_SQL_COUNT_DLFILESHORTCUT_WHERE);
3677    
3678                    query.append(_FINDER_COLUMN_G_F_S_GROUPID_2);
3679    
3680                    query.append(_FINDER_COLUMN_G_F_S_FOLDERID_2);
3681    
3682                    query.append(_FINDER_COLUMN_G_F_S_STATUS_2);
3683    
3684                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3685                                    DLFileShortcut.class.getName(), _FILTER_COLUMN_PK,
3686                                    _FILTER_COLUMN_USERID, groupId);
3687    
3688                    Session session = null;
3689    
3690                    try {
3691                            session = openSession();
3692    
3693                            SQLQuery q = session.createSQLQuery(sql);
3694    
3695                            q.addScalar(COUNT_COLUMN_NAME,
3696                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
3697    
3698                            QueryPos qPos = QueryPos.getInstance(q);
3699    
3700                            qPos.add(groupId);
3701    
3702                            qPos.add(folderId);
3703    
3704                            qPos.add(status);
3705    
3706                            Long count = (Long)q.uniqueResult();
3707    
3708                            return count.intValue();
3709                    }
3710                    catch (Exception e) {
3711                            throw processException(e);
3712                    }
3713                    finally {
3714                            closeSession(session);
3715                    }
3716            }
3717    
3718            /**
3719             * Counts all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63;.
3720             *
3721             * @param groupId the group id to search with
3722             * @param toFolderId the to folder id to search with
3723             * @param toName the to name to search with
3724             * @return the number of matching d l file shortcuts
3725             * @throws SystemException if a system exception occurred
3726             */
3727            public int countByG_TF_TN(long groupId, long toFolderId, String toName)
3728                    throws SystemException {
3729                    Object[] finderArgs = new Object[] { groupId, toFolderId, toName };
3730    
3731                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_TF_TN,
3732                                    finderArgs, this);
3733    
3734                    if (count == null) {
3735                            StringBundler query = new StringBundler(4);
3736    
3737                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
3738    
3739                            query.append(_FINDER_COLUMN_G_TF_TN_GROUPID_2);
3740    
3741                            query.append(_FINDER_COLUMN_G_TF_TN_TOFOLDERID_2);
3742    
3743                            if (toName == null) {
3744                                    query.append(_FINDER_COLUMN_G_TF_TN_TONAME_1);
3745                            }
3746                            else {
3747                                    if (toName.equals(StringPool.BLANK)) {
3748                                            query.append(_FINDER_COLUMN_G_TF_TN_TONAME_3);
3749                                    }
3750                                    else {
3751                                            query.append(_FINDER_COLUMN_G_TF_TN_TONAME_2);
3752                                    }
3753                            }
3754    
3755                            String sql = query.toString();
3756    
3757                            Session session = null;
3758    
3759                            try {
3760                                    session = openSession();
3761    
3762                                    Query q = session.createQuery(sql);
3763    
3764                                    QueryPos qPos = QueryPos.getInstance(q);
3765    
3766                                    qPos.add(groupId);
3767    
3768                                    qPos.add(toFolderId);
3769    
3770                                    if (toName != null) {
3771                                            qPos.add(toName);
3772                                    }
3773    
3774                                    count = (Long)q.uniqueResult();
3775                            }
3776                            catch (Exception e) {
3777                                    throw processException(e);
3778                            }
3779                            finally {
3780                                    if (count == null) {
3781                                            count = Long.valueOf(0);
3782                                    }
3783    
3784                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_TF_TN,
3785                                            finderArgs, count);
3786    
3787                                    closeSession(session);
3788                            }
3789                    }
3790    
3791                    return count.intValue();
3792            }
3793    
3794            /**
3795             * Filters by the user's permissions and counts all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63;.
3796             *
3797             * @param groupId the group id to search with
3798             * @param toFolderId the to folder id to search with
3799             * @param toName the to name to search with
3800             * @return the number of matching d l file shortcuts that the user has permission to view
3801             * @throws SystemException if a system exception occurred
3802             */
3803            public int filterCountByG_TF_TN(long groupId, long toFolderId, String toName)
3804                    throws SystemException {
3805                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3806                            return countByG_TF_TN(groupId, toFolderId, toName);
3807                    }
3808    
3809                    StringBundler query = new StringBundler(4);
3810    
3811                    query.append(_FILTER_SQL_COUNT_DLFILESHORTCUT_WHERE);
3812    
3813                    query.append(_FINDER_COLUMN_G_TF_TN_GROUPID_2);
3814    
3815                    query.append(_FINDER_COLUMN_G_TF_TN_TOFOLDERID_2);
3816    
3817                    if (toName == null) {
3818                            query.append(_FINDER_COLUMN_G_TF_TN_TONAME_1);
3819                    }
3820                    else {
3821                            if (toName.equals(StringPool.BLANK)) {
3822                                    query.append(_FINDER_COLUMN_G_TF_TN_TONAME_3);
3823                            }
3824                            else {
3825                                    query.append(_FINDER_COLUMN_G_TF_TN_TONAME_2);
3826                            }
3827                    }
3828    
3829                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3830                                    DLFileShortcut.class.getName(), _FILTER_COLUMN_PK,
3831                                    _FILTER_COLUMN_USERID, groupId);
3832    
3833                    Session session = null;
3834    
3835                    try {
3836                            session = openSession();
3837    
3838                            SQLQuery q = session.createSQLQuery(sql);
3839    
3840                            q.addScalar(COUNT_COLUMN_NAME,
3841                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
3842    
3843                            QueryPos qPos = QueryPos.getInstance(q);
3844    
3845                            qPos.add(groupId);
3846    
3847                            qPos.add(toFolderId);
3848    
3849                            if (toName != null) {
3850                                    qPos.add(toName);
3851                            }
3852    
3853                            Long count = (Long)q.uniqueResult();
3854    
3855                            return count.intValue();
3856                    }
3857                    catch (Exception e) {
3858                            throw processException(e);
3859                    }
3860                    finally {
3861                            closeSession(session);
3862                    }
3863            }
3864    
3865            /**
3866             * Counts all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63;.
3867             *
3868             * @param groupId the group id to search with
3869             * @param toFolderId the to folder id to search with
3870             * @param toName the to name to search with
3871             * @param status the status to search with
3872             * @return the number of matching d l file shortcuts
3873             * @throws SystemException if a system exception occurred
3874             */
3875            public int countByG_TF_TN_S(long groupId, long toFolderId, String toName,
3876                    int status) throws SystemException {
3877                    Object[] finderArgs = new Object[] { groupId, toFolderId, toName, status };
3878    
3879                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_TF_TN_S,
3880                                    finderArgs, this);
3881    
3882                    if (count == null) {
3883                            StringBundler query = new StringBundler(5);
3884    
3885                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
3886    
3887                            query.append(_FINDER_COLUMN_G_TF_TN_S_GROUPID_2);
3888    
3889                            query.append(_FINDER_COLUMN_G_TF_TN_S_TOFOLDERID_2);
3890    
3891                            if (toName == null) {
3892                                    query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_1);
3893                            }
3894                            else {
3895                                    if (toName.equals(StringPool.BLANK)) {
3896                                            query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_3);
3897                                    }
3898                                    else {
3899                                            query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_2);
3900                                    }
3901                            }
3902    
3903                            query.append(_FINDER_COLUMN_G_TF_TN_S_STATUS_2);
3904    
3905                            String sql = query.toString();
3906    
3907                            Session session = null;
3908    
3909                            try {
3910                                    session = openSession();
3911    
3912                                    Query q = session.createQuery(sql);
3913    
3914                                    QueryPos qPos = QueryPos.getInstance(q);
3915    
3916                                    qPos.add(groupId);
3917    
3918                                    qPos.add(toFolderId);
3919    
3920                                    if (toName != null) {
3921                                            qPos.add(toName);
3922                                    }
3923    
3924                                    qPos.add(status);
3925    
3926                                    count = (Long)q.uniqueResult();
3927                            }
3928                            catch (Exception e) {
3929                                    throw processException(e);
3930                            }
3931                            finally {
3932                                    if (count == null) {
3933                                            count = Long.valueOf(0);
3934                                    }
3935    
3936                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_TF_TN_S,
3937                                            finderArgs, count);
3938    
3939                                    closeSession(session);
3940                            }
3941                    }
3942    
3943                    return count.intValue();
3944            }
3945    
3946            /**
3947             * Filters by the user's permissions and counts all the d l file shortcuts where groupId = &#63; and toFolderId = &#63; and toName = &#63; and status = &#63;.
3948             *
3949             * @param groupId the group id to search with
3950             * @param toFolderId the to folder id to search with
3951             * @param toName the to name to search with
3952             * @param status the status to search with
3953             * @return the number of matching d l file shortcuts that the user has permission to view
3954             * @throws SystemException if a system exception occurred
3955             */
3956            public int filterCountByG_TF_TN_S(long groupId, long toFolderId,
3957                    String toName, int status) throws SystemException {
3958                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3959                            return countByG_TF_TN_S(groupId, toFolderId, toName, status);
3960                    }
3961    
3962                    StringBundler query = new StringBundler(5);
3963    
3964                    query.append(_FILTER_SQL_COUNT_DLFILESHORTCUT_WHERE);
3965    
3966                    query.append(_FINDER_COLUMN_G_TF_TN_S_GROUPID_2);
3967    
3968                    query.append(_FINDER_COLUMN_G_TF_TN_S_TOFOLDERID_2);
3969    
3970                    if (toName == null) {
3971                            query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_1);
3972                    }
3973                    else {
3974                            if (toName.equals(StringPool.BLANK)) {
3975                                    query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_3);
3976                            }
3977                            else {
3978                                    query.append(_FINDER_COLUMN_G_TF_TN_S_TONAME_2);
3979                            }
3980                    }
3981    
3982                    query.append(_FINDER_COLUMN_G_TF_TN_S_STATUS_2);
3983    
3984                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3985                                    DLFileShortcut.class.getName(), _FILTER_COLUMN_PK,
3986                                    _FILTER_COLUMN_USERID, groupId);
3987    
3988                    Session session = null;
3989    
3990                    try {
3991                            session = openSession();
3992    
3993                            SQLQuery q = session.createSQLQuery(sql);
3994    
3995                            q.addScalar(COUNT_COLUMN_NAME,
3996                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
3997    
3998                            QueryPos qPos = QueryPos.getInstance(q);
3999    
4000                            qPos.add(groupId);
4001    
4002                            qPos.add(toFolderId);
4003    
4004                            if (toName != null) {
4005                                    qPos.add(toName);
4006                            }
4007    
4008                            qPos.add(status);
4009    
4010                            Long count = (Long)q.uniqueResult();
4011    
4012                            return count.intValue();
4013                    }
4014                    catch (Exception e) {
4015                            throw processException(e);
4016                    }
4017                    finally {
4018                            closeSession(session);
4019                    }
4020            }
4021    
4022            /**
4023             * Counts all the d l file shortcuts.
4024             *
4025             * @return the number of d l file shortcuts
4026             * @throws SystemException if a system exception occurred
4027             */
4028            public int countAll() throws SystemException {
4029                    Object[] finderArgs = new Object[0];
4030    
4031                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
4032                                    finderArgs, this);
4033    
4034                    if (count == null) {
4035                            Session session = null;
4036    
4037                            try {
4038                                    session = openSession();
4039    
4040                                    Query q = session.createQuery(_SQL_COUNT_DLFILESHORTCUT);
4041    
4042                                    count = (Long)q.uniqueResult();
4043                            }
4044                            catch (Exception e) {
4045                                    throw processException(e);
4046                            }
4047                            finally {
4048                                    if (count == null) {
4049                                            count = Long.valueOf(0);
4050                                    }
4051    
4052                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
4053                                            count);
4054    
4055                                    closeSession(session);
4056                            }
4057                    }
4058    
4059                    return count.intValue();
4060            }
4061    
4062            /**
4063             * Initializes the d l file shortcut persistence.
4064             */
4065            public void afterPropertiesSet() {
4066                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
4067                                            com.liferay.portal.util.PropsUtil.get(
4068                                                    "value.object.listener.com.liferay.portlet.documentlibrary.model.DLFileShortcut")));
4069    
4070                    if (listenerClassNames.length > 0) {
4071                            try {
4072                                    List<ModelListener<DLFileShortcut>> listenersList = new ArrayList<ModelListener<DLFileShortcut>>();
4073    
4074                                    for (String listenerClassName : listenerClassNames) {
4075                                            listenersList.add((ModelListener<DLFileShortcut>)InstanceFactory.newInstance(
4076                                                            listenerClassName));
4077                                    }
4078    
4079                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
4080                            }
4081                            catch (Exception e) {
4082                                    _log.error(e);
4083                            }
4084                    }
4085            }
4086    
4087            public void destroy() {
4088                    EntityCacheUtil.removeCache(DLFileShortcutImpl.class.getName());
4089                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
4090                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
4091            }
4092    
4093            @BeanReference(type = DLFileEntryPersistence.class)
4094            protected DLFileEntryPersistence dlFileEntryPersistence;
4095            @BeanReference(type = DLFileRankPersistence.class)
4096            protected DLFileRankPersistence dlFileRankPersistence;
4097            @BeanReference(type = DLFileShortcutPersistence.class)
4098            protected DLFileShortcutPersistence dlFileShortcutPersistence;
4099            @BeanReference(type = DLFileVersionPersistence.class)
4100            protected DLFileVersionPersistence dlFileVersionPersistence;
4101            @BeanReference(type = DLFolderPersistence.class)
4102            protected DLFolderPersistence dlFolderPersistence;
4103            @BeanReference(type = ResourcePersistence.class)
4104            protected ResourcePersistence resourcePersistence;
4105            @BeanReference(type = UserPersistence.class)
4106            protected UserPersistence userPersistence;
4107            @BeanReference(type = AssetEntryPersistence.class)
4108            protected AssetEntryPersistence assetEntryPersistence;
4109            @BeanReference(type = AssetTagPersistence.class)
4110            protected AssetTagPersistence assetTagPersistence;
4111            private static final String _SQL_SELECT_DLFILESHORTCUT = "SELECT dlFileShortcut FROM DLFileShortcut dlFileShortcut";
4112            private static final String _SQL_SELECT_DLFILESHORTCUT_WHERE = "SELECT dlFileShortcut FROM DLFileShortcut dlFileShortcut WHERE ";
4113            private static final String _SQL_COUNT_DLFILESHORTCUT = "SELECT COUNT(dlFileShortcut) FROM DLFileShortcut dlFileShortcut";
4114            private static final String _SQL_COUNT_DLFILESHORTCUT_WHERE = "SELECT COUNT(dlFileShortcut) FROM DLFileShortcut dlFileShortcut WHERE ";
4115            private static final String _FINDER_COLUMN_UUID_UUID_1 = "dlFileShortcut.uuid IS NULL";
4116            private static final String _FINDER_COLUMN_UUID_UUID_2 = "dlFileShortcut.uuid = ?";
4117            private static final String _FINDER_COLUMN_UUID_UUID_3 = "(dlFileShortcut.uuid IS NULL OR dlFileShortcut.uuid = ?)";
4118            private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "dlFileShortcut.uuid IS NULL AND ";
4119            private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "dlFileShortcut.uuid = ? AND ";
4120            private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(dlFileShortcut.uuid IS NULL OR dlFileShortcut.uuid = ?) AND ";
4121            private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "dlFileShortcut.groupId = ?";
4122            private static final String _FINDER_COLUMN_G_F_GROUPID_2 = "dlFileShortcut.groupId = ? AND ";
4123            private static final String _FINDER_COLUMN_G_F_FOLDERID_2 = "dlFileShortcut.folderId = ?";
4124            private static final String _FINDER_COLUMN_G_F_S_GROUPID_2 = "dlFileShortcut.groupId = ? AND ";
4125            private static final String _FINDER_COLUMN_G_F_S_FOLDERID_2 = "dlFileShortcut.folderId = ? AND ";
4126            private static final String _FINDER_COLUMN_G_F_S_STATUS_2 = "dlFileShortcut.status = ?";
4127            private static final String _FINDER_COLUMN_G_TF_TN_GROUPID_2 = "dlFileShortcut.groupId = ? AND ";
4128            private static final String _FINDER_COLUMN_G_TF_TN_TOFOLDERID_2 = "dlFileShortcut.toFolderId = ? AND ";
4129            private static final String _FINDER_COLUMN_G_TF_TN_TONAME_1 = "dlFileShortcut.toName IS NULL";
4130            private static final String _FINDER_COLUMN_G_TF_TN_TONAME_2 = "dlFileShortcut.toName = ?";
4131            private static final String _FINDER_COLUMN_G_TF_TN_TONAME_3 = "(dlFileShortcut.toName IS NULL OR dlFileShortcut.toName = ?)";
4132            private static final String _FINDER_COLUMN_G_TF_TN_S_GROUPID_2 = "dlFileShortcut.groupId = ? AND ";
4133            private static final String _FINDER_COLUMN_G_TF_TN_S_TOFOLDERID_2 = "dlFileShortcut.toFolderId = ? AND ";
4134            private static final String _FINDER_COLUMN_G_TF_TN_S_TONAME_1 = "dlFileShortcut.toName IS NULL AND ";
4135            private static final String _FINDER_COLUMN_G_TF_TN_S_TONAME_2 = "dlFileShortcut.toName = ? AND ";
4136            private static final String _FINDER_COLUMN_G_TF_TN_S_TONAME_3 = "(dlFileShortcut.toName IS NULL OR dlFileShortcut.toName = ?) AND ";
4137            private static final String _FINDER_COLUMN_G_TF_TN_S_STATUS_2 = "dlFileShortcut.status = ?";
4138            private static final String _FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE = "SELECT DISTINCT {dlFileShortcut.*} FROM DLFileShortcut dlFileShortcut WHERE ";
4139            private static final String _FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1 =
4140                    "SELECT {DLFileShortcut.*} FROM (SELECT DISTINCT dlFileShortcut.fileShortcutId FROM DLFileShortcut dlFileShortcut WHERE ";
4141            private static final String _FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2 =
4142                    ") TEMP_TABLE INNER JOIN DLFileShortcut ON TEMP_TABLE.fileShortcutId = DLFileShortcut.fileShortcutId";
4143            private static final String _FILTER_SQL_COUNT_DLFILESHORTCUT_WHERE = "SELECT COUNT(DISTINCT dlFileShortcut.fileShortcutId) AS COUNT_VALUE FROM DLFileShortcut dlFileShortcut WHERE ";
4144            private static final String _FILTER_COLUMN_PK = "dlFileShortcut.fileShortcutId";
4145            private static final String _FILTER_COLUMN_USERID = "dlFileShortcut.userId";
4146            private static final String _FILTER_ENTITY_ALIAS = "dlFileShortcut";
4147            private static final String _FILTER_ENTITY_TABLE = "DLFileShortcut";
4148            private static final String _ORDER_BY_ENTITY_ALIAS = "dlFileShortcut.";
4149            private static final String _ORDER_BY_ENTITY_TABLE = "DLFileShortcut.";
4150            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DLFileShortcut exists with the primary key ";
4151            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DLFileShortcut exists with the key {";
4152            private static Log _log = LogFactoryUtil.getLog(DLFileShortcutPersistenceImpl.class);
4153    }