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