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