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