001    /**
002     * Copyright (c) 2000-2012 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.bean.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.CacheModel;
040    import com.liferay.portal.model.ModelListener;
041    import com.liferay.portal.security.permission.InlineSQLHelperUtil;
042    import com.liferay.portal.service.persistence.UserPersistence;
043    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
044    
045    import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
046    import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
047    import com.liferay.portlet.documentlibrary.NoSuchFileShortcutException;
048    import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
049    import com.liferay.portlet.documentlibrary.model.impl.DLFileShortcutImpl;
050    import com.liferay.portlet.documentlibrary.model.impl.DLFileShortcutModelImpl;
051    import com.liferay.portlet.trash.service.persistence.TrashEntryPersistence;
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 document library file shortcut service.
061     *
062     * <p>
063     * Caching information and settings can be found in <code>portal.properties</code>
064     * </p>
065     *
066     * @author Brian Wing Shun Chan
067     * @see DLFileShortcutPersistence
068     * @see DLFileShortcutUtil
069     * @generated
070     */
071    public class DLFileShortcutPersistenceImpl extends BasePersistenceImpl<DLFileShortcut>
072            implements DLFileShortcutPersistence {
073            /*
074             * NOTE FOR DEVELOPERS:
075             *
076             * Never modify or reference this class directly. Always use {@link DLFileShortcutUtil} to access the document library file shortcut persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
077             */
078            public static final String FINDER_CLASS_NAME_ENTITY = DLFileShortcutImpl.class.getName();
079            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
080                    ".List1";
081            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
082                    ".List2";
083            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
084                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
085                            DLFileShortcutImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
086                            "findByUuid",
087                            new String[] {
088                                    String.class.getName(),
089                                    
090                            "java.lang.Integer", "java.lang.Integer",
091                                    "com.liferay.portal.kernel.util.OrderByComparator"
092                            });
093            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
094                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
095                            DLFileShortcutImpl.class,
096                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
097                            new String[] { String.class.getName() },
098                            DLFileShortcutModelImpl.UUID_COLUMN_BITMASK);
099            public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
100                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED, Long.class,
101                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
102                            new String[] { String.class.getName() });
103            public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
104                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
105                            DLFileShortcutImpl.class, FINDER_CLASS_NAME_ENTITY,
106                            "fetchByUUID_G",
107                            new String[] { String.class.getName(), Long.class.getName() },
108                            DLFileShortcutModelImpl.UUID_COLUMN_BITMASK |
109                            DLFileShortcutModelImpl.GROUPID_COLUMN_BITMASK);
110            public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
111                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED, Long.class,
112                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G",
113                            new String[] { String.class.getName(), Long.class.getName() });
114            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID_C = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
115                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
116                            DLFileShortcutImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
117                            "findByUuid_C",
118                            new String[] {
119                                    String.class.getName(), Long.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_WITHOUT_PAGINATION_FIND_BY_UUID_C =
125                    new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
126                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
127                            DLFileShortcutImpl.class,
128                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid_C",
129                            new String[] { String.class.getName(), Long.class.getName() },
130                            DLFileShortcutModelImpl.UUID_COLUMN_BITMASK |
131                            DLFileShortcutModelImpl.COMPANYID_COLUMN_BITMASK);
132            public static final FinderPath FINDER_PATH_COUNT_BY_UUID_C = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
133                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED, Long.class,
134                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid_C",
135                            new String[] { String.class.getName(), Long.class.getName() });
136            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_TOFILEENTRYID =
137                    new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
138                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
139                            DLFileShortcutImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
140                            "findByToFileEntryId",
141                            new String[] {
142                                    Long.class.getName(),
143                                    
144                            "java.lang.Integer", "java.lang.Integer",
145                                    "com.liferay.portal.kernel.util.OrderByComparator"
146                            });
147            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOFILEENTRYID =
148                    new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
149                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
150                            DLFileShortcutImpl.class,
151                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByToFileEntryId",
152                            new String[] { Long.class.getName() },
153                            DLFileShortcutModelImpl.TOFILEENTRYID_COLUMN_BITMASK);
154            public static final FinderPath FINDER_PATH_COUNT_BY_TOFILEENTRYID = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
155                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED, Long.class,
156                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByToFileEntryId",
157                            new String[] { Long.class.getName() });
158            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_F = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
159                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
160                            DLFileShortcutImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
161                            "findByG_F",
162                            new String[] {
163                                    Long.class.getName(), Long.class.getName(),
164                                    
165                            "java.lang.Integer", "java.lang.Integer",
166                                    "com.liferay.portal.kernel.util.OrderByComparator"
167                            });
168            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
169                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
170                            DLFileShortcutImpl.class,
171                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_F",
172                            new String[] { Long.class.getName(), Long.class.getName() },
173                            DLFileShortcutModelImpl.GROUPID_COLUMN_BITMASK |
174                            DLFileShortcutModelImpl.FOLDERID_COLUMN_BITMASK);
175            public static final FinderPath FINDER_PATH_COUNT_BY_G_F = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
176                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED, Long.class,
177                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_F",
178                            new String[] { Long.class.getName(), Long.class.getName() });
179            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_F_A = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
180                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
181                            DLFileShortcutImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
182                            "findByG_F_A",
183                            new String[] {
184                                    Long.class.getName(), Long.class.getName(),
185                                    Boolean.class.getName(),
186                                    
187                            "java.lang.Integer", "java.lang.Integer",
188                                    "com.liferay.portal.kernel.util.OrderByComparator"
189                            });
190            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_A = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
191                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
192                            DLFileShortcutImpl.class,
193                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_F_A",
194                            new String[] {
195                                    Long.class.getName(), Long.class.getName(),
196                                    Boolean.class.getName()
197                            },
198                            DLFileShortcutModelImpl.GROUPID_COLUMN_BITMASK |
199                            DLFileShortcutModelImpl.FOLDERID_COLUMN_BITMASK |
200                            DLFileShortcutModelImpl.ACTIVE_COLUMN_BITMASK);
201            public static final FinderPath FINDER_PATH_COUNT_BY_G_F_A = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
202                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED, Long.class,
203                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_F_A",
204                            new String[] {
205                                    Long.class.getName(), Long.class.getName(),
206                                    Boolean.class.getName()
207                            });
208            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_F_A_S = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
209                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
210                            DLFileShortcutImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
211                            "findByG_F_A_S",
212                            new String[] {
213                                    Long.class.getName(), Long.class.getName(),
214                                    Boolean.class.getName(), Integer.class.getName(),
215                                    
216                            "java.lang.Integer", "java.lang.Integer",
217                                    "com.liferay.portal.kernel.util.OrderByComparator"
218                            });
219            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_A_S =
220                    new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
221                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
222                            DLFileShortcutImpl.class,
223                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_F_A_S",
224                            new String[] {
225                                    Long.class.getName(), Long.class.getName(),
226                                    Boolean.class.getName(), Integer.class.getName()
227                            },
228                            DLFileShortcutModelImpl.GROUPID_COLUMN_BITMASK |
229                            DLFileShortcutModelImpl.FOLDERID_COLUMN_BITMASK |
230                            DLFileShortcutModelImpl.ACTIVE_COLUMN_BITMASK |
231                            DLFileShortcutModelImpl.STATUS_COLUMN_BITMASK);
232            public static final FinderPath FINDER_PATH_COUNT_BY_G_F_A_S = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
233                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED, Long.class,
234                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_F_A_S",
235                            new String[] {
236                                    Long.class.getName(), Long.class.getName(),
237                                    Boolean.class.getName(), Integer.class.getName()
238                            });
239            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
240                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
241                            DLFileShortcutImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
242                            "findAll", new String[0]);
243            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
244                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED,
245                            DLFileShortcutImpl.class,
246                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
247            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
248                            DLFileShortcutModelImpl.FINDER_CACHE_ENABLED, Long.class,
249                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
250    
251            /**
252             * Caches the document library file shortcut in the entity cache if it is enabled.
253             *
254             * @param dlFileShortcut the document library file shortcut
255             */
256            public void cacheResult(DLFileShortcut dlFileShortcut) {
257                    EntityCacheUtil.putResult(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
258                            DLFileShortcutImpl.class, dlFileShortcut.getPrimaryKey(),
259                            dlFileShortcut);
260    
261                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
262                            new Object[] {
263                                    dlFileShortcut.getUuid(),
264                                    Long.valueOf(dlFileShortcut.getGroupId())
265                            }, dlFileShortcut);
266    
267                    dlFileShortcut.resetOriginalValues();
268            }
269    
270            /**
271             * Caches the document library file shortcuts in the entity cache if it is enabled.
272             *
273             * @param dlFileShortcuts the document library file shortcuts
274             */
275            public void cacheResult(List<DLFileShortcut> dlFileShortcuts) {
276                    for (DLFileShortcut dlFileShortcut : dlFileShortcuts) {
277                            if (EntityCacheUtil.getResult(
278                                                    DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
279                                                    DLFileShortcutImpl.class, dlFileShortcut.getPrimaryKey()) == null) {
280                                    cacheResult(dlFileShortcut);
281                            }
282                            else {
283                                    dlFileShortcut.resetOriginalValues();
284                            }
285                    }
286            }
287    
288            /**
289             * Clears the cache for all document library file shortcuts.
290             *
291             * <p>
292             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
293             * </p>
294             */
295            @Override
296            public void clearCache() {
297                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
298                            CacheRegistryUtil.clear(DLFileShortcutImpl.class.getName());
299                    }
300    
301                    EntityCacheUtil.clearCache(DLFileShortcutImpl.class.getName());
302    
303                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
304                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
305                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
306            }
307    
308            /**
309             * Clears the cache for the document library file shortcut.
310             *
311             * <p>
312             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
313             * </p>
314             */
315            @Override
316            public void clearCache(DLFileShortcut dlFileShortcut) {
317                    EntityCacheUtil.removeResult(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
318                            DLFileShortcutImpl.class, dlFileShortcut.getPrimaryKey());
319    
320                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
321                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
322    
323                    clearUniqueFindersCache(dlFileShortcut);
324            }
325    
326            @Override
327            public void clearCache(List<DLFileShortcut> dlFileShortcuts) {
328                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
329                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
330    
331                    for (DLFileShortcut dlFileShortcut : dlFileShortcuts) {
332                            EntityCacheUtil.removeResult(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
333                                    DLFileShortcutImpl.class, dlFileShortcut.getPrimaryKey());
334    
335                            clearUniqueFindersCache(dlFileShortcut);
336                    }
337            }
338    
339            protected void clearUniqueFindersCache(DLFileShortcut dlFileShortcut) {
340                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
341                            new Object[] {
342                                    dlFileShortcut.getUuid(),
343                                    Long.valueOf(dlFileShortcut.getGroupId())
344                            });
345            }
346    
347            /**
348             * Creates a new document library file shortcut with the primary key. Does not add the document library file shortcut to the database.
349             *
350             * @param fileShortcutId the primary key for the new document library file shortcut
351             * @return the new document library file shortcut
352             */
353            public DLFileShortcut create(long fileShortcutId) {
354                    DLFileShortcut dlFileShortcut = new DLFileShortcutImpl();
355    
356                    dlFileShortcut.setNew(true);
357                    dlFileShortcut.setPrimaryKey(fileShortcutId);
358    
359                    String uuid = PortalUUIDUtil.generate();
360    
361                    dlFileShortcut.setUuid(uuid);
362    
363                    return dlFileShortcut;
364            }
365    
366            /**
367             * Removes the document library file shortcut with the primary key from the database. Also notifies the appropriate model listeners.
368             *
369             * @param fileShortcutId the primary key of the document library file shortcut
370             * @return the document library file shortcut that was removed
371             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
372             * @throws SystemException if a system exception occurred
373             */
374            public DLFileShortcut remove(long fileShortcutId)
375                    throws NoSuchFileShortcutException, SystemException {
376                    return remove(Long.valueOf(fileShortcutId));
377            }
378    
379            /**
380             * Removes the document library file shortcut with the primary key from the database. Also notifies the appropriate model listeners.
381             *
382             * @param primaryKey the primary key of the document library file shortcut
383             * @return the document library file shortcut that was removed
384             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
385             * @throws SystemException if a system exception occurred
386             */
387            @Override
388            public DLFileShortcut remove(Serializable primaryKey)
389                    throws NoSuchFileShortcutException, SystemException {
390                    Session session = null;
391    
392                    try {
393                            session = openSession();
394    
395                            DLFileShortcut dlFileShortcut = (DLFileShortcut)session.get(DLFileShortcutImpl.class,
396                                            primaryKey);
397    
398                            if (dlFileShortcut == null) {
399                                    if (_log.isWarnEnabled()) {
400                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
401                                    }
402    
403                                    throw new NoSuchFileShortcutException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
404                                            primaryKey);
405                            }
406    
407                            return remove(dlFileShortcut);
408                    }
409                    catch (NoSuchFileShortcutException nsee) {
410                            throw nsee;
411                    }
412                    catch (Exception e) {
413                            throw processException(e);
414                    }
415                    finally {
416                            closeSession(session);
417                    }
418            }
419    
420            @Override
421            protected DLFileShortcut removeImpl(DLFileShortcut dlFileShortcut)
422                    throws SystemException {
423                    dlFileShortcut = toUnwrappedModel(dlFileShortcut);
424    
425                    Session session = null;
426    
427                    try {
428                            session = openSession();
429    
430                            if (dlFileShortcut.isCachedModel()) {
431                                    dlFileShortcut = (DLFileShortcut)session.get(DLFileShortcutImpl.class,
432                                                    dlFileShortcut.getPrimaryKeyObj());
433                            }
434    
435                            session.delete(dlFileShortcut);
436                    }
437                    catch (Exception e) {
438                            throw processException(e);
439                    }
440                    finally {
441                            closeSession(session);
442                    }
443    
444                    clearCache(dlFileShortcut);
445    
446                    return dlFileShortcut;
447            }
448    
449            @Override
450            public DLFileShortcut updateImpl(
451                    com.liferay.portlet.documentlibrary.model.DLFileShortcut dlFileShortcut)
452                    throws SystemException {
453                    dlFileShortcut = toUnwrappedModel(dlFileShortcut);
454    
455                    boolean isNew = dlFileShortcut.isNew();
456    
457                    DLFileShortcutModelImpl dlFileShortcutModelImpl = (DLFileShortcutModelImpl)dlFileShortcut;
458    
459                    if (Validator.isNull(dlFileShortcut.getUuid())) {
460                            String uuid = PortalUUIDUtil.generate();
461    
462                            dlFileShortcut.setUuid(uuid);
463                    }
464    
465                    Session session = null;
466    
467                    try {
468                            session = openSession();
469    
470                            if (dlFileShortcut.isNew()) {
471                                    session.save(dlFileShortcut);
472    
473                                    dlFileShortcut.setNew(false);
474                            }
475                            else {
476                                    session.merge(dlFileShortcut);
477                            }
478                    }
479                    catch (Exception e) {
480                            throw processException(e);
481                    }
482                    finally {
483                            closeSession(session);
484                    }
485    
486                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
487    
488                    if (isNew || !DLFileShortcutModelImpl.COLUMN_BITMASK_ENABLED) {
489                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
490                    }
491    
492                    else {
493                            if ((dlFileShortcutModelImpl.getColumnBitmask() &
494                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
495                                    Object[] args = new Object[] {
496                                                    dlFileShortcutModelImpl.getOriginalUuid()
497                                            };
498    
499                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
500                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
501                                            args);
502    
503                                    args = new Object[] { dlFileShortcutModelImpl.getUuid() };
504    
505                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
506                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
507                                            args);
508                            }
509    
510                            if ((dlFileShortcutModelImpl.getColumnBitmask() &
511                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C.getColumnBitmask()) != 0) {
512                                    Object[] args = new Object[] {
513                                                    dlFileShortcutModelImpl.getOriginalUuid(),
514                                                    Long.valueOf(dlFileShortcutModelImpl.getOriginalCompanyId())
515                                            };
516    
517                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
518                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C,
519                                            args);
520    
521                                    args = new Object[] {
522                                                    dlFileShortcutModelImpl.getUuid(),
523                                                    Long.valueOf(dlFileShortcutModelImpl.getCompanyId())
524                                            };
525    
526                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
527                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C,
528                                            args);
529                            }
530    
531                            if ((dlFileShortcutModelImpl.getColumnBitmask() &
532                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOFILEENTRYID.getColumnBitmask()) != 0) {
533                                    Object[] args = new Object[] {
534                                                    Long.valueOf(dlFileShortcutModelImpl.getOriginalToFileEntryId())
535                                            };
536    
537                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TOFILEENTRYID,
538                                            args);
539                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOFILEENTRYID,
540                                            args);
541    
542                                    args = new Object[] {
543                                                    Long.valueOf(dlFileShortcutModelImpl.getToFileEntryId())
544                                            };
545    
546                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TOFILEENTRYID,
547                                            args);
548                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOFILEENTRYID,
549                                            args);
550                            }
551    
552                            if ((dlFileShortcutModelImpl.getColumnBitmask() &
553                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F.getColumnBitmask()) != 0) {
554                                    Object[] args = new Object[] {
555                                                    Long.valueOf(dlFileShortcutModelImpl.getOriginalGroupId()),
556                                                    Long.valueOf(dlFileShortcutModelImpl.getOriginalFolderId())
557                                            };
558    
559                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_F, args);
560                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F,
561                                            args);
562    
563                                    args = new Object[] {
564                                                    Long.valueOf(dlFileShortcutModelImpl.getGroupId()),
565                                                    Long.valueOf(dlFileShortcutModelImpl.getFolderId())
566                                            };
567    
568                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_F, args);
569                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F,
570                                            args);
571                            }
572    
573                            if ((dlFileShortcutModelImpl.getColumnBitmask() &
574                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_A.getColumnBitmask()) != 0) {
575                                    Object[] args = new Object[] {
576                                                    Long.valueOf(dlFileShortcutModelImpl.getOriginalGroupId()),
577                                                    Long.valueOf(dlFileShortcutModelImpl.getOriginalFolderId()),
578                                                    Boolean.valueOf(dlFileShortcutModelImpl.getOriginalActive())
579                                            };
580    
581                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_F_A, args);
582                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_A,
583                                            args);
584    
585                                    args = new Object[] {
586                                                    Long.valueOf(dlFileShortcutModelImpl.getGroupId()),
587                                                    Long.valueOf(dlFileShortcutModelImpl.getFolderId()),
588                                                    Boolean.valueOf(dlFileShortcutModelImpl.getActive())
589                                            };
590    
591                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_F_A, args);
592                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_A,
593                                            args);
594                            }
595    
596                            if ((dlFileShortcutModelImpl.getColumnBitmask() &
597                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_A_S.getColumnBitmask()) != 0) {
598                                    Object[] args = new Object[] {
599                                                    Long.valueOf(dlFileShortcutModelImpl.getOriginalGroupId()),
600                                                    Long.valueOf(dlFileShortcutModelImpl.getOriginalFolderId()),
601                                                    Boolean.valueOf(dlFileShortcutModelImpl.getOriginalActive()),
602                                                    Integer.valueOf(dlFileShortcutModelImpl.getOriginalStatus())
603                                            };
604    
605                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_F_A_S, args);
606                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_A_S,
607                                            args);
608    
609                                    args = new Object[] {
610                                                    Long.valueOf(dlFileShortcutModelImpl.getGroupId()),
611                                                    Long.valueOf(dlFileShortcutModelImpl.getFolderId()),
612                                                    Boolean.valueOf(dlFileShortcutModelImpl.getActive()),
613                                                    Integer.valueOf(dlFileShortcutModelImpl.getStatus())
614                                            };
615    
616                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_F_A_S, args);
617                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_A_S,
618                                            args);
619                            }
620                    }
621    
622                    EntityCacheUtil.putResult(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
623                            DLFileShortcutImpl.class, dlFileShortcut.getPrimaryKey(),
624                            dlFileShortcut);
625    
626                    if (isNew) {
627                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
628                                    new Object[] {
629                                            dlFileShortcut.getUuid(),
630                                            Long.valueOf(dlFileShortcut.getGroupId())
631                                    }, dlFileShortcut);
632                    }
633                    else {
634                            if ((dlFileShortcutModelImpl.getColumnBitmask() &
635                                            FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
636                                    Object[] args = new Object[] {
637                                                    dlFileShortcutModelImpl.getOriginalUuid(),
638                                                    Long.valueOf(dlFileShortcutModelImpl.getOriginalGroupId())
639                                            };
640    
641                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
642    
643                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
644    
645                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
646                                            new Object[] {
647                                                    dlFileShortcut.getUuid(),
648                                                    Long.valueOf(dlFileShortcut.getGroupId())
649                                            }, dlFileShortcut);
650                            }
651                    }
652    
653                    return dlFileShortcut;
654            }
655    
656            protected DLFileShortcut toUnwrappedModel(DLFileShortcut dlFileShortcut) {
657                    if (dlFileShortcut instanceof DLFileShortcutImpl) {
658                            return dlFileShortcut;
659                    }
660    
661                    DLFileShortcutImpl dlFileShortcutImpl = new DLFileShortcutImpl();
662    
663                    dlFileShortcutImpl.setNew(dlFileShortcut.isNew());
664                    dlFileShortcutImpl.setPrimaryKey(dlFileShortcut.getPrimaryKey());
665    
666                    dlFileShortcutImpl.setUuid(dlFileShortcut.getUuid());
667                    dlFileShortcutImpl.setFileShortcutId(dlFileShortcut.getFileShortcutId());
668                    dlFileShortcutImpl.setGroupId(dlFileShortcut.getGroupId());
669                    dlFileShortcutImpl.setCompanyId(dlFileShortcut.getCompanyId());
670                    dlFileShortcutImpl.setUserId(dlFileShortcut.getUserId());
671                    dlFileShortcutImpl.setUserName(dlFileShortcut.getUserName());
672                    dlFileShortcutImpl.setCreateDate(dlFileShortcut.getCreateDate());
673                    dlFileShortcutImpl.setModifiedDate(dlFileShortcut.getModifiedDate());
674                    dlFileShortcutImpl.setRepositoryId(dlFileShortcut.getRepositoryId());
675                    dlFileShortcutImpl.setFolderId(dlFileShortcut.getFolderId());
676                    dlFileShortcutImpl.setToFileEntryId(dlFileShortcut.getToFileEntryId());
677                    dlFileShortcutImpl.setActive(dlFileShortcut.isActive());
678                    dlFileShortcutImpl.setStatus(dlFileShortcut.getStatus());
679                    dlFileShortcutImpl.setStatusByUserId(dlFileShortcut.getStatusByUserId());
680                    dlFileShortcutImpl.setStatusByUserName(dlFileShortcut.getStatusByUserName());
681                    dlFileShortcutImpl.setStatusDate(dlFileShortcut.getStatusDate());
682    
683                    return dlFileShortcutImpl;
684            }
685    
686            /**
687             * Returns the document library file shortcut with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
688             *
689             * @param primaryKey the primary key of the document library file shortcut
690             * @return the document library file shortcut
691             * @throws com.liferay.portal.NoSuchModelException if a document library file shortcut with the primary key could not be found
692             * @throws SystemException if a system exception occurred
693             */
694            @Override
695            public DLFileShortcut findByPrimaryKey(Serializable primaryKey)
696                    throws NoSuchModelException, SystemException {
697                    return findByPrimaryKey(((Long)primaryKey).longValue());
698            }
699    
700            /**
701             * Returns the document library file shortcut with the primary key or throws a {@link com.liferay.portlet.documentlibrary.NoSuchFileShortcutException} if it could not be found.
702             *
703             * @param fileShortcutId the primary key of the document library file shortcut
704             * @return the document library file shortcut
705             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
706             * @throws SystemException if a system exception occurred
707             */
708            public DLFileShortcut findByPrimaryKey(long fileShortcutId)
709                    throws NoSuchFileShortcutException, SystemException {
710                    DLFileShortcut dlFileShortcut = fetchByPrimaryKey(fileShortcutId);
711    
712                    if (dlFileShortcut == null) {
713                            if (_log.isWarnEnabled()) {
714                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + fileShortcutId);
715                            }
716    
717                            throw new NoSuchFileShortcutException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
718                                    fileShortcutId);
719                    }
720    
721                    return dlFileShortcut;
722            }
723    
724            /**
725             * Returns the document library file shortcut with the primary key or returns <code>null</code> if it could not be found.
726             *
727             * @param primaryKey the primary key of the document library file shortcut
728             * @return the document library file shortcut, or <code>null</code> if a document library file shortcut with the primary key could not be found
729             * @throws SystemException if a system exception occurred
730             */
731            @Override
732            public DLFileShortcut fetchByPrimaryKey(Serializable primaryKey)
733                    throws SystemException {
734                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
735            }
736    
737            /**
738             * Returns the document library file shortcut with the primary key or returns <code>null</code> if it could not be found.
739             *
740             * @param fileShortcutId the primary key of the document library file shortcut
741             * @return the document library file shortcut, or <code>null</code> if a document library file shortcut with the primary key could not be found
742             * @throws SystemException if a system exception occurred
743             */
744            public DLFileShortcut fetchByPrimaryKey(long fileShortcutId)
745                    throws SystemException {
746                    DLFileShortcut dlFileShortcut = (DLFileShortcut)EntityCacheUtil.getResult(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
747                                    DLFileShortcutImpl.class, fileShortcutId);
748    
749                    if (dlFileShortcut == _nullDLFileShortcut) {
750                            return null;
751                    }
752    
753                    if (dlFileShortcut == null) {
754                            Session session = null;
755    
756                            boolean hasException = false;
757    
758                            try {
759                                    session = openSession();
760    
761                                    dlFileShortcut = (DLFileShortcut)session.get(DLFileShortcutImpl.class,
762                                                    Long.valueOf(fileShortcutId));
763                            }
764                            catch (Exception e) {
765                                    hasException = true;
766    
767                                    throw processException(e);
768                            }
769                            finally {
770                                    if (dlFileShortcut != null) {
771                                            cacheResult(dlFileShortcut);
772                                    }
773                                    else if (!hasException) {
774                                            EntityCacheUtil.putResult(DLFileShortcutModelImpl.ENTITY_CACHE_ENABLED,
775                                                    DLFileShortcutImpl.class, fileShortcutId,
776                                                    _nullDLFileShortcut);
777                                    }
778    
779                                    closeSession(session);
780                            }
781                    }
782    
783                    return dlFileShortcut;
784            }
785    
786            /**
787             * Returns all the document library file shortcuts where uuid = &#63;.
788             *
789             * @param uuid the uuid
790             * @return the matching document library file shortcuts
791             * @throws SystemException if a system exception occurred
792             */
793            public List<DLFileShortcut> findByUuid(String uuid)
794                    throws SystemException {
795                    return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
796            }
797    
798            /**
799             * Returns a range of all the document library file shortcuts where uuid = &#63;.
800             *
801             * <p>
802             * 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.
803             * </p>
804             *
805             * @param uuid the uuid
806             * @param start the lower bound of the range of document library file shortcuts
807             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
808             * @return the range of matching document library file shortcuts
809             * @throws SystemException if a system exception occurred
810             */
811            public List<DLFileShortcut> findByUuid(String uuid, int start, int end)
812                    throws SystemException {
813                    return findByUuid(uuid, start, end, null);
814            }
815    
816            /**
817             * Returns an ordered range of all the document library file shortcuts where uuid = &#63;.
818             *
819             * <p>
820             * 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.
821             * </p>
822             *
823             * @param uuid the uuid
824             * @param start the lower bound of the range of document library file shortcuts
825             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
826             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
827             * @return the ordered range of matching document library file shortcuts
828             * @throws SystemException if a system exception occurred
829             */
830            public List<DLFileShortcut> findByUuid(String uuid, int start, int end,
831                    OrderByComparator orderByComparator) throws SystemException {
832                    FinderPath finderPath = null;
833                    Object[] finderArgs = null;
834    
835                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
836                                    (orderByComparator == null)) {
837                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
838                            finderArgs = new Object[] { uuid };
839                    }
840                    else {
841                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
842                            finderArgs = new Object[] { uuid, start, end, orderByComparator };
843                    }
844    
845                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(finderPath,
846                                    finderArgs, this);
847    
848                    if ((list != null) && !list.isEmpty()) {
849                            for (DLFileShortcut dlFileShortcut : list) {
850                                    if (!Validator.equals(uuid, dlFileShortcut.getUuid())) {
851                                            list = null;
852    
853                                            break;
854                                    }
855                            }
856                    }
857    
858                    if (list == null) {
859                            StringBundler query = null;
860    
861                            if (orderByComparator != null) {
862                                    query = new StringBundler(3 +
863                                                    (orderByComparator.getOrderByFields().length * 3));
864                            }
865                            else {
866                                    query = new StringBundler(2);
867                            }
868    
869                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
870    
871                            if (uuid == null) {
872                                    query.append(_FINDER_COLUMN_UUID_UUID_1);
873                            }
874                            else {
875                                    if (uuid.equals(StringPool.BLANK)) {
876                                            query.append(_FINDER_COLUMN_UUID_UUID_3);
877                                    }
878                                    else {
879                                            query.append(_FINDER_COLUMN_UUID_UUID_2);
880                                    }
881                            }
882    
883                            if (orderByComparator != null) {
884                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
885                                            orderByComparator);
886                            }
887    
888                            String sql = query.toString();
889    
890                            Session session = null;
891    
892                            try {
893                                    session = openSession();
894    
895                                    Query q = session.createQuery(sql);
896    
897                                    QueryPos qPos = QueryPos.getInstance(q);
898    
899                                    if (uuid != null) {
900                                            qPos.add(uuid);
901                                    }
902    
903                                    list = (List<DLFileShortcut>)QueryUtil.list(q, getDialect(),
904                                                    start, end);
905                            }
906                            catch (Exception e) {
907                                    throw processException(e);
908                            }
909                            finally {
910                                    if (list == null) {
911                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
912                                    }
913                                    else {
914                                            cacheResult(list);
915    
916                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
917                                    }
918    
919                                    closeSession(session);
920                            }
921                    }
922    
923                    return list;
924            }
925    
926            /**
927             * Returns the first document library file shortcut in the ordered set where uuid = &#63;.
928             *
929             * @param uuid the uuid
930             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
931             * @return the first matching document library file shortcut
932             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
933             * @throws SystemException if a system exception occurred
934             */
935            public DLFileShortcut findByUuid_First(String uuid,
936                    OrderByComparator orderByComparator)
937                    throws NoSuchFileShortcutException, SystemException {
938                    DLFileShortcut dlFileShortcut = fetchByUuid_First(uuid,
939                                    orderByComparator);
940    
941                    if (dlFileShortcut != null) {
942                            return dlFileShortcut;
943                    }
944    
945                    StringBundler msg = new StringBundler(4);
946    
947                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
948    
949                    msg.append("uuid=");
950                    msg.append(uuid);
951    
952                    msg.append(StringPool.CLOSE_CURLY_BRACE);
953    
954                    throw new NoSuchFileShortcutException(msg.toString());
955            }
956    
957            /**
958             * Returns the first document library file shortcut in the ordered set where uuid = &#63;.
959             *
960             * @param uuid the uuid
961             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
962             * @return the first matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
963             * @throws SystemException if a system exception occurred
964             */
965            public DLFileShortcut fetchByUuid_First(String uuid,
966                    OrderByComparator orderByComparator) throws SystemException {
967                    List<DLFileShortcut> list = findByUuid(uuid, 0, 1, orderByComparator);
968    
969                    if (!list.isEmpty()) {
970                            return list.get(0);
971                    }
972    
973                    return null;
974            }
975    
976            /**
977             * Returns the last document library file shortcut in the ordered set where uuid = &#63;.
978             *
979             * @param uuid the uuid
980             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
981             * @return the last matching document library file shortcut
982             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
983             * @throws SystemException if a system exception occurred
984             */
985            public DLFileShortcut findByUuid_Last(String uuid,
986                    OrderByComparator orderByComparator)
987                    throws NoSuchFileShortcutException, SystemException {
988                    DLFileShortcut dlFileShortcut = fetchByUuid_Last(uuid, orderByComparator);
989    
990                    if (dlFileShortcut != null) {
991                            return dlFileShortcut;
992                    }
993    
994                    StringBundler msg = new StringBundler(4);
995    
996                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
997    
998                    msg.append("uuid=");
999                    msg.append(uuid);
1000    
1001                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1002    
1003                    throw new NoSuchFileShortcutException(msg.toString());
1004            }
1005    
1006            /**
1007             * Returns the last document library file shortcut in the ordered set where uuid = &#63;.
1008             *
1009             * @param uuid the uuid
1010             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1011             * @return the last matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
1012             * @throws SystemException if a system exception occurred
1013             */
1014            public DLFileShortcut fetchByUuid_Last(String uuid,
1015                    OrderByComparator orderByComparator) throws SystemException {
1016                    int count = countByUuid(uuid);
1017    
1018                    List<DLFileShortcut> list = findByUuid(uuid, count - 1, count,
1019                                    orderByComparator);
1020    
1021                    if (!list.isEmpty()) {
1022                            return list.get(0);
1023                    }
1024    
1025                    return null;
1026            }
1027    
1028            /**
1029             * Returns the document library file shortcuts before and after the current document library file shortcut in the ordered set where uuid = &#63;.
1030             *
1031             * @param fileShortcutId the primary key of the current document library file shortcut
1032             * @param uuid the uuid
1033             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1034             * @return the previous, current, and next document library file shortcut
1035             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
1036             * @throws SystemException if a system exception occurred
1037             */
1038            public DLFileShortcut[] findByUuid_PrevAndNext(long fileShortcutId,
1039                    String uuid, OrderByComparator orderByComparator)
1040                    throws NoSuchFileShortcutException, SystemException {
1041                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
1042    
1043                    Session session = null;
1044    
1045                    try {
1046                            session = openSession();
1047    
1048                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
1049    
1050                            array[0] = getByUuid_PrevAndNext(session, dlFileShortcut, uuid,
1051                                            orderByComparator, true);
1052    
1053                            array[1] = dlFileShortcut;
1054    
1055                            array[2] = getByUuid_PrevAndNext(session, dlFileShortcut, uuid,
1056                                            orderByComparator, false);
1057    
1058                            return array;
1059                    }
1060                    catch (Exception e) {
1061                            throw processException(e);
1062                    }
1063                    finally {
1064                            closeSession(session);
1065                    }
1066            }
1067    
1068            protected DLFileShortcut getByUuid_PrevAndNext(Session session,
1069                    DLFileShortcut dlFileShortcut, String uuid,
1070                    OrderByComparator orderByComparator, boolean previous) {
1071                    StringBundler query = null;
1072    
1073                    if (orderByComparator != null) {
1074                            query = new StringBundler(6 +
1075                                            (orderByComparator.getOrderByFields().length * 6));
1076                    }
1077                    else {
1078                            query = new StringBundler(3);
1079                    }
1080    
1081                    query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
1082    
1083                    if (uuid == null) {
1084                            query.append(_FINDER_COLUMN_UUID_UUID_1);
1085                    }
1086                    else {
1087                            if (uuid.equals(StringPool.BLANK)) {
1088                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
1089                            }
1090                            else {
1091                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
1092                            }
1093                    }
1094    
1095                    if (orderByComparator != null) {
1096                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1097    
1098                            if (orderByConditionFields.length > 0) {
1099                                    query.append(WHERE_AND);
1100                            }
1101    
1102                            for (int i = 0; i < orderByConditionFields.length; i++) {
1103                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1104                                    query.append(orderByConditionFields[i]);
1105    
1106                                    if ((i + 1) < orderByConditionFields.length) {
1107                                            if (orderByComparator.isAscending() ^ previous) {
1108                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1109                                            }
1110                                            else {
1111                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1112                                            }
1113                                    }
1114                                    else {
1115                                            if (orderByComparator.isAscending() ^ previous) {
1116                                                    query.append(WHERE_GREATER_THAN);
1117                                            }
1118                                            else {
1119                                                    query.append(WHERE_LESSER_THAN);
1120                                            }
1121                                    }
1122                            }
1123    
1124                            query.append(ORDER_BY_CLAUSE);
1125    
1126                            String[] orderByFields = orderByComparator.getOrderByFields();
1127    
1128                            for (int i = 0; i < orderByFields.length; i++) {
1129                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1130                                    query.append(orderByFields[i]);
1131    
1132                                    if ((i + 1) < orderByFields.length) {
1133                                            if (orderByComparator.isAscending() ^ previous) {
1134                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1135                                            }
1136                                            else {
1137                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1138                                            }
1139                                    }
1140                                    else {
1141                                            if (orderByComparator.isAscending() ^ previous) {
1142                                                    query.append(ORDER_BY_ASC);
1143                                            }
1144                                            else {
1145                                                    query.append(ORDER_BY_DESC);
1146                                            }
1147                                    }
1148                            }
1149                    }
1150    
1151                    String sql = query.toString();
1152    
1153                    Query q = session.createQuery(sql);
1154    
1155                    q.setFirstResult(0);
1156                    q.setMaxResults(2);
1157    
1158                    QueryPos qPos = QueryPos.getInstance(q);
1159    
1160                    if (uuid != null) {
1161                            qPos.add(uuid);
1162                    }
1163    
1164                    if (orderByComparator != null) {
1165                            Object[] values = orderByComparator.getOrderByConditionValues(dlFileShortcut);
1166    
1167                            for (Object value : values) {
1168                                    qPos.add(value);
1169                            }
1170                    }
1171    
1172                    List<DLFileShortcut> list = q.list();
1173    
1174                    if (list.size() == 2) {
1175                            return list.get(1);
1176                    }
1177                    else {
1178                            return null;
1179                    }
1180            }
1181    
1182            /**
1183             * Returns the document library file shortcut where uuid = &#63; and groupId = &#63; or throws a {@link com.liferay.portlet.documentlibrary.NoSuchFileShortcutException} if it could not be found.
1184             *
1185             * @param uuid the uuid
1186             * @param groupId the group ID
1187             * @return the matching document library file shortcut
1188             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
1189             * @throws SystemException if a system exception occurred
1190             */
1191            public DLFileShortcut findByUUID_G(String uuid, long groupId)
1192                    throws NoSuchFileShortcutException, SystemException {
1193                    DLFileShortcut dlFileShortcut = fetchByUUID_G(uuid, groupId);
1194    
1195                    if (dlFileShortcut == null) {
1196                            StringBundler msg = new StringBundler(6);
1197    
1198                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1199    
1200                            msg.append("uuid=");
1201                            msg.append(uuid);
1202    
1203                            msg.append(", groupId=");
1204                            msg.append(groupId);
1205    
1206                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1207    
1208                            if (_log.isWarnEnabled()) {
1209                                    _log.warn(msg.toString());
1210                            }
1211    
1212                            throw new NoSuchFileShortcutException(msg.toString());
1213                    }
1214    
1215                    return dlFileShortcut;
1216            }
1217    
1218            /**
1219             * Returns the document library file shortcut where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1220             *
1221             * @param uuid the uuid
1222             * @param groupId the group ID
1223             * @return the matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
1224             * @throws SystemException if a system exception occurred
1225             */
1226            public DLFileShortcut fetchByUUID_G(String uuid, long groupId)
1227                    throws SystemException {
1228                    return fetchByUUID_G(uuid, groupId, true);
1229            }
1230    
1231            /**
1232             * Returns the document library file shortcut where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1233             *
1234             * @param uuid the uuid
1235             * @param groupId the group ID
1236             * @param retrieveFromCache whether to use the finder cache
1237             * @return the matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
1238             * @throws SystemException if a system exception occurred
1239             */
1240            public DLFileShortcut fetchByUUID_G(String uuid, long groupId,
1241                    boolean retrieveFromCache) throws SystemException {
1242                    Object[] finderArgs = new Object[] { uuid, groupId };
1243    
1244                    Object result = null;
1245    
1246                    if (retrieveFromCache) {
1247                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1248                                            finderArgs, this);
1249                    }
1250    
1251                    if (result instanceof DLFileShortcut) {
1252                            DLFileShortcut dlFileShortcut = (DLFileShortcut)result;
1253    
1254                            if (!Validator.equals(uuid, dlFileShortcut.getUuid()) ||
1255                                            (groupId != dlFileShortcut.getGroupId())) {
1256                                    result = null;
1257                            }
1258                    }
1259    
1260                    if (result == null) {
1261                            StringBundler query = new StringBundler(3);
1262    
1263                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
1264    
1265                            if (uuid == null) {
1266                                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1267                            }
1268                            else {
1269                                    if (uuid.equals(StringPool.BLANK)) {
1270                                            query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1271                                    }
1272                                    else {
1273                                            query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1274                                    }
1275                            }
1276    
1277                            query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1278    
1279                            String sql = query.toString();
1280    
1281                            Session session = null;
1282    
1283                            try {
1284                                    session = openSession();
1285    
1286                                    Query q = session.createQuery(sql);
1287    
1288                                    QueryPos qPos = QueryPos.getInstance(q);
1289    
1290                                    if (uuid != null) {
1291                                            qPos.add(uuid);
1292                                    }
1293    
1294                                    qPos.add(groupId);
1295    
1296                                    List<DLFileShortcut> list = q.list();
1297    
1298                                    result = list;
1299    
1300                                    DLFileShortcut dlFileShortcut = null;
1301    
1302                                    if (list.isEmpty()) {
1303                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1304                                                    finderArgs, list);
1305                                    }
1306                                    else {
1307                                            dlFileShortcut = list.get(0);
1308    
1309                                            cacheResult(dlFileShortcut);
1310    
1311                                            if ((dlFileShortcut.getUuid() == null) ||
1312                                                            !dlFileShortcut.getUuid().equals(uuid) ||
1313                                                            (dlFileShortcut.getGroupId() != groupId)) {
1314                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1315                                                            finderArgs, dlFileShortcut);
1316                                            }
1317                                    }
1318    
1319                                    return dlFileShortcut;
1320                            }
1321                            catch (Exception e) {
1322                                    throw processException(e);
1323                            }
1324                            finally {
1325                                    if (result == null) {
1326                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1327                                                    finderArgs);
1328                                    }
1329    
1330                                    closeSession(session);
1331                            }
1332                    }
1333                    else {
1334                            if (result instanceof List<?>) {
1335                                    return null;
1336                            }
1337                            else {
1338                                    return (DLFileShortcut)result;
1339                            }
1340                    }
1341            }
1342    
1343            /**
1344             * Returns all the document library file shortcuts where uuid = &#63; and companyId = &#63;.
1345             *
1346             * @param uuid the uuid
1347             * @param companyId the company ID
1348             * @return the matching document library file shortcuts
1349             * @throws SystemException if a system exception occurred
1350             */
1351            public List<DLFileShortcut> findByUuid_C(String uuid, long companyId)
1352                    throws SystemException {
1353                    return findByUuid_C(uuid, companyId, QueryUtil.ALL_POS,
1354                            QueryUtil.ALL_POS, null);
1355            }
1356    
1357            /**
1358             * Returns a range of all the document library file shortcuts where uuid = &#63; and companyId = &#63;.
1359             *
1360             * <p>
1361             * 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.
1362             * </p>
1363             *
1364             * @param uuid the uuid
1365             * @param companyId the company ID
1366             * @param start the lower bound of the range of document library file shortcuts
1367             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
1368             * @return the range of matching document library file shortcuts
1369             * @throws SystemException if a system exception occurred
1370             */
1371            public List<DLFileShortcut> findByUuid_C(String uuid, long companyId,
1372                    int start, int end) throws SystemException {
1373                    return findByUuid_C(uuid, companyId, start, end, null);
1374            }
1375    
1376            /**
1377             * Returns an ordered range of all the document library file shortcuts where uuid = &#63; and companyId = &#63;.
1378             *
1379             * <p>
1380             * 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.
1381             * </p>
1382             *
1383             * @param uuid the uuid
1384             * @param companyId the company ID
1385             * @param start the lower bound of the range of document library file shortcuts
1386             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
1387             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1388             * @return the ordered range of matching document library file shortcuts
1389             * @throws SystemException if a system exception occurred
1390             */
1391            public List<DLFileShortcut> findByUuid_C(String uuid, long companyId,
1392                    int start, int end, OrderByComparator orderByComparator)
1393                    throws SystemException {
1394                    FinderPath finderPath = null;
1395                    Object[] finderArgs = null;
1396    
1397                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1398                                    (orderByComparator == null)) {
1399                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C;
1400                            finderArgs = new Object[] { uuid, companyId };
1401                    }
1402                    else {
1403                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID_C;
1404                            finderArgs = new Object[] {
1405                                            uuid, companyId,
1406                                            
1407                                            start, end, orderByComparator
1408                                    };
1409                    }
1410    
1411                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(finderPath,
1412                                    finderArgs, this);
1413    
1414                    if ((list != null) && !list.isEmpty()) {
1415                            for (DLFileShortcut dlFileShortcut : list) {
1416                                    if (!Validator.equals(uuid, dlFileShortcut.getUuid()) ||
1417                                                    (companyId != dlFileShortcut.getCompanyId())) {
1418                                            list = null;
1419    
1420                                            break;
1421                                    }
1422                            }
1423                    }
1424    
1425                    if (list == null) {
1426                            StringBundler query = null;
1427    
1428                            if (orderByComparator != null) {
1429                                    query = new StringBundler(4 +
1430                                                    (orderByComparator.getOrderByFields().length * 3));
1431                            }
1432                            else {
1433                                    query = new StringBundler(3);
1434                            }
1435    
1436                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
1437    
1438                            if (uuid == null) {
1439                                    query.append(_FINDER_COLUMN_UUID_C_UUID_1);
1440                            }
1441                            else {
1442                                    if (uuid.equals(StringPool.BLANK)) {
1443                                            query.append(_FINDER_COLUMN_UUID_C_UUID_3);
1444                                    }
1445                                    else {
1446                                            query.append(_FINDER_COLUMN_UUID_C_UUID_2);
1447                                    }
1448                            }
1449    
1450                            query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
1451    
1452                            if (orderByComparator != null) {
1453                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1454                                            orderByComparator);
1455                            }
1456    
1457                            String sql = query.toString();
1458    
1459                            Session session = null;
1460    
1461                            try {
1462                                    session = openSession();
1463    
1464                                    Query q = session.createQuery(sql);
1465    
1466                                    QueryPos qPos = QueryPos.getInstance(q);
1467    
1468                                    if (uuid != null) {
1469                                            qPos.add(uuid);
1470                                    }
1471    
1472                                    qPos.add(companyId);
1473    
1474                                    list = (List<DLFileShortcut>)QueryUtil.list(q, getDialect(),
1475                                                    start, end);
1476                            }
1477                            catch (Exception e) {
1478                                    throw processException(e);
1479                            }
1480                            finally {
1481                                    if (list == null) {
1482                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1483                                    }
1484                                    else {
1485                                            cacheResult(list);
1486    
1487                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1488                                    }
1489    
1490                                    closeSession(session);
1491                            }
1492                    }
1493    
1494                    return list;
1495            }
1496    
1497            /**
1498             * Returns the first document library file shortcut in the ordered set where uuid = &#63; and companyId = &#63;.
1499             *
1500             * @param uuid the uuid
1501             * @param companyId the company ID
1502             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1503             * @return the first matching document library file shortcut
1504             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
1505             * @throws SystemException if a system exception occurred
1506             */
1507            public DLFileShortcut findByUuid_C_First(String uuid, long companyId,
1508                    OrderByComparator orderByComparator)
1509                    throws NoSuchFileShortcutException, SystemException {
1510                    DLFileShortcut dlFileShortcut = fetchByUuid_C_First(uuid, companyId,
1511                                    orderByComparator);
1512    
1513                    if (dlFileShortcut != null) {
1514                            return dlFileShortcut;
1515                    }
1516    
1517                    StringBundler msg = new StringBundler(6);
1518    
1519                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1520    
1521                    msg.append("uuid=");
1522                    msg.append(uuid);
1523    
1524                    msg.append(", companyId=");
1525                    msg.append(companyId);
1526    
1527                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1528    
1529                    throw new NoSuchFileShortcutException(msg.toString());
1530            }
1531    
1532            /**
1533             * Returns the first document library file shortcut in the ordered set where uuid = &#63; and companyId = &#63;.
1534             *
1535             * @param uuid the uuid
1536             * @param companyId the company ID
1537             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1538             * @return the first matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
1539             * @throws SystemException if a system exception occurred
1540             */
1541            public DLFileShortcut fetchByUuid_C_First(String uuid, long companyId,
1542                    OrderByComparator orderByComparator) throws SystemException {
1543                    List<DLFileShortcut> list = findByUuid_C(uuid, companyId, 0, 1,
1544                                    orderByComparator);
1545    
1546                    if (!list.isEmpty()) {
1547                            return list.get(0);
1548                    }
1549    
1550                    return null;
1551            }
1552    
1553            /**
1554             * Returns the last document library file shortcut in the ordered set where uuid = &#63; and companyId = &#63;.
1555             *
1556             * @param uuid the uuid
1557             * @param companyId the company ID
1558             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1559             * @return the last matching document library file shortcut
1560             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
1561             * @throws SystemException if a system exception occurred
1562             */
1563            public DLFileShortcut findByUuid_C_Last(String uuid, long companyId,
1564                    OrderByComparator orderByComparator)
1565                    throws NoSuchFileShortcutException, SystemException {
1566                    DLFileShortcut dlFileShortcut = fetchByUuid_C_Last(uuid, companyId,
1567                                    orderByComparator);
1568    
1569                    if (dlFileShortcut != null) {
1570                            return dlFileShortcut;
1571                    }
1572    
1573                    StringBundler msg = new StringBundler(6);
1574    
1575                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1576    
1577                    msg.append("uuid=");
1578                    msg.append(uuid);
1579    
1580                    msg.append(", companyId=");
1581                    msg.append(companyId);
1582    
1583                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1584    
1585                    throw new NoSuchFileShortcutException(msg.toString());
1586            }
1587    
1588            /**
1589             * Returns the last document library file shortcut in the ordered set where uuid = &#63; and companyId = &#63;.
1590             *
1591             * @param uuid the uuid
1592             * @param companyId the company ID
1593             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1594             * @return the last matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
1595             * @throws SystemException if a system exception occurred
1596             */
1597            public DLFileShortcut fetchByUuid_C_Last(String uuid, long companyId,
1598                    OrderByComparator orderByComparator) throws SystemException {
1599                    int count = countByUuid_C(uuid, companyId);
1600    
1601                    List<DLFileShortcut> list = findByUuid_C(uuid, companyId, count - 1,
1602                                    count, orderByComparator);
1603    
1604                    if (!list.isEmpty()) {
1605                            return list.get(0);
1606                    }
1607    
1608                    return null;
1609            }
1610    
1611            /**
1612             * Returns the document library file shortcuts before and after the current document library file shortcut in the ordered set where uuid = &#63; and companyId = &#63;.
1613             *
1614             * @param fileShortcutId the primary key of the current document library file shortcut
1615             * @param uuid the uuid
1616             * @param companyId the company ID
1617             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1618             * @return the previous, current, and next document library file shortcut
1619             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
1620             * @throws SystemException if a system exception occurred
1621             */
1622            public DLFileShortcut[] findByUuid_C_PrevAndNext(long fileShortcutId,
1623                    String uuid, long companyId, OrderByComparator orderByComparator)
1624                    throws NoSuchFileShortcutException, SystemException {
1625                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
1626    
1627                    Session session = null;
1628    
1629                    try {
1630                            session = openSession();
1631    
1632                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
1633    
1634                            array[0] = getByUuid_C_PrevAndNext(session, dlFileShortcut, uuid,
1635                                            companyId, orderByComparator, true);
1636    
1637                            array[1] = dlFileShortcut;
1638    
1639                            array[2] = getByUuid_C_PrevAndNext(session, dlFileShortcut, uuid,
1640                                            companyId, orderByComparator, false);
1641    
1642                            return array;
1643                    }
1644                    catch (Exception e) {
1645                            throw processException(e);
1646                    }
1647                    finally {
1648                            closeSession(session);
1649                    }
1650            }
1651    
1652            protected DLFileShortcut getByUuid_C_PrevAndNext(Session session,
1653                    DLFileShortcut dlFileShortcut, String uuid, long companyId,
1654                    OrderByComparator orderByComparator, boolean previous) {
1655                    StringBundler query = null;
1656    
1657                    if (orderByComparator != null) {
1658                            query = new StringBundler(6 +
1659                                            (orderByComparator.getOrderByFields().length * 6));
1660                    }
1661                    else {
1662                            query = new StringBundler(3);
1663                    }
1664    
1665                    query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
1666    
1667                    if (uuid == null) {
1668                            query.append(_FINDER_COLUMN_UUID_C_UUID_1);
1669                    }
1670                    else {
1671                            if (uuid.equals(StringPool.BLANK)) {
1672                                    query.append(_FINDER_COLUMN_UUID_C_UUID_3);
1673                            }
1674                            else {
1675                                    query.append(_FINDER_COLUMN_UUID_C_UUID_2);
1676                            }
1677                    }
1678    
1679                    query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
1680    
1681                    if (orderByComparator != null) {
1682                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1683    
1684                            if (orderByConditionFields.length > 0) {
1685                                    query.append(WHERE_AND);
1686                            }
1687    
1688                            for (int i = 0; i < orderByConditionFields.length; i++) {
1689                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1690                                    query.append(orderByConditionFields[i]);
1691    
1692                                    if ((i + 1) < orderByConditionFields.length) {
1693                                            if (orderByComparator.isAscending() ^ previous) {
1694                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1695                                            }
1696                                            else {
1697                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1698                                            }
1699                                    }
1700                                    else {
1701                                            if (orderByComparator.isAscending() ^ previous) {
1702                                                    query.append(WHERE_GREATER_THAN);
1703                                            }
1704                                            else {
1705                                                    query.append(WHERE_LESSER_THAN);
1706                                            }
1707                                    }
1708                            }
1709    
1710                            query.append(ORDER_BY_CLAUSE);
1711    
1712                            String[] orderByFields = orderByComparator.getOrderByFields();
1713    
1714                            for (int i = 0; i < orderByFields.length; i++) {
1715                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1716                                    query.append(orderByFields[i]);
1717    
1718                                    if ((i + 1) < orderByFields.length) {
1719                                            if (orderByComparator.isAscending() ^ previous) {
1720                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1721                                            }
1722                                            else {
1723                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1724                                            }
1725                                    }
1726                                    else {
1727                                            if (orderByComparator.isAscending() ^ previous) {
1728                                                    query.append(ORDER_BY_ASC);
1729                                            }
1730                                            else {
1731                                                    query.append(ORDER_BY_DESC);
1732                                            }
1733                                    }
1734                            }
1735                    }
1736    
1737                    String sql = query.toString();
1738    
1739                    Query q = session.createQuery(sql);
1740    
1741                    q.setFirstResult(0);
1742                    q.setMaxResults(2);
1743    
1744                    QueryPos qPos = QueryPos.getInstance(q);
1745    
1746                    if (uuid != null) {
1747                            qPos.add(uuid);
1748                    }
1749    
1750                    qPos.add(companyId);
1751    
1752                    if (orderByComparator != null) {
1753                            Object[] values = orderByComparator.getOrderByConditionValues(dlFileShortcut);
1754    
1755                            for (Object value : values) {
1756                                    qPos.add(value);
1757                            }
1758                    }
1759    
1760                    List<DLFileShortcut> list = q.list();
1761    
1762                    if (list.size() == 2) {
1763                            return list.get(1);
1764                    }
1765                    else {
1766                            return null;
1767                    }
1768            }
1769    
1770            /**
1771             * Returns all the document library file shortcuts where toFileEntryId = &#63;.
1772             *
1773             * @param toFileEntryId the to file entry ID
1774             * @return the matching document library file shortcuts
1775             * @throws SystemException if a system exception occurred
1776             */
1777            public List<DLFileShortcut> findByToFileEntryId(long toFileEntryId)
1778                    throws SystemException {
1779                    return findByToFileEntryId(toFileEntryId, QueryUtil.ALL_POS,
1780                            QueryUtil.ALL_POS, null);
1781            }
1782    
1783            /**
1784             * Returns a range of all the document library file shortcuts where toFileEntryId = &#63;.
1785             *
1786             * <p>
1787             * 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.
1788             * </p>
1789             *
1790             * @param toFileEntryId the to file entry ID
1791             * @param start the lower bound of the range of document library file shortcuts
1792             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
1793             * @return the range of matching document library file shortcuts
1794             * @throws SystemException if a system exception occurred
1795             */
1796            public List<DLFileShortcut> findByToFileEntryId(long toFileEntryId,
1797                    int start, int end) throws SystemException {
1798                    return findByToFileEntryId(toFileEntryId, start, end, null);
1799            }
1800    
1801            /**
1802             * Returns an ordered range of all the document library file shortcuts where toFileEntryId = &#63;.
1803             *
1804             * <p>
1805             * 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.
1806             * </p>
1807             *
1808             * @param toFileEntryId the to file entry ID
1809             * @param start the lower bound of the range of document library file shortcuts
1810             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
1811             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1812             * @return the ordered range of matching document library file shortcuts
1813             * @throws SystemException if a system exception occurred
1814             */
1815            public List<DLFileShortcut> findByToFileEntryId(long toFileEntryId,
1816                    int start, int end, OrderByComparator orderByComparator)
1817                    throws SystemException {
1818                    FinderPath finderPath = null;
1819                    Object[] finderArgs = null;
1820    
1821                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1822                                    (orderByComparator == null)) {
1823                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOFILEENTRYID;
1824                            finderArgs = new Object[] { toFileEntryId };
1825                    }
1826                    else {
1827                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TOFILEENTRYID;
1828                            finderArgs = new Object[] {
1829                                            toFileEntryId,
1830                                            
1831                                            start, end, orderByComparator
1832                                    };
1833                    }
1834    
1835                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(finderPath,
1836                                    finderArgs, this);
1837    
1838                    if ((list != null) && !list.isEmpty()) {
1839                            for (DLFileShortcut dlFileShortcut : list) {
1840                                    if ((toFileEntryId != dlFileShortcut.getToFileEntryId())) {
1841                                            list = null;
1842    
1843                                            break;
1844                                    }
1845                            }
1846                    }
1847    
1848                    if (list == null) {
1849                            StringBundler query = null;
1850    
1851                            if (orderByComparator != null) {
1852                                    query = new StringBundler(3 +
1853                                                    (orderByComparator.getOrderByFields().length * 3));
1854                            }
1855                            else {
1856                                    query = new StringBundler(2);
1857                            }
1858    
1859                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
1860    
1861                            query.append(_FINDER_COLUMN_TOFILEENTRYID_TOFILEENTRYID_2);
1862    
1863                            if (orderByComparator != null) {
1864                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1865                                            orderByComparator);
1866                            }
1867    
1868                            String sql = query.toString();
1869    
1870                            Session session = null;
1871    
1872                            try {
1873                                    session = openSession();
1874    
1875                                    Query q = session.createQuery(sql);
1876    
1877                                    QueryPos qPos = QueryPos.getInstance(q);
1878    
1879                                    qPos.add(toFileEntryId);
1880    
1881                                    list = (List<DLFileShortcut>)QueryUtil.list(q, getDialect(),
1882                                                    start, end);
1883                            }
1884                            catch (Exception e) {
1885                                    throw processException(e);
1886                            }
1887                            finally {
1888                                    if (list == null) {
1889                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1890                                    }
1891                                    else {
1892                                            cacheResult(list);
1893    
1894                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1895                                    }
1896    
1897                                    closeSession(session);
1898                            }
1899                    }
1900    
1901                    return list;
1902            }
1903    
1904            /**
1905             * Returns the first document library file shortcut in the ordered set where toFileEntryId = &#63;.
1906             *
1907             * @param toFileEntryId the to file entry ID
1908             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1909             * @return the first matching document library file shortcut
1910             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
1911             * @throws SystemException if a system exception occurred
1912             */
1913            public DLFileShortcut findByToFileEntryId_First(long toFileEntryId,
1914                    OrderByComparator orderByComparator)
1915                    throws NoSuchFileShortcutException, SystemException {
1916                    DLFileShortcut dlFileShortcut = fetchByToFileEntryId_First(toFileEntryId,
1917                                    orderByComparator);
1918    
1919                    if (dlFileShortcut != null) {
1920                            return dlFileShortcut;
1921                    }
1922    
1923                    StringBundler msg = new StringBundler(4);
1924    
1925                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1926    
1927                    msg.append("toFileEntryId=");
1928                    msg.append(toFileEntryId);
1929    
1930                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1931    
1932                    throw new NoSuchFileShortcutException(msg.toString());
1933            }
1934    
1935            /**
1936             * Returns the first document library file shortcut in the ordered set where toFileEntryId = &#63;.
1937             *
1938             * @param toFileEntryId the to file entry ID
1939             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1940             * @return the first matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
1941             * @throws SystemException if a system exception occurred
1942             */
1943            public DLFileShortcut fetchByToFileEntryId_First(long toFileEntryId,
1944                    OrderByComparator orderByComparator) throws SystemException {
1945                    List<DLFileShortcut> list = findByToFileEntryId(toFileEntryId, 0, 1,
1946                                    orderByComparator);
1947    
1948                    if (!list.isEmpty()) {
1949                            return list.get(0);
1950                    }
1951    
1952                    return null;
1953            }
1954    
1955            /**
1956             * Returns the last document library file shortcut in the ordered set where toFileEntryId = &#63;.
1957             *
1958             * @param toFileEntryId the to file entry ID
1959             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1960             * @return the last matching document library file shortcut
1961             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
1962             * @throws SystemException if a system exception occurred
1963             */
1964            public DLFileShortcut findByToFileEntryId_Last(long toFileEntryId,
1965                    OrderByComparator orderByComparator)
1966                    throws NoSuchFileShortcutException, SystemException {
1967                    DLFileShortcut dlFileShortcut = fetchByToFileEntryId_Last(toFileEntryId,
1968                                    orderByComparator);
1969    
1970                    if (dlFileShortcut != null) {
1971                            return dlFileShortcut;
1972                    }
1973    
1974                    StringBundler msg = new StringBundler(4);
1975    
1976                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1977    
1978                    msg.append("toFileEntryId=");
1979                    msg.append(toFileEntryId);
1980    
1981                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1982    
1983                    throw new NoSuchFileShortcutException(msg.toString());
1984            }
1985    
1986            /**
1987             * Returns the last document library file shortcut in the ordered set where toFileEntryId = &#63;.
1988             *
1989             * @param toFileEntryId the to file entry ID
1990             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1991             * @return the last matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
1992             * @throws SystemException if a system exception occurred
1993             */
1994            public DLFileShortcut fetchByToFileEntryId_Last(long toFileEntryId,
1995                    OrderByComparator orderByComparator) throws SystemException {
1996                    int count = countByToFileEntryId(toFileEntryId);
1997    
1998                    List<DLFileShortcut> list = findByToFileEntryId(toFileEntryId,
1999                                    count - 1, count, orderByComparator);
2000    
2001                    if (!list.isEmpty()) {
2002                            return list.get(0);
2003                    }
2004    
2005                    return null;
2006            }
2007    
2008            /**
2009             * Returns the document library file shortcuts before and after the current document library file shortcut in the ordered set where toFileEntryId = &#63;.
2010             *
2011             * @param fileShortcutId the primary key of the current document library file shortcut
2012             * @param toFileEntryId the to file entry ID
2013             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2014             * @return the previous, current, and next document library file shortcut
2015             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
2016             * @throws SystemException if a system exception occurred
2017             */
2018            public DLFileShortcut[] findByToFileEntryId_PrevAndNext(
2019                    long fileShortcutId, long toFileEntryId,
2020                    OrderByComparator orderByComparator)
2021                    throws NoSuchFileShortcutException, SystemException {
2022                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
2023    
2024                    Session session = null;
2025    
2026                    try {
2027                            session = openSession();
2028    
2029                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
2030    
2031                            array[0] = getByToFileEntryId_PrevAndNext(session, dlFileShortcut,
2032                                            toFileEntryId, orderByComparator, true);
2033    
2034                            array[1] = dlFileShortcut;
2035    
2036                            array[2] = getByToFileEntryId_PrevAndNext(session, dlFileShortcut,
2037                                            toFileEntryId, orderByComparator, false);
2038    
2039                            return array;
2040                    }
2041                    catch (Exception e) {
2042                            throw processException(e);
2043                    }
2044                    finally {
2045                            closeSession(session);
2046                    }
2047            }
2048    
2049            protected DLFileShortcut getByToFileEntryId_PrevAndNext(Session session,
2050                    DLFileShortcut dlFileShortcut, long toFileEntryId,
2051                    OrderByComparator orderByComparator, boolean previous) {
2052                    StringBundler query = null;
2053    
2054                    if (orderByComparator != null) {
2055                            query = new StringBundler(6 +
2056                                            (orderByComparator.getOrderByFields().length * 6));
2057                    }
2058                    else {
2059                            query = new StringBundler(3);
2060                    }
2061    
2062                    query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
2063    
2064                    query.append(_FINDER_COLUMN_TOFILEENTRYID_TOFILEENTRYID_2);
2065    
2066                    if (orderByComparator != null) {
2067                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2068    
2069                            if (orderByConditionFields.length > 0) {
2070                                    query.append(WHERE_AND);
2071                            }
2072    
2073                            for (int i = 0; i < orderByConditionFields.length; i++) {
2074                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2075                                    query.append(orderByConditionFields[i]);
2076    
2077                                    if ((i + 1) < orderByConditionFields.length) {
2078                                            if (orderByComparator.isAscending() ^ previous) {
2079                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2080                                            }
2081                                            else {
2082                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2083                                            }
2084                                    }
2085                                    else {
2086                                            if (orderByComparator.isAscending() ^ previous) {
2087                                                    query.append(WHERE_GREATER_THAN);
2088                                            }
2089                                            else {
2090                                                    query.append(WHERE_LESSER_THAN);
2091                                            }
2092                                    }
2093                            }
2094    
2095                            query.append(ORDER_BY_CLAUSE);
2096    
2097                            String[] orderByFields = orderByComparator.getOrderByFields();
2098    
2099                            for (int i = 0; i < orderByFields.length; i++) {
2100                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2101                                    query.append(orderByFields[i]);
2102    
2103                                    if ((i + 1) < orderByFields.length) {
2104                                            if (orderByComparator.isAscending() ^ previous) {
2105                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2106                                            }
2107                                            else {
2108                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2109                                            }
2110                                    }
2111                                    else {
2112                                            if (orderByComparator.isAscending() ^ previous) {
2113                                                    query.append(ORDER_BY_ASC);
2114                                            }
2115                                            else {
2116                                                    query.append(ORDER_BY_DESC);
2117                                            }
2118                                    }
2119                            }
2120                    }
2121    
2122                    String sql = query.toString();
2123    
2124                    Query q = session.createQuery(sql);
2125    
2126                    q.setFirstResult(0);
2127                    q.setMaxResults(2);
2128    
2129                    QueryPos qPos = QueryPos.getInstance(q);
2130    
2131                    qPos.add(toFileEntryId);
2132    
2133                    if (orderByComparator != null) {
2134                            Object[] values = orderByComparator.getOrderByConditionValues(dlFileShortcut);
2135    
2136                            for (Object value : values) {
2137                                    qPos.add(value);
2138                            }
2139                    }
2140    
2141                    List<DLFileShortcut> list = q.list();
2142    
2143                    if (list.size() == 2) {
2144                            return list.get(1);
2145                    }
2146                    else {
2147                            return null;
2148                    }
2149            }
2150    
2151            /**
2152             * Returns all the document library file shortcuts where groupId = &#63; and folderId = &#63;.
2153             *
2154             * @param groupId the group ID
2155             * @param folderId the folder ID
2156             * @return the matching document library file shortcuts
2157             * @throws SystemException if a system exception occurred
2158             */
2159            public List<DLFileShortcut> findByG_F(long groupId, long folderId)
2160                    throws SystemException {
2161                    return findByG_F(groupId, folderId, QueryUtil.ALL_POS,
2162                            QueryUtil.ALL_POS, null);
2163            }
2164    
2165            /**
2166             * Returns a range of all the document library file shortcuts where groupId = &#63; and folderId = &#63;.
2167             *
2168             * <p>
2169             * 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.
2170             * </p>
2171             *
2172             * @param groupId the group ID
2173             * @param folderId the folder ID
2174             * @param start the lower bound of the range of document library file shortcuts
2175             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
2176             * @return the range of matching document library file shortcuts
2177             * @throws SystemException if a system exception occurred
2178             */
2179            public List<DLFileShortcut> findByG_F(long groupId, long folderId,
2180                    int start, int end) throws SystemException {
2181                    return findByG_F(groupId, folderId, start, end, null);
2182            }
2183    
2184            /**
2185             * Returns an ordered range of all the document library file shortcuts where groupId = &#63; and folderId = &#63;.
2186             *
2187             * <p>
2188             * 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.
2189             * </p>
2190             *
2191             * @param groupId the group ID
2192             * @param folderId the folder ID
2193             * @param start the lower bound of the range of document library file shortcuts
2194             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
2195             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
2196             * @return the ordered range of matching document library file shortcuts
2197             * @throws SystemException if a system exception occurred
2198             */
2199            public List<DLFileShortcut> findByG_F(long groupId, long folderId,
2200                    int start, int end, OrderByComparator orderByComparator)
2201                    throws SystemException {
2202                    FinderPath finderPath = null;
2203                    Object[] finderArgs = null;
2204    
2205                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2206                                    (orderByComparator == null)) {
2207                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F;
2208                            finderArgs = new Object[] { groupId, folderId };
2209                    }
2210                    else {
2211                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_F;
2212                            finderArgs = new Object[] {
2213                                            groupId, folderId,
2214                                            
2215                                            start, end, orderByComparator
2216                                    };
2217                    }
2218    
2219                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(finderPath,
2220                                    finderArgs, this);
2221    
2222                    if ((list != null) && !list.isEmpty()) {
2223                            for (DLFileShortcut dlFileShortcut : list) {
2224                                    if ((groupId != dlFileShortcut.getGroupId()) ||
2225                                                    (folderId != dlFileShortcut.getFolderId())) {
2226                                            list = null;
2227    
2228                                            break;
2229                                    }
2230                            }
2231                    }
2232    
2233                    if (list == null) {
2234                            StringBundler query = null;
2235    
2236                            if (orderByComparator != null) {
2237                                    query = new StringBundler(4 +
2238                                                    (orderByComparator.getOrderByFields().length * 3));
2239                            }
2240                            else {
2241                                    query = new StringBundler(3);
2242                            }
2243    
2244                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
2245    
2246                            query.append(_FINDER_COLUMN_G_F_GROUPID_2);
2247    
2248                            query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
2249    
2250                            if (orderByComparator != null) {
2251                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2252                                            orderByComparator);
2253                            }
2254    
2255                            String sql = query.toString();
2256    
2257                            Session session = null;
2258    
2259                            try {
2260                                    session = openSession();
2261    
2262                                    Query q = session.createQuery(sql);
2263    
2264                                    QueryPos qPos = QueryPos.getInstance(q);
2265    
2266                                    qPos.add(groupId);
2267    
2268                                    qPos.add(folderId);
2269    
2270                                    list = (List<DLFileShortcut>)QueryUtil.list(q, getDialect(),
2271                                                    start, end);
2272                            }
2273                            catch (Exception e) {
2274                                    throw processException(e);
2275                            }
2276                            finally {
2277                                    if (list == null) {
2278                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
2279                                    }
2280                                    else {
2281                                            cacheResult(list);
2282    
2283                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
2284                                    }
2285    
2286                                    closeSession(session);
2287                            }
2288                    }
2289    
2290                    return list;
2291            }
2292    
2293            /**
2294             * Returns the first document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63;.
2295             *
2296             * @param groupId the group ID
2297             * @param folderId the folder ID
2298             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2299             * @return the first matching document library file shortcut
2300             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
2301             * @throws SystemException if a system exception occurred
2302             */
2303            public DLFileShortcut findByG_F_First(long groupId, long folderId,
2304                    OrderByComparator orderByComparator)
2305                    throws NoSuchFileShortcutException, SystemException {
2306                    DLFileShortcut dlFileShortcut = fetchByG_F_First(groupId, folderId,
2307                                    orderByComparator);
2308    
2309                    if (dlFileShortcut != null) {
2310                            return dlFileShortcut;
2311                    }
2312    
2313                    StringBundler msg = new StringBundler(6);
2314    
2315                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2316    
2317                    msg.append("groupId=");
2318                    msg.append(groupId);
2319    
2320                    msg.append(", folderId=");
2321                    msg.append(folderId);
2322    
2323                    msg.append(StringPool.CLOSE_CURLY_BRACE);
2324    
2325                    throw new NoSuchFileShortcutException(msg.toString());
2326            }
2327    
2328            /**
2329             * Returns the first document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63;.
2330             *
2331             * @param groupId the group ID
2332             * @param folderId the folder ID
2333             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2334             * @return the first matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
2335             * @throws SystemException if a system exception occurred
2336             */
2337            public DLFileShortcut fetchByG_F_First(long groupId, long folderId,
2338                    OrderByComparator orderByComparator) throws SystemException {
2339                    List<DLFileShortcut> list = findByG_F(groupId, folderId, 0, 1,
2340                                    orderByComparator);
2341    
2342                    if (!list.isEmpty()) {
2343                            return list.get(0);
2344                    }
2345    
2346                    return null;
2347            }
2348    
2349            /**
2350             * Returns the last document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63;.
2351             *
2352             * @param groupId the group ID
2353             * @param folderId the folder ID
2354             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2355             * @return the last matching document library file shortcut
2356             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
2357             * @throws SystemException if a system exception occurred
2358             */
2359            public DLFileShortcut findByG_F_Last(long groupId, long folderId,
2360                    OrderByComparator orderByComparator)
2361                    throws NoSuchFileShortcutException, SystemException {
2362                    DLFileShortcut dlFileShortcut = fetchByG_F_Last(groupId, folderId,
2363                                    orderByComparator);
2364    
2365                    if (dlFileShortcut != null) {
2366                            return dlFileShortcut;
2367                    }
2368    
2369                    StringBundler msg = new StringBundler(6);
2370    
2371                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2372    
2373                    msg.append("groupId=");
2374                    msg.append(groupId);
2375    
2376                    msg.append(", folderId=");
2377                    msg.append(folderId);
2378    
2379                    msg.append(StringPool.CLOSE_CURLY_BRACE);
2380    
2381                    throw new NoSuchFileShortcutException(msg.toString());
2382            }
2383    
2384            /**
2385             * Returns the last document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63;.
2386             *
2387             * @param groupId the group ID
2388             * @param folderId the folder ID
2389             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2390             * @return the last matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
2391             * @throws SystemException if a system exception occurred
2392             */
2393            public DLFileShortcut fetchByG_F_Last(long groupId, long folderId,
2394                    OrderByComparator orderByComparator) throws SystemException {
2395                    int count = countByG_F(groupId, folderId);
2396    
2397                    List<DLFileShortcut> list = findByG_F(groupId, folderId, count - 1,
2398                                    count, orderByComparator);
2399    
2400                    if (!list.isEmpty()) {
2401                            return list.get(0);
2402                    }
2403    
2404                    return null;
2405            }
2406    
2407            /**
2408             * Returns the document library file shortcuts before and after the current document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63;.
2409             *
2410             * @param fileShortcutId the primary key of the current document library file shortcut
2411             * @param groupId the group ID
2412             * @param folderId the folder ID
2413             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2414             * @return the previous, current, and next document library file shortcut
2415             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
2416             * @throws SystemException if a system exception occurred
2417             */
2418            public DLFileShortcut[] findByG_F_PrevAndNext(long fileShortcutId,
2419                    long groupId, long folderId, OrderByComparator orderByComparator)
2420                    throws NoSuchFileShortcutException, SystemException {
2421                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
2422    
2423                    Session session = null;
2424    
2425                    try {
2426                            session = openSession();
2427    
2428                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
2429    
2430                            array[0] = getByG_F_PrevAndNext(session, dlFileShortcut, groupId,
2431                                            folderId, orderByComparator, true);
2432    
2433                            array[1] = dlFileShortcut;
2434    
2435                            array[2] = getByG_F_PrevAndNext(session, dlFileShortcut, groupId,
2436                                            folderId, orderByComparator, false);
2437    
2438                            return array;
2439                    }
2440                    catch (Exception e) {
2441                            throw processException(e);
2442                    }
2443                    finally {
2444                            closeSession(session);
2445                    }
2446            }
2447    
2448            protected DLFileShortcut getByG_F_PrevAndNext(Session session,
2449                    DLFileShortcut dlFileShortcut, long groupId, long folderId,
2450                    OrderByComparator orderByComparator, boolean previous) {
2451                    StringBundler query = null;
2452    
2453                    if (orderByComparator != null) {
2454                            query = new StringBundler(6 +
2455                                            (orderByComparator.getOrderByFields().length * 6));
2456                    }
2457                    else {
2458                            query = new StringBundler(3);
2459                    }
2460    
2461                    query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
2462    
2463                    query.append(_FINDER_COLUMN_G_F_GROUPID_2);
2464    
2465                    query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
2466    
2467                    if (orderByComparator != null) {
2468                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2469    
2470                            if (orderByConditionFields.length > 0) {
2471                                    query.append(WHERE_AND);
2472                            }
2473    
2474                            for (int i = 0; i < orderByConditionFields.length; i++) {
2475                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2476                                    query.append(orderByConditionFields[i]);
2477    
2478                                    if ((i + 1) < orderByConditionFields.length) {
2479                                            if (orderByComparator.isAscending() ^ previous) {
2480                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2481                                            }
2482                                            else {
2483                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2484                                            }
2485                                    }
2486                                    else {
2487                                            if (orderByComparator.isAscending() ^ previous) {
2488                                                    query.append(WHERE_GREATER_THAN);
2489                                            }
2490                                            else {
2491                                                    query.append(WHERE_LESSER_THAN);
2492                                            }
2493                                    }
2494                            }
2495    
2496                            query.append(ORDER_BY_CLAUSE);
2497    
2498                            String[] orderByFields = orderByComparator.getOrderByFields();
2499    
2500                            for (int i = 0; i < orderByFields.length; i++) {
2501                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2502                                    query.append(orderByFields[i]);
2503    
2504                                    if ((i + 1) < orderByFields.length) {
2505                                            if (orderByComparator.isAscending() ^ previous) {
2506                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2507                                            }
2508                                            else {
2509                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2510                                            }
2511                                    }
2512                                    else {
2513                                            if (orderByComparator.isAscending() ^ previous) {
2514                                                    query.append(ORDER_BY_ASC);
2515                                            }
2516                                            else {
2517                                                    query.append(ORDER_BY_DESC);
2518                                            }
2519                                    }
2520                            }
2521                    }
2522    
2523                    String sql = query.toString();
2524    
2525                    Query q = session.createQuery(sql);
2526    
2527                    q.setFirstResult(0);
2528                    q.setMaxResults(2);
2529    
2530                    QueryPos qPos = QueryPos.getInstance(q);
2531    
2532                    qPos.add(groupId);
2533    
2534                    qPos.add(folderId);
2535    
2536                    if (orderByComparator != null) {
2537                            Object[] values = orderByComparator.getOrderByConditionValues(dlFileShortcut);
2538    
2539                            for (Object value : values) {
2540                                    qPos.add(value);
2541                            }
2542                    }
2543    
2544                    List<DLFileShortcut> list = q.list();
2545    
2546                    if (list.size() == 2) {
2547                            return list.get(1);
2548                    }
2549                    else {
2550                            return null;
2551                    }
2552            }
2553    
2554            /**
2555             * Returns all the document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63;.
2556             *
2557             * @param groupId the group ID
2558             * @param folderId the folder ID
2559             * @return the matching document library file shortcuts that the user has permission to view
2560             * @throws SystemException if a system exception occurred
2561             */
2562            public List<DLFileShortcut> filterFindByG_F(long groupId, long folderId)
2563                    throws SystemException {
2564                    return filterFindByG_F(groupId, folderId, QueryUtil.ALL_POS,
2565                            QueryUtil.ALL_POS, null);
2566            }
2567    
2568            /**
2569             * Returns a range of all the document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63;.
2570             *
2571             * <p>
2572             * 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.
2573             * </p>
2574             *
2575             * @param groupId the group ID
2576             * @param folderId the folder ID
2577             * @param start the lower bound of the range of document library file shortcuts
2578             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
2579             * @return the range of matching document library file shortcuts that the user has permission to view
2580             * @throws SystemException if a system exception occurred
2581             */
2582            public List<DLFileShortcut> filterFindByG_F(long groupId, long folderId,
2583                    int start, int end) throws SystemException {
2584                    return filterFindByG_F(groupId, folderId, start, end, null);
2585            }
2586    
2587            /**
2588             * Returns an ordered range of all the document library file shortcuts that the user has permissions to view where groupId = &#63; and folderId = &#63;.
2589             *
2590             * <p>
2591             * 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.
2592             * </p>
2593             *
2594             * @param groupId the group ID
2595             * @param folderId the folder ID
2596             * @param start the lower bound of the range of document library file shortcuts
2597             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
2598             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
2599             * @return the ordered range of matching document library file shortcuts that the user has permission to view
2600             * @throws SystemException if a system exception occurred
2601             */
2602            public List<DLFileShortcut> filterFindByG_F(long groupId, long folderId,
2603                    int start, int end, OrderByComparator orderByComparator)
2604                    throws SystemException {
2605                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2606                            return findByG_F(groupId, folderId, start, end, orderByComparator);
2607                    }
2608    
2609                    StringBundler query = null;
2610    
2611                    if (orderByComparator != null) {
2612                            query = new StringBundler(4 +
2613                                            (orderByComparator.getOrderByFields().length * 3));
2614                    }
2615                    else {
2616                            query = new StringBundler(3);
2617                    }
2618    
2619                    if (getDB().isSupportsInlineDistinct()) {
2620                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE);
2621                    }
2622                    else {
2623                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1);
2624                    }
2625    
2626                    query.append(_FINDER_COLUMN_G_F_GROUPID_2);
2627    
2628                    query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
2629    
2630                    if (!getDB().isSupportsInlineDistinct()) {
2631                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2);
2632                    }
2633    
2634                    if (orderByComparator != null) {
2635                            if (getDB().isSupportsInlineDistinct()) {
2636                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2637                                            orderByComparator);
2638                            }
2639                            else {
2640                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2641                                            orderByComparator);
2642                            }
2643                    }
2644    
2645                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2646                                    DLFileShortcut.class.getName(),
2647                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2648    
2649                    Session session = null;
2650    
2651                    try {
2652                            session = openSession();
2653    
2654                            SQLQuery q = session.createSQLQuery(sql);
2655    
2656                            if (getDB().isSupportsInlineDistinct()) {
2657                                    q.addEntity(_FILTER_ENTITY_ALIAS, DLFileShortcutImpl.class);
2658                            }
2659                            else {
2660                                    q.addEntity(_FILTER_ENTITY_TABLE, DLFileShortcutImpl.class);
2661                            }
2662    
2663                            QueryPos qPos = QueryPos.getInstance(q);
2664    
2665                            qPos.add(groupId);
2666    
2667                            qPos.add(folderId);
2668    
2669                            return (List<DLFileShortcut>)QueryUtil.list(q, getDialect(), start,
2670                                    end);
2671                    }
2672                    catch (Exception e) {
2673                            throw processException(e);
2674                    }
2675                    finally {
2676                            closeSession(session);
2677                    }
2678            }
2679    
2680            /**
2681             * Returns the document library file shortcuts before and after the current document library file shortcut in the ordered set of document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63;.
2682             *
2683             * @param fileShortcutId the primary key of the current document library file shortcut
2684             * @param groupId the group ID
2685             * @param folderId the folder ID
2686             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2687             * @return the previous, current, and next document library file shortcut
2688             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
2689             * @throws SystemException if a system exception occurred
2690             */
2691            public DLFileShortcut[] filterFindByG_F_PrevAndNext(long fileShortcutId,
2692                    long groupId, long folderId, OrderByComparator orderByComparator)
2693                    throws NoSuchFileShortcutException, SystemException {
2694                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2695                            return findByG_F_PrevAndNext(fileShortcutId, groupId, folderId,
2696                                    orderByComparator);
2697                    }
2698    
2699                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
2700    
2701                    Session session = null;
2702    
2703                    try {
2704                            session = openSession();
2705    
2706                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
2707    
2708                            array[0] = filterGetByG_F_PrevAndNext(session, dlFileShortcut,
2709                                            groupId, folderId, orderByComparator, true);
2710    
2711                            array[1] = dlFileShortcut;
2712    
2713                            array[2] = filterGetByG_F_PrevAndNext(session, dlFileShortcut,
2714                                            groupId, folderId, orderByComparator, false);
2715    
2716                            return array;
2717                    }
2718                    catch (Exception e) {
2719                            throw processException(e);
2720                    }
2721                    finally {
2722                            closeSession(session);
2723                    }
2724            }
2725    
2726            protected DLFileShortcut filterGetByG_F_PrevAndNext(Session session,
2727                    DLFileShortcut dlFileShortcut, long groupId, long folderId,
2728                    OrderByComparator orderByComparator, boolean previous) {
2729                    StringBundler query = null;
2730    
2731                    if (orderByComparator != null) {
2732                            query = new StringBundler(6 +
2733                                            (orderByComparator.getOrderByFields().length * 6));
2734                    }
2735                    else {
2736                            query = new StringBundler(3);
2737                    }
2738    
2739                    if (getDB().isSupportsInlineDistinct()) {
2740                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE);
2741                    }
2742                    else {
2743                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1);
2744                    }
2745    
2746                    query.append(_FINDER_COLUMN_G_F_GROUPID_2);
2747    
2748                    query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
2749    
2750                    if (!getDB().isSupportsInlineDistinct()) {
2751                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2);
2752                    }
2753    
2754                    if (orderByComparator != null) {
2755                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2756    
2757                            if (orderByConditionFields.length > 0) {
2758                                    query.append(WHERE_AND);
2759                            }
2760    
2761                            for (int i = 0; i < orderByConditionFields.length; i++) {
2762                                    if (getDB().isSupportsInlineDistinct()) {
2763                                            query.append(_ORDER_BY_ENTITY_ALIAS);
2764                                    }
2765                                    else {
2766                                            query.append(_ORDER_BY_ENTITY_TABLE);
2767                                    }
2768    
2769                                    query.append(orderByConditionFields[i]);
2770    
2771                                    if ((i + 1) < orderByConditionFields.length) {
2772                                            if (orderByComparator.isAscending() ^ previous) {
2773                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2774                                            }
2775                                            else {
2776                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2777                                            }
2778                                    }
2779                                    else {
2780                                            if (orderByComparator.isAscending() ^ previous) {
2781                                                    query.append(WHERE_GREATER_THAN);
2782                                            }
2783                                            else {
2784                                                    query.append(WHERE_LESSER_THAN);
2785                                            }
2786                                    }
2787                            }
2788    
2789                            query.append(ORDER_BY_CLAUSE);
2790    
2791                            String[] orderByFields = orderByComparator.getOrderByFields();
2792    
2793                            for (int i = 0; i < orderByFields.length; i++) {
2794                                    if (getDB().isSupportsInlineDistinct()) {
2795                                            query.append(_ORDER_BY_ENTITY_ALIAS);
2796                                    }
2797                                    else {
2798                                            query.append(_ORDER_BY_ENTITY_TABLE);
2799                                    }
2800    
2801                                    query.append(orderByFields[i]);
2802    
2803                                    if ((i + 1) < orderByFields.length) {
2804                                            if (orderByComparator.isAscending() ^ previous) {
2805                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2806                                            }
2807                                            else {
2808                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2809                                            }
2810                                    }
2811                                    else {
2812                                            if (orderByComparator.isAscending() ^ previous) {
2813                                                    query.append(ORDER_BY_ASC);
2814                                            }
2815                                            else {
2816                                                    query.append(ORDER_BY_DESC);
2817                                            }
2818                                    }
2819                            }
2820                    }
2821    
2822                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2823                                    DLFileShortcut.class.getName(),
2824                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2825    
2826                    SQLQuery q = session.createSQLQuery(sql);
2827    
2828                    q.setFirstResult(0);
2829                    q.setMaxResults(2);
2830    
2831                    if (getDB().isSupportsInlineDistinct()) {
2832                            q.addEntity(_FILTER_ENTITY_ALIAS, DLFileShortcutImpl.class);
2833                    }
2834                    else {
2835                            q.addEntity(_FILTER_ENTITY_TABLE, DLFileShortcutImpl.class);
2836                    }
2837    
2838                    QueryPos qPos = QueryPos.getInstance(q);
2839    
2840                    qPos.add(groupId);
2841    
2842                    qPos.add(folderId);
2843    
2844                    if (orderByComparator != null) {
2845                            Object[] values = orderByComparator.getOrderByConditionValues(dlFileShortcut);
2846    
2847                            for (Object value : values) {
2848                                    qPos.add(value);
2849                            }
2850                    }
2851    
2852                    List<DLFileShortcut> list = q.list();
2853    
2854                    if (list.size() == 2) {
2855                            return list.get(1);
2856                    }
2857                    else {
2858                            return null;
2859                    }
2860            }
2861    
2862            /**
2863             * Returns all the document library file shortcuts where groupId = &#63; and folderId = &#63; and active = &#63;.
2864             *
2865             * @param groupId the group ID
2866             * @param folderId the folder ID
2867             * @param active the active
2868             * @return the matching document library file shortcuts
2869             * @throws SystemException if a system exception occurred
2870             */
2871            public List<DLFileShortcut> findByG_F_A(long groupId, long folderId,
2872                    boolean active) throws SystemException {
2873                    return findByG_F_A(groupId, folderId, active, QueryUtil.ALL_POS,
2874                            QueryUtil.ALL_POS, null);
2875            }
2876    
2877            /**
2878             * Returns a range of all the document library file shortcuts where groupId = &#63; and folderId = &#63; and active = &#63;.
2879             *
2880             * <p>
2881             * 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.
2882             * </p>
2883             *
2884             * @param groupId the group ID
2885             * @param folderId the folder ID
2886             * @param active the active
2887             * @param start the lower bound of the range of document library file shortcuts
2888             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
2889             * @return the range of matching document library file shortcuts
2890             * @throws SystemException if a system exception occurred
2891             */
2892            public List<DLFileShortcut> findByG_F_A(long groupId, long folderId,
2893                    boolean active, int start, int end) throws SystemException {
2894                    return findByG_F_A(groupId, folderId, active, start, end, null);
2895            }
2896    
2897            /**
2898             * Returns an ordered range of all the document library file shortcuts where groupId = &#63; and folderId = &#63; and active = &#63;.
2899             *
2900             * <p>
2901             * 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.
2902             * </p>
2903             *
2904             * @param groupId the group ID
2905             * @param folderId the folder ID
2906             * @param active the active
2907             * @param start the lower bound of the range of document library file shortcuts
2908             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
2909             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
2910             * @return the ordered range of matching document library file shortcuts
2911             * @throws SystemException if a system exception occurred
2912             */
2913            public List<DLFileShortcut> findByG_F_A(long groupId, long folderId,
2914                    boolean active, int start, int end, OrderByComparator orderByComparator)
2915                    throws SystemException {
2916                    FinderPath finderPath = null;
2917                    Object[] finderArgs = null;
2918    
2919                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2920                                    (orderByComparator == null)) {
2921                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_A;
2922                            finderArgs = new Object[] { groupId, folderId, active };
2923                    }
2924                    else {
2925                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_F_A;
2926                            finderArgs = new Object[] {
2927                                            groupId, folderId, active,
2928                                            
2929                                            start, end, orderByComparator
2930                                    };
2931                    }
2932    
2933                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(finderPath,
2934                                    finderArgs, this);
2935    
2936                    if ((list != null) && !list.isEmpty()) {
2937                            for (DLFileShortcut dlFileShortcut : list) {
2938                                    if ((groupId != dlFileShortcut.getGroupId()) ||
2939                                                    (folderId != dlFileShortcut.getFolderId()) ||
2940                                                    (active != dlFileShortcut.getActive())) {
2941                                            list = null;
2942    
2943                                            break;
2944                                    }
2945                            }
2946                    }
2947    
2948                    if (list == null) {
2949                            StringBundler query = null;
2950    
2951                            if (orderByComparator != null) {
2952                                    query = new StringBundler(5 +
2953                                                    (orderByComparator.getOrderByFields().length * 3));
2954                            }
2955                            else {
2956                                    query = new StringBundler(4);
2957                            }
2958    
2959                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
2960    
2961                            query.append(_FINDER_COLUMN_G_F_A_GROUPID_2);
2962    
2963                            query.append(_FINDER_COLUMN_G_F_A_FOLDERID_2);
2964    
2965                            query.append(_FINDER_COLUMN_G_F_A_ACTIVE_2);
2966    
2967                            if (orderByComparator != null) {
2968                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2969                                            orderByComparator);
2970                            }
2971    
2972                            String sql = query.toString();
2973    
2974                            Session session = null;
2975    
2976                            try {
2977                                    session = openSession();
2978    
2979                                    Query q = session.createQuery(sql);
2980    
2981                                    QueryPos qPos = QueryPos.getInstance(q);
2982    
2983                                    qPos.add(groupId);
2984    
2985                                    qPos.add(folderId);
2986    
2987                                    qPos.add(active);
2988    
2989                                    list = (List<DLFileShortcut>)QueryUtil.list(q, getDialect(),
2990                                                    start, end);
2991                            }
2992                            catch (Exception e) {
2993                                    throw processException(e);
2994                            }
2995                            finally {
2996                                    if (list == null) {
2997                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
2998                                    }
2999                                    else {
3000                                            cacheResult(list);
3001    
3002                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
3003                                    }
3004    
3005                                    closeSession(session);
3006                            }
3007                    }
3008    
3009                    return list;
3010            }
3011    
3012            /**
3013             * Returns the first document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and active = &#63;.
3014             *
3015             * @param groupId the group ID
3016             * @param folderId the folder ID
3017             * @param active the active
3018             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3019             * @return the first matching document library file shortcut
3020             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
3021             * @throws SystemException if a system exception occurred
3022             */
3023            public DLFileShortcut findByG_F_A_First(long groupId, long folderId,
3024                    boolean active, OrderByComparator orderByComparator)
3025                    throws NoSuchFileShortcutException, SystemException {
3026                    DLFileShortcut dlFileShortcut = fetchByG_F_A_First(groupId, folderId,
3027                                    active, orderByComparator);
3028    
3029                    if (dlFileShortcut != null) {
3030                            return dlFileShortcut;
3031                    }
3032    
3033                    StringBundler msg = new StringBundler(8);
3034    
3035                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3036    
3037                    msg.append("groupId=");
3038                    msg.append(groupId);
3039    
3040                    msg.append(", folderId=");
3041                    msg.append(folderId);
3042    
3043                    msg.append(", active=");
3044                    msg.append(active);
3045    
3046                    msg.append(StringPool.CLOSE_CURLY_BRACE);
3047    
3048                    throw new NoSuchFileShortcutException(msg.toString());
3049            }
3050    
3051            /**
3052             * Returns the first document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and active = &#63;.
3053             *
3054             * @param groupId the group ID
3055             * @param folderId the folder ID
3056             * @param active the active
3057             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3058             * @return the first matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
3059             * @throws SystemException if a system exception occurred
3060             */
3061            public DLFileShortcut fetchByG_F_A_First(long groupId, long folderId,
3062                    boolean active, OrderByComparator orderByComparator)
3063                    throws SystemException {
3064                    List<DLFileShortcut> list = findByG_F_A(groupId, folderId, active, 0,
3065                                    1, orderByComparator);
3066    
3067                    if (!list.isEmpty()) {
3068                            return list.get(0);
3069                    }
3070    
3071                    return null;
3072            }
3073    
3074            /**
3075             * Returns the last document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and active = &#63;.
3076             *
3077             * @param groupId the group ID
3078             * @param folderId the folder ID
3079             * @param active the active
3080             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3081             * @return the last matching document library file shortcut
3082             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
3083             * @throws SystemException if a system exception occurred
3084             */
3085            public DLFileShortcut findByG_F_A_Last(long groupId, long folderId,
3086                    boolean active, OrderByComparator orderByComparator)
3087                    throws NoSuchFileShortcutException, SystemException {
3088                    DLFileShortcut dlFileShortcut = fetchByG_F_A_Last(groupId, folderId,
3089                                    active, orderByComparator);
3090    
3091                    if (dlFileShortcut != null) {
3092                            return dlFileShortcut;
3093                    }
3094    
3095                    StringBundler msg = new StringBundler(8);
3096    
3097                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3098    
3099                    msg.append("groupId=");
3100                    msg.append(groupId);
3101    
3102                    msg.append(", folderId=");
3103                    msg.append(folderId);
3104    
3105                    msg.append(", active=");
3106                    msg.append(active);
3107    
3108                    msg.append(StringPool.CLOSE_CURLY_BRACE);
3109    
3110                    throw new NoSuchFileShortcutException(msg.toString());
3111            }
3112    
3113            /**
3114             * Returns the last document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and active = &#63;.
3115             *
3116             * @param groupId the group ID
3117             * @param folderId the folder ID
3118             * @param active the active
3119             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3120             * @return the last matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
3121             * @throws SystemException if a system exception occurred
3122             */
3123            public DLFileShortcut fetchByG_F_A_Last(long groupId, long folderId,
3124                    boolean active, OrderByComparator orderByComparator)
3125                    throws SystemException {
3126                    int count = countByG_F_A(groupId, folderId, active);
3127    
3128                    List<DLFileShortcut> list = findByG_F_A(groupId, folderId, active,
3129                                    count - 1, count, orderByComparator);
3130    
3131                    if (!list.isEmpty()) {
3132                            return list.get(0);
3133                    }
3134    
3135                    return null;
3136            }
3137    
3138            /**
3139             * Returns the document library file shortcuts before and after the current document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and active = &#63;.
3140             *
3141             * @param fileShortcutId the primary key of the current document library file shortcut
3142             * @param groupId the group ID
3143             * @param folderId the folder ID
3144             * @param active the active
3145             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3146             * @return the previous, current, and next document library file shortcut
3147             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
3148             * @throws SystemException if a system exception occurred
3149             */
3150            public DLFileShortcut[] findByG_F_A_PrevAndNext(long fileShortcutId,
3151                    long groupId, long folderId, boolean active,
3152                    OrderByComparator orderByComparator)
3153                    throws NoSuchFileShortcutException, SystemException {
3154                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
3155    
3156                    Session session = null;
3157    
3158                    try {
3159                            session = openSession();
3160    
3161                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
3162    
3163                            array[0] = getByG_F_A_PrevAndNext(session, dlFileShortcut, groupId,
3164                                            folderId, active, orderByComparator, true);
3165    
3166                            array[1] = dlFileShortcut;
3167    
3168                            array[2] = getByG_F_A_PrevAndNext(session, dlFileShortcut, groupId,
3169                                            folderId, active, orderByComparator, false);
3170    
3171                            return array;
3172                    }
3173                    catch (Exception e) {
3174                            throw processException(e);
3175                    }
3176                    finally {
3177                            closeSession(session);
3178                    }
3179            }
3180    
3181            protected DLFileShortcut getByG_F_A_PrevAndNext(Session session,
3182                    DLFileShortcut dlFileShortcut, long groupId, long folderId,
3183                    boolean active, OrderByComparator orderByComparator, boolean previous) {
3184                    StringBundler query = null;
3185    
3186                    if (orderByComparator != null) {
3187                            query = new StringBundler(6 +
3188                                            (orderByComparator.getOrderByFields().length * 6));
3189                    }
3190                    else {
3191                            query = new StringBundler(3);
3192                    }
3193    
3194                    query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
3195    
3196                    query.append(_FINDER_COLUMN_G_F_A_GROUPID_2);
3197    
3198                    query.append(_FINDER_COLUMN_G_F_A_FOLDERID_2);
3199    
3200                    query.append(_FINDER_COLUMN_G_F_A_ACTIVE_2);
3201    
3202                    if (orderByComparator != null) {
3203                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3204    
3205                            if (orderByConditionFields.length > 0) {
3206                                    query.append(WHERE_AND);
3207                            }
3208    
3209                            for (int i = 0; i < orderByConditionFields.length; i++) {
3210                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3211                                    query.append(orderByConditionFields[i]);
3212    
3213                                    if ((i + 1) < orderByConditionFields.length) {
3214                                            if (orderByComparator.isAscending() ^ previous) {
3215                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
3216                                            }
3217                                            else {
3218                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
3219                                            }
3220                                    }
3221                                    else {
3222                                            if (orderByComparator.isAscending() ^ previous) {
3223                                                    query.append(WHERE_GREATER_THAN);
3224                                            }
3225                                            else {
3226                                                    query.append(WHERE_LESSER_THAN);
3227                                            }
3228                                    }
3229                            }
3230    
3231                            query.append(ORDER_BY_CLAUSE);
3232    
3233                            String[] orderByFields = orderByComparator.getOrderByFields();
3234    
3235                            for (int i = 0; i < orderByFields.length; i++) {
3236                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3237                                    query.append(orderByFields[i]);
3238    
3239                                    if ((i + 1) < orderByFields.length) {
3240                                            if (orderByComparator.isAscending() ^ previous) {
3241                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
3242                                            }
3243                                            else {
3244                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
3245                                            }
3246                                    }
3247                                    else {
3248                                            if (orderByComparator.isAscending() ^ previous) {
3249                                                    query.append(ORDER_BY_ASC);
3250                                            }
3251                                            else {
3252                                                    query.append(ORDER_BY_DESC);
3253                                            }
3254                                    }
3255                            }
3256                    }
3257    
3258                    String sql = query.toString();
3259    
3260                    Query q = session.createQuery(sql);
3261    
3262                    q.setFirstResult(0);
3263                    q.setMaxResults(2);
3264    
3265                    QueryPos qPos = QueryPos.getInstance(q);
3266    
3267                    qPos.add(groupId);
3268    
3269                    qPos.add(folderId);
3270    
3271                    qPos.add(active);
3272    
3273                    if (orderByComparator != null) {
3274                            Object[] values = orderByComparator.getOrderByConditionValues(dlFileShortcut);
3275    
3276                            for (Object value : values) {
3277                                    qPos.add(value);
3278                            }
3279                    }
3280    
3281                    List<DLFileShortcut> list = q.list();
3282    
3283                    if (list.size() == 2) {
3284                            return list.get(1);
3285                    }
3286                    else {
3287                            return null;
3288                    }
3289            }
3290    
3291            /**
3292             * Returns all the document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63; and active = &#63;.
3293             *
3294             * @param groupId the group ID
3295             * @param folderId the folder ID
3296             * @param active the active
3297             * @return the matching document library file shortcuts that the user has permission to view
3298             * @throws SystemException if a system exception occurred
3299             */
3300            public List<DLFileShortcut> filterFindByG_F_A(long groupId, long folderId,
3301                    boolean active) throws SystemException {
3302                    return filterFindByG_F_A(groupId, folderId, active, QueryUtil.ALL_POS,
3303                            QueryUtil.ALL_POS, null);
3304            }
3305    
3306            /**
3307             * Returns a range of all the document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63; and active = &#63;.
3308             *
3309             * <p>
3310             * 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.
3311             * </p>
3312             *
3313             * @param groupId the group ID
3314             * @param folderId the folder ID
3315             * @param active the active
3316             * @param start the lower bound of the range of document library file shortcuts
3317             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
3318             * @return the range of matching document library file shortcuts that the user has permission to view
3319             * @throws SystemException if a system exception occurred
3320             */
3321            public List<DLFileShortcut> filterFindByG_F_A(long groupId, long folderId,
3322                    boolean active, int start, int end) throws SystemException {
3323                    return filterFindByG_F_A(groupId, folderId, active, start, end, null);
3324            }
3325    
3326            /**
3327             * Returns an ordered range of all the document library file shortcuts that the user has permissions to view where groupId = &#63; and folderId = &#63; and active = &#63;.
3328             *
3329             * <p>
3330             * 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.
3331             * </p>
3332             *
3333             * @param groupId the group ID
3334             * @param folderId the folder ID
3335             * @param active the active
3336             * @param start the lower bound of the range of document library file shortcuts
3337             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
3338             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
3339             * @return the ordered range of matching document library file shortcuts that the user has permission to view
3340             * @throws SystemException if a system exception occurred
3341             */
3342            public List<DLFileShortcut> filterFindByG_F_A(long groupId, long folderId,
3343                    boolean active, int start, int end, OrderByComparator orderByComparator)
3344                    throws SystemException {
3345                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3346                            return findByG_F_A(groupId, folderId, active, start, end,
3347                                    orderByComparator);
3348                    }
3349    
3350                    StringBundler query = null;
3351    
3352                    if (orderByComparator != null) {
3353                            query = new StringBundler(5 +
3354                                            (orderByComparator.getOrderByFields().length * 3));
3355                    }
3356                    else {
3357                            query = new StringBundler(4);
3358                    }
3359    
3360                    if (getDB().isSupportsInlineDistinct()) {
3361                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE);
3362                    }
3363                    else {
3364                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1);
3365                    }
3366    
3367                    query.append(_FINDER_COLUMN_G_F_A_GROUPID_2);
3368    
3369                    query.append(_FINDER_COLUMN_G_F_A_FOLDERID_2);
3370    
3371                    query.append(_FINDER_COLUMN_G_F_A_ACTIVE_2);
3372    
3373                    if (!getDB().isSupportsInlineDistinct()) {
3374                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2);
3375                    }
3376    
3377                    if (orderByComparator != null) {
3378                            if (getDB().isSupportsInlineDistinct()) {
3379                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3380                                            orderByComparator);
3381                            }
3382                            else {
3383                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
3384                                            orderByComparator);
3385                            }
3386                    }
3387    
3388                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3389                                    DLFileShortcut.class.getName(),
3390                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3391    
3392                    Session session = null;
3393    
3394                    try {
3395                            session = openSession();
3396    
3397                            SQLQuery q = session.createSQLQuery(sql);
3398    
3399                            if (getDB().isSupportsInlineDistinct()) {
3400                                    q.addEntity(_FILTER_ENTITY_ALIAS, DLFileShortcutImpl.class);
3401                            }
3402                            else {
3403                                    q.addEntity(_FILTER_ENTITY_TABLE, DLFileShortcutImpl.class);
3404                            }
3405    
3406                            QueryPos qPos = QueryPos.getInstance(q);
3407    
3408                            qPos.add(groupId);
3409    
3410                            qPos.add(folderId);
3411    
3412                            qPos.add(active);
3413    
3414                            return (List<DLFileShortcut>)QueryUtil.list(q, getDialect(), start,
3415                                    end);
3416                    }
3417                    catch (Exception e) {
3418                            throw processException(e);
3419                    }
3420                    finally {
3421                            closeSession(session);
3422                    }
3423            }
3424    
3425            /**
3426             * Returns the document library file shortcuts before and after the current document library file shortcut in the ordered set of document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63; and active = &#63;.
3427             *
3428             * @param fileShortcutId the primary key of the current document library file shortcut
3429             * @param groupId the group ID
3430             * @param folderId the folder ID
3431             * @param active the active
3432             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3433             * @return the previous, current, and next document library file shortcut
3434             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
3435             * @throws SystemException if a system exception occurred
3436             */
3437            public DLFileShortcut[] filterFindByG_F_A_PrevAndNext(long fileShortcutId,
3438                    long groupId, long folderId, boolean active,
3439                    OrderByComparator orderByComparator)
3440                    throws NoSuchFileShortcutException, SystemException {
3441                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3442                            return findByG_F_A_PrevAndNext(fileShortcutId, groupId, folderId,
3443                                    active, orderByComparator);
3444                    }
3445    
3446                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
3447    
3448                    Session session = null;
3449    
3450                    try {
3451                            session = openSession();
3452    
3453                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
3454    
3455                            array[0] = filterGetByG_F_A_PrevAndNext(session, dlFileShortcut,
3456                                            groupId, folderId, active, orderByComparator, true);
3457    
3458                            array[1] = dlFileShortcut;
3459    
3460                            array[2] = filterGetByG_F_A_PrevAndNext(session, dlFileShortcut,
3461                                            groupId, folderId, active, orderByComparator, false);
3462    
3463                            return array;
3464                    }
3465                    catch (Exception e) {
3466                            throw processException(e);
3467                    }
3468                    finally {
3469                            closeSession(session);
3470                    }
3471            }
3472    
3473            protected DLFileShortcut filterGetByG_F_A_PrevAndNext(Session session,
3474                    DLFileShortcut dlFileShortcut, long groupId, long folderId,
3475                    boolean active, OrderByComparator orderByComparator, boolean previous) {
3476                    StringBundler query = null;
3477    
3478                    if (orderByComparator != null) {
3479                            query = new StringBundler(6 +
3480                                            (orderByComparator.getOrderByFields().length * 6));
3481                    }
3482                    else {
3483                            query = new StringBundler(3);
3484                    }
3485    
3486                    if (getDB().isSupportsInlineDistinct()) {
3487                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE);
3488                    }
3489                    else {
3490                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1);
3491                    }
3492    
3493                    query.append(_FINDER_COLUMN_G_F_A_GROUPID_2);
3494    
3495                    query.append(_FINDER_COLUMN_G_F_A_FOLDERID_2);
3496    
3497                    query.append(_FINDER_COLUMN_G_F_A_ACTIVE_2);
3498    
3499                    if (!getDB().isSupportsInlineDistinct()) {
3500                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2);
3501                    }
3502    
3503                    if (orderByComparator != null) {
3504                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3505    
3506                            if (orderByConditionFields.length > 0) {
3507                                    query.append(WHERE_AND);
3508                            }
3509    
3510                            for (int i = 0; i < orderByConditionFields.length; i++) {
3511                                    if (getDB().isSupportsInlineDistinct()) {
3512                                            query.append(_ORDER_BY_ENTITY_ALIAS);
3513                                    }
3514                                    else {
3515                                            query.append(_ORDER_BY_ENTITY_TABLE);
3516                                    }
3517    
3518                                    query.append(orderByConditionFields[i]);
3519    
3520                                    if ((i + 1) < orderByConditionFields.length) {
3521                                            if (orderByComparator.isAscending() ^ previous) {
3522                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
3523                                            }
3524                                            else {
3525                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
3526                                            }
3527                                    }
3528                                    else {
3529                                            if (orderByComparator.isAscending() ^ previous) {
3530                                                    query.append(WHERE_GREATER_THAN);
3531                                            }
3532                                            else {
3533                                                    query.append(WHERE_LESSER_THAN);
3534                                            }
3535                                    }
3536                            }
3537    
3538                            query.append(ORDER_BY_CLAUSE);
3539    
3540                            String[] orderByFields = orderByComparator.getOrderByFields();
3541    
3542                            for (int i = 0; i < orderByFields.length; i++) {
3543                                    if (getDB().isSupportsInlineDistinct()) {
3544                                            query.append(_ORDER_BY_ENTITY_ALIAS);
3545                                    }
3546                                    else {
3547                                            query.append(_ORDER_BY_ENTITY_TABLE);
3548                                    }
3549    
3550                                    query.append(orderByFields[i]);
3551    
3552                                    if ((i + 1) < orderByFields.length) {
3553                                            if (orderByComparator.isAscending() ^ previous) {
3554                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
3555                                            }
3556                                            else {
3557                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
3558                                            }
3559                                    }
3560                                    else {
3561                                            if (orderByComparator.isAscending() ^ previous) {
3562                                                    query.append(ORDER_BY_ASC);
3563                                            }
3564                                            else {
3565                                                    query.append(ORDER_BY_DESC);
3566                                            }
3567                                    }
3568                            }
3569                    }
3570    
3571                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3572                                    DLFileShortcut.class.getName(),
3573                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3574    
3575                    SQLQuery q = session.createSQLQuery(sql);
3576    
3577                    q.setFirstResult(0);
3578                    q.setMaxResults(2);
3579    
3580                    if (getDB().isSupportsInlineDistinct()) {
3581                            q.addEntity(_FILTER_ENTITY_ALIAS, DLFileShortcutImpl.class);
3582                    }
3583                    else {
3584                            q.addEntity(_FILTER_ENTITY_TABLE, DLFileShortcutImpl.class);
3585                    }
3586    
3587                    QueryPos qPos = QueryPos.getInstance(q);
3588    
3589                    qPos.add(groupId);
3590    
3591                    qPos.add(folderId);
3592    
3593                    qPos.add(active);
3594    
3595                    if (orderByComparator != null) {
3596                            Object[] values = orderByComparator.getOrderByConditionValues(dlFileShortcut);
3597    
3598                            for (Object value : values) {
3599                                    qPos.add(value);
3600                            }
3601                    }
3602    
3603                    List<DLFileShortcut> list = q.list();
3604    
3605                    if (list.size() == 2) {
3606                            return list.get(1);
3607                    }
3608                    else {
3609                            return null;
3610                    }
3611            }
3612    
3613            /**
3614             * Returns all the document library file shortcuts where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
3615             *
3616             * @param groupId the group ID
3617             * @param folderId the folder ID
3618             * @param active the active
3619             * @param status the status
3620             * @return the matching document library file shortcuts
3621             * @throws SystemException if a system exception occurred
3622             */
3623            public List<DLFileShortcut> findByG_F_A_S(long groupId, long folderId,
3624                    boolean active, int status) throws SystemException {
3625                    return findByG_F_A_S(groupId, folderId, active, status,
3626                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3627            }
3628    
3629            /**
3630             * Returns a range of all the document library file shortcuts where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
3631             *
3632             * <p>
3633             * 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.
3634             * </p>
3635             *
3636             * @param groupId the group ID
3637             * @param folderId the folder ID
3638             * @param active the active
3639             * @param status the status
3640             * @param start the lower bound of the range of document library file shortcuts
3641             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
3642             * @return the range of matching document library file shortcuts
3643             * @throws SystemException if a system exception occurred
3644             */
3645            public List<DLFileShortcut> findByG_F_A_S(long groupId, long folderId,
3646                    boolean active, int status, int start, int end)
3647                    throws SystemException {
3648                    return findByG_F_A_S(groupId, folderId, active, status, start, end, null);
3649            }
3650    
3651            /**
3652             * Returns an ordered range of all the document library file shortcuts where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
3653             *
3654             * <p>
3655             * 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.
3656             * </p>
3657             *
3658             * @param groupId the group ID
3659             * @param folderId the folder ID
3660             * @param active the active
3661             * @param status the status
3662             * @param start the lower bound of the range of document library file shortcuts
3663             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
3664             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
3665             * @return the ordered range of matching document library file shortcuts
3666             * @throws SystemException if a system exception occurred
3667             */
3668            public List<DLFileShortcut> findByG_F_A_S(long groupId, long folderId,
3669                    boolean active, int status, int start, int end,
3670                    OrderByComparator orderByComparator) throws SystemException {
3671                    FinderPath finderPath = null;
3672                    Object[] finderArgs = null;
3673    
3674                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3675                                    (orderByComparator == null)) {
3676                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_F_A_S;
3677                            finderArgs = new Object[] { groupId, folderId, active, status };
3678                    }
3679                    else {
3680                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_F_A_S;
3681                            finderArgs = new Object[] {
3682                                            groupId, folderId, active, status,
3683                                            
3684                                            start, end, orderByComparator
3685                                    };
3686                    }
3687    
3688                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(finderPath,
3689                                    finderArgs, this);
3690    
3691                    if ((list != null) && !list.isEmpty()) {
3692                            for (DLFileShortcut dlFileShortcut : list) {
3693                                    if ((groupId != dlFileShortcut.getGroupId()) ||
3694                                                    (folderId != dlFileShortcut.getFolderId()) ||
3695                                                    (active != dlFileShortcut.getActive()) ||
3696                                                    (status != dlFileShortcut.getStatus())) {
3697                                            list = null;
3698    
3699                                            break;
3700                                    }
3701                            }
3702                    }
3703    
3704                    if (list == null) {
3705                            StringBundler query = null;
3706    
3707                            if (orderByComparator != null) {
3708                                    query = new StringBundler(6 +
3709                                                    (orderByComparator.getOrderByFields().length * 3));
3710                            }
3711                            else {
3712                                    query = new StringBundler(5);
3713                            }
3714    
3715                            query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
3716    
3717                            query.append(_FINDER_COLUMN_G_F_A_S_GROUPID_2);
3718    
3719                            query.append(_FINDER_COLUMN_G_F_A_S_FOLDERID_2);
3720    
3721                            query.append(_FINDER_COLUMN_G_F_A_S_ACTIVE_2);
3722    
3723                            query.append(_FINDER_COLUMN_G_F_A_S_STATUS_2);
3724    
3725                            if (orderByComparator != null) {
3726                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3727                                            orderByComparator);
3728                            }
3729    
3730                            String sql = query.toString();
3731    
3732                            Session session = null;
3733    
3734                            try {
3735                                    session = openSession();
3736    
3737                                    Query q = session.createQuery(sql);
3738    
3739                                    QueryPos qPos = QueryPos.getInstance(q);
3740    
3741                                    qPos.add(groupId);
3742    
3743                                    qPos.add(folderId);
3744    
3745                                    qPos.add(active);
3746    
3747                                    qPos.add(status);
3748    
3749                                    list = (List<DLFileShortcut>)QueryUtil.list(q, getDialect(),
3750                                                    start, end);
3751                            }
3752                            catch (Exception e) {
3753                                    throw processException(e);
3754                            }
3755                            finally {
3756                                    if (list == null) {
3757                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
3758                                    }
3759                                    else {
3760                                            cacheResult(list);
3761    
3762                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
3763                                    }
3764    
3765                                    closeSession(session);
3766                            }
3767                    }
3768    
3769                    return list;
3770            }
3771    
3772            /**
3773             * Returns the first document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
3774             *
3775             * @param groupId the group ID
3776             * @param folderId the folder ID
3777             * @param active the active
3778             * @param status the status
3779             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3780             * @return the first matching document library file shortcut
3781             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
3782             * @throws SystemException if a system exception occurred
3783             */
3784            public DLFileShortcut findByG_F_A_S_First(long groupId, long folderId,
3785                    boolean active, int status, OrderByComparator orderByComparator)
3786                    throws NoSuchFileShortcutException, SystemException {
3787                    DLFileShortcut dlFileShortcut = fetchByG_F_A_S_First(groupId, folderId,
3788                                    active, status, orderByComparator);
3789    
3790                    if (dlFileShortcut != null) {
3791                            return dlFileShortcut;
3792                    }
3793    
3794                    StringBundler msg = new StringBundler(10);
3795    
3796                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3797    
3798                    msg.append("groupId=");
3799                    msg.append(groupId);
3800    
3801                    msg.append(", folderId=");
3802                    msg.append(folderId);
3803    
3804                    msg.append(", active=");
3805                    msg.append(active);
3806    
3807                    msg.append(", status=");
3808                    msg.append(status);
3809    
3810                    msg.append(StringPool.CLOSE_CURLY_BRACE);
3811    
3812                    throw new NoSuchFileShortcutException(msg.toString());
3813            }
3814    
3815            /**
3816             * Returns the first document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
3817             *
3818             * @param groupId the group ID
3819             * @param folderId the folder ID
3820             * @param active the active
3821             * @param status the status
3822             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3823             * @return the first matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
3824             * @throws SystemException if a system exception occurred
3825             */
3826            public DLFileShortcut fetchByG_F_A_S_First(long groupId, long folderId,
3827                    boolean active, int status, OrderByComparator orderByComparator)
3828                    throws SystemException {
3829                    List<DLFileShortcut> list = findByG_F_A_S(groupId, folderId, active,
3830                                    status, 0, 1, orderByComparator);
3831    
3832                    if (!list.isEmpty()) {
3833                            return list.get(0);
3834                    }
3835    
3836                    return null;
3837            }
3838    
3839            /**
3840             * Returns the last document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
3841             *
3842             * @param groupId the group ID
3843             * @param folderId the folder ID
3844             * @param active the active
3845             * @param status the status
3846             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3847             * @return the last matching document library file shortcut
3848             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a matching document library file shortcut could not be found
3849             * @throws SystemException if a system exception occurred
3850             */
3851            public DLFileShortcut findByG_F_A_S_Last(long groupId, long folderId,
3852                    boolean active, int status, OrderByComparator orderByComparator)
3853                    throws NoSuchFileShortcutException, SystemException {
3854                    DLFileShortcut dlFileShortcut = fetchByG_F_A_S_Last(groupId, folderId,
3855                                    active, status, orderByComparator);
3856    
3857                    if (dlFileShortcut != null) {
3858                            return dlFileShortcut;
3859                    }
3860    
3861                    StringBundler msg = new StringBundler(10);
3862    
3863                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3864    
3865                    msg.append("groupId=");
3866                    msg.append(groupId);
3867    
3868                    msg.append(", folderId=");
3869                    msg.append(folderId);
3870    
3871                    msg.append(", active=");
3872                    msg.append(active);
3873    
3874                    msg.append(", status=");
3875                    msg.append(status);
3876    
3877                    msg.append(StringPool.CLOSE_CURLY_BRACE);
3878    
3879                    throw new NoSuchFileShortcutException(msg.toString());
3880            }
3881    
3882            /**
3883             * Returns the last document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
3884             *
3885             * @param groupId the group ID
3886             * @param folderId the folder ID
3887             * @param active the active
3888             * @param status the status
3889             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3890             * @return the last matching document library file shortcut, or <code>null</code> if a matching document library file shortcut could not be found
3891             * @throws SystemException if a system exception occurred
3892             */
3893            public DLFileShortcut fetchByG_F_A_S_Last(long groupId, long folderId,
3894                    boolean active, int status, OrderByComparator orderByComparator)
3895                    throws SystemException {
3896                    int count = countByG_F_A_S(groupId, folderId, active, status);
3897    
3898                    List<DLFileShortcut> list = findByG_F_A_S(groupId, folderId, active,
3899                                    status, count - 1, count, orderByComparator);
3900    
3901                    if (!list.isEmpty()) {
3902                            return list.get(0);
3903                    }
3904    
3905                    return null;
3906            }
3907    
3908            /**
3909             * Returns the document library file shortcuts before and after the current document library file shortcut in the ordered set where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
3910             *
3911             * @param fileShortcutId the primary key of the current document library file shortcut
3912             * @param groupId the group ID
3913             * @param folderId the folder ID
3914             * @param active the active
3915             * @param status the status
3916             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3917             * @return the previous, current, and next document library file shortcut
3918             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
3919             * @throws SystemException if a system exception occurred
3920             */
3921            public DLFileShortcut[] findByG_F_A_S_PrevAndNext(long fileShortcutId,
3922                    long groupId, long folderId, boolean active, int status,
3923                    OrderByComparator orderByComparator)
3924                    throws NoSuchFileShortcutException, SystemException {
3925                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
3926    
3927                    Session session = null;
3928    
3929                    try {
3930                            session = openSession();
3931    
3932                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
3933    
3934                            array[0] = getByG_F_A_S_PrevAndNext(session, dlFileShortcut,
3935                                            groupId, folderId, active, status, orderByComparator, true);
3936    
3937                            array[1] = dlFileShortcut;
3938    
3939                            array[2] = getByG_F_A_S_PrevAndNext(session, dlFileShortcut,
3940                                            groupId, folderId, active, status, orderByComparator, false);
3941    
3942                            return array;
3943                    }
3944                    catch (Exception e) {
3945                            throw processException(e);
3946                    }
3947                    finally {
3948                            closeSession(session);
3949                    }
3950            }
3951    
3952            protected DLFileShortcut getByG_F_A_S_PrevAndNext(Session session,
3953                    DLFileShortcut dlFileShortcut, long groupId, long folderId,
3954                    boolean active, int status, OrderByComparator orderByComparator,
3955                    boolean previous) {
3956                    StringBundler query = null;
3957    
3958                    if (orderByComparator != null) {
3959                            query = new StringBundler(6 +
3960                                            (orderByComparator.getOrderByFields().length * 6));
3961                    }
3962                    else {
3963                            query = new StringBundler(3);
3964                    }
3965    
3966                    query.append(_SQL_SELECT_DLFILESHORTCUT_WHERE);
3967    
3968                    query.append(_FINDER_COLUMN_G_F_A_S_GROUPID_2);
3969    
3970                    query.append(_FINDER_COLUMN_G_F_A_S_FOLDERID_2);
3971    
3972                    query.append(_FINDER_COLUMN_G_F_A_S_ACTIVE_2);
3973    
3974                    query.append(_FINDER_COLUMN_G_F_A_S_STATUS_2);
3975    
3976                    if (orderByComparator != null) {
3977                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3978    
3979                            if (orderByConditionFields.length > 0) {
3980                                    query.append(WHERE_AND);
3981                            }
3982    
3983                            for (int i = 0; i < orderByConditionFields.length; i++) {
3984                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3985                                    query.append(orderByConditionFields[i]);
3986    
3987                                    if ((i + 1) < orderByConditionFields.length) {
3988                                            if (orderByComparator.isAscending() ^ previous) {
3989                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
3990                                            }
3991                                            else {
3992                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
3993                                            }
3994                                    }
3995                                    else {
3996                                            if (orderByComparator.isAscending() ^ previous) {
3997                                                    query.append(WHERE_GREATER_THAN);
3998                                            }
3999                                            else {
4000                                                    query.append(WHERE_LESSER_THAN);
4001                                            }
4002                                    }
4003                            }
4004    
4005                            query.append(ORDER_BY_CLAUSE);
4006    
4007                            String[] orderByFields = orderByComparator.getOrderByFields();
4008    
4009                            for (int i = 0; i < orderByFields.length; i++) {
4010                                    query.append(_ORDER_BY_ENTITY_ALIAS);
4011                                    query.append(orderByFields[i]);
4012    
4013                                    if ((i + 1) < orderByFields.length) {
4014                                            if (orderByComparator.isAscending() ^ previous) {
4015                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
4016                                            }
4017                                            else {
4018                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
4019                                            }
4020                                    }
4021                                    else {
4022                                            if (orderByComparator.isAscending() ^ previous) {
4023                                                    query.append(ORDER_BY_ASC);
4024                                            }
4025                                            else {
4026                                                    query.append(ORDER_BY_DESC);
4027                                            }
4028                                    }
4029                            }
4030                    }
4031    
4032                    String sql = query.toString();
4033    
4034                    Query q = session.createQuery(sql);
4035    
4036                    q.setFirstResult(0);
4037                    q.setMaxResults(2);
4038    
4039                    QueryPos qPos = QueryPos.getInstance(q);
4040    
4041                    qPos.add(groupId);
4042    
4043                    qPos.add(folderId);
4044    
4045                    qPos.add(active);
4046    
4047                    qPos.add(status);
4048    
4049                    if (orderByComparator != null) {
4050                            Object[] values = orderByComparator.getOrderByConditionValues(dlFileShortcut);
4051    
4052                            for (Object value : values) {
4053                                    qPos.add(value);
4054                            }
4055                    }
4056    
4057                    List<DLFileShortcut> list = q.list();
4058    
4059                    if (list.size() == 2) {
4060                            return list.get(1);
4061                    }
4062                    else {
4063                            return null;
4064                    }
4065            }
4066    
4067            /**
4068             * Returns all the document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
4069             *
4070             * @param groupId the group ID
4071             * @param folderId the folder ID
4072             * @param active the active
4073             * @param status the status
4074             * @return the matching document library file shortcuts that the user has permission to view
4075             * @throws SystemException if a system exception occurred
4076             */
4077            public List<DLFileShortcut> filterFindByG_F_A_S(long groupId,
4078                    long folderId, boolean active, int status) throws SystemException {
4079                    return filterFindByG_F_A_S(groupId, folderId, active, status,
4080                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
4081            }
4082    
4083            /**
4084             * Returns a range of all the document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
4085             *
4086             * <p>
4087             * 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.
4088             * </p>
4089             *
4090             * @param groupId the group ID
4091             * @param folderId the folder ID
4092             * @param active the active
4093             * @param status the status
4094             * @param start the lower bound of the range of document library file shortcuts
4095             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
4096             * @return the range of matching document library file shortcuts that the user has permission to view
4097             * @throws SystemException if a system exception occurred
4098             */
4099            public List<DLFileShortcut> filterFindByG_F_A_S(long groupId,
4100                    long folderId, boolean active, int status, int start, int end)
4101                    throws SystemException {
4102                    return filterFindByG_F_A_S(groupId, folderId, active, status, start,
4103                            end, null);
4104            }
4105    
4106            /**
4107             * Returns an ordered range of all the document library file shortcuts that the user has permissions to view where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
4108             *
4109             * <p>
4110             * 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.
4111             * </p>
4112             *
4113             * @param groupId the group ID
4114             * @param folderId the folder ID
4115             * @param active the active
4116             * @param status the status
4117             * @param start the lower bound of the range of document library file shortcuts
4118             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
4119             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
4120             * @return the ordered range of matching document library file shortcuts that the user has permission to view
4121             * @throws SystemException if a system exception occurred
4122             */
4123            public List<DLFileShortcut> filterFindByG_F_A_S(long groupId,
4124                    long folderId, boolean active, int status, int start, int end,
4125                    OrderByComparator orderByComparator) throws SystemException {
4126                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
4127                            return findByG_F_A_S(groupId, folderId, active, status, start, end,
4128                                    orderByComparator);
4129                    }
4130    
4131                    StringBundler query = null;
4132    
4133                    if (orderByComparator != null) {
4134                            query = new StringBundler(6 +
4135                                            (orderByComparator.getOrderByFields().length * 3));
4136                    }
4137                    else {
4138                            query = new StringBundler(5);
4139                    }
4140    
4141                    if (getDB().isSupportsInlineDistinct()) {
4142                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE);
4143                    }
4144                    else {
4145                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1);
4146                    }
4147    
4148                    query.append(_FINDER_COLUMN_G_F_A_S_GROUPID_2);
4149    
4150                    query.append(_FINDER_COLUMN_G_F_A_S_FOLDERID_2);
4151    
4152                    query.append(_FINDER_COLUMN_G_F_A_S_ACTIVE_2);
4153    
4154                    query.append(_FINDER_COLUMN_G_F_A_S_STATUS_2);
4155    
4156                    if (!getDB().isSupportsInlineDistinct()) {
4157                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2);
4158                    }
4159    
4160                    if (orderByComparator != null) {
4161                            if (getDB().isSupportsInlineDistinct()) {
4162                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4163                                            orderByComparator);
4164                            }
4165                            else {
4166                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
4167                                            orderByComparator);
4168                            }
4169                    }
4170    
4171                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4172                                    DLFileShortcut.class.getName(),
4173                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
4174    
4175                    Session session = null;
4176    
4177                    try {
4178                            session = openSession();
4179    
4180                            SQLQuery q = session.createSQLQuery(sql);
4181    
4182                            if (getDB().isSupportsInlineDistinct()) {
4183                                    q.addEntity(_FILTER_ENTITY_ALIAS, DLFileShortcutImpl.class);
4184                            }
4185                            else {
4186                                    q.addEntity(_FILTER_ENTITY_TABLE, DLFileShortcutImpl.class);
4187                            }
4188    
4189                            QueryPos qPos = QueryPos.getInstance(q);
4190    
4191                            qPos.add(groupId);
4192    
4193                            qPos.add(folderId);
4194    
4195                            qPos.add(active);
4196    
4197                            qPos.add(status);
4198    
4199                            return (List<DLFileShortcut>)QueryUtil.list(q, getDialect(), start,
4200                                    end);
4201                    }
4202                    catch (Exception e) {
4203                            throw processException(e);
4204                    }
4205                    finally {
4206                            closeSession(session);
4207                    }
4208            }
4209    
4210            /**
4211             * Returns the document library file shortcuts before and after the current document library file shortcut in the ordered set of document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
4212             *
4213             * @param fileShortcutId the primary key of the current document library file shortcut
4214             * @param groupId the group ID
4215             * @param folderId the folder ID
4216             * @param active the active
4217             * @param status the status
4218             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
4219             * @return the previous, current, and next document library file shortcut
4220             * @throws com.liferay.portlet.documentlibrary.NoSuchFileShortcutException if a document library file shortcut with the primary key could not be found
4221             * @throws SystemException if a system exception occurred
4222             */
4223            public DLFileShortcut[] filterFindByG_F_A_S_PrevAndNext(
4224                    long fileShortcutId, long groupId, long folderId, boolean active,
4225                    int status, OrderByComparator orderByComparator)
4226                    throws NoSuchFileShortcutException, SystemException {
4227                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
4228                            return findByG_F_A_S_PrevAndNext(fileShortcutId, groupId, folderId,
4229                                    active, status, orderByComparator);
4230                    }
4231    
4232                    DLFileShortcut dlFileShortcut = findByPrimaryKey(fileShortcutId);
4233    
4234                    Session session = null;
4235    
4236                    try {
4237                            session = openSession();
4238    
4239                            DLFileShortcut[] array = new DLFileShortcutImpl[3];
4240    
4241                            array[0] = filterGetByG_F_A_S_PrevAndNext(session, dlFileShortcut,
4242                                            groupId, folderId, active, status, orderByComparator, true);
4243    
4244                            array[1] = dlFileShortcut;
4245    
4246                            array[2] = filterGetByG_F_A_S_PrevAndNext(session, dlFileShortcut,
4247                                            groupId, folderId, active, status, orderByComparator, false);
4248    
4249                            return array;
4250                    }
4251                    catch (Exception e) {
4252                            throw processException(e);
4253                    }
4254                    finally {
4255                            closeSession(session);
4256                    }
4257            }
4258    
4259            protected DLFileShortcut filterGetByG_F_A_S_PrevAndNext(Session session,
4260                    DLFileShortcut dlFileShortcut, long groupId, long folderId,
4261                    boolean active, int status, OrderByComparator orderByComparator,
4262                    boolean previous) {
4263                    StringBundler query = null;
4264    
4265                    if (orderByComparator != null) {
4266                            query = new StringBundler(6 +
4267                                            (orderByComparator.getOrderByFields().length * 6));
4268                    }
4269                    else {
4270                            query = new StringBundler(3);
4271                    }
4272    
4273                    if (getDB().isSupportsInlineDistinct()) {
4274                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE);
4275                    }
4276                    else {
4277                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1);
4278                    }
4279    
4280                    query.append(_FINDER_COLUMN_G_F_A_S_GROUPID_2);
4281    
4282                    query.append(_FINDER_COLUMN_G_F_A_S_FOLDERID_2);
4283    
4284                    query.append(_FINDER_COLUMN_G_F_A_S_ACTIVE_2);
4285    
4286                    query.append(_FINDER_COLUMN_G_F_A_S_STATUS_2);
4287    
4288                    if (!getDB().isSupportsInlineDistinct()) {
4289                            query.append(_FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2);
4290                    }
4291    
4292                    if (orderByComparator != null) {
4293                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4294    
4295                            if (orderByConditionFields.length > 0) {
4296                                    query.append(WHERE_AND);
4297                            }
4298    
4299                            for (int i = 0; i < orderByConditionFields.length; i++) {
4300                                    if (getDB().isSupportsInlineDistinct()) {
4301                                            query.append(_ORDER_BY_ENTITY_ALIAS);
4302                                    }
4303                                    else {
4304                                            query.append(_ORDER_BY_ENTITY_TABLE);
4305                                    }
4306    
4307                                    query.append(orderByConditionFields[i]);
4308    
4309                                    if ((i + 1) < orderByConditionFields.length) {
4310                                            if (orderByComparator.isAscending() ^ previous) {
4311                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
4312                                            }
4313                                            else {
4314                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
4315                                            }
4316                                    }
4317                                    else {
4318                                            if (orderByComparator.isAscending() ^ previous) {
4319                                                    query.append(WHERE_GREATER_THAN);
4320                                            }
4321                                            else {
4322                                                    query.append(WHERE_LESSER_THAN);
4323                                            }
4324                                    }
4325                            }
4326    
4327                            query.append(ORDER_BY_CLAUSE);
4328    
4329                            String[] orderByFields = orderByComparator.getOrderByFields();
4330    
4331                            for (int i = 0; i < orderByFields.length; i++) {
4332                                    if (getDB().isSupportsInlineDistinct()) {
4333                                            query.append(_ORDER_BY_ENTITY_ALIAS);
4334                                    }
4335                                    else {
4336                                            query.append(_ORDER_BY_ENTITY_TABLE);
4337                                    }
4338    
4339                                    query.append(orderByFields[i]);
4340    
4341                                    if ((i + 1) < orderByFields.length) {
4342                                            if (orderByComparator.isAscending() ^ previous) {
4343                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
4344                                            }
4345                                            else {
4346                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
4347                                            }
4348                                    }
4349                                    else {
4350                                            if (orderByComparator.isAscending() ^ previous) {
4351                                                    query.append(ORDER_BY_ASC);
4352                                            }
4353                                            else {
4354                                                    query.append(ORDER_BY_DESC);
4355                                            }
4356                                    }
4357                            }
4358                    }
4359    
4360                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4361                                    DLFileShortcut.class.getName(),
4362                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
4363    
4364                    SQLQuery q = session.createSQLQuery(sql);
4365    
4366                    q.setFirstResult(0);
4367                    q.setMaxResults(2);
4368    
4369                    if (getDB().isSupportsInlineDistinct()) {
4370                            q.addEntity(_FILTER_ENTITY_ALIAS, DLFileShortcutImpl.class);
4371                    }
4372                    else {
4373                            q.addEntity(_FILTER_ENTITY_TABLE, DLFileShortcutImpl.class);
4374                    }
4375    
4376                    QueryPos qPos = QueryPos.getInstance(q);
4377    
4378                    qPos.add(groupId);
4379    
4380                    qPos.add(folderId);
4381    
4382                    qPos.add(active);
4383    
4384                    qPos.add(status);
4385    
4386                    if (orderByComparator != null) {
4387                            Object[] values = orderByComparator.getOrderByConditionValues(dlFileShortcut);
4388    
4389                            for (Object value : values) {
4390                                    qPos.add(value);
4391                            }
4392                    }
4393    
4394                    List<DLFileShortcut> list = q.list();
4395    
4396                    if (list.size() == 2) {
4397                            return list.get(1);
4398                    }
4399                    else {
4400                            return null;
4401                    }
4402            }
4403    
4404            /**
4405             * Returns all the document library file shortcuts.
4406             *
4407             * @return the document library file shortcuts
4408             * @throws SystemException if a system exception occurred
4409             */
4410            public List<DLFileShortcut> findAll() throws SystemException {
4411                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
4412            }
4413    
4414            /**
4415             * Returns a range of all the document library file shortcuts.
4416             *
4417             * <p>
4418             * 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.
4419             * </p>
4420             *
4421             * @param start the lower bound of the range of document library file shortcuts
4422             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
4423             * @return the range of document library file shortcuts
4424             * @throws SystemException if a system exception occurred
4425             */
4426            public List<DLFileShortcut> findAll(int start, int end)
4427                    throws SystemException {
4428                    return findAll(start, end, null);
4429            }
4430    
4431            /**
4432             * Returns an ordered range of all the document library file shortcuts.
4433             *
4434             * <p>
4435             * 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.
4436             * </p>
4437             *
4438             * @param start the lower bound of the range of document library file shortcuts
4439             * @param end the upper bound of the range of document library file shortcuts (not inclusive)
4440             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
4441             * @return the ordered range of document library file shortcuts
4442             * @throws SystemException if a system exception occurred
4443             */
4444            public List<DLFileShortcut> findAll(int start, int end,
4445                    OrderByComparator orderByComparator) throws SystemException {
4446                    FinderPath finderPath = null;
4447                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
4448    
4449                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
4450                                    (orderByComparator == null)) {
4451                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
4452                            finderArgs = FINDER_ARGS_EMPTY;
4453                    }
4454                    else {
4455                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
4456                            finderArgs = new Object[] { start, end, orderByComparator };
4457                    }
4458    
4459                    List<DLFileShortcut> list = (List<DLFileShortcut>)FinderCacheUtil.getResult(finderPath,
4460                                    finderArgs, this);
4461    
4462                    if (list == null) {
4463                            StringBundler query = null;
4464                            String sql = null;
4465    
4466                            if (orderByComparator != null) {
4467                                    query = new StringBundler(2 +
4468                                                    (orderByComparator.getOrderByFields().length * 3));
4469    
4470                                    query.append(_SQL_SELECT_DLFILESHORTCUT);
4471    
4472                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4473                                            orderByComparator);
4474    
4475                                    sql = query.toString();
4476                            }
4477                            else {
4478                                    sql = _SQL_SELECT_DLFILESHORTCUT;
4479                            }
4480    
4481                            Session session = null;
4482    
4483                            try {
4484                                    session = openSession();
4485    
4486                                    Query q = session.createQuery(sql);
4487    
4488                                    if (orderByComparator == null) {
4489                                            list = (List<DLFileShortcut>)QueryUtil.list(q,
4490                                                            getDialect(), start, end, false);
4491    
4492                                            Collections.sort(list);
4493                                    }
4494                                    else {
4495                                            list = (List<DLFileShortcut>)QueryUtil.list(q,
4496                                                            getDialect(), start, end);
4497                                    }
4498                            }
4499                            catch (Exception e) {
4500                                    throw processException(e);
4501                            }
4502                            finally {
4503                                    if (list == null) {
4504                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
4505                                    }
4506                                    else {
4507                                            cacheResult(list);
4508    
4509                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
4510                                    }
4511    
4512                                    closeSession(session);
4513                            }
4514                    }
4515    
4516                    return list;
4517            }
4518    
4519            /**
4520             * Removes all the document library file shortcuts where uuid = &#63; from the database.
4521             *
4522             * @param uuid the uuid
4523             * @throws SystemException if a system exception occurred
4524             */
4525            public void removeByUuid(String uuid) throws SystemException {
4526                    for (DLFileShortcut dlFileShortcut : findByUuid(uuid)) {
4527                            remove(dlFileShortcut);
4528                    }
4529            }
4530    
4531            /**
4532             * Removes the document library file shortcut where uuid = &#63; and groupId = &#63; from the database.
4533             *
4534             * @param uuid the uuid
4535             * @param groupId the group ID
4536             * @return the document library file shortcut that was removed
4537             * @throws SystemException if a system exception occurred
4538             */
4539            public DLFileShortcut removeByUUID_G(String uuid, long groupId)
4540                    throws NoSuchFileShortcutException, SystemException {
4541                    DLFileShortcut dlFileShortcut = findByUUID_G(uuid, groupId);
4542    
4543                    return remove(dlFileShortcut);
4544            }
4545    
4546            /**
4547             * Removes all the document library file shortcuts where uuid = &#63; and companyId = &#63; from the database.
4548             *
4549             * @param uuid the uuid
4550             * @param companyId the company ID
4551             * @throws SystemException if a system exception occurred
4552             */
4553            public void removeByUuid_C(String uuid, long companyId)
4554                    throws SystemException {
4555                    for (DLFileShortcut dlFileShortcut : findByUuid_C(uuid, companyId)) {
4556                            remove(dlFileShortcut);
4557                    }
4558            }
4559    
4560            /**
4561             * Removes all the document library file shortcuts where toFileEntryId = &#63; from the database.
4562             *
4563             * @param toFileEntryId the to file entry ID
4564             * @throws SystemException if a system exception occurred
4565             */
4566            public void removeByToFileEntryId(long toFileEntryId)
4567                    throws SystemException {
4568                    for (DLFileShortcut dlFileShortcut : findByToFileEntryId(toFileEntryId)) {
4569                            remove(dlFileShortcut);
4570                    }
4571            }
4572    
4573            /**
4574             * Removes all the document library file shortcuts where groupId = &#63; and folderId = &#63; from the database.
4575             *
4576             * @param groupId the group ID
4577             * @param folderId the folder ID
4578             * @throws SystemException if a system exception occurred
4579             */
4580            public void removeByG_F(long groupId, long folderId)
4581                    throws SystemException {
4582                    for (DLFileShortcut dlFileShortcut : findByG_F(groupId, folderId)) {
4583                            remove(dlFileShortcut);
4584                    }
4585            }
4586    
4587            /**
4588             * Removes all the document library file shortcuts where groupId = &#63; and folderId = &#63; and active = &#63; from the database.
4589             *
4590             * @param groupId the group ID
4591             * @param folderId the folder ID
4592             * @param active the active
4593             * @throws SystemException if a system exception occurred
4594             */
4595            public void removeByG_F_A(long groupId, long folderId, boolean active)
4596                    throws SystemException {
4597                    for (DLFileShortcut dlFileShortcut : findByG_F_A(groupId, folderId,
4598                                    active)) {
4599                            remove(dlFileShortcut);
4600                    }
4601            }
4602    
4603            /**
4604             * Removes all the document library file shortcuts where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63; from the database.
4605             *
4606             * @param groupId the group ID
4607             * @param folderId the folder ID
4608             * @param active the active
4609             * @param status the status
4610             * @throws SystemException if a system exception occurred
4611             */
4612            public void removeByG_F_A_S(long groupId, long folderId, boolean active,
4613                    int status) throws SystemException {
4614                    for (DLFileShortcut dlFileShortcut : findByG_F_A_S(groupId, folderId,
4615                                    active, status)) {
4616                            remove(dlFileShortcut);
4617                    }
4618            }
4619    
4620            /**
4621             * Removes all the document library file shortcuts from the database.
4622             *
4623             * @throws SystemException if a system exception occurred
4624             */
4625            public void removeAll() throws SystemException {
4626                    for (DLFileShortcut dlFileShortcut : findAll()) {
4627                            remove(dlFileShortcut);
4628                    }
4629            }
4630    
4631            /**
4632             * Returns the number of document library file shortcuts where uuid = &#63;.
4633             *
4634             * @param uuid the uuid
4635             * @return the number of matching document library file shortcuts
4636             * @throws SystemException if a system exception occurred
4637             */
4638            public int countByUuid(String uuid) throws SystemException {
4639                    Object[] finderArgs = new Object[] { uuid };
4640    
4641                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
4642                                    finderArgs, this);
4643    
4644                    if (count == null) {
4645                            StringBundler query = new StringBundler(2);
4646    
4647                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
4648    
4649                            if (uuid == null) {
4650                                    query.append(_FINDER_COLUMN_UUID_UUID_1);
4651                            }
4652                            else {
4653                                    if (uuid.equals(StringPool.BLANK)) {
4654                                            query.append(_FINDER_COLUMN_UUID_UUID_3);
4655                                    }
4656                                    else {
4657                                            query.append(_FINDER_COLUMN_UUID_UUID_2);
4658                                    }
4659                            }
4660    
4661                            String sql = query.toString();
4662    
4663                            Session session = null;
4664    
4665                            try {
4666                                    session = openSession();
4667    
4668                                    Query q = session.createQuery(sql);
4669    
4670                                    QueryPos qPos = QueryPos.getInstance(q);
4671    
4672                                    if (uuid != null) {
4673                                            qPos.add(uuid);
4674                                    }
4675    
4676                                    count = (Long)q.uniqueResult();
4677                            }
4678                            catch (Exception e) {
4679                                    throw processException(e);
4680                            }
4681                            finally {
4682                                    if (count == null) {
4683                                            count = Long.valueOf(0);
4684                                    }
4685    
4686                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
4687                                            finderArgs, count);
4688    
4689                                    closeSession(session);
4690                            }
4691                    }
4692    
4693                    return count.intValue();
4694            }
4695    
4696            /**
4697             * Returns the number of document library file shortcuts where uuid = &#63; and groupId = &#63;.
4698             *
4699             * @param uuid the uuid
4700             * @param groupId the group ID
4701             * @return the number of matching document library file shortcuts
4702             * @throws SystemException if a system exception occurred
4703             */
4704            public int countByUUID_G(String uuid, long groupId)
4705                    throws SystemException {
4706                    Object[] finderArgs = new Object[] { uuid, groupId };
4707    
4708                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
4709                                    finderArgs, this);
4710    
4711                    if (count == null) {
4712                            StringBundler query = new StringBundler(3);
4713    
4714                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
4715    
4716                            if (uuid == null) {
4717                                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
4718                            }
4719                            else {
4720                                    if (uuid.equals(StringPool.BLANK)) {
4721                                            query.append(_FINDER_COLUMN_UUID_G_UUID_3);
4722                                    }
4723                                    else {
4724                                            query.append(_FINDER_COLUMN_UUID_G_UUID_2);
4725                                    }
4726                            }
4727    
4728                            query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
4729    
4730                            String sql = query.toString();
4731    
4732                            Session session = null;
4733    
4734                            try {
4735                                    session = openSession();
4736    
4737                                    Query q = session.createQuery(sql);
4738    
4739                                    QueryPos qPos = QueryPos.getInstance(q);
4740    
4741                                    if (uuid != null) {
4742                                            qPos.add(uuid);
4743                                    }
4744    
4745                                    qPos.add(groupId);
4746    
4747                                    count = (Long)q.uniqueResult();
4748                            }
4749                            catch (Exception e) {
4750                                    throw processException(e);
4751                            }
4752                            finally {
4753                                    if (count == null) {
4754                                            count = Long.valueOf(0);
4755                                    }
4756    
4757                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
4758                                            finderArgs, count);
4759    
4760                                    closeSession(session);
4761                            }
4762                    }
4763    
4764                    return count.intValue();
4765            }
4766    
4767            /**
4768             * Returns the number of document library file shortcuts where uuid = &#63; and companyId = &#63;.
4769             *
4770             * @param uuid the uuid
4771             * @param companyId the company ID
4772             * @return the number of matching document library file shortcuts
4773             * @throws SystemException if a system exception occurred
4774             */
4775            public int countByUuid_C(String uuid, long companyId)
4776                    throws SystemException {
4777                    Object[] finderArgs = new Object[] { uuid, companyId };
4778    
4779                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_C,
4780                                    finderArgs, this);
4781    
4782                    if (count == null) {
4783                            StringBundler query = new StringBundler(3);
4784    
4785                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
4786    
4787                            if (uuid == null) {
4788                                    query.append(_FINDER_COLUMN_UUID_C_UUID_1);
4789                            }
4790                            else {
4791                                    if (uuid.equals(StringPool.BLANK)) {
4792                                            query.append(_FINDER_COLUMN_UUID_C_UUID_3);
4793                                    }
4794                                    else {
4795                                            query.append(_FINDER_COLUMN_UUID_C_UUID_2);
4796                                    }
4797                            }
4798    
4799                            query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
4800    
4801                            String sql = query.toString();
4802    
4803                            Session session = null;
4804    
4805                            try {
4806                                    session = openSession();
4807    
4808                                    Query q = session.createQuery(sql);
4809    
4810                                    QueryPos qPos = QueryPos.getInstance(q);
4811    
4812                                    if (uuid != null) {
4813                                            qPos.add(uuid);
4814                                    }
4815    
4816                                    qPos.add(companyId);
4817    
4818                                    count = (Long)q.uniqueResult();
4819                            }
4820                            catch (Exception e) {
4821                                    throw processException(e);
4822                            }
4823                            finally {
4824                                    if (count == null) {
4825                                            count = Long.valueOf(0);
4826                                    }
4827    
4828                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_C,
4829                                            finderArgs, count);
4830    
4831                                    closeSession(session);
4832                            }
4833                    }
4834    
4835                    return count.intValue();
4836            }
4837    
4838            /**
4839             * Returns the number of document library file shortcuts where toFileEntryId = &#63;.
4840             *
4841             * @param toFileEntryId the to file entry ID
4842             * @return the number of matching document library file shortcuts
4843             * @throws SystemException if a system exception occurred
4844             */
4845            public int countByToFileEntryId(long toFileEntryId)
4846                    throws SystemException {
4847                    Object[] finderArgs = new Object[] { toFileEntryId };
4848    
4849                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TOFILEENTRYID,
4850                                    finderArgs, this);
4851    
4852                    if (count == null) {
4853                            StringBundler query = new StringBundler(2);
4854    
4855                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
4856    
4857                            query.append(_FINDER_COLUMN_TOFILEENTRYID_TOFILEENTRYID_2);
4858    
4859                            String sql = query.toString();
4860    
4861                            Session session = null;
4862    
4863                            try {
4864                                    session = openSession();
4865    
4866                                    Query q = session.createQuery(sql);
4867    
4868                                    QueryPos qPos = QueryPos.getInstance(q);
4869    
4870                                    qPos.add(toFileEntryId);
4871    
4872                                    count = (Long)q.uniqueResult();
4873                            }
4874                            catch (Exception e) {
4875                                    throw processException(e);
4876                            }
4877                            finally {
4878                                    if (count == null) {
4879                                            count = Long.valueOf(0);
4880                                    }
4881    
4882                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TOFILEENTRYID,
4883                                            finderArgs, count);
4884    
4885                                    closeSession(session);
4886                            }
4887                    }
4888    
4889                    return count.intValue();
4890            }
4891    
4892            /**
4893             * Returns the number of document library file shortcuts where groupId = &#63; and folderId = &#63;.
4894             *
4895             * @param groupId the group ID
4896             * @param folderId the folder ID
4897             * @return the number of matching document library file shortcuts
4898             * @throws SystemException if a system exception occurred
4899             */
4900            public int countByG_F(long groupId, long folderId)
4901                    throws SystemException {
4902                    Object[] finderArgs = new Object[] { groupId, folderId };
4903    
4904                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F,
4905                                    finderArgs, this);
4906    
4907                    if (count == null) {
4908                            StringBundler query = new StringBundler(3);
4909    
4910                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
4911    
4912                            query.append(_FINDER_COLUMN_G_F_GROUPID_2);
4913    
4914                            query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
4915    
4916                            String sql = query.toString();
4917    
4918                            Session session = null;
4919    
4920                            try {
4921                                    session = openSession();
4922    
4923                                    Query q = session.createQuery(sql);
4924    
4925                                    QueryPos qPos = QueryPos.getInstance(q);
4926    
4927                                    qPos.add(groupId);
4928    
4929                                    qPos.add(folderId);
4930    
4931                                    count = (Long)q.uniqueResult();
4932                            }
4933                            catch (Exception e) {
4934                                    throw processException(e);
4935                            }
4936                            finally {
4937                                    if (count == null) {
4938                                            count = Long.valueOf(0);
4939                                    }
4940    
4941                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F, finderArgs,
4942                                            count);
4943    
4944                                    closeSession(session);
4945                            }
4946                    }
4947    
4948                    return count.intValue();
4949            }
4950    
4951            /**
4952             * Returns the number of document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63;.
4953             *
4954             * @param groupId the group ID
4955             * @param folderId the folder ID
4956             * @return the number of matching document library file shortcuts that the user has permission to view
4957             * @throws SystemException if a system exception occurred
4958             */
4959            public int filterCountByG_F(long groupId, long folderId)
4960                    throws SystemException {
4961                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
4962                            return countByG_F(groupId, folderId);
4963                    }
4964    
4965                    StringBundler query = new StringBundler(3);
4966    
4967                    query.append(_FILTER_SQL_COUNT_DLFILESHORTCUT_WHERE);
4968    
4969                    query.append(_FINDER_COLUMN_G_F_GROUPID_2);
4970    
4971                    query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
4972    
4973                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4974                                    DLFileShortcut.class.getName(),
4975                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
4976    
4977                    Session session = null;
4978    
4979                    try {
4980                            session = openSession();
4981    
4982                            SQLQuery q = session.createSQLQuery(sql);
4983    
4984                            q.addScalar(COUNT_COLUMN_NAME,
4985                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
4986    
4987                            QueryPos qPos = QueryPos.getInstance(q);
4988    
4989                            qPos.add(groupId);
4990    
4991                            qPos.add(folderId);
4992    
4993                            Long count = (Long)q.uniqueResult();
4994    
4995                            return count.intValue();
4996                    }
4997                    catch (Exception e) {
4998                            throw processException(e);
4999                    }
5000                    finally {
5001                            closeSession(session);
5002                    }
5003            }
5004    
5005            /**
5006             * Returns the number of document library file shortcuts where groupId = &#63; and folderId = &#63; and active = &#63;.
5007             *
5008             * @param groupId the group ID
5009             * @param folderId the folder ID
5010             * @param active the active
5011             * @return the number of matching document library file shortcuts
5012             * @throws SystemException if a system exception occurred
5013             */
5014            public int countByG_F_A(long groupId, long folderId, boolean active)
5015                    throws SystemException {
5016                    Object[] finderArgs = new Object[] { groupId, folderId, active };
5017    
5018                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F_A,
5019                                    finderArgs, this);
5020    
5021                    if (count == null) {
5022                            StringBundler query = new StringBundler(4);
5023    
5024                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
5025    
5026                            query.append(_FINDER_COLUMN_G_F_A_GROUPID_2);
5027    
5028                            query.append(_FINDER_COLUMN_G_F_A_FOLDERID_2);
5029    
5030                            query.append(_FINDER_COLUMN_G_F_A_ACTIVE_2);
5031    
5032                            String sql = query.toString();
5033    
5034                            Session session = null;
5035    
5036                            try {
5037                                    session = openSession();
5038    
5039                                    Query q = session.createQuery(sql);
5040    
5041                                    QueryPos qPos = QueryPos.getInstance(q);
5042    
5043                                    qPos.add(groupId);
5044    
5045                                    qPos.add(folderId);
5046    
5047                                    qPos.add(active);
5048    
5049                                    count = (Long)q.uniqueResult();
5050                            }
5051                            catch (Exception e) {
5052                                    throw processException(e);
5053                            }
5054                            finally {
5055                                    if (count == null) {
5056                                            count = Long.valueOf(0);
5057                                    }
5058    
5059                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F_A,
5060                                            finderArgs, count);
5061    
5062                                    closeSession(session);
5063                            }
5064                    }
5065    
5066                    return count.intValue();
5067            }
5068    
5069            /**
5070             * Returns the number of document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63; and active = &#63;.
5071             *
5072             * @param groupId the group ID
5073             * @param folderId the folder ID
5074             * @param active the active
5075             * @return the number of matching document library file shortcuts that the user has permission to view
5076             * @throws SystemException if a system exception occurred
5077             */
5078            public int filterCountByG_F_A(long groupId, long folderId, boolean active)
5079                    throws SystemException {
5080                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
5081                            return countByG_F_A(groupId, folderId, active);
5082                    }
5083    
5084                    StringBundler query = new StringBundler(4);
5085    
5086                    query.append(_FILTER_SQL_COUNT_DLFILESHORTCUT_WHERE);
5087    
5088                    query.append(_FINDER_COLUMN_G_F_A_GROUPID_2);
5089    
5090                    query.append(_FINDER_COLUMN_G_F_A_FOLDERID_2);
5091    
5092                    query.append(_FINDER_COLUMN_G_F_A_ACTIVE_2);
5093    
5094                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
5095                                    DLFileShortcut.class.getName(),
5096                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
5097    
5098                    Session session = null;
5099    
5100                    try {
5101                            session = openSession();
5102    
5103                            SQLQuery q = session.createSQLQuery(sql);
5104    
5105                            q.addScalar(COUNT_COLUMN_NAME,
5106                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
5107    
5108                            QueryPos qPos = QueryPos.getInstance(q);
5109    
5110                            qPos.add(groupId);
5111    
5112                            qPos.add(folderId);
5113    
5114                            qPos.add(active);
5115    
5116                            Long count = (Long)q.uniqueResult();
5117    
5118                            return count.intValue();
5119                    }
5120                    catch (Exception e) {
5121                            throw processException(e);
5122                    }
5123                    finally {
5124                            closeSession(session);
5125                    }
5126            }
5127    
5128            /**
5129             * Returns the number of document library file shortcuts where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
5130             *
5131             * @param groupId the group ID
5132             * @param folderId the folder ID
5133             * @param active the active
5134             * @param status the status
5135             * @return the number of matching document library file shortcuts
5136             * @throws SystemException if a system exception occurred
5137             */
5138            public int countByG_F_A_S(long groupId, long folderId, boolean active,
5139                    int status) throws SystemException {
5140                    Object[] finderArgs = new Object[] { groupId, folderId, active, status };
5141    
5142                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F_A_S,
5143                                    finderArgs, this);
5144    
5145                    if (count == null) {
5146                            StringBundler query = new StringBundler(5);
5147    
5148                            query.append(_SQL_COUNT_DLFILESHORTCUT_WHERE);
5149    
5150                            query.append(_FINDER_COLUMN_G_F_A_S_GROUPID_2);
5151    
5152                            query.append(_FINDER_COLUMN_G_F_A_S_FOLDERID_2);
5153    
5154                            query.append(_FINDER_COLUMN_G_F_A_S_ACTIVE_2);
5155    
5156                            query.append(_FINDER_COLUMN_G_F_A_S_STATUS_2);
5157    
5158                            String sql = query.toString();
5159    
5160                            Session session = null;
5161    
5162                            try {
5163                                    session = openSession();
5164    
5165                                    Query q = session.createQuery(sql);
5166    
5167                                    QueryPos qPos = QueryPos.getInstance(q);
5168    
5169                                    qPos.add(groupId);
5170    
5171                                    qPos.add(folderId);
5172    
5173                                    qPos.add(active);
5174    
5175                                    qPos.add(status);
5176    
5177                                    count = (Long)q.uniqueResult();
5178                            }
5179                            catch (Exception e) {
5180                                    throw processException(e);
5181                            }
5182                            finally {
5183                                    if (count == null) {
5184                                            count = Long.valueOf(0);
5185                                    }
5186    
5187                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F_A_S,
5188                                            finderArgs, count);
5189    
5190                                    closeSession(session);
5191                            }
5192                    }
5193    
5194                    return count.intValue();
5195            }
5196    
5197            /**
5198             * Returns the number of document library file shortcuts that the user has permission to view where groupId = &#63; and folderId = &#63; and active = &#63; and status = &#63;.
5199             *
5200             * @param groupId the group ID
5201             * @param folderId the folder ID
5202             * @param active the active
5203             * @param status the status
5204             * @return the number of matching document library file shortcuts that the user has permission to view
5205             * @throws SystemException if a system exception occurred
5206             */
5207            public int filterCountByG_F_A_S(long groupId, long folderId,
5208                    boolean active, int status) throws SystemException {
5209                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
5210                            return countByG_F_A_S(groupId, folderId, active, status);
5211                    }
5212    
5213                    StringBundler query = new StringBundler(5);
5214    
5215                    query.append(_FILTER_SQL_COUNT_DLFILESHORTCUT_WHERE);
5216    
5217                    query.append(_FINDER_COLUMN_G_F_A_S_GROUPID_2);
5218    
5219                    query.append(_FINDER_COLUMN_G_F_A_S_FOLDERID_2);
5220    
5221                    query.append(_FINDER_COLUMN_G_F_A_S_ACTIVE_2);
5222    
5223                    query.append(_FINDER_COLUMN_G_F_A_S_STATUS_2);
5224    
5225                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
5226                                    DLFileShortcut.class.getName(),
5227                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
5228    
5229                    Session session = null;
5230    
5231                    try {
5232                            session = openSession();
5233    
5234                            SQLQuery q = session.createSQLQuery(sql);
5235    
5236                            q.addScalar(COUNT_COLUMN_NAME,
5237                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
5238    
5239                            QueryPos qPos = QueryPos.getInstance(q);
5240    
5241                            qPos.add(groupId);
5242    
5243                            qPos.add(folderId);
5244    
5245                            qPos.add(active);
5246    
5247                            qPos.add(status);
5248    
5249                            Long count = (Long)q.uniqueResult();
5250    
5251                            return count.intValue();
5252                    }
5253                    catch (Exception e) {
5254                            throw processException(e);
5255                    }
5256                    finally {
5257                            closeSession(session);
5258                    }
5259            }
5260    
5261            /**
5262             * Returns the number of document library file shortcuts.
5263             *
5264             * @return the number of document library file shortcuts
5265             * @throws SystemException if a system exception occurred
5266             */
5267            public int countAll() throws SystemException {
5268                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
5269                                    FINDER_ARGS_EMPTY, this);
5270    
5271                    if (count == null) {
5272                            Session session = null;
5273    
5274                            try {
5275                                    session = openSession();
5276    
5277                                    Query q = session.createQuery(_SQL_COUNT_DLFILESHORTCUT);
5278    
5279                                    count = (Long)q.uniqueResult();
5280                            }
5281                            catch (Exception e) {
5282                                    throw processException(e);
5283                            }
5284                            finally {
5285                                    if (count == null) {
5286                                            count = Long.valueOf(0);
5287                                    }
5288    
5289                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
5290                                            FINDER_ARGS_EMPTY, count);
5291    
5292                                    closeSession(session);
5293                            }
5294                    }
5295    
5296                    return count.intValue();
5297            }
5298    
5299            /**
5300             * Initializes the document library file shortcut persistence.
5301             */
5302            public void afterPropertiesSet() {
5303                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
5304                                            com.liferay.portal.util.PropsUtil.get(
5305                                                    "value.object.listener.com.liferay.portlet.documentlibrary.model.DLFileShortcut")));
5306    
5307                    if (listenerClassNames.length > 0) {
5308                            try {
5309                                    List<ModelListener<DLFileShortcut>> listenersList = new ArrayList<ModelListener<DLFileShortcut>>();
5310    
5311                                    for (String listenerClassName : listenerClassNames) {
5312                                            listenersList.add((ModelListener<DLFileShortcut>)InstanceFactory.newInstance(
5313                                                            listenerClassName));
5314                                    }
5315    
5316                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
5317                            }
5318                            catch (Exception e) {
5319                                    _log.error(e);
5320                            }
5321                    }
5322            }
5323    
5324            public void destroy() {
5325                    EntityCacheUtil.removeCache(DLFileShortcutImpl.class.getName());
5326                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
5327                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
5328            }
5329    
5330            @BeanReference(type = DLContentPersistence.class)
5331            protected DLContentPersistence dlContentPersistence;
5332            @BeanReference(type = DLFileEntryPersistence.class)
5333            protected DLFileEntryPersistence dlFileEntryPersistence;
5334            @BeanReference(type = DLFileEntryMetadataPersistence.class)
5335            protected DLFileEntryMetadataPersistence dlFileEntryMetadataPersistence;
5336            @BeanReference(type = DLFileEntryTypePersistence.class)
5337            protected DLFileEntryTypePersistence dlFileEntryTypePersistence;
5338            @BeanReference(type = DLFileRankPersistence.class)
5339            protected DLFileRankPersistence dlFileRankPersistence;
5340            @BeanReference(type = DLFileShortcutPersistence.class)
5341            protected DLFileShortcutPersistence dlFileShortcutPersistence;
5342            @BeanReference(type = DLFileVersionPersistence.class)
5343            protected DLFileVersionPersistence dlFileVersionPersistence;
5344            @BeanReference(type = DLFolderPersistence.class)
5345            protected DLFolderPersistence dlFolderPersistence;
5346            @BeanReference(type = DLSyncPersistence.class)
5347            protected DLSyncPersistence dlSyncPersistence;
5348            @BeanReference(type = UserPersistence.class)
5349            protected UserPersistence userPersistence;
5350            @BeanReference(type = AssetEntryPersistence.class)
5351            protected AssetEntryPersistence assetEntryPersistence;
5352            @BeanReference(type = AssetTagPersistence.class)
5353            protected AssetTagPersistence assetTagPersistence;
5354            @BeanReference(type = TrashEntryPersistence.class)
5355            protected TrashEntryPersistence trashEntryPersistence;
5356            private static final String _SQL_SELECT_DLFILESHORTCUT = "SELECT dlFileShortcut FROM DLFileShortcut dlFileShortcut";
5357            private static final String _SQL_SELECT_DLFILESHORTCUT_WHERE = "SELECT dlFileShortcut FROM DLFileShortcut dlFileShortcut WHERE ";
5358            private static final String _SQL_COUNT_DLFILESHORTCUT = "SELECT COUNT(dlFileShortcut) FROM DLFileShortcut dlFileShortcut";
5359            private static final String _SQL_COUNT_DLFILESHORTCUT_WHERE = "SELECT COUNT(dlFileShortcut) FROM DLFileShortcut dlFileShortcut WHERE ";
5360            private static final String _FINDER_COLUMN_UUID_UUID_1 = "dlFileShortcut.uuid IS NULL";
5361            private static final String _FINDER_COLUMN_UUID_UUID_2 = "dlFileShortcut.uuid = ?";
5362            private static final String _FINDER_COLUMN_UUID_UUID_3 = "(dlFileShortcut.uuid IS NULL OR dlFileShortcut.uuid = ?)";
5363            private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "dlFileShortcut.uuid IS NULL AND ";
5364            private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "dlFileShortcut.uuid = ? AND ";
5365            private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(dlFileShortcut.uuid IS NULL OR dlFileShortcut.uuid = ?) AND ";
5366            private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "dlFileShortcut.groupId = ?";
5367            private static final String _FINDER_COLUMN_UUID_C_UUID_1 = "dlFileShortcut.uuid IS NULL AND ";
5368            private static final String _FINDER_COLUMN_UUID_C_UUID_2 = "dlFileShortcut.uuid = ? AND ";
5369            private static final String _FINDER_COLUMN_UUID_C_UUID_3 = "(dlFileShortcut.uuid IS NULL OR dlFileShortcut.uuid = ?) AND ";
5370            private static final String _FINDER_COLUMN_UUID_C_COMPANYID_2 = "dlFileShortcut.companyId = ?";
5371            private static final String _FINDER_COLUMN_TOFILEENTRYID_TOFILEENTRYID_2 = "dlFileShortcut.toFileEntryId = ?";
5372            private static final String _FINDER_COLUMN_G_F_GROUPID_2 = "dlFileShortcut.groupId = ? AND ";
5373            private static final String _FINDER_COLUMN_G_F_FOLDERID_2 = "dlFileShortcut.folderId = ?";
5374            private static final String _FINDER_COLUMN_G_F_A_GROUPID_2 = "dlFileShortcut.groupId = ? AND ";
5375            private static final String _FINDER_COLUMN_G_F_A_FOLDERID_2 = "dlFileShortcut.folderId = ? AND ";
5376            private static final String _FINDER_COLUMN_G_F_A_ACTIVE_2 = "dlFileShortcut.active = ?";
5377            private static final String _FINDER_COLUMN_G_F_A_S_GROUPID_2 = "dlFileShortcut.groupId = ? AND ";
5378            private static final String _FINDER_COLUMN_G_F_A_S_FOLDERID_2 = "dlFileShortcut.folderId = ? AND ";
5379            private static final String _FINDER_COLUMN_G_F_A_S_ACTIVE_2 = "dlFileShortcut.active = ? AND ";
5380            private static final String _FINDER_COLUMN_G_F_A_S_STATUS_2 = "dlFileShortcut.status = ?";
5381            private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "dlFileShortcut.fileShortcutId";
5382            private static final String _FILTER_SQL_SELECT_DLFILESHORTCUT_WHERE = "SELECT DISTINCT {dlFileShortcut.*} FROM DLFileShortcut dlFileShortcut WHERE ";
5383            private static final String _FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_1 =
5384                    "SELECT {DLFileShortcut.*} FROM (SELECT DISTINCT dlFileShortcut.fileShortcutId FROM DLFileShortcut dlFileShortcut WHERE ";
5385            private static final String _FILTER_SQL_SELECT_DLFILESHORTCUT_NO_INLINE_DISTINCT_WHERE_2 =
5386                    ") TEMP_TABLE INNER JOIN DLFileShortcut ON TEMP_TABLE.fileShortcutId = DLFileShortcut.fileShortcutId";
5387            private static final String _FILTER_SQL_COUNT_DLFILESHORTCUT_WHERE = "SELECT COUNT(DISTINCT dlFileShortcut.fileShortcutId) AS COUNT_VALUE FROM DLFileShortcut dlFileShortcut WHERE ";
5388            private static final String _FILTER_ENTITY_ALIAS = "dlFileShortcut";
5389            private static final String _FILTER_ENTITY_TABLE = "DLFileShortcut";
5390            private static final String _ORDER_BY_ENTITY_ALIAS = "dlFileShortcut.";
5391            private static final String _ORDER_BY_ENTITY_TABLE = "DLFileShortcut.";
5392            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DLFileShortcut exists with the primary key ";
5393            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DLFileShortcut exists with the key {";
5394            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
5395            private static Log _log = LogFactoryUtil.getLog(DLFileShortcutPersistenceImpl.class);
5396            private static DLFileShortcut _nullDLFileShortcut = new DLFileShortcutImpl() {
5397                            @Override
5398                            public Object clone() {
5399                                    return this;
5400                            }
5401    
5402                            @Override
5403                            public CacheModel<DLFileShortcut> toCacheModel() {
5404                                    return _nullDLFileShortcutCacheModel;
5405                            }
5406                    };
5407    
5408            private static CacheModel<DLFileShortcut> _nullDLFileShortcutCacheModel = new CacheModel<DLFileShortcut>() {
5409                            public DLFileShortcut toEntityModel() {
5410                                    return _nullDLFileShortcut;
5411                            }
5412                    };
5413    }