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