001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.NoSuchListTypeException;
018    import com.liferay.portal.NoSuchModelException;
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.kernel.util.Validator;
038    import com.liferay.portal.model.CacheModel;
039    import com.liferay.portal.model.ListType;
040    import com.liferay.portal.model.ModelListener;
041    import com.liferay.portal.model.impl.ListTypeImpl;
042    import com.liferay.portal.model.impl.ListTypeModelImpl;
043    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
044    
045    import java.io.Serializable;
046    
047    import java.util.ArrayList;
048    import java.util.Collections;
049    import java.util.List;
050    
051    /**
052     * The persistence implementation for the list type service.
053     *
054     * <p>
055     * Caching information and settings can be found in <code>portal.properties</code>
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see ListTypePersistence
060     * @see ListTypeUtil
061     * @generated
062     */
063    public class ListTypePersistenceImpl extends BasePersistenceImpl<ListType>
064            implements ListTypePersistence {
065            /*
066             * NOTE FOR DEVELOPERS:
067             *
068             * Never modify or reference this class directly. Always use {@link ListTypeUtil} to access the list type persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
069             */
070            public static final String FINDER_CLASS_NAME_ENTITY = ListTypeImpl.class.getName();
071            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
072                    ".List1";
073            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074                    ".List2";
075            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_TYPE = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
076                            ListTypeModelImpl.FINDER_CACHE_ENABLED, ListTypeImpl.class,
077                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByType",
078                            new String[] {
079                                    String.class.getName(),
080                                    
081                            "java.lang.Integer", "java.lang.Integer",
082                                    "com.liferay.portal.kernel.util.OrderByComparator"
083                            });
084            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
085                            ListTypeModelImpl.FINDER_CACHE_ENABLED, ListTypeImpl.class,
086                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByType",
087                            new String[] { String.class.getName() },
088                            ListTypeModelImpl.TYPE_COLUMN_BITMASK);
089            public static final FinderPath FINDER_PATH_COUNT_BY_TYPE = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
090                            ListTypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
091                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByType",
092                            new String[] { String.class.getName() });
093            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
094                            ListTypeModelImpl.FINDER_CACHE_ENABLED, ListTypeImpl.class,
095                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
096            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
097                            ListTypeModelImpl.FINDER_CACHE_ENABLED, ListTypeImpl.class,
098                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
099            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
100                            ListTypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
101                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
102    
103            /**
104             * Caches the list type in the entity cache if it is enabled.
105             *
106             * @param listType the list type
107             */
108            public void cacheResult(ListType listType) {
109                    EntityCacheUtil.putResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
110                            ListTypeImpl.class, listType.getPrimaryKey(), listType);
111    
112                    listType.resetOriginalValues();
113            }
114    
115            /**
116             * Caches the list types in the entity cache if it is enabled.
117             *
118             * @param listTypes the list types
119             */
120            public void cacheResult(List<ListType> listTypes) {
121                    for (ListType listType : listTypes) {
122                            if (EntityCacheUtil.getResult(
123                                                    ListTypeModelImpl.ENTITY_CACHE_ENABLED,
124                                                    ListTypeImpl.class, listType.getPrimaryKey()) == null) {
125                                    cacheResult(listType);
126                            }
127                            else {
128                                    listType.resetOriginalValues();
129                            }
130                    }
131            }
132    
133            /**
134             * Clears the cache for all list types.
135             *
136             * <p>
137             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
138             * </p>
139             */
140            @Override
141            public void clearCache() {
142                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
143                            CacheRegistryUtil.clear(ListTypeImpl.class.getName());
144                    }
145    
146                    EntityCacheUtil.clearCache(ListTypeImpl.class.getName());
147    
148                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
149                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
150                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
151            }
152    
153            /**
154             * Clears the cache for the list type.
155             *
156             * <p>
157             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
158             * </p>
159             */
160            @Override
161            public void clearCache(ListType listType) {
162                    EntityCacheUtil.removeResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
163                            ListTypeImpl.class, listType.getPrimaryKey());
164    
165                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
166                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
167            }
168    
169            @Override
170            public void clearCache(List<ListType> listTypes) {
171                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
172                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
173    
174                    for (ListType listType : listTypes) {
175                            EntityCacheUtil.removeResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
176                                    ListTypeImpl.class, listType.getPrimaryKey());
177                    }
178            }
179    
180            /**
181             * Creates a new list type with the primary key. Does not add the list type to the database.
182             *
183             * @param listTypeId the primary key for the new list type
184             * @return the new list type
185             */
186            public ListType create(int listTypeId) {
187                    ListType listType = new ListTypeImpl();
188    
189                    listType.setNew(true);
190                    listType.setPrimaryKey(listTypeId);
191    
192                    return listType;
193            }
194    
195            /**
196             * Removes the list type with the primary key from the database. Also notifies the appropriate model listeners.
197             *
198             * @param listTypeId the primary key of the list type
199             * @return the list type that was removed
200             * @throws com.liferay.portal.NoSuchListTypeException if a list type with the primary key could not be found
201             * @throws SystemException if a system exception occurred
202             */
203            public ListType remove(int listTypeId)
204                    throws NoSuchListTypeException, SystemException {
205                    return remove(Integer.valueOf(listTypeId));
206            }
207    
208            /**
209             * Removes the list type with the primary key from the database. Also notifies the appropriate model listeners.
210             *
211             * @param primaryKey the primary key of the list type
212             * @return the list type that was removed
213             * @throws com.liferay.portal.NoSuchListTypeException if a list type with the primary key could not be found
214             * @throws SystemException if a system exception occurred
215             */
216            @Override
217            public ListType remove(Serializable primaryKey)
218                    throws NoSuchListTypeException, SystemException {
219                    Session session = null;
220    
221                    try {
222                            session = openSession();
223    
224                            ListType listType = (ListType)session.get(ListTypeImpl.class,
225                                            primaryKey);
226    
227                            if (listType == null) {
228                                    if (_log.isWarnEnabled()) {
229                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
230                                    }
231    
232                                    throw new NoSuchListTypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
233                                            primaryKey);
234                            }
235    
236                            return remove(listType);
237                    }
238                    catch (NoSuchListTypeException nsee) {
239                            throw nsee;
240                    }
241                    catch (Exception e) {
242                            throw processException(e);
243                    }
244                    finally {
245                            closeSession(session);
246                    }
247            }
248    
249            @Override
250            protected ListType removeImpl(ListType listType) throws SystemException {
251                    listType = toUnwrappedModel(listType);
252    
253                    Session session = null;
254    
255                    try {
256                            session = openSession();
257    
258                            BatchSessionUtil.delete(session, listType);
259                    }
260                    catch (Exception e) {
261                            throw processException(e);
262                    }
263                    finally {
264                            closeSession(session);
265                    }
266    
267                    clearCache(listType);
268    
269                    return listType;
270            }
271    
272            @Override
273            public ListType updateImpl(com.liferay.portal.model.ListType listType,
274                    boolean merge) throws SystemException {
275                    listType = toUnwrappedModel(listType);
276    
277                    boolean isNew = listType.isNew();
278    
279                    ListTypeModelImpl listTypeModelImpl = (ListTypeModelImpl)listType;
280    
281                    Session session = null;
282    
283                    try {
284                            session = openSession();
285    
286                            BatchSessionUtil.update(session, listType, merge);
287    
288                            listType.setNew(false);
289                    }
290                    catch (Exception e) {
291                            throw processException(e);
292                    }
293                    finally {
294                            closeSession(session);
295                    }
296    
297                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
298    
299                    if (isNew || !ListTypeModelImpl.COLUMN_BITMASK_ENABLED) {
300                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
301                    }
302                    else {
303                            if ((listTypeModelImpl.getColumnBitmask() &
304                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE.getColumnBitmask()) != 0) {
305                                    Object[] args = new Object[] { listTypeModelImpl.getOriginalType() };
306    
307                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TYPE, args);
308                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE,
309                                            args);
310    
311                                    args = new Object[] { listTypeModelImpl.getType() };
312    
313                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TYPE, args);
314                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE,
315                                            args);
316                            }
317                    }
318    
319                    EntityCacheUtil.putResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
320                            ListTypeImpl.class, listType.getPrimaryKey(), listType);
321    
322                    return listType;
323            }
324    
325            protected ListType toUnwrappedModel(ListType listType) {
326                    if (listType instanceof ListTypeImpl) {
327                            return listType;
328                    }
329    
330                    ListTypeImpl listTypeImpl = new ListTypeImpl();
331    
332                    listTypeImpl.setNew(listType.isNew());
333                    listTypeImpl.setPrimaryKey(listType.getPrimaryKey());
334    
335                    listTypeImpl.setListTypeId(listType.getListTypeId());
336                    listTypeImpl.setName(listType.getName());
337                    listTypeImpl.setType(listType.getType());
338    
339                    return listTypeImpl;
340            }
341    
342            /**
343             * Returns the list type with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
344             *
345             * @param primaryKey the primary key of the list type
346             * @return the list type
347             * @throws com.liferay.portal.NoSuchModelException if a list type with the primary key could not be found
348             * @throws SystemException if a system exception occurred
349             */
350            @Override
351            public ListType findByPrimaryKey(Serializable primaryKey)
352                    throws NoSuchModelException, SystemException {
353                    return findByPrimaryKey(((Integer)primaryKey).intValue());
354            }
355    
356            /**
357             * Returns the list type with the primary key or throws a {@link com.liferay.portal.NoSuchListTypeException} if it could not be found.
358             *
359             * @param listTypeId the primary key of the list type
360             * @return the list type
361             * @throws com.liferay.portal.NoSuchListTypeException if a list type with the primary key could not be found
362             * @throws SystemException if a system exception occurred
363             */
364            public ListType findByPrimaryKey(int listTypeId)
365                    throws NoSuchListTypeException, SystemException {
366                    ListType listType = fetchByPrimaryKey(listTypeId);
367    
368                    if (listType == null) {
369                            if (_log.isWarnEnabled()) {
370                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + listTypeId);
371                            }
372    
373                            throw new NoSuchListTypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
374                                    listTypeId);
375                    }
376    
377                    return listType;
378            }
379    
380            /**
381             * Returns the list type with the primary key or returns <code>null</code> if it could not be found.
382             *
383             * @param primaryKey the primary key of the list type
384             * @return the list type, or <code>null</code> if a list type with the primary key could not be found
385             * @throws SystemException if a system exception occurred
386             */
387            @Override
388            public ListType fetchByPrimaryKey(Serializable primaryKey)
389                    throws SystemException {
390                    return fetchByPrimaryKey(((Integer)primaryKey).intValue());
391            }
392    
393            /**
394             * Returns the list type with the primary key or returns <code>null</code> if it could not be found.
395             *
396             * @param listTypeId the primary key of the list type
397             * @return the list type, or <code>null</code> if a list type with the primary key could not be found
398             * @throws SystemException if a system exception occurred
399             */
400            public ListType fetchByPrimaryKey(int listTypeId) throws SystemException {
401                    ListType listType = (ListType)EntityCacheUtil.getResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
402                                    ListTypeImpl.class, listTypeId);
403    
404                    if (listType == _nullListType) {
405                            return null;
406                    }
407    
408                    if (listType == null) {
409                            Session session = null;
410    
411                            boolean hasException = false;
412    
413                            try {
414                                    session = openSession();
415    
416                                    listType = (ListType)session.get(ListTypeImpl.class,
417                                                    Integer.valueOf(listTypeId));
418                            }
419                            catch (Exception e) {
420                                    hasException = true;
421    
422                                    throw processException(e);
423                            }
424                            finally {
425                                    if (listType != null) {
426                                            cacheResult(listType);
427                                    }
428                                    else if (!hasException) {
429                                            EntityCacheUtil.putResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
430                                                    ListTypeImpl.class, listTypeId, _nullListType);
431                                    }
432    
433                                    closeSession(session);
434                            }
435                    }
436    
437                    return listType;
438            }
439    
440            /**
441             * Returns all the list types where type = &#63;.
442             *
443             * @param type the type
444             * @return the matching list types
445             * @throws SystemException if a system exception occurred
446             */
447            public List<ListType> findByType(String type) throws SystemException {
448                    return findByType(type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
449            }
450    
451            /**
452             * Returns a range of all the list types where type = &#63;.
453             *
454             * <p>
455             * 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.
456             * </p>
457             *
458             * @param type the type
459             * @param start the lower bound of the range of list types
460             * @param end the upper bound of the range of list types (not inclusive)
461             * @return the range of matching list types
462             * @throws SystemException if a system exception occurred
463             */
464            public List<ListType> findByType(String type, int start, int end)
465                    throws SystemException {
466                    return findByType(type, start, end, null);
467            }
468    
469            /**
470             * Returns an ordered range of all the list types where type = &#63;.
471             *
472             * <p>
473             * 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.
474             * </p>
475             *
476             * @param type the type
477             * @param start the lower bound of the range of list types
478             * @param end the upper bound of the range of list types (not inclusive)
479             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
480             * @return the ordered range of matching list types
481             * @throws SystemException if a system exception occurred
482             */
483            public List<ListType> findByType(String type, int start, int end,
484                    OrderByComparator orderByComparator) throws SystemException {
485                    FinderPath finderPath = null;
486                    Object[] finderArgs = null;
487    
488                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
489                                    (orderByComparator == null)) {
490                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE;
491                            finderArgs = new Object[] { type };
492                    }
493                    else {
494                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TYPE;
495                            finderArgs = new Object[] { type, start, end, orderByComparator };
496                    }
497    
498                    List<ListType> list = (List<ListType>)FinderCacheUtil.getResult(finderPath,
499                                    finderArgs, this);
500    
501                    if ((list != null) && !list.isEmpty()) {
502                            for (ListType listType : list) {
503                                    if (!Validator.equals(type, listType.getType())) {
504                                            list = null;
505    
506                                            break;
507                                    }
508                            }
509                    }
510    
511                    if (list == null) {
512                            StringBundler query = null;
513    
514                            if (orderByComparator != null) {
515                                    query = new StringBundler(3 +
516                                                    (orderByComparator.getOrderByFields().length * 3));
517                            }
518                            else {
519                                    query = new StringBundler(3);
520                            }
521    
522                            query.append(_SQL_SELECT_LISTTYPE_WHERE);
523    
524                            if (type == null) {
525                                    query.append(_FINDER_COLUMN_TYPE_TYPE_1);
526                            }
527                            else {
528                                    if (type.equals(StringPool.BLANK)) {
529                                            query.append(_FINDER_COLUMN_TYPE_TYPE_3);
530                                    }
531                                    else {
532                                            query.append(_FINDER_COLUMN_TYPE_TYPE_2);
533                                    }
534                            }
535    
536                            if (orderByComparator != null) {
537                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
538                                            orderByComparator);
539                            }
540    
541                            else {
542                                    query.append(ListTypeModelImpl.ORDER_BY_JPQL);
543                            }
544    
545                            String sql = query.toString();
546    
547                            Session session = null;
548    
549                            try {
550                                    session = openSession();
551    
552                                    Query q = session.createQuery(sql);
553    
554                                    QueryPos qPos = QueryPos.getInstance(q);
555    
556                                    if (type != null) {
557                                            qPos.add(type);
558                                    }
559    
560                                    list = (List<ListType>)QueryUtil.list(q, getDialect(), start,
561                                                    end);
562                            }
563                            catch (Exception e) {
564                                    throw processException(e);
565                            }
566                            finally {
567                                    if (list == null) {
568                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
569                                    }
570                                    else {
571                                            cacheResult(list);
572    
573                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
574                                    }
575    
576                                    closeSession(session);
577                            }
578                    }
579    
580                    return list;
581            }
582    
583            /**
584             * Returns the first list type in the ordered set where type = &#63;.
585             *
586             * <p>
587             * 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.
588             * </p>
589             *
590             * @param type the type
591             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
592             * @return the first matching list type
593             * @throws com.liferay.portal.NoSuchListTypeException if a matching list type could not be found
594             * @throws SystemException if a system exception occurred
595             */
596            public ListType findByType_First(String type,
597                    OrderByComparator orderByComparator)
598                    throws NoSuchListTypeException, SystemException {
599                    List<ListType> list = findByType(type, 0, 1, orderByComparator);
600    
601                    if (list.isEmpty()) {
602                            StringBundler msg = new StringBundler(4);
603    
604                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
605    
606                            msg.append("type=");
607                            msg.append(type);
608    
609                            msg.append(StringPool.CLOSE_CURLY_BRACE);
610    
611                            throw new NoSuchListTypeException(msg.toString());
612                    }
613                    else {
614                            return list.get(0);
615                    }
616            }
617    
618            /**
619             * Returns the last list type in the ordered set where type = &#63;.
620             *
621             * <p>
622             * 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.
623             * </p>
624             *
625             * @param type the type
626             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
627             * @return the last matching list type
628             * @throws com.liferay.portal.NoSuchListTypeException if a matching list type could not be found
629             * @throws SystemException if a system exception occurred
630             */
631            public ListType findByType_Last(String type,
632                    OrderByComparator orderByComparator)
633                    throws NoSuchListTypeException, SystemException {
634                    int count = countByType(type);
635    
636                    List<ListType> list = findByType(type, count - 1, count,
637                                    orderByComparator);
638    
639                    if (list.isEmpty()) {
640                            StringBundler msg = new StringBundler(4);
641    
642                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
643    
644                            msg.append("type=");
645                            msg.append(type);
646    
647                            msg.append(StringPool.CLOSE_CURLY_BRACE);
648    
649                            throw new NoSuchListTypeException(msg.toString());
650                    }
651                    else {
652                            return list.get(0);
653                    }
654            }
655    
656            /**
657             * Returns the list types before and after the current list type in the ordered set where type = &#63;.
658             *
659             * <p>
660             * 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.
661             * </p>
662             *
663             * @param listTypeId the primary key of the current list type
664             * @param type the type
665             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
666             * @return the previous, current, and next list type
667             * @throws com.liferay.portal.NoSuchListTypeException if a list type with the primary key could not be found
668             * @throws SystemException if a system exception occurred
669             */
670            public ListType[] findByType_PrevAndNext(int listTypeId, String type,
671                    OrderByComparator orderByComparator)
672                    throws NoSuchListTypeException, SystemException {
673                    ListType listType = findByPrimaryKey(listTypeId);
674    
675                    Session session = null;
676    
677                    try {
678                            session = openSession();
679    
680                            ListType[] array = new ListTypeImpl[3];
681    
682                            array[0] = getByType_PrevAndNext(session, listType, type,
683                                            orderByComparator, true);
684    
685                            array[1] = listType;
686    
687                            array[2] = getByType_PrevAndNext(session, listType, type,
688                                            orderByComparator, false);
689    
690                            return array;
691                    }
692                    catch (Exception e) {
693                            throw processException(e);
694                    }
695                    finally {
696                            closeSession(session);
697                    }
698            }
699    
700            protected ListType getByType_PrevAndNext(Session session,
701                    ListType listType, String type, OrderByComparator orderByComparator,
702                    boolean previous) {
703                    StringBundler query = null;
704    
705                    if (orderByComparator != null) {
706                            query = new StringBundler(6 +
707                                            (orderByComparator.getOrderByFields().length * 6));
708                    }
709                    else {
710                            query = new StringBundler(3);
711                    }
712    
713                    query.append(_SQL_SELECT_LISTTYPE_WHERE);
714    
715                    if (type == null) {
716                            query.append(_FINDER_COLUMN_TYPE_TYPE_1);
717                    }
718                    else {
719                            if (type.equals(StringPool.BLANK)) {
720                                    query.append(_FINDER_COLUMN_TYPE_TYPE_3);
721                            }
722                            else {
723                                    query.append(_FINDER_COLUMN_TYPE_TYPE_2);
724                            }
725                    }
726    
727                    if (orderByComparator != null) {
728                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
729    
730                            if (orderByConditionFields.length > 0) {
731                                    query.append(WHERE_AND);
732                            }
733    
734                            for (int i = 0; i < orderByConditionFields.length; i++) {
735                                    query.append(_ORDER_BY_ENTITY_ALIAS);
736                                    query.append(orderByConditionFields[i]);
737    
738                                    if ((i + 1) < orderByConditionFields.length) {
739                                            if (orderByComparator.isAscending() ^ previous) {
740                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
741                                            }
742                                            else {
743                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
744                                            }
745                                    }
746                                    else {
747                                            if (orderByComparator.isAscending() ^ previous) {
748                                                    query.append(WHERE_GREATER_THAN);
749                                            }
750                                            else {
751                                                    query.append(WHERE_LESSER_THAN);
752                                            }
753                                    }
754                            }
755    
756                            query.append(ORDER_BY_CLAUSE);
757    
758                            String[] orderByFields = orderByComparator.getOrderByFields();
759    
760                            for (int i = 0; i < orderByFields.length; i++) {
761                                    query.append(_ORDER_BY_ENTITY_ALIAS);
762                                    query.append(orderByFields[i]);
763    
764                                    if ((i + 1) < orderByFields.length) {
765                                            if (orderByComparator.isAscending() ^ previous) {
766                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
767                                            }
768                                            else {
769                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
770                                            }
771                                    }
772                                    else {
773                                            if (orderByComparator.isAscending() ^ previous) {
774                                                    query.append(ORDER_BY_ASC);
775                                            }
776                                            else {
777                                                    query.append(ORDER_BY_DESC);
778                                            }
779                                    }
780                            }
781                    }
782    
783                    else {
784                            query.append(ListTypeModelImpl.ORDER_BY_JPQL);
785                    }
786    
787                    String sql = query.toString();
788    
789                    Query q = session.createQuery(sql);
790    
791                    q.setFirstResult(0);
792                    q.setMaxResults(2);
793    
794                    QueryPos qPos = QueryPos.getInstance(q);
795    
796                    if (type != null) {
797                            qPos.add(type);
798                    }
799    
800                    if (orderByComparator != null) {
801                            Object[] values = orderByComparator.getOrderByConditionValues(listType);
802    
803                            for (Object value : values) {
804                                    qPos.add(value);
805                            }
806                    }
807    
808                    List<ListType> list = q.list();
809    
810                    if (list.size() == 2) {
811                            return list.get(1);
812                    }
813                    else {
814                            return null;
815                    }
816            }
817    
818            /**
819             * Returns all the list types.
820             *
821             * @return the list types
822             * @throws SystemException if a system exception occurred
823             */
824            public List<ListType> findAll() throws SystemException {
825                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
826            }
827    
828            /**
829             * Returns a range of all the list types.
830             *
831             * <p>
832             * 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.
833             * </p>
834             *
835             * @param start the lower bound of the range of list types
836             * @param end the upper bound of the range of list types (not inclusive)
837             * @return the range of list types
838             * @throws SystemException if a system exception occurred
839             */
840            public List<ListType> findAll(int start, int end) throws SystemException {
841                    return findAll(start, end, null);
842            }
843    
844            /**
845             * Returns an ordered range of all the list types.
846             *
847             * <p>
848             * 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.
849             * </p>
850             *
851             * @param start the lower bound of the range of list types
852             * @param end the upper bound of the range of list types (not inclusive)
853             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
854             * @return the ordered range of list types
855             * @throws SystemException if a system exception occurred
856             */
857            public List<ListType> findAll(int start, int end,
858                    OrderByComparator orderByComparator) throws SystemException {
859                    FinderPath finderPath = null;
860                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
861    
862                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
863                                    (orderByComparator == null)) {
864                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
865                            finderArgs = FINDER_ARGS_EMPTY;
866                    }
867                    else {
868                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
869                            finderArgs = new Object[] { start, end, orderByComparator };
870                    }
871    
872                    List<ListType> list = (List<ListType>)FinderCacheUtil.getResult(finderPath,
873                                    finderArgs, this);
874    
875                    if (list == null) {
876                            StringBundler query = null;
877                            String sql = null;
878    
879                            if (orderByComparator != null) {
880                                    query = new StringBundler(2 +
881                                                    (orderByComparator.getOrderByFields().length * 3));
882    
883                                    query.append(_SQL_SELECT_LISTTYPE);
884    
885                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
886                                            orderByComparator);
887    
888                                    sql = query.toString();
889                            }
890                            else {
891                                    sql = _SQL_SELECT_LISTTYPE.concat(ListTypeModelImpl.ORDER_BY_JPQL);
892                            }
893    
894                            Session session = null;
895    
896                            try {
897                                    session = openSession();
898    
899                                    Query q = session.createQuery(sql);
900    
901                                    if (orderByComparator == null) {
902                                            list = (List<ListType>)QueryUtil.list(q, getDialect(),
903                                                            start, end, false);
904    
905                                            Collections.sort(list);
906                                    }
907                                    else {
908                                            list = (List<ListType>)QueryUtil.list(q, getDialect(),
909                                                            start, end);
910                                    }
911                            }
912                            catch (Exception e) {
913                                    throw processException(e);
914                            }
915                            finally {
916                                    if (list == null) {
917                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
918                                    }
919                                    else {
920                                            cacheResult(list);
921    
922                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
923                                    }
924    
925                                    closeSession(session);
926                            }
927                    }
928    
929                    return list;
930            }
931    
932            /**
933             * Removes all the list types where type = &#63; from the database.
934             *
935             * @param type the type
936             * @throws SystemException if a system exception occurred
937             */
938            public void removeByType(String type) throws SystemException {
939                    for (ListType listType : findByType(type)) {
940                            remove(listType);
941                    }
942            }
943    
944            /**
945             * Removes all the list types from the database.
946             *
947             * @throws SystemException if a system exception occurred
948             */
949            public void removeAll() throws SystemException {
950                    for (ListType listType : findAll()) {
951                            remove(listType);
952                    }
953            }
954    
955            /**
956             * Returns the number of list types where type = &#63;.
957             *
958             * @param type the type
959             * @return the number of matching list types
960             * @throws SystemException if a system exception occurred
961             */
962            public int countByType(String type) throws SystemException {
963                    Object[] finderArgs = new Object[] { type };
964    
965                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TYPE,
966                                    finderArgs, this);
967    
968                    if (count == null) {
969                            StringBundler query = new StringBundler(2);
970    
971                            query.append(_SQL_COUNT_LISTTYPE_WHERE);
972    
973                            if (type == null) {
974                                    query.append(_FINDER_COLUMN_TYPE_TYPE_1);
975                            }
976                            else {
977                                    if (type.equals(StringPool.BLANK)) {
978                                            query.append(_FINDER_COLUMN_TYPE_TYPE_3);
979                                    }
980                                    else {
981                                            query.append(_FINDER_COLUMN_TYPE_TYPE_2);
982                                    }
983                            }
984    
985                            String sql = query.toString();
986    
987                            Session session = null;
988    
989                            try {
990                                    session = openSession();
991    
992                                    Query q = session.createQuery(sql);
993    
994                                    QueryPos qPos = QueryPos.getInstance(q);
995    
996                                    if (type != null) {
997                                            qPos.add(type);
998                                    }
999    
1000                                    count = (Long)q.uniqueResult();
1001                            }
1002                            catch (Exception e) {
1003                                    throw processException(e);
1004                            }
1005                            finally {
1006                                    if (count == null) {
1007                                            count = Long.valueOf(0);
1008                                    }
1009    
1010                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TYPE,
1011                                            finderArgs, count);
1012    
1013                                    closeSession(session);
1014                            }
1015                    }
1016    
1017                    return count.intValue();
1018            }
1019    
1020            /**
1021             * Returns the number of list types.
1022             *
1023             * @return the number of list types
1024             * @throws SystemException if a system exception occurred
1025             */
1026            public int countAll() throws SystemException {
1027                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1028                                    FINDER_ARGS_EMPTY, this);
1029    
1030                    if (count == null) {
1031                            Session session = null;
1032    
1033                            try {
1034                                    session = openSession();
1035    
1036                                    Query q = session.createQuery(_SQL_COUNT_LISTTYPE);
1037    
1038                                    count = (Long)q.uniqueResult();
1039                            }
1040                            catch (Exception e) {
1041                                    throw processException(e);
1042                            }
1043                            finally {
1044                                    if (count == null) {
1045                                            count = Long.valueOf(0);
1046                                    }
1047    
1048                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1049                                            FINDER_ARGS_EMPTY, count);
1050    
1051                                    closeSession(session);
1052                            }
1053                    }
1054    
1055                    return count.intValue();
1056            }
1057    
1058            /**
1059             * Initializes the list type persistence.
1060             */
1061            public void afterPropertiesSet() {
1062                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1063                                            com.liferay.portal.util.PropsUtil.get(
1064                                                    "value.object.listener.com.liferay.portal.model.ListType")));
1065    
1066                    if (listenerClassNames.length > 0) {
1067                            try {
1068                                    List<ModelListener<ListType>> listenersList = new ArrayList<ModelListener<ListType>>();
1069    
1070                                    for (String listenerClassName : listenerClassNames) {
1071                                            listenersList.add((ModelListener<ListType>)InstanceFactory.newInstance(
1072                                                            listenerClassName));
1073                                    }
1074    
1075                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1076                            }
1077                            catch (Exception e) {
1078                                    _log.error(e);
1079                            }
1080                    }
1081            }
1082    
1083            public void destroy() {
1084                    EntityCacheUtil.removeCache(ListTypeImpl.class.getName());
1085                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1086                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1087            }
1088    
1089            @BeanReference(type = AccountPersistence.class)
1090            protected AccountPersistence accountPersistence;
1091            @BeanReference(type = AddressPersistence.class)
1092            protected AddressPersistence addressPersistence;
1093            @BeanReference(type = BrowserTrackerPersistence.class)
1094            protected BrowserTrackerPersistence browserTrackerPersistence;
1095            @BeanReference(type = ClassNamePersistence.class)
1096            protected ClassNamePersistence classNamePersistence;
1097            @BeanReference(type = ClusterGroupPersistence.class)
1098            protected ClusterGroupPersistence clusterGroupPersistence;
1099            @BeanReference(type = CompanyPersistence.class)
1100            protected CompanyPersistence companyPersistence;
1101            @BeanReference(type = ContactPersistence.class)
1102            protected ContactPersistence contactPersistence;
1103            @BeanReference(type = CountryPersistence.class)
1104            protected CountryPersistence countryPersistence;
1105            @BeanReference(type = EmailAddressPersistence.class)
1106            protected EmailAddressPersistence emailAddressPersistence;
1107            @BeanReference(type = GroupPersistence.class)
1108            protected GroupPersistence groupPersistence;
1109            @BeanReference(type = ImagePersistence.class)
1110            protected ImagePersistence imagePersistence;
1111            @BeanReference(type = LayoutPersistence.class)
1112            protected LayoutPersistence layoutPersistence;
1113            @BeanReference(type = LayoutBranchPersistence.class)
1114            protected LayoutBranchPersistence layoutBranchPersistence;
1115            @BeanReference(type = LayoutPrototypePersistence.class)
1116            protected LayoutPrototypePersistence layoutPrototypePersistence;
1117            @BeanReference(type = LayoutRevisionPersistence.class)
1118            protected LayoutRevisionPersistence layoutRevisionPersistence;
1119            @BeanReference(type = LayoutSetPersistence.class)
1120            protected LayoutSetPersistence layoutSetPersistence;
1121            @BeanReference(type = LayoutSetBranchPersistence.class)
1122            protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1123            @BeanReference(type = LayoutSetPrototypePersistence.class)
1124            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1125            @BeanReference(type = ListTypePersistence.class)
1126            protected ListTypePersistence listTypePersistence;
1127            @BeanReference(type = LockPersistence.class)
1128            protected LockPersistence lockPersistence;
1129            @BeanReference(type = MembershipRequestPersistence.class)
1130            protected MembershipRequestPersistence membershipRequestPersistence;
1131            @BeanReference(type = OrganizationPersistence.class)
1132            protected OrganizationPersistence organizationPersistence;
1133            @BeanReference(type = OrgGroupPermissionPersistence.class)
1134            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1135            @BeanReference(type = OrgGroupRolePersistence.class)
1136            protected OrgGroupRolePersistence orgGroupRolePersistence;
1137            @BeanReference(type = OrgLaborPersistence.class)
1138            protected OrgLaborPersistence orgLaborPersistence;
1139            @BeanReference(type = PasswordPolicyPersistence.class)
1140            protected PasswordPolicyPersistence passwordPolicyPersistence;
1141            @BeanReference(type = PasswordPolicyRelPersistence.class)
1142            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1143            @BeanReference(type = PasswordTrackerPersistence.class)
1144            protected PasswordTrackerPersistence passwordTrackerPersistence;
1145            @BeanReference(type = PermissionPersistence.class)
1146            protected PermissionPersistence permissionPersistence;
1147            @BeanReference(type = PhonePersistence.class)
1148            protected PhonePersistence phonePersistence;
1149            @BeanReference(type = PluginSettingPersistence.class)
1150            protected PluginSettingPersistence pluginSettingPersistence;
1151            @BeanReference(type = PortalPreferencesPersistence.class)
1152            protected PortalPreferencesPersistence portalPreferencesPersistence;
1153            @BeanReference(type = PortletPersistence.class)
1154            protected PortletPersistence portletPersistence;
1155            @BeanReference(type = PortletItemPersistence.class)
1156            protected PortletItemPersistence portletItemPersistence;
1157            @BeanReference(type = PortletPreferencesPersistence.class)
1158            protected PortletPreferencesPersistence portletPreferencesPersistence;
1159            @BeanReference(type = RegionPersistence.class)
1160            protected RegionPersistence regionPersistence;
1161            @BeanReference(type = ReleasePersistence.class)
1162            protected ReleasePersistence releasePersistence;
1163            @BeanReference(type = RepositoryPersistence.class)
1164            protected RepositoryPersistence repositoryPersistence;
1165            @BeanReference(type = RepositoryEntryPersistence.class)
1166            protected RepositoryEntryPersistence repositoryEntryPersistence;
1167            @BeanReference(type = ResourcePersistence.class)
1168            protected ResourcePersistence resourcePersistence;
1169            @BeanReference(type = ResourceActionPersistence.class)
1170            protected ResourceActionPersistence resourceActionPersistence;
1171            @BeanReference(type = ResourceBlockPersistence.class)
1172            protected ResourceBlockPersistence resourceBlockPersistence;
1173            @BeanReference(type = ResourceBlockPermissionPersistence.class)
1174            protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1175            @BeanReference(type = ResourceCodePersistence.class)
1176            protected ResourceCodePersistence resourceCodePersistence;
1177            @BeanReference(type = ResourcePermissionPersistence.class)
1178            protected ResourcePermissionPersistence resourcePermissionPersistence;
1179            @BeanReference(type = ResourceTypePermissionPersistence.class)
1180            protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1181            @BeanReference(type = RolePersistence.class)
1182            protected RolePersistence rolePersistence;
1183            @BeanReference(type = ServiceComponentPersistence.class)
1184            protected ServiceComponentPersistence serviceComponentPersistence;
1185            @BeanReference(type = ShardPersistence.class)
1186            protected ShardPersistence shardPersistence;
1187            @BeanReference(type = SubscriptionPersistence.class)
1188            protected SubscriptionPersistence subscriptionPersistence;
1189            @BeanReference(type = TeamPersistence.class)
1190            protected TeamPersistence teamPersistence;
1191            @BeanReference(type = TicketPersistence.class)
1192            protected TicketPersistence ticketPersistence;
1193            @BeanReference(type = UserPersistence.class)
1194            protected UserPersistence userPersistence;
1195            @BeanReference(type = UserGroupPersistence.class)
1196            protected UserGroupPersistence userGroupPersistence;
1197            @BeanReference(type = UserGroupGroupRolePersistence.class)
1198            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1199            @BeanReference(type = UserGroupRolePersistence.class)
1200            protected UserGroupRolePersistence userGroupRolePersistence;
1201            @BeanReference(type = UserIdMapperPersistence.class)
1202            protected UserIdMapperPersistence userIdMapperPersistence;
1203            @BeanReference(type = UserNotificationEventPersistence.class)
1204            protected UserNotificationEventPersistence userNotificationEventPersistence;
1205            @BeanReference(type = UserTrackerPersistence.class)
1206            protected UserTrackerPersistence userTrackerPersistence;
1207            @BeanReference(type = UserTrackerPathPersistence.class)
1208            protected UserTrackerPathPersistence userTrackerPathPersistence;
1209            @BeanReference(type = VirtualHostPersistence.class)
1210            protected VirtualHostPersistence virtualHostPersistence;
1211            @BeanReference(type = WebDAVPropsPersistence.class)
1212            protected WebDAVPropsPersistence webDAVPropsPersistence;
1213            @BeanReference(type = WebsitePersistence.class)
1214            protected WebsitePersistence websitePersistence;
1215            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1216            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1217            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1218            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1219            private static final String _SQL_SELECT_LISTTYPE = "SELECT listType FROM ListType listType";
1220            private static final String _SQL_SELECT_LISTTYPE_WHERE = "SELECT listType FROM ListType listType WHERE ";
1221            private static final String _SQL_COUNT_LISTTYPE = "SELECT COUNT(listType) FROM ListType listType";
1222            private static final String _SQL_COUNT_LISTTYPE_WHERE = "SELECT COUNT(listType) FROM ListType listType WHERE ";
1223            private static final String _FINDER_COLUMN_TYPE_TYPE_1 = "listType.type IS NULL";
1224            private static final String _FINDER_COLUMN_TYPE_TYPE_2 = "listType.type = ?";
1225            private static final String _FINDER_COLUMN_TYPE_TYPE_3 = "(listType.type IS NULL OR listType.type = ?)";
1226            private static final String _ORDER_BY_ENTITY_ALIAS = "listType.";
1227            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ListType exists with the primary key ";
1228            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ListType exists with the key {";
1229            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1230            private static Log _log = LogFactoryUtil.getLog(ListTypePersistenceImpl.class);
1231            private static ListType _nullListType = new ListTypeImpl() {
1232                            @Override
1233                            public Object clone() {
1234                                    return this;
1235                            }
1236    
1237                            @Override
1238                            public CacheModel<ListType> toCacheModel() {
1239                                    return _nullListTypeCacheModel;
1240                            }
1241                    };
1242    
1243            private static CacheModel<ListType> _nullListTypeCacheModel = new CacheModel<ListType>() {
1244                            public ListType toEntityModel() {
1245                                    return _nullListType;
1246                            }
1247                    };
1248    }