1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchListTypeException;
18  import com.liferay.portal.NoSuchModelException;
19  import com.liferay.portal.kernel.annotation.BeanReference;
20  import com.liferay.portal.kernel.cache.CacheRegistry;
21  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
22  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
24  import com.liferay.portal.kernel.dao.orm.FinderPath;
25  import com.liferay.portal.kernel.dao.orm.Query;
26  import com.liferay.portal.kernel.dao.orm.QueryPos;
27  import com.liferay.portal.kernel.dao.orm.QueryUtil;
28  import com.liferay.portal.kernel.dao.orm.Session;
29  import com.liferay.portal.kernel.exception.SystemException;
30  import com.liferay.portal.kernel.log.Log;
31  import com.liferay.portal.kernel.log.LogFactoryUtil;
32  import com.liferay.portal.kernel.util.GetterUtil;
33  import com.liferay.portal.kernel.util.OrderByComparator;
34  import com.liferay.portal.kernel.util.StringBundler;
35  import com.liferay.portal.kernel.util.StringPool;
36  import com.liferay.portal.kernel.util.StringUtil;
37  import com.liferay.portal.model.ListType;
38  import com.liferay.portal.model.ModelListener;
39  import com.liferay.portal.model.impl.ListTypeImpl;
40  import com.liferay.portal.model.impl.ListTypeModelImpl;
41  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
42  
43  import java.io.Serializable;
44  
45  import java.util.ArrayList;
46  import java.util.Collections;
47  import java.util.List;
48  
49  /**
50   * <a href="ListTypePersistenceImpl.java.html"><b><i>View Source</i></b></a>
51   *
52   * <p>
53   * ServiceBuilder generated this class. Modifications in this class will be
54   * overwritten the next time is generated.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       ListTypePersistence
59   * @see       ListTypeUtil
60   * @generated
61   */
62  public class ListTypePersistenceImpl extends BasePersistenceImpl<ListType>
63      implements ListTypePersistence {
64      public static final String FINDER_CLASS_NAME_ENTITY = ListTypeImpl.class.getName();
65      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
66          ".List";
67      public static final FinderPath FINDER_PATH_FIND_BY_TYPE = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
68              ListTypeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
69              "findByType", new String[] { String.class.getName() });
70      public static final FinderPath FINDER_PATH_FIND_BY_OBC_TYPE = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
71              ListTypeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
72              "findByType",
73              new String[] {
74                  String.class.getName(),
75                  
76              "java.lang.Integer", "java.lang.Integer",
77                  "com.liferay.portal.kernel.util.OrderByComparator"
78              });
79      public static final FinderPath FINDER_PATH_COUNT_BY_TYPE = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
80              ListTypeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
81              "countByType", new String[] { String.class.getName() });
82      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
83              ListTypeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
84              "findAll", new String[0]);
85      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
86              ListTypeModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
87              "countAll", new String[0]);
88  
89      public void cacheResult(ListType listType) {
90          EntityCacheUtil.putResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
91              ListTypeImpl.class, listType.getPrimaryKey(), listType);
92      }
93  
94      public void cacheResult(List<ListType> listTypes) {
95          for (ListType listType : listTypes) {
96              if (EntityCacheUtil.getResult(
97                          ListTypeModelImpl.ENTITY_CACHE_ENABLED,
98                          ListTypeImpl.class, listType.getPrimaryKey(), this) == null) {
99                  cacheResult(listType);
100             }
101         }
102     }
103 
104     public void clearCache() {
105         CacheRegistry.clear(ListTypeImpl.class.getName());
106         EntityCacheUtil.clearCache(ListTypeImpl.class.getName());
107         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
108         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
109     }
110 
111     public ListType create(int listTypeId) {
112         ListType listType = new ListTypeImpl();
113 
114         listType.setNew(true);
115         listType.setPrimaryKey(listTypeId);
116 
117         return listType;
118     }
119 
120     public ListType remove(Serializable primaryKey)
121         throws NoSuchModelException, SystemException {
122         return remove(((Integer)primaryKey).intValue());
123     }
124 
125     public ListType remove(int listTypeId)
126         throws NoSuchListTypeException, SystemException {
127         Session session = null;
128 
129         try {
130             session = openSession();
131 
132             ListType listType = (ListType)session.get(ListTypeImpl.class,
133                     new Integer(listTypeId));
134 
135             if (listType == null) {
136                 if (_log.isWarnEnabled()) {
137                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + listTypeId);
138                 }
139 
140                 throw new NoSuchListTypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
141                     listTypeId);
142             }
143 
144             return remove(listType);
145         }
146         catch (NoSuchListTypeException nsee) {
147             throw nsee;
148         }
149         catch (Exception e) {
150             throw processException(e);
151         }
152         finally {
153             closeSession(session);
154         }
155     }
156 
157     public ListType remove(ListType listType) throws SystemException {
158         for (ModelListener<ListType> listener : listeners) {
159             listener.onBeforeRemove(listType);
160         }
161 
162         listType = removeImpl(listType);
163 
164         for (ModelListener<ListType> listener : listeners) {
165             listener.onAfterRemove(listType);
166         }
167 
168         return listType;
169     }
170 
171     protected ListType removeImpl(ListType listType) throws SystemException {
172         listType = toUnwrappedModel(listType);
173 
174         Session session = null;
175 
176         try {
177             session = openSession();
178 
179             if (listType.isCachedModel() || BatchSessionUtil.isEnabled()) {
180                 Object staleObject = session.get(ListTypeImpl.class,
181                         listType.getPrimaryKeyObj());
182 
183                 if (staleObject != null) {
184                     session.evict(staleObject);
185                 }
186             }
187 
188             session.delete(listType);
189 
190             session.flush();
191         }
192         catch (Exception e) {
193             throw processException(e);
194         }
195         finally {
196             closeSession(session);
197         }
198 
199         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
200 
201         EntityCacheUtil.removeResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
202             ListTypeImpl.class, listType.getPrimaryKey());
203 
204         return listType;
205     }
206 
207     public ListType updateImpl(com.liferay.portal.model.ListType listType,
208         boolean merge) throws SystemException {
209         listType = toUnwrappedModel(listType);
210 
211         Session session = null;
212 
213         try {
214             session = openSession();
215 
216             BatchSessionUtil.update(session, listType, merge);
217 
218             listType.setNew(false);
219         }
220         catch (Exception e) {
221             throw processException(e);
222         }
223         finally {
224             closeSession(session);
225         }
226 
227         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
228 
229         EntityCacheUtil.putResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
230             ListTypeImpl.class, listType.getPrimaryKey(), listType);
231 
232         return listType;
233     }
234 
235     protected ListType toUnwrappedModel(ListType listType) {
236         if (listType instanceof ListTypeImpl) {
237             return listType;
238         }
239 
240         ListTypeImpl listTypeImpl = new ListTypeImpl();
241 
242         listTypeImpl.setNew(listType.isNew());
243         listTypeImpl.setPrimaryKey(listType.getPrimaryKey());
244 
245         listTypeImpl.setListTypeId(listType.getListTypeId());
246         listTypeImpl.setName(listType.getName());
247         listTypeImpl.setType(listType.getType());
248 
249         return listTypeImpl;
250     }
251 
252     public ListType findByPrimaryKey(Serializable primaryKey)
253         throws NoSuchModelException, SystemException {
254         return findByPrimaryKey(((Integer)primaryKey).intValue());
255     }
256 
257     public ListType findByPrimaryKey(int listTypeId)
258         throws NoSuchListTypeException, SystemException {
259         ListType listType = fetchByPrimaryKey(listTypeId);
260 
261         if (listType == null) {
262             if (_log.isWarnEnabled()) {
263                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + listTypeId);
264             }
265 
266             throw new NoSuchListTypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
267                 listTypeId);
268         }
269 
270         return listType;
271     }
272 
273     public ListType fetchByPrimaryKey(Serializable primaryKey)
274         throws SystemException {
275         return fetchByPrimaryKey(((Integer)primaryKey).intValue());
276     }
277 
278     public ListType fetchByPrimaryKey(int listTypeId) throws SystemException {
279         ListType listType = (ListType)EntityCacheUtil.getResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
280                 ListTypeImpl.class, listTypeId, this);
281 
282         if (listType == null) {
283             Session session = null;
284 
285             try {
286                 session = openSession();
287 
288                 listType = (ListType)session.get(ListTypeImpl.class,
289                         new Integer(listTypeId));
290             }
291             catch (Exception e) {
292                 throw processException(e);
293             }
294             finally {
295                 if (listType != null) {
296                     cacheResult(listType);
297                 }
298 
299                 closeSession(session);
300             }
301         }
302 
303         return listType;
304     }
305 
306     public List<ListType> findByType(String type) throws SystemException {
307         Object[] finderArgs = new Object[] { type };
308 
309         List<ListType> list = (List<ListType>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_TYPE,
310                 finderArgs, this);
311 
312         if (list == null) {
313             Session session = null;
314 
315             try {
316                 session = openSession();
317 
318                 StringBundler query = new StringBundler(3);
319 
320                 query.append(_SQL_SELECT_LISTTYPE_WHERE);
321 
322                 if (type == null) {
323                     query.append(_FINDER_COLUMN_TYPE_TYPE_1);
324                 }
325                 else {
326                     if (type.equals(StringPool.BLANK)) {
327                         query.append(_FINDER_COLUMN_TYPE_TYPE_3);
328                     }
329                     else {
330                         query.append(_FINDER_COLUMN_TYPE_TYPE_2);
331                     }
332                 }
333 
334                 query.append(ListTypeModelImpl.ORDER_BY_JPQL);
335 
336                 String sql = query.toString();
337 
338                 Query q = session.createQuery(sql);
339 
340                 QueryPos qPos = QueryPos.getInstance(q);
341 
342                 if (type != null) {
343                     qPos.add(type);
344                 }
345 
346                 list = q.list();
347             }
348             catch (Exception e) {
349                 throw processException(e);
350             }
351             finally {
352                 if (list == null) {
353                     list = new ArrayList<ListType>();
354                 }
355 
356                 cacheResult(list);
357 
358                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_TYPE, finderArgs,
359                     list);
360 
361                 closeSession(session);
362             }
363         }
364 
365         return list;
366     }
367 
368     public List<ListType> findByType(String type, int start, int end)
369         throws SystemException {
370         return findByType(type, start, end, null);
371     }
372 
373     public List<ListType> findByType(String type, int start, int end,
374         OrderByComparator obc) throws SystemException {
375         Object[] finderArgs = new Object[] {
376                 type,
377                 
378                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
379             };
380 
381         List<ListType> list = (List<ListType>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_TYPE,
382                 finderArgs, this);
383 
384         if (list == null) {
385             Session session = null;
386 
387             try {
388                 session = openSession();
389 
390                 StringBundler query = null;
391 
392                 if (obc != null) {
393                     query = new StringBundler(3 +
394                             (obc.getOrderByFields().length * 3));
395                 }
396                 else {
397                     query = new StringBundler(3);
398                 }
399 
400                 query.append(_SQL_SELECT_LISTTYPE_WHERE);
401 
402                 if (type == null) {
403                     query.append(_FINDER_COLUMN_TYPE_TYPE_1);
404                 }
405                 else {
406                     if (type.equals(StringPool.BLANK)) {
407                         query.append(_FINDER_COLUMN_TYPE_TYPE_3);
408                     }
409                     else {
410                         query.append(_FINDER_COLUMN_TYPE_TYPE_2);
411                     }
412                 }
413 
414                 if (obc != null) {
415                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
416                 }
417 
418                 else {
419                     query.append(ListTypeModelImpl.ORDER_BY_JPQL);
420                 }
421 
422                 String sql = query.toString();
423 
424                 Query q = session.createQuery(sql);
425 
426                 QueryPos qPos = QueryPos.getInstance(q);
427 
428                 if (type != null) {
429                     qPos.add(type);
430                 }
431 
432                 list = (List<ListType>)QueryUtil.list(q, getDialect(), start,
433                         end);
434             }
435             catch (Exception e) {
436                 throw processException(e);
437             }
438             finally {
439                 if (list == null) {
440                     list = new ArrayList<ListType>();
441                 }
442 
443                 cacheResult(list);
444 
445                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_TYPE,
446                     finderArgs, list);
447 
448                 closeSession(session);
449             }
450         }
451 
452         return list;
453     }
454 
455     public ListType findByType_First(String type, OrderByComparator obc)
456         throws NoSuchListTypeException, SystemException {
457         List<ListType> list = findByType(type, 0, 1, obc);
458 
459         if (list.isEmpty()) {
460             StringBundler msg = new StringBundler(4);
461 
462             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
463 
464             msg.append("type=");
465             msg.append(type);
466 
467             msg.append(StringPool.CLOSE_CURLY_BRACE);
468 
469             throw new NoSuchListTypeException(msg.toString());
470         }
471         else {
472             return list.get(0);
473         }
474     }
475 
476     public ListType findByType_Last(String type, OrderByComparator obc)
477         throws NoSuchListTypeException, SystemException {
478         int count = countByType(type);
479 
480         List<ListType> list = findByType(type, count - 1, count, obc);
481 
482         if (list.isEmpty()) {
483             StringBundler msg = new StringBundler(4);
484 
485             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
486 
487             msg.append("type=");
488             msg.append(type);
489 
490             msg.append(StringPool.CLOSE_CURLY_BRACE);
491 
492             throw new NoSuchListTypeException(msg.toString());
493         }
494         else {
495             return list.get(0);
496         }
497     }
498 
499     public ListType[] findByType_PrevAndNext(int listTypeId, String type,
500         OrderByComparator obc) throws NoSuchListTypeException, SystemException {
501         ListType listType = findByPrimaryKey(listTypeId);
502 
503         int count = countByType(type);
504 
505         Session session = null;
506 
507         try {
508             session = openSession();
509 
510             StringBundler query = null;
511 
512             if (obc != null) {
513                 query = new StringBundler(3 +
514                         (obc.getOrderByFields().length * 3));
515             }
516             else {
517                 query = new StringBundler(3);
518             }
519 
520             query.append(_SQL_SELECT_LISTTYPE_WHERE);
521 
522             if (type == null) {
523                 query.append(_FINDER_COLUMN_TYPE_TYPE_1);
524             }
525             else {
526                 if (type.equals(StringPool.BLANK)) {
527                     query.append(_FINDER_COLUMN_TYPE_TYPE_3);
528                 }
529                 else {
530                     query.append(_FINDER_COLUMN_TYPE_TYPE_2);
531                 }
532             }
533 
534             if (obc != null) {
535                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
536             }
537 
538             else {
539                 query.append(ListTypeModelImpl.ORDER_BY_JPQL);
540             }
541 
542             String sql = query.toString();
543 
544             Query q = session.createQuery(sql);
545 
546             QueryPos qPos = QueryPos.getInstance(q);
547 
548             if (type != null) {
549                 qPos.add(type);
550             }
551 
552             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, listType);
553 
554             ListType[] array = new ListTypeImpl[3];
555 
556             array[0] = (ListType)objArray[0];
557             array[1] = (ListType)objArray[1];
558             array[2] = (ListType)objArray[2];
559 
560             return array;
561         }
562         catch (Exception e) {
563             throw processException(e);
564         }
565         finally {
566             closeSession(session);
567         }
568     }
569 
570     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
571         throws SystemException {
572         Session session = null;
573 
574         try {
575             session = openSession();
576 
577             dynamicQuery.compile(session);
578 
579             return dynamicQuery.list();
580         }
581         catch (Exception e) {
582             throw processException(e);
583         }
584         finally {
585             closeSession(session);
586         }
587     }
588 
589     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
590         int start, int end) throws SystemException {
591         Session session = null;
592 
593         try {
594             session = openSession();
595 
596             dynamicQuery.setLimit(start, end);
597 
598             dynamicQuery.compile(session);
599 
600             return dynamicQuery.list();
601         }
602         catch (Exception e) {
603             throw processException(e);
604         }
605         finally {
606             closeSession(session);
607         }
608     }
609 
610     public List<ListType> findAll() throws SystemException {
611         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
612     }
613 
614     public List<ListType> findAll(int start, int end) throws SystemException {
615         return findAll(start, end, null);
616     }
617 
618     public List<ListType> findAll(int start, int end, OrderByComparator obc)
619         throws SystemException {
620         Object[] finderArgs = new Object[] {
621                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
622             };
623 
624         List<ListType> list = (List<ListType>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
625                 finderArgs, this);
626 
627         if (list == null) {
628             Session session = null;
629 
630             try {
631                 session = openSession();
632 
633                 StringBundler query = null;
634                 String sql = null;
635 
636                 if (obc != null) {
637                     query = new StringBundler(2 +
638                             (obc.getOrderByFields().length * 3));
639 
640                     query.append(_SQL_SELECT_LISTTYPE);
641 
642                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
643 
644                     sql = query.toString();
645                 }
646 
647                 else {
648                     sql = _SQL_SELECT_LISTTYPE.concat(ListTypeModelImpl.ORDER_BY_JPQL);
649                 }
650 
651                 Query q = session.createQuery(sql);
652 
653                 if (obc == null) {
654                     list = (List<ListType>)QueryUtil.list(q, getDialect(),
655                             start, end, false);
656 
657                     Collections.sort(list);
658                 }
659                 else {
660                     list = (List<ListType>)QueryUtil.list(q, getDialect(),
661                             start, end);
662                 }
663             }
664             catch (Exception e) {
665                 throw processException(e);
666             }
667             finally {
668                 if (list == null) {
669                     list = new ArrayList<ListType>();
670                 }
671 
672                 cacheResult(list);
673 
674                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
675 
676                 closeSession(session);
677             }
678         }
679 
680         return list;
681     }
682 
683     public void removeByType(String type) throws SystemException {
684         for (ListType listType : findByType(type)) {
685             remove(listType);
686         }
687     }
688 
689     public void removeAll() throws SystemException {
690         for (ListType listType : findAll()) {
691             remove(listType);
692         }
693     }
694 
695     public int countByType(String type) throws SystemException {
696         Object[] finderArgs = new Object[] { type };
697 
698         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TYPE,
699                 finderArgs, this);
700 
701         if (count == null) {
702             Session session = null;
703 
704             try {
705                 session = openSession();
706 
707                 StringBundler query = new StringBundler(2);
708 
709                 query.append(_SQL_COUNT_LISTTYPE_WHERE);
710 
711                 if (type == null) {
712                     query.append(_FINDER_COLUMN_TYPE_TYPE_1);
713                 }
714                 else {
715                     if (type.equals(StringPool.BLANK)) {
716                         query.append(_FINDER_COLUMN_TYPE_TYPE_3);
717                     }
718                     else {
719                         query.append(_FINDER_COLUMN_TYPE_TYPE_2);
720                     }
721                 }
722 
723                 String sql = query.toString();
724 
725                 Query q = session.createQuery(sql);
726 
727                 QueryPos qPos = QueryPos.getInstance(q);
728 
729                 if (type != null) {
730                     qPos.add(type);
731                 }
732 
733                 count = (Long)q.uniqueResult();
734             }
735             catch (Exception e) {
736                 throw processException(e);
737             }
738             finally {
739                 if (count == null) {
740                     count = Long.valueOf(0);
741                 }
742 
743                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TYPE,
744                     finderArgs, count);
745 
746                 closeSession(session);
747             }
748         }
749 
750         return count.intValue();
751     }
752 
753     public int countAll() throws SystemException {
754         Object[] finderArgs = new Object[0];
755 
756         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
757                 finderArgs, this);
758 
759         if (count == null) {
760             Session session = null;
761 
762             try {
763                 session = openSession();
764 
765                 Query q = session.createQuery(_SQL_COUNT_LISTTYPE);
766 
767                 count = (Long)q.uniqueResult();
768             }
769             catch (Exception e) {
770                 throw processException(e);
771             }
772             finally {
773                 if (count == null) {
774                     count = Long.valueOf(0);
775                 }
776 
777                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
778                     count);
779 
780                 closeSession(session);
781             }
782         }
783 
784         return count.intValue();
785     }
786 
787     public void afterPropertiesSet() {
788         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
789                     com.liferay.portal.util.PropsUtil.get(
790                         "value.object.listener.com.liferay.portal.model.ListType")));
791 
792         if (listenerClassNames.length > 0) {
793             try {
794                 List<ModelListener<ListType>> listenersList = new ArrayList<ModelListener<ListType>>();
795 
796                 for (String listenerClassName : listenerClassNames) {
797                     listenersList.add((ModelListener<ListType>)Class.forName(
798                             listenerClassName).newInstance());
799                 }
800 
801                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
802             }
803             catch (Exception e) {
804                 _log.error(e);
805             }
806         }
807     }
808 
809     @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence")
810     protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
811     @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence")
812     protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
813     @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence")
814     protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
815     @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence")
816     protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
817     @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence")
818     protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
819     @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence")
820     protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
821     @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence")
822     protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
823     @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence")
824     protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
825     @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence")
826     protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
827     @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence")
828     protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
829     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence")
830     protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
831     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPrototypePersistence")
832     protected com.liferay.portal.service.persistence.LayoutPrototypePersistence layoutPrototypePersistence;
833     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence")
834     protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
835     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPrototypePersistence")
836     protected com.liferay.portal.service.persistence.LayoutSetPrototypePersistence layoutSetPrototypePersistence;
837     @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence")
838     protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
839     @BeanReference(name = "com.liferay.portal.service.persistence.LockPersistence")
840     protected com.liferay.portal.service.persistence.LockPersistence lockPersistence;
841     @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence")
842     protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
843     @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence")
844     protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
845     @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence")
846     protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
847     @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence")
848     protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
849     @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence")
850     protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
851     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence")
852     protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
853     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence")
854     protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
855     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence")
856     protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
857     @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence")
858     protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
859     @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence")
860     protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
861     @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence")
862     protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
863     @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence")
864     protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
865     @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence")
866     protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
867     @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence")
868     protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
869     @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence")
870     protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
871     @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence")
872     protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
873     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
874     protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
875     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence")
876     protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
877     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence")
878     protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
879     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence")
880     protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
881     @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence")
882     protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
883     @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence")
884     protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
885     @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence")
886     protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
887     @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence")
888     protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
889     @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
890     protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
891     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence")
892     protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
893     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupGroupRolePersistence")
894     protected com.liferay.portal.service.persistence.UserGroupGroupRolePersistence userGroupGroupRolePersistence;
895     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence")
896     protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
897     @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence")
898     protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
899     @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence")
900     protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
901     @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence")
902     protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
903     @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence")
904     protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
905     @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence")
906     protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
907     @BeanReference(name = "com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence")
908     protected com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
909     @BeanReference(name = "com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence")
910     protected com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
911     private static final String _SQL_SELECT_LISTTYPE = "SELECT listType FROM ListType listType";
912     private static final String _SQL_SELECT_LISTTYPE_WHERE = "SELECT listType FROM ListType listType WHERE ";
913     private static final String _SQL_COUNT_LISTTYPE = "SELECT COUNT(listType) FROM ListType listType";
914     private static final String _SQL_COUNT_LISTTYPE_WHERE = "SELECT COUNT(listType) FROM ListType listType WHERE ";
915     private static final String _FINDER_COLUMN_TYPE_TYPE_1 = "listType.type IS NULL";
916     private static final String _FINDER_COLUMN_TYPE_TYPE_2 = "listType.type = ?";
917     private static final String _FINDER_COLUMN_TYPE_TYPE_3 = "(listType.type IS NULL OR listType.type = ?)";
918     private static final String _ORDER_BY_ENTITY_ALIAS = "listType.";
919     private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ListType exists with the primary key ";
920     private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ListType exists with the key {";
921     private static Log _log = LogFactoryUtil.getLog(ListTypePersistenceImpl.class);
922 }