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